A few details in the comments
This commit is contained in:
parent
04e429fdb1
commit
5d8c30b2ae
2 changed files with 14 additions and 13 deletions
|
|
@ -23,8 +23,6 @@
|
||||||
// define your genotype and fitness types
|
// define your genotype and fitness types
|
||||||
typedef eoBin<double> Indi;
|
typedef eoBin<double> Indi;
|
||||||
|
|
||||||
// PARAMETRES
|
|
||||||
|
|
||||||
// the main_function: nothing changed(!), except variable initialization
|
// the main_function: nothing changed(!), except variable initialization
|
||||||
void main_function(int argc, char **argv)
|
void main_function(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
@ -187,8 +185,10 @@ void main_function(int argc, char **argv)
|
||||||
// SELECT
|
// SELECT
|
||||||
// The robust tournament selection
|
// The robust tournament selection
|
||||||
eoDetTournament<Indi> selectOne(tSize); // tSize in [2,POPSIZE]
|
eoDetTournament<Indi> selectOne(tSize); // tSize in [2,POPSIZE]
|
||||||
// is now encapsulated in a eoSelectPerc (entage)
|
// is now encapsulated in a eoSelectPerc (stands for Percentage)
|
||||||
eoSelectPerc<Indi> select(selectOne);// by default rate==1
|
eoSelectPerc<Indi> select(selectOne);
|
||||||
|
// or eoSelectPerc<Indi> select(selectOne, rate);
|
||||||
|
// but by default rate==1
|
||||||
|
|
||||||
// REPLACE
|
// REPLACE
|
||||||
// And we now have the full slection/replacement - though with
|
// And we now have the full slection/replacement - though with
|
||||||
|
|
@ -314,7 +314,7 @@ void main_function(int argc, char **argv)
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
// Easy EA requires
|
// Easy EA requires
|
||||||
// selection, transformation, eval, replacement, and stopping criterion
|
// stopping criterion, eval, selection, transformation, replacement
|
||||||
eoEasyEA<Indi> gga(checkpoint, eval, select, transform, replace);
|
eoEasyEA<Indi> gga(checkpoint, eval, select, transform, replace);
|
||||||
|
|
||||||
// Apply algo to pop - that's it!
|
// Apply algo to pop - that's it!
|
||||||
|
|
|
||||||
|
|
@ -309,12 +309,14 @@ of initializatio of the population</font></tt></td>
|
||||||
<tr>
|
<tr>
|
||||||
<td><tt><font color="#009900"><b> </b>// The robust tournament selection</font></tt>
|
<td><tt><font color="#009900"><b> </b>// The robust tournament selection</font></tt>
|
||||||
<br><tt><font color="#009900"><b> eoDetTournament<Indi> selectOne(tSize);
|
<br><tt><font color="#009900"><b> eoDetTournament<Indi> selectOne(tSize);
|
||||||
|
|
||||||
</b>// tSize in [2,POPSIZE]</font></tt>
|
</b>// tSize in [2,POPSIZE]</font></tt>
|
||||||
<br><tt><font color="#009900"><b> </b>// is now encapsulated in a
|
<br><tt><font color="#009900"><b> </b>// is now encapsulated in a
|
||||||
eoSelectPerc (entage)</font></tt>
|
eoSelectPerc (entage)</font></tt>
|
||||||
<br><tt><font color="#009900"><b> eoSelectPerc<Indi> select(selectOne);</b>//
|
<br><b><tt><font color="#009900"> eoSelectPerc<Indi> select(selectOne);</font></tt></b>
|
||||||
by default rate==1</font></tt></td>
|
<br><tt><font color="#009900"> // or eoSelectPerc<Indi> select(selectOne,
|
||||||
|
rate); </font></tt>
|
||||||
|
<br><tt><font color="#009900"> // but by default rate==1</font></tt>
|
||||||
|
<br><tt><font color="#009900"></font></tt> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<a NAME="replace"></a>
|
<a NAME="replace"></a>
|
||||||
|
|
@ -479,9 +481,8 @@ outState.registerObject(parser);</font></tt></b>
|
||||||
<br><b><tt><font color="#3366FF"> outState.registerObject(rng);</font></tt></b>
|
<br><b><tt><font color="#3366FF"> outState.registerObject(rng);</font></tt></b>
|
||||||
<br><tt><font color="#3366FF"><b> </b>// and feed
|
<br><tt><font color="#3366FF"><b> </b>// and feed
|
||||||
the state to state savers</font></tt>
|
the state to state savers</font></tt>
|
||||||
<br><a NAME="statesaver_declare"></a><tt><font color="#3366FF"><b>
|
<br><a NAME="statesaver_declare"></a><tt><font color="#3366FF">// save
|
||||||
</b>//
|
state every 100th generation</font></tt>
|
||||||
save state every 100th generation</font></tt>
|
|
||||||
<br><b><tt><font color="#3366FF"> eoCountedStateSaver
|
<br><b><tt><font color="#3366FF"> eoCountedStateSaver
|
||||||
stateSaver1(100, outState, "generation"); </font></tt></b>
|
stateSaver1(100, outState, "generation"); </font></tt></b>
|
||||||
<br><tt><font color="#3366FF"><b> </b>// save state
|
<br><tt><font color="#3366FF"><b> </b>// save state
|
||||||
|
|
@ -503,8 +504,8 @@ it for the (control and) output</font></tt></td>
|
||||||
<br><tt><font color="#FF6666"><b> </b>// the algorithm</font></tt>
|
<br><tt><font color="#FF6666"><b> </b>// the algorithm</font></tt>
|
||||||
<br><tt><font color="#FF6666"><b> </b>////////////////////////////////////////</font></tt>
|
<br><tt><font color="#FF6666"><b> </b>////////////////////////////////////////</font></tt>
|
||||||
<br><tt><font color="#FF6666"><b> </b>// Easy EA requires </font></tt>
|
<br><tt><font color="#FF6666"><b> </b>// Easy EA requires </font></tt>
|
||||||
<br><tt><font color="#FF6666"><b> </b>// selection, transformation,
|
<br><tt><font color="#FF6666"> // stopping criterion, eval, selection,
|
||||||
eval, replacement, and stopping criterion</font></tt>
|
transformation, replacement</font></tt>
|
||||||
<br><b><tt><font color="#FF6666"> eoEasyEA<Indi> gga(checkpoint,
|
<br><b><tt><font color="#FF6666"> eoEasyEA<Indi> gga(checkpoint,
|
||||||
eval, select, transform, replace);</font></tt></b>
|
eval, select, transform, replace);</font></tt></b>
|
||||||
<br><tt><font color="#FF6666"><b> </b>// Apply algo to pop - that's
|
<br><tt><font color="#FF6666"><b> </b>// Apply algo to pop - that's
|
||||||
|
|
|
||||||
Reference in a new issue