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
|
||||
typedef eoBin<double> Indi;
|
||||
|
||||
// PARAMETRES
|
||||
|
||||
// the main_function: nothing changed(!), except variable initialization
|
||||
void main_function(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -187,8 +185,10 @@ void main_function(int argc, char **argv)
|
|||
// SELECT
|
||||
// The robust tournament selection
|
||||
eoDetTournament<Indi> selectOne(tSize); // tSize in [2,POPSIZE]
|
||||
// is now encapsulated in a eoSelectPerc (entage)
|
||||
eoSelectPerc<Indi> select(selectOne);// by default rate==1
|
||||
// is now encapsulated in a eoSelectPerc (stands for Percentage)
|
||||
eoSelectPerc<Indi> select(selectOne);
|
||||
// or eoSelectPerc<Indi> select(selectOne, rate);
|
||||
// but by default rate==1
|
||||
|
||||
// REPLACE
|
||||
// And we now have the full slection/replacement - though with
|
||||
|
|
@ -314,7 +314,7 @@ void main_function(int argc, char **argv)
|
|||
////////////////////////////////////////
|
||||
|
||||
// Easy EA requires
|
||||
// selection, transformation, eval, replacement, and stopping criterion
|
||||
// stopping criterion, eval, selection, transformation, replacement
|
||||
eoEasyEA<Indi> gga(checkpoint, eval, select, transform, replace);
|
||||
|
||||
// Apply algo to pop - that's it!
|
||||
|
|
|
|||
|
|
@ -309,12 +309,14 @@ of initializatio of the population</font></tt></td>
|
|||
<tr>
|
||||
<td><tt><font color="#009900"><b> </b>// The robust tournament selection</font></tt>
|
||||
<br><tt><font color="#009900"><b> eoDetTournament<Indi> selectOne(tSize);
|
||||
|
||||
</b>// tSize in [2,POPSIZE]</font></tt>
|
||||
<br><tt><font color="#009900"><b> </b>// is now encapsulated in a
|
||||
eoSelectPerc (entage)</font></tt>
|
||||
<br><tt><font color="#009900"><b> eoSelectPerc<Indi> select(selectOne);</b>//
|
||||
by default rate==1</font></tt></td>
|
||||
<br><b><tt><font color="#009900"> eoSelectPerc<Indi> select(selectOne);</font></tt></b>
|
||||
<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>
|
||||
</table>
|
||||
<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><tt><font color="#3366FF"><b> </b>// and feed
|
||||
the state to state savers</font></tt>
|
||||
<br><a NAME="statesaver_declare"></a><tt><font color="#3366FF"><b>
|
||||
</b>//
|
||||
save state every 100th generation</font></tt>
|
||||
<br><a NAME="statesaver_declare"></a><tt><font color="#3366FF">// save
|
||||
state every 100th generation</font></tt>
|
||||
<br><b><tt><font color="#3366FF"> eoCountedStateSaver
|
||||
stateSaver1(100, outState, "generation"); </font></tt></b>
|
||||
<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>////////////////////////////////////////</font></tt>
|
||||
<br><tt><font color="#FF6666"><b> </b>// Easy EA requires </font></tt>
|
||||
<br><tt><font color="#FF6666"><b> </b>// selection, transformation,
|
||||
eval, replacement, and stopping criterion</font></tt>
|
||||
<br><tt><font color="#FF6666"> // stopping criterion, eval, selection,
|
||||
transformation, replacement</font></tt>
|
||||
<br><b><tt><font color="#FF6666"> eoEasyEA<Indi> gga(checkpoint,
|
||||
eval, select, transform, replace);</font></tt></b>
|
||||
<br><tt><font color="#FF6666"><b> </b>// Apply algo to pop - that's
|
||||
|
|
|
|||
Reference in a new issue