- added the #define for eo_verbose (true) and eo_no_verbose (false)
- added the eoNormMutation, simple normal mutation for simple real variables
This commit is contained in:
parent
4944881d7c
commit
b5382fce74
2 changed files with 9 additions and 4 deletions
|
|
@ -117,11 +117,13 @@ The actual code is in boldface and the comment in normal face.
|
|||
<b> const float P_CROSS = 0.8; </b>// Crossover probability<br>
|
||||
<b> const float P_MUT = 0.5; </b>// mutation probability<br>
|
||||
<b> const double EPSILON = 0.01; </b>// range for real uniform mutation<br>
|
||||
<b> const double SIGMA = 0.01; </b>// std. dev. of normal mutation<br>
|
||||
<b> </b>// some parameters for chosing among different operators<br>
|
||||
<b> const double segmentRate = 0.5; </b>// rate for 1-pt Xover<br>
|
||||
<b> const double arithmeticRate = 0.5; </b>// rate for 2-pt Xover<br>
|
||||
<b> const double uniformMutRate = 0.5; </b>// rate for bit-flip mutation<br>
|
||||
<b> const double detMutRate = 0.5; </b>// rate for one-bit mutation<br>
|
||||
<b> const double normMutRate = 0.5; </b>// rate for normal mutation<br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -242,7 +244,7 @@ The actual code is in boldface and the comment in normal face.
|
|||
<b> eoArithmeticCrossover<Indi> xoverA;</b><br>
|
||||
<b> </b>// Combine them with relative rates<br>
|
||||
<b> eoPropCombinedQuadOp<Indi> xover(xoverS, segmentRate);</b><br>
|
||||
<b> xover.add(xoverA, arithmeticRate, true);</b><br>
|
||||
<b> xover.add(xoverA, arithmeticRate, eo_verbose);</b><br>
|
||||
</font></tt>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -252,13 +254,16 @@ The actual code is in boldface and the comment in normal face.
|
|||
<td>
|
||||
<tt><font color="#993399">
|
||||
<b> </b><br>
|
||||
<b> </b>// Gaussian mutation - std dev as argument<br>
|
||||
<b> eoNormalMutation<Indi> mutationN(SIGMA); </b><br>
|
||||
<b> </b>// offspring(i) uniformly chosen in [parent(i)-epsilon, parent(i)+epsilon]<br>
|
||||
<b> eoUniformMutation<Indi> mutationU(EPSILON); </b><br>
|
||||
<b> </b>// k (=1) coordinates of parents are uniformly modified<br>
|
||||
<b> eoDetUniformMutation<Indi> mutationD(EPSILON); </b><br>
|
||||
<b> </b>// Combine them with relative rates<br>
|
||||
<b> eoPropCombinedMonOp<Indi> mutation(mutationU, uniformMutRate);</b><br>
|
||||
<b> mutation.add(mutationD, detMutRate, true);</b><br>
|
||||
<b> mutation.add(mutationD, detMutRate);</b><br>
|
||||
<b> mutation.add(mutationN, normMutRate, eo_verbose);</b><br>
|
||||
<b> </b><br>
|
||||
<b> </b>// The operators are encapsulated into an eoTRansform object<br>
|
||||
<b> eoSGATransform<Indi> transform(xover, P_CROSS, mutation, P_MUT);</b><br>
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ rates</font></tt>
|
|||
onePointRate);</font></tt></b>
|
||||
<br><b><tt><font color="#993399"> xover.add(xoverU, URate);</font></tt></b>
|
||||
<br><b><tt><font color="#993399"> xover.add(xover2, twoPointsRate,
|
||||
true);</font></tt></b></td>
|
||||
eo_verbose);</font></tt></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<a NAME="mutation"></a>
|
||||
|
|
@ -413,7 +413,7 @@ rates</font></tt>
|
|||
<br><b><tt><font color="#993399"> eoPropCombinedMonOp<Indi> mutation(mutationBitFlip,
|
||||
bitFlipRate);</font></tt></b>
|
||||
<br><b><tt><font color="#993399"> mutation.add(mutationOneBit, oneBitRate,
|
||||
true);</font></tt></b>
|
||||
eo_verbose);</font></tt></b>
|
||||
<br><tt><font color="#993399"><b> </b>// The operators are encapsulated
|
||||
into an eoTRansform object</font></tt>
|
||||
<br><b><tt><font color="#993399"> eoSGATransform<Indi> transform(xover,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue