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
|
|
@ -27,7 +27,7 @@
|
|||
// Include the corresponding file
|
||||
#include <ga.h> // bitstring representation & operators
|
||||
// define your genotype and fitness types
|
||||
typedef eoBin<eoMinimizingFitness> Indi;
|
||||
typedef eoBit<eoMinimizingFitness> Indi;
|
||||
|
||||
// the main_function: nothing changed(!), except variable initialization
|
||||
void main_function(int argc, char **argv)
|
||||
|
|
@ -210,11 +210,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);
|
||||
|
|
@ -222,7 +222,7 @@ void main_function(int argc, char **argv)
|
|||
|
||||
// MUTATION
|
||||
// standard bit-flip mutation for bitstring
|
||||
eoBinMutation<Indi> mutationBitFlip(pMutPerBit);
|
||||
eoBitMutation<Indi> mutationBitFlip(pMutPerBit);
|
||||
// mutate exactly 1 bit per individual
|
||||
eoDetBitFlip<Indi> mutationOneBit;
|
||||
// Combine them with relative rates
|
||||
|
|
@ -314,6 +314,9 @@ void main_function(int argc, char **argv)
|
|||
gnuMonitor.add(bestStat);
|
||||
gnuMonitor.add(averageStat);
|
||||
|
||||
// send a scaling command to gnuplot
|
||||
gnuMonitor.gnuplotCommand("set yrange [0:500]");
|
||||
|
||||
// a specific plot monitor for FDC
|
||||
// first into a file (it adds everything ti itself
|
||||
eoFDCFileSnapshot<Indi> fdcFileSnapshot(fdcStat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue