The BIG change of general operator interface
I also changed
- the eoQuadratic into eoQuad (as dicussed with Maarten)
- the eoBin into eoBit, with more appropriate names for the "binary"
operators (that can be unary!) as no one protested when I posted on
eodev list
This commit is contained in:
parent
1b681e4e0d
commit
415b419671
60 changed files with 2034 additions and 940 deletions
|
|
@ -34,9 +34,8 @@ Breeder - and Combined Ops</font></tt>
|
|||
<br><tt><font color="#993300">//-----------------------------------------------------------------------------</font></tt>
|
||||
<br><tt><font color="#993300">// standard includes</font></tt>
|
||||
<br><tt><font color="#993300"><b>#include <stdexcept> </b>// runtime_error </font></tt>
|
||||
<br><tt><font color="#993300"><b>#include <iostream>
|
||||
</b>//
|
||||
cout</font></tt>
|
||||
<br><tt><font color="#993300"><b>#include <iostream>
|
||||
</b>// cout</font></tt>
|
||||
<br><tt><font color="#993300"><b>#include <strstream> </b>// ostrstream,
|
||||
istrstream</font></tt>
|
||||
<br><tt><font color="#993300">// the general include for eo</font></tt>
|
||||
|
|
@ -46,10 +45,8 @@ istrstream</font></tt>
|
|||
<a NAME="representation"></a>
|
||||
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#FFFFCC" NOSAVE >
|
||||
<tr>
|
||||
<td><tt><font color="#999900">//-----------------------------------------------------------------------------</font></tt>
|
||||
<br><tt><font color="#999900">// Include the corresponding file </font></tt>
|
||||
<br><tt><font color="#999900"><b>#include <es.h></b>
|
||||
// real-representation & operators </font></tt>
|
||||
<td><tt><font color="#999900"><b>#include <es.h></b></font></tt><br>
|
||||
<tt><font color="#999900">//-----------------------------------------------------------------------------</font></tt>
|
||||
<br><tt><font color="#999900">// define your individuals</font></tt>
|
||||
<br><b><tt><font color="#999900">typedef eoReal<double> Indi; </font></tt></b></td>
|
||||
</tr>
|
||||
|
|
@ -81,16 +78,12 @@ seed for random number generator</font></tt>
|
|||
<br><tt><font color="#3366FF"><b> const unsigned int T_SIZE = 3; </b>//
|
||||
size for tournament selection</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int VEC_SIZE = 8;
|
||||
</b>//
|
||||
Number of object variables in genotypes</font></tt>
|
||||
</b>// Number of object variables in genotypes</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int POP_SIZE = 20;
|
||||
</b>//
|
||||
Size of population</font></tt>
|
||||
</b>// Size of population</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int MAX_GEN = 500;
|
||||
</b>//
|
||||
Maximum number of generation before STOP</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int MIN_GEN = 10;
|
||||
|
||||
</b>// Maximum number of generation before STOP</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int MIN_GEN = 10;
|
||||
</b>// Minimum number of generation before ...</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const unsigned int STEADY_GEN =
|
||||
50; </b>// stop after STEADY_GEN gen. without improvelent</font></tt>
|
||||
|
|
@ -105,17 +98,13 @@ SIGMA = 0.3; </b> // std dev.
|
|||
for normal mutation</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> </b>// some parameters for chosing
|
||||
among different operators</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const double segmentRate = 0.5;
|
||||
|
||||
<br><tt><font color="#3366FF"><b> const double segmentRate = 0.5;
|
||||
</b>// relative weight for 1-pt Xover</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const double arithmeticRate = 0.5;
|
||||
</b>//
|
||||
relative weight for 2-pt Xover</font></tt>
|
||||
</b>// relative weight for 2-pt Xover</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const double uniformMutRate = 0.5;
|
||||
</b>//
|
||||
relative weight for bit-flip mutation</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const double detMutRate = 0.5;
|
||||
|
||||
</b>// relative weight for bit-flip mutation</font></tt>
|
||||
<br><tt><font color="#3366FF"><b> const double detMutRate = 0.5;
|
||||
</b>// relative weight for one-bit mutation</font></tt>
|
||||
<br><tt><font color="#3366FF"> <b>const double normalMutRate = 0.5;</b>
|
||||
// relative weight for normal mutation</font></tt></td>
|
||||
|
|
@ -193,8 +182,8 @@ it!</font></tt>
|
|||
<tr>
|
||||
<td><tt><font color="#009900"><b> </b>// The robust tournament selection</font></tt>
|
||||
<br><b><tt><font color="#009900"> eoDetTournamentSelect<Indi> selectOne(T_SIZE);</font></tt></b>
|
||||
<br><a NAME="select_encapsulate"></a><tt><font color="#009900">// is now
|
||||
encapsulated in a eoSelectPerc (entage)</font></tt>
|
||||
<br><a NAME="select_encapsulate"></a><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>
|
||||
</tr>
|
||||
|
|
@ -307,7 +296,8 @@ eval, select, transform, replace);</font></tt></b>
|
|||
it!</font></tt>
|
||||
<br><b><tt><font color="#FF6666"> cout << "\n
|
||||
Here we go\n\n";</font></tt></b>
|
||||
<br><b><tt><font color="#FF6666"> gga(pop);</font></tt></b></td>
|
||||
<br><b><tt><font color="#FF6666"> gga(pop);</font></tt></b>
|
||||
<br> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<a NAME="output"></a>
|
||||
|
|
|
|||
Reference in a new issue