NDSorting: changed exact ranking values to make check for front easier
eoRNG: changed nothing (did some debugging)
This commit is contained in:
parent
a1508b75a2
commit
ebca71e228
2 changed files with 49 additions and 35 deletions
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ private :
|
|||
uint32* next;
|
||||
int left;
|
||||
|
||||
// for normal distribution
|
||||
bool cached;
|
||||
float cacheValue;
|
||||
|
||||
|
|
@ -266,6 +267,7 @@ private :
|
|||
const int M;
|
||||
const uint32 K; // a magic constant
|
||||
|
||||
|
||||
/**
|
||||
Private copy ctor and assignment operator to make sure that
|
||||
nobody accidentally copies the random number generator.
|
||||
|
|
@ -373,9 +375,9 @@ inline uint32 eoRng::restart(void)
|
|||
return(s1 ^ (s1 >> 18));
|
||||
}
|
||||
|
||||
|
||||
inline uint32 eoRng::rand(void)
|
||||
{
|
||||
|
||||
uint32 y;
|
||||
|
||||
if(--left < 0)
|
||||
|
|
|
|||
Reference in a new issue