NDSorting: changed exact ranking values to make check for front easier

eoRNG: changed nothing (did some debugging)
This commit is contained in:
maartenkeijzer 2001-03-26 10:09:40 +00:00
commit ebca71e228
2 changed files with 49 additions and 35 deletions

View file

@ -119,6 +119,8 @@ class eoNDSorting : public eoPerf2WorthCached<EOT, double>
}
}
unsigned first_front_size = current_front.size();
vector<unsigned> next_front;
next_front.reserve(_pop.size());
@ -165,11 +167,21 @@ class eoNDSorting : public eoPerf2WorthCached<EOT, double>
// now all that's left to do is to transform lower rank into higher worth
double max_fitness = *std::max_element(value().begin(), value().end());
// but make sure it's an integer upper bound, so that all ranks inside the highest integer are the front
max_fitness = ceil(max_fitness);
unsigned nfirst = 0;
for (unsigned i = 0; i < value().size(); ++i)
{
value()[i] = max_fitness - value()[i];
assert(n[i] == 0);
if (value()[i] > (max_fitness-1)) // this would be the test for 'front_ness'
nfirst++;
}
assert(nfirst == first_front_size);
}
};