added a 'nasty_declone_flag' to be able to declone a population
This commit is contained in:
parent
3b6a88f34e
commit
c55fcdbb3f
1 changed files with 13 additions and 5 deletions
|
|
@ -41,6 +41,9 @@ class eoNDSorting : public eoPerf2WorthCached<EOT, double>
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
|
eoNDSorting() : nasty_declone_flag_that_only_is_implemented_for_two_objectives(false)
|
||||||
|
{}
|
||||||
|
|
||||||
/** Pure virtual function that calculates the 'distance' for each element in the current front
|
/** Pure virtual function that calculates the 'distance' for each element in the current front
|
||||||
Implement to create your own nondominated sorting algorithm. The size of the returned vector
|
Implement to create your own nondominated sorting algorithm. The size of the returned vector
|
||||||
should be equal to the size of the current_front.
|
should be equal to the size of the current_front.
|
||||||
|
|
@ -113,8 +116,7 @@ private :
|
||||||
* complexity O(n log n) where n is the population size
|
* complexity O(n log n) where n is the population size
|
||||||
*
|
*
|
||||||
* This is the same complexity as for a single objective
|
* This is the same complexity as for a single objective
|
||||||
* or truncation selection or sorting. A paper about this
|
* or truncation selection or sorting.
|
||||||
* algorithm is quite likely forthcoming.
|
|
||||||
*
|
*
|
||||||
* It will perform a sort on the two objectives seperately,
|
* It will perform a sort on the two objectives seperately,
|
||||||
* and from the information on the ranks of the individuals on
|
* and from the information on the ranks of the individuals on
|
||||||
|
|
@ -168,8 +170,13 @@ private :
|
||||||
{
|
{
|
||||||
unsigned prev = sort1[i-1];
|
unsigned prev = sort1[i-1];
|
||||||
if ( _pop[index].fitness() == _pop[prev].fitness())
|
if ( _pop[index].fitness() == _pop[prev].fitness())
|
||||||
{ // it's a clone
|
{ // it's a clone, give it the worst rank!
|
||||||
fronts[prev_front].push_back(index);
|
|
||||||
|
if (nasty_declone_flag_that_only_is_implemented_for_two_objectives)
|
||||||
|
//declone
|
||||||
|
fronts.back().push_back(index);
|
||||||
|
else // assign it the rank of the previous
|
||||||
|
ronts[prev_front].push_back(index);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -354,6 +361,7 @@ private :
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public : bool nasty_declone_flag_that_only_is_implemented_for_two_objectives;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Reference in a new issue