AUTHORS modification
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@152 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cde1586361
commit
4c21c72510
137 changed files with 2356 additions and 2369 deletions
|
|
@ -1,12 +1,14 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
moeoNDSorting.h
|
||||
(c) Deneche Abdelhakim, 2006
|
||||
//-----------------------------------------------------------------------------
|
||||
// moeoNDSorting.h
|
||||
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2006
|
||||
/*
|
||||
This library...
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef moeoNDSorting_h
|
||||
#define moeoNDSorting_h
|
||||
|
|
@ -14,78 +16,93 @@
|
|||
#include <cfloat>
|
||||
#include <eoNDSorting.h>
|
||||
|
||||
# define INF 1.0e14 // DBL_MAX
|
||||
# define INF 1.0e14 // DBL_MAX
|
||||
|
||||
/** @brief Fast Elitist Non-Dominant Sorting Genetic Algorithm
|
||||
|
||||
Note : This is a corrected version of the original eoNDSorting_II class
|
||||
.
|
||||
@see eoNDSorting_II
|
||||
*/
|
||||
template <class EOT>
|
||||
class moeoNDSorting_II : public eoNDSorting<EOT>
|
||||
/**
|
||||
* Fast Elitist Non-Dominant Sorting Genetic Algorithm assignment strategie
|
||||
* Note : This is a corrected version of the original eoNDSorting_II class
|
||||
* @see eoNDSorting_II
|
||||
*/
|
||||
template < class EOT > class moeoNDSorting_II:public eoNDSorting < EOT >
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
moeoNDSorting_II(bool nasty_flag_ = false) : eoNDSorting<EOT>(nasty_flag_) {}
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
moeoNDSorting_II (bool nasty_flag_ = false):eoNDSorting < EOT >
|
||||
(nasty_flag_)
|
||||
{
|
||||
}
|
||||
|
||||
typedef std::pair<double, unsigned> double_index_pair;
|
||||
/**
|
||||
* index pair
|
||||
*/
|
||||
typedef std::pair < double, unsigned >double_index_pair;
|
||||
|
||||
/**
|
||||
* A class to compare the nodes
|
||||
*/
|
||||
class compare_nodes
|
||||
{
|
||||
public :
|
||||
bool operator()(const double_index_pair& a, const double_index_pair& b) const
|
||||
public:bool operator () (const double_index_pair & a,
|
||||
const double_index_pair & b) const
|
||||
{
|
||||
return a.first < b.first;
|
||||
}
|
||||
};
|
||||
|
||||
/// _cf points into the elements that consist of the current front
|
||||
std::vector<double> niche_penalty(const std::vector<unsigned>& _cf, const eoPop<EOT>& _pop)
|
||||
std::vector < double >niche_penalty (const std::vector < unsigned >&_cf,
|
||||
const eoPop < EOT > &_pop)
|
||||
{
|
||||
typedef typename EOT::Fitness::fitness_traits traits;
|
||||
unsigned i;
|
||||
std::vector<double> niche_count(_cf.size(), 0.);
|
||||
std::vector < double >niche_count (_cf.size (), 0.);
|
||||
|
||||
|
||||
unsigned nObjectives = traits::nObjectives(); //_pop[_cf[0]].fitness().size();
|
||||
unsigned nObjectives = traits::nObjectives (); //_pop[_cf[0]].fitness().size();
|
||||
|
||||
for (unsigned o = 0; o < nObjectives; ++o)
|
||||
{
|
||||
std::vector<std::pair<double, unsigned> > performance(_cf.size());
|
||||
for (i =0; i < _cf.size(); ++i)
|
||||
{
|
||||
performance[i].first = _pop[_cf[i]].fitness()[o];
|
||||
performance[i].second = i;
|
||||
std::vector < std::pair < double,
|
||||
unsigned > >performance (_cf.size ());
|
||||
for (i = 0; i < _cf.size (); ++i)
|
||||
{
|
||||
performance[i].first = _pop[_cf[i]].fitness ()[o];
|
||||
performance[i].second = i;
|
||||
}
|
||||
|
||||
std::sort (performance.begin (), performance.end (), compare_nodes ()); // a lambda operator would've been nice here
|
||||
|
||||
// set boundary at INF (so it will get chosen over all the others
|
||||
niche_count[performance[0].second] = INF;
|
||||
niche_count[performance.back ().second] = INF;
|
||||
|
||||
if (performance[0].first != performance.back ().first)
|
||||
{
|
||||
for (i = 1; i < _cf.size () - 1; ++i)
|
||||
{
|
||||
if (niche_count[performance[i].second] != INF)
|
||||
{
|
||||
niche_count[performance[i].second] +=
|
||||
(performance[i + 1].first -
|
||||
performance[i -
|
||||
1].first) / (performance.back ().first -
|
||||
performance[0].first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(performance.begin(), performance.end(), compare_nodes()); // a lambda operator would've been nice here
|
||||
// transform niche_count into penality
|
||||
for (i = 0; i < niche_count.size (); ++i)
|
||||
{
|
||||
niche_count[i] = INF - niche_count[i];
|
||||
}
|
||||
|
||||
// set boundary at INF (so it will get chosen over all the others
|
||||
niche_count[performance[0].second] = INF;
|
||||
niche_count[performance.back().second] = INF;
|
||||
|
||||
if (performance[0].first != performance.back().first)
|
||||
{
|
||||
for (i = 1; i < _cf.size()-1; ++i)
|
||||
{
|
||||
if (niche_count[performance[i].second] != INF)
|
||||
{
|
||||
niche_count[performance[i].second] += (performance[i+1].first - performance[i-1].first)/
|
||||
(performance.back().first-performance[0].first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// transform niche_count into penality
|
||||
for (i = 0; i < niche_count.size(); ++i)
|
||||
{
|
||||
niche_count[i] = INF - niche_count[i];
|
||||
}
|
||||
|
||||
return niche_count;
|
||||
return niche_count;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue