A few details in the comments

This commit is contained in:
evomarc 2001-01-02 07:19:55 +00:00
commit 5d8c30b2ae
2 changed files with 14 additions and 13 deletions

View file

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

View file

@ -309,12 +309,14 @@ of initializatio of the population</font></tt></td>
<tr> <tr>
<td><tt><font color="#009900"><b>&nbsp;</b>// The robust tournament selection</font></tt> <td><tt><font color="#009900"><b>&nbsp;</b>// The robust tournament selection</font></tt>
<br><tt><font color="#009900"><b>&nbsp;eoDetTournament&lt;Indi> selectOne(tSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><tt><font color="#009900"><b>&nbsp;eoDetTournament&lt;Indi> selectOne(tSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</b>// tSize in [2,POPSIZE]</font></tt> </b>// tSize in [2,POPSIZE]</font></tt>
<br><tt><font color="#009900"><b>&nbsp;</b>// is now encapsulated in a <br><tt><font color="#009900"><b>&nbsp;</b>// is now encapsulated in a
eoSelectPerc (entage)</font></tt> eoSelectPerc (entage)</font></tt>
<br><tt><font color="#009900"><b>&nbsp;eoSelectPerc&lt;Indi> select(selectOne);</b>// <br><b><tt><font color="#009900">&nbsp;eoSelectPerc&lt;Indi> select(selectOne);</font></tt></b>
by default rate==1</font></tt></td> <br><tt><font color="#009900">&nbsp;// or eoSelectPerc&lt;Indi> select(selectOne,
rate);&nbsp;</font></tt>
<br><tt><font color="#009900">&nbsp;// but by default rate==1</font></tt>
<br><tt><font color="#009900"></font></tt>&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp; outState.registerObject(rng);</font></tt></b> <br><b><tt><font color="#3366FF">&nbsp;&nbsp;&nbsp;&nbsp; outState.registerObject(rng);</font></tt></b>
<br><tt><font color="#3366FF"><b>&nbsp;&nbsp;&nbsp;&nbsp; </b>// and feed <br><tt><font color="#3366FF"><b>&nbsp;&nbsp;&nbsp;&nbsp; </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&nbsp; generation</font></tt>
save state every 100th&nbsp; generation</font></tt>
<br><b><tt><font color="#3366FF">&nbsp;&nbsp;&nbsp;&nbsp; eoCountedStateSaver <br><b><tt><font color="#3366FF">&nbsp;&nbsp;&nbsp;&nbsp; eoCountedStateSaver
stateSaver1(100, outState, "generation");&nbsp;</font></tt></b> stateSaver1(100, outState, "generation");&nbsp;</font></tt></b>
<br><tt><font color="#3366FF"><b>&nbsp;&nbsp;&nbsp;&nbsp; </b>// save state <br><tt><font color="#3366FF"><b>&nbsp;&nbsp;&nbsp;&nbsp; </b>// save state
@ -503,8 +504,8 @@ it for the (control and) output</font></tt></td>
<br><tt><font color="#FF6666"><b>&nbsp;</b>// the algorithm</font></tt> <br><tt><font color="#FF6666"><b>&nbsp;</b>// the algorithm</font></tt>
<br><tt><font color="#FF6666"><b>&nbsp;</b>////////////////////////////////////////</font></tt> <br><tt><font color="#FF6666"><b>&nbsp;</b>////////////////////////////////////////</font></tt>
<br><tt><font color="#FF6666"><b>&nbsp;</b>// Easy EA requires&nbsp;</font></tt> <br><tt><font color="#FF6666"><b>&nbsp;</b>// Easy EA requires&nbsp;</font></tt>
<br><tt><font color="#FF6666"><b>&nbsp;</b>// selection, transformation, <br><tt><font color="#FF6666">&nbsp;// stopping criterion, eval, selection,
eval, replacement, and stopping criterion</font></tt> transformation, replacement</font></tt>
<br><b><tt><font color="#FF6666">&nbsp;eoEasyEA&lt;Indi> gga(checkpoint, <br><b><tt><font color="#FF6666">&nbsp;eoEasyEA&lt;Indi> gga(checkpoint,
eval, select, transform, replace);</font></tt></b> eval, select, transform, replace);</font></tt></b>
<br><tt><font color="#FF6666"><b>&nbsp;</b>// Apply algo to pop - that's <br><tt><font color="#FF6666"><b>&nbsp;</b>// Apply algo to pop - that's