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
|
|
@ -19,7 +19,7 @@
|
|||
// Include the corresponding file
|
||||
#include <ga.h> // bitstring representation & operators
|
||||
// define your individuals
|
||||
typedef eoBin<double> Indi; // A bitstring with fitness double
|
||||
typedef eoBit<double> Indi; // A bitstring with fitness double
|
||||
|
||||
// EVAL
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -118,11 +118,11 @@ void main_function(int argc, char **argv)
|
|||
//////////////////////////////////////
|
||||
// CROSSOVER
|
||||
// 1-point crossover for bitstring
|
||||
eoBinCrossover<Indi> xover1;
|
||||
eo1PtBitXover<Indi> xover1;
|
||||
// uniform crossover for bitstring
|
||||
eoBinUxOver<Indi> xoverU;
|
||||
eoUBitXover<Indi> xoverU;
|
||||
// 2-pots xover
|
||||
eoBinNxOver<Indi> xover2(2);
|
||||
eoNPtsBitXover<Indi> xover2(2);
|
||||
// Combine them with relative rates
|
||||
eoPropCombinedQuadOp<Indi> xover(xover1, onePointRate);
|
||||
xover.add(xoverU, URate);
|
||||
|
|
@ -130,7 +130,7 @@ void main_function(int argc, char **argv)
|
|||
|
||||
// MUTATION
|
||||
// standard bit-flip mutation for bitstring
|
||||
eoBinMutation<Indi> mutationBitFlip(P_MUT_PER_BIT);
|
||||
eoBitMutation<Indi> mutationBitFlip(P_MUT_PER_BIT);
|
||||
// mutate exactly 1 bit per individual
|
||||
eoDetBitFlip<Indi> mutationOneBit;
|
||||
// Combine them with relative rates
|
||||
|
|
|
|||
Reference in a new issue