Added the normal mutation - and the 1/5 mutation in FirstRealEA in Lesson2

This commit is contained in:
evomarc 2001-01-16 07:20:48 +00:00
commit deace62e55
2 changed files with 278 additions and 286 deletions

View file

@ -45,11 +45,13 @@ void main_function(int argc, char **argv)
const float P_MUT = 0.5; // mutation probability
const double EPSILON = 0.01; // range for real uniform mutation
double SIGMA = 0.3; // std dev. for normal mutation
// some parameters for chosing among different operators
const double segmentRate = 0.5; // rate for 1-pt Xover
const double arithmeticRate = 0.5; // rate for 2-pt Xover
const double uniformMutRate = 0.5; // rate for bit-flip mutation
const double detMutRate = 0.5; // rate for one-bit mutation
const double segmentRate = 0.5; // relative weight for 1-pt Xover
const double arithmeticRate = 0.5; // relative weight for 2-pt Xover
const double uniformMutRate = 0.5; // relative weight for bit-flip mutation
const double detMutRate = 0.5; // relative weight for one-bit mutation
const double normalMutRate = 0.5; // relative weight for normal mutation
// GENERAL
//////////////////////////
@ -111,7 +113,7 @@ void main_function(int argc, char **argv)
eoSegmentCrossover<Indi> xoverS;
// uniform choice in hypercube built by the parents
eoArithmeticCrossover<Indi> xoverA;
// Combine them with relative rates
// Combine them with relative weights
eoPropCombinedQuadOp<Indi> xover(xoverS, segmentRate);
xover.add(xoverA, arithmeticRate, true);
@ -120,9 +122,12 @@ void main_function(int argc, char **argv)
eoUniformMutation<Indi> mutationU(EPSILON);
// k (=1) coordinates of parents are uniformly modified
eoDetUniformMutation<Indi> mutationD(EPSILON);
// Combine them with relative rates
// all coordinates of parents are normally modified (stDev SIGMA)
eoNormalMutation<Indi> mutationN(SIGMA);
// Combine them with relative weights
eoPropCombinedMonOp<Indi> mutation(mutationU, uniformMutRate);
mutation.add(mutationD, detMutRate, true);
mutation.add(mutationD, detMutRate);
mutation.add(mutationN, normalMutRate, true);
// STOP
// CHECKPOINT