64 void operator()( PopulationType & population, std::size_t mu ){
65 if(population.empty())
return;
70 typedef std::vector< view_reference<typename PopulationType::value_type > > View;
72 unsigned int maxRank = 0;
73 std::map< unsigned int, View > fronts;
75 for(
unsigned int i = 0; i < population.size(); i++ ) {
76 maxRank = std::max( maxRank, population[i].rank());
77 fronts[population[i].rank()].push_back( population[i] );
78 population[i].selected() =
true;
82 unsigned int rank = maxRank;
83 std::size_t popSize = population.size();
85 while(popSize-fronts[rank].size() >= mu){
87 View & front = fronts[rank];
88 for(std::size_t i = 0; i != front.size(); ++i){
89 front[i].selected() =
false;
91 popSize -= front.size();
95 View& front = fronts[rank];
99 archive.reserve(popSize - front.size());
100 for(
unsigned int r = 1; r != rank; ++r){
101 archive.insert(archive.end(),fronts[r].begin(), fronts[r].end());
105 for(
auto lc:deselected){
106 front[lc].selected() =
false;