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:
evomarc 2001-02-27 05:09:10 +00:00
commit 72b6692f9b
9 changed files with 24 additions and 23 deletions

View file

@ -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);

View file

@ -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);

View file

@ -12,3 +12,7 @@ all : $(ALL)
clean :
@/bin/rm $(ALL) *.o *~
FirstRealEA : real_value.h
FirstBitEA : binary_value.h

View file

@ -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);

View file

@ -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;

View file

@ -164,8 +164,8 @@ void main_function(int argc, char **argv)
rng.reseed(seed);
// a Indi random initializer
// based on boolean_generator class (see utils/rnd_generator.h)
eoInitFixedLength<Indi, boolean_generator>
random(vecSize, boolean_generator());
eoUniformGenerator<bool> uGen;
eoInitFixedLength<Indi> random(vecSize, uGen);
// Init pop from the randomizer: need to use the append function
pop.append(popSize, random);

View file

@ -165,8 +165,8 @@ void main_function(int argc, char **argv)
rng.reseed(seed);
// a Indi random initializer
// based on boolean_generator class (see utils/rnd_generator.h)
eoInitFixedLength<Indi, boolean_generator>
random(vecSize, boolean_generator());
eoUniformGenerator<bool> uGen;
eoInitFixedLength<Indi> random(vecSize, uGen);
// Init pop from the randomizer: need to use the append function
pop.append(popSize, random);

View file

@ -162,9 +162,9 @@ The actual code is in boldface and the comment in normal face.
<b> &nbsp;</b>////////////////////////////////<br>
<b> &nbsp;</b>// Initilisation of population<br>
<b> &nbsp;</b>////////////////////////////////<br>
<b> &nbsp;</b>// based on boolean_generator class (see utils/rnd_generator.h)<br>
<b> &nbsp;eoInitFixedLength&lt;Indi, boolean_generator> </b><br>
<b> &nbsp; &nbsp; &nbsp;random(VEC_SIZE, boolean_generator());</b><br>
<b> &nbsp;</b>// based on eoUniformGenerator class (see utils/eoRndGenerators.h)<br>
<b> &nbsp;eoUniformGenerator&lt;bool> uGen;</b><br>
<b> &nbsp;eoInitFixedLength&lt;Indi> random(VEC_SIZE, uGen);</b><br>
<b> &nbsp;</b>// Initialization of the population<br>
<b> &nbsp;eoPop&lt;Indi> pop(POP_SIZE, random);</b><br>
<b> &nbsp;</b>// and evaluate it in one line<br>

View file

@ -270,11 +270,11 @@ rng.reseed(seed);</font></tt></b>
<br><tt><font color="#993399"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b>//
a Indi random initializer</font></tt>
<br><tt><font color="#993399"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b>//
based on boolean_generator class (see utils/rnd_generator.h)</font></tt>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
eoInitFixedLength&lt;Indi, boolean_generator>&nbsp;</font></tt></b>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
random(vecSize, boolean_generator());</font></tt></b>
based on eoUniformGenerator class (see utils/eoRndGenerators.h)</font></tt>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eoUniformGenerator&lt;bool>
uGen;</font></tt></b>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eoInitFixedLength&lt;Indi>
random(vecSize, uGen);</font></tt></b>
<br><tt><font color="#993399"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b>//
Init pop from the randomizer: need to use the append function</font></tt>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@ -284,7 +284,7 @@ and evaluate pop (STL syntax)&nbsp;</font></tt>
<br><b><tt><font color="#993399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
apply&lt;Indi>(eval, pop);</font></tt></b>
<br><tt><font color="#993399"><b>&nbsp;&nbsp;&nbsp;&nbsp; } </b>// end
of initializatio of the population</font></tt></td>
of initialization of the population</font></tt></td>
</tr>
</table>
<a NAME="output"></a>
@ -311,7 +311,6 @@ of initializatio of the population</font></tt></td>
<tr>
<td><tt><font color="#009900"><b>&nbsp;</b>// The robust tournament selection</font></tt>
<br><tt><font color="#009900"><b>&nbsp;eoDetTournamentSelect&lt;Indi> selectOne(tSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</b>// tSize in [2,POPSIZE]</font></tt>
<br><tt><font color="#009900"><b>&nbsp;</b>// is now encapsulated in a
eoSelectPerc (entage)</font></tt>