Modified all init sequences in Lesson2 and Lesson3 - and all corresponding
files in html dir - after the return of eoRndGenerators and subsequent modifications of eoInit
This commit is contained in:
parent
a79075f673
commit
72b6692f9b
9 changed files with 24 additions and 23 deletions
|
|
@ -74,9 +74,9 @@ void main_function(int argc, char **argv)
|
|||
// Initilisation of population
|
||||
////////////////////////////////
|
||||
|
||||
// based on boolean_generator class (see utils/rnd_generator.h)
|
||||
eoInitFixedLength<Indi, boolean_generator>
|
||||
random(VEC_SIZE, boolean_generator());
|
||||
// based on boolean_generator class (see utils/eoRndGenerators.h)
|
||||
eoUniformGenerator<bool> uGen;
|
||||
eoInitFixedLength<Indi> random(VEC_SIZE, uGen);
|
||||
// Initialization of the population
|
||||
eoPop<Indi> pop(POP_SIZE, random);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ void main_function(int argc, char **argv)
|
|||
// Initilisation of population
|
||||
////////////////////////////////
|
||||
// based on a uniform generator
|
||||
eoInitFixedLength<Indi, uniform_generator<double> >
|
||||
random(VEC_SIZE, uniform_generator<double>(-1.0, 1.0));
|
||||
eoUniformGenerator<double> uGen(-1.0, 1.0);
|
||||
eoInitFixedLength<Indi> random(VEC_SIZE, uGen);
|
||||
// Initialization of the population
|
||||
eoPop<Indi> pop(POP_SIZE, random);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,7 @@ all : $(ALL)
|
|||
|
||||
clean :
|
||||
@/bin/rm $(ALL) *.o *~
|
||||
|
||||
FirstRealEA : real_value.h
|
||||
|
||||
FirstBitEA : binary_value.h
|
||||
|
|
@ -76,8 +76,8 @@ void main_function(int argc, char **argv)
|
|||
////////////////////////////////
|
||||
|
||||
// based on boolean_generator class (see utils/rnd_generator.h)
|
||||
eoInitFixedLength<Indi, boolean_generator>
|
||||
random(VEC_SIZE, boolean_generator());
|
||||
eoUniformGenerator<bool> uGen;
|
||||
eoInitFixedLength<Indi> random(VEC_SIZE, uGen);
|
||||
// Initialization of the population
|
||||
eoPop<Indi> pop(POP_SIZE, random);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ double real_value(const std::vector<double>& _ind)
|
|||
double sum = 0;
|
||||
for (unsigned i = 0; i < _ind.size(); i++)
|
||||
{
|
||||
if ( (_ind[i]<0) || (_ind[i]>1) )
|
||||
cout << "Sorti des bornes: " << _ind[i] << " ";
|
||||
sum += _ind[i] * _ind[i];
|
||||
}
|
||||
return -sum;
|
||||
|
|
|
|||
Reference in a new issue