Big change in eoGeneralOp interface: left out!
This commit is contained in:
parent
a556036315
commit
0c1036617e
4 changed files with 13 additions and 13 deletions
|
|
@ -121,7 +121,7 @@ public:
|
||||||
// eoChromXover
|
// eoChromXover
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class eoChromXover: public eoQuadraticOp<Chrom>
|
class eoChromXover: public eoQuadOp<Chrom>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator()(Chrom& chrom1, Chrom& chrom2)
|
void operator()(Chrom& chrom1, Chrom& chrom2)
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ class eoChromMutation: public eoMonOp<Chrom>
|
||||||
// eoChromXover
|
// eoChromXover
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class eoChromXover: public eoQuadraticOp<Chrom>
|
class eoChromXover: public eoQuadOp<Chrom>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void operator()(Chrom& chrom1, Chrom& chrom2)
|
void operator()(Chrom& chrom1, Chrom& chrom2)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
// general
|
// general
|
||||||
#include <utils/eoRNG.h> // Random number generators
|
#include <utils/eoRNG.h> // Random number generators
|
||||||
#include <ga/eoBin.h>
|
#include <ga.h>
|
||||||
#include <utils/eoParser.h>
|
#include <utils/eoParser.h>
|
||||||
#include <utils/eoState.h>
|
#include <utils/eoState.h>
|
||||||
#include <eoGenContinue.h>
|
#include <eoGenContinue.h>
|
||||||
|
|
@ -41,7 +41,7 @@ public :
|
||||||
int the_main(int argc, char **argv)
|
int the_main(int argc, char **argv)
|
||||||
{ // ok, we have a command line parser and a state
|
{ // ok, we have a command line parser and a state
|
||||||
|
|
||||||
typedef eoBin<float> Chrom;
|
typedef eoBit<float> Chrom;
|
||||||
|
|
||||||
eoParser parser(argc, argv);
|
eoParser parser(argc, argv);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef eoBin<float> Chrom;
|
typedef eoBit<float> Chrom;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -74,23 +74,23 @@ void main_function()
|
||||||
random(chrom); chrom.fitness(binary_value(chrom));
|
random(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBinRandom ............ " << chrom << endl;
|
cout << "after eoBinRandom ............ " << chrom << endl;
|
||||||
|
|
||||||
eoBinBitFlip<Chrom> bitflip;
|
eoOneBitFlip<Chrom> bitflip;
|
||||||
bitflip(chrom); chrom.fitness(binary_value(chrom));
|
bitflip(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBitFlip .............. " << chrom << endl;
|
cout << "after eoBitFlip .............. " << chrom << endl;
|
||||||
|
|
||||||
eoBinMutation<Chrom> mutation(0.5);
|
eoBitMutation<Chrom> mutation(0.5);
|
||||||
mutation(chrom); chrom.fitness(binary_value(chrom));
|
mutation(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBinMutation(0.5) ..... " << chrom << endl;
|
cout << "after eoBinMutation(0.5) ..... " << chrom << endl;
|
||||||
|
|
||||||
eoBinInversion<Chrom> inversion;
|
eoBitInversion<Chrom> inversion;
|
||||||
inversion(chrom); chrom.fitness(binary_value(chrom));
|
inversion(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBinInversion ......... " << chrom << endl;
|
cout << "after eoBinInversion ......... " << chrom << endl;
|
||||||
|
|
||||||
eoBinNext<Chrom> next;
|
eoBitNext<Chrom> next;
|
||||||
next(chrom); chrom.fitness(binary_value(chrom));
|
next(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBinNext .............. " << chrom << endl;
|
cout << "after eoBinNext .............. " << chrom << endl;
|
||||||
|
|
||||||
eoBinPrev<Chrom> prev;
|
eoBitPrev<Chrom> prev;
|
||||||
prev(chrom); chrom.fitness(binary_value(chrom));
|
prev(chrom); chrom.fitness(binary_value(chrom));
|
||||||
cout << "after eoBinPrev .............. " << chrom << endl;
|
cout << "after eoBinPrev .............. " << chrom << endl;
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ void main_function()
|
||||||
<< endl << "eoBinOp's aplied to ... "
|
<< endl << "eoBinOp's aplied to ... "
|
||||||
<< chrom << " " << chrom2 << endl;
|
<< chrom << " " << chrom2 << endl;
|
||||||
|
|
||||||
eoBinCrossover<Chrom> xover;
|
eo1PtBitXover<Chrom> xover;
|
||||||
fill(chrom.begin(), chrom.end(), false);
|
fill(chrom.begin(), chrom.end(), false);
|
||||||
fill(chrom2.begin(), chrom2.end(), true);
|
fill(chrom2.begin(), chrom2.end(), true);
|
||||||
xover(chrom, chrom2);
|
xover(chrom, chrom2);
|
||||||
|
|
@ -109,7 +109,7 @@ void main_function()
|
||||||
|
|
||||||
for (i = 1; i < SIZE; i++)
|
for (i = 1; i < SIZE; i++)
|
||||||
{
|
{
|
||||||
eoBinNxOver<Chrom> nxover(i);
|
eoNPtsBitXover<Chrom> nxover(i);
|
||||||
fill(chrom.begin(), chrom.end(), false);
|
fill(chrom.begin(), chrom.end(), false);
|
||||||
fill(chrom2.begin(), chrom2.end(), true);
|
fill(chrom2.begin(), chrom2.end(), true);
|
||||||
nxover(chrom, chrom2);
|
nxover(chrom, chrom2);
|
||||||
|
|
@ -121,7 +121,7 @@ void main_function()
|
||||||
for (i = 1; i < SIZE / 2; i++)
|
for (i = 1; i < SIZE / 2; i++)
|
||||||
for (j = 1; j < SIZE / 2; j++)
|
for (j = 1; j < SIZE / 2; j++)
|
||||||
{
|
{
|
||||||
eoBinGxOver<Chrom> gxover(i, j);
|
eoBitGxOver<Chrom> gxover(i, j);
|
||||||
fill(chrom.begin(), chrom.end(), false);
|
fill(chrom.begin(), chrom.end(), false);
|
||||||
fill(chrom2.begin(), chrom2.end(), true);
|
fill(chrom2.begin(), chrom2.end(), true);
|
||||||
gxover(chrom, chrom2);
|
gxover(chrom, chrom2);
|
||||||
|
|
|
||||||
Reference in a new issue