peo: lessons 1,2 and 3 modified
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@999 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
ea8e0c686a
commit
93f0cfd82e
8 changed files with 123 additions and 79 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* <main.cpp>
|
* <main.cpp>
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
* (C) OPAC Team, INRIA, 2007
|
* (C) OPAC Team, INRIA, 2008
|
||||||
*
|
*
|
||||||
* Clive Canape
|
* Clive Canape
|
||||||
*
|
*
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
typedef eoReal<double> Indi;
|
typedef eoReal<double> Indi;
|
||||||
|
|
||||||
//Evaluation function
|
//Evaluation function
|
||||||
|
|
||||||
double f (const Indi & _indi)
|
double f (const Indi & _indi)
|
||||||
{
|
{
|
||||||
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
||||||
|
|
@ -56,20 +55,19 @@ double f (const Indi & _indi)
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
|
|
||||||
//Parameters
|
//Parameters
|
||||||
|
eoParser parser(__argc, __argv);
|
||||||
const unsigned int VEC_SIZE = 2; // Don't change this parameter when you are resolving the Rosenbrock function
|
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||||
const unsigned int POP_SIZE = 20; // As with a sequential algorithm, you change the size of the population
|
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||||
const unsigned int MAX_GEN = 300; // Define the number of maximal generation
|
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||||
const double INIT_POSITION_MIN = -2.0; // For initialize x
|
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||||
const double INIT_POSITION_MAX = 2.0; // In the case of the Rosenbrock function : -2 < x[i] < 2
|
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||||
const float CROSS_RATE = 0.8; // Crossover rate
|
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||||
const double EPSILON = 0.01; // Range for real uniform mutation
|
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||||
const float MUT_RATE = 0.3; // Mutation rate
|
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||||
rng.reseed (time(0));
|
rng.reseed (time(0));
|
||||||
|
|
||||||
// Stopping
|
// Stopping
|
||||||
|
|
@ -78,11 +76,9 @@ int main (int __argc, char *__argv[])
|
||||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||||
|
|
||||||
// For a parallel evaluation
|
// For a parallel evaluation
|
||||||
|
|
||||||
peoEvalFunc<Indi> plainEval(f);
|
peoEvalFunc<Indi> plainEval(f);
|
||||||
peoPopEval <Indi> eval(plainEval);
|
peoPopEval <Indi> eval(plainEval);
|
||||||
|
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||||
|
|
@ -92,8 +88,8 @@ int main (int __argc, char *__argv[])
|
||||||
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
||||||
|
|
||||||
// Transformation
|
// Transformation
|
||||||
eoSegmentCrossover<Indi> crossover; // Crossover
|
eoSegmentCrossover<Indi> crossover;
|
||||||
eoUniformMutation<Indi> mutation(EPSILON); // Mutation
|
eoUniformMutation<Indi> mutation(EPSILON);
|
||||||
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||||
|
|
||||||
// Replacement
|
// Replacement
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* <main.cpp>
|
* <main.cpp>
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
* (C) OPAC Team, INRIA, 2007
|
* (C) OPAC Team, INRIA, 2008
|
||||||
*
|
*
|
||||||
* Clive Canape
|
* Clive Canape
|
||||||
*
|
*
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
typedef eoRealParticle < double >Indi;
|
typedef eoRealParticle < double >Indi;
|
||||||
|
|
||||||
//Evaluation function
|
//Evaluation function
|
||||||
|
|
||||||
double f (const Indi & _indi)
|
double f (const Indi & _indi)
|
||||||
{
|
{
|
||||||
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
||||||
|
|
@ -55,27 +54,22 @@ double f (const Indi & _indi)
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
|
|
||||||
//Parameters
|
//Parameters
|
||||||
|
eoParser parser(__argc, __argv);
|
||||||
const unsigned int VEC_SIZE = 2; // Don't change this parameter when you are resolving the Rosenbrock function
|
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||||
|
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||||
const unsigned int POP_SIZE = 20; // As with a sequential algorithm, you change the size of the population
|
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||||
|
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||||
const unsigned int NEIGHBORHOOD_SIZE= 6; // This parameter define the neighborhoods in the PSO's topology
|
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||||
|
double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value();
|
||||||
const unsigned int MAX_GEN = 150; // Define the number of maximal generation
|
double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value();
|
||||||
|
double weight = parser.createParam(1.0, "weight", "Weight",'w',"Param").value();
|
||||||
const double INIT_POSITION_MIN = -2.0; // For initialize x
|
double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value();
|
||||||
const double INIT_POSITION_MAX = 2.0; // In the case of the Rosenbrock function : -2 < x[i] < 2
|
double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value();
|
||||||
const double INIT_VELOCITY_MIN = -1.;
|
unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value();
|
||||||
const double INIT_VELOCITY_MAX = 1.;
|
|
||||||
const double weight = 1;
|
|
||||||
const double C1 = 0.5;
|
|
||||||
const double C2 = 2.;
|
|
||||||
rng.reseed (time(0));
|
rng.reseed (time(0));
|
||||||
|
|
||||||
// Stopping
|
// Stopping
|
||||||
|
|
@ -83,7 +77,6 @@ int main (int __argc, char *__argv[])
|
||||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||||
|
|
||||||
|
|
||||||
// For a parallel evaluation
|
// For a parallel evaluation
|
||||||
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
||||||
peoPopEval< Indi > eval(plainEval);
|
peoPopEval< Indi > eval(plainEval);
|
||||||
|
|
@ -107,7 +100,7 @@ int main (int __argc, char *__argv[])
|
||||||
eoPop < Indi > pop;
|
eoPop < Indi > pop;
|
||||||
pop.append (POP_SIZE, random);
|
pop.append (POP_SIZE, random);
|
||||||
|
|
||||||
// Topology (ie Lesson 6 of ParadisEO-PEO)
|
// Topology
|
||||||
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
|
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
|
||||||
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
|
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
|
||||||
eoStandardVelocity < Indi > velocity (topology,weight,C1,C2,bnds);
|
eoStandardVelocity < Indi > velocity (topology,weight,C1,C2,bnds);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,19 @@
|
||||||
|
###### Param ######
|
||||||
|
--popSize=20 # -P : Population size
|
||||||
|
--maxGen=200 # -G : Maximum number of generations
|
||||||
|
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||||
|
--pCross=0.80 # -C : Crossover probability
|
||||||
|
--pMut=0.30 # -M : Mutation probability
|
||||||
|
--vecSize=2 # -V : Vector size
|
||||||
|
--pMin=-2.0 # -N : Init position min
|
||||||
|
--pMax=2.0 # -X : Init position max
|
||||||
|
--vMin=-1.0 # -n : Init velocity min
|
||||||
|
--vMax=1.0 # -x : Init velocity max
|
||||||
|
--neighSize=6 # -H : Neighborhood size
|
||||||
|
--weight=1.0 # -w : Weight
|
||||||
|
--c1=0.5 # -1 : C1
|
||||||
|
--c2=2.0 # -2 : C2
|
||||||
|
|
||||||
## miscallenous parameters
|
## miscallenous parameters
|
||||||
|
|
||||||
--debug=false
|
--debug=false
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* <main.cpp>
|
* <main.cpp>
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
* (C) OPAC Team, INRIA, 2007
|
* (C) OPAC Team, INRIA, 2008
|
||||||
*
|
*
|
||||||
* Clive Canape
|
* Clive Canape
|
||||||
*
|
*
|
||||||
|
|
@ -52,14 +52,15 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
const unsigned int VEC_SIZE = 2;
|
eoParser parser(__argc, __argv);
|
||||||
const unsigned int POP_SIZE = 20;
|
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||||
const unsigned int MAX_GEN = 300;
|
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||||
const double INIT_POSITION_MIN = -2.0;
|
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||||
const double INIT_POSITION_MAX = 2.0;
|
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||||
const float CROSS_RATE = 0.8;
|
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||||
const double EPSILON = 0.01;
|
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||||
const float MUT_RATE = 0.3;
|
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||||
|
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||||
rng.reseed (time(0));
|
rng.reseed (time(0));
|
||||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||||
|
|
@ -73,6 +74,7 @@ int main (int __argc, char *__argv[])
|
||||||
eoSegmentCrossover<Indi> crossover;
|
eoSegmentCrossover<Indi> crossover;
|
||||||
eoUniformMutation<Indi> mutation(EPSILON);
|
eoUniformMutation<Indi> mutation(EPSILON);
|
||||||
|
|
||||||
|
// Parallel transformation
|
||||||
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||||
|
|
||||||
eoPlusReplacement<Indi> replace;
|
eoPlusReplacement<Indi> replace;
|
||||||
|
|
@ -82,6 +84,7 @@ int main (int __argc, char *__argv[])
|
||||||
peoWrapper parallelEA( eaAlg, pop);
|
peoWrapper parallelEA( eaAlg, pop);
|
||||||
eval.setOwner(parallelEA);
|
eval.setOwner(parallelEA);
|
||||||
|
|
||||||
|
// setOwner
|
||||||
transform.setOwner (parallelEA);
|
transform.setOwner (parallelEA);
|
||||||
|
|
||||||
peo :: run();
|
peo :: run();
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
|
###### Param ######
|
||||||
|
--popSize=20 # -P : Population size
|
||||||
|
--maxGen=300 # -G : Maximum number of generations
|
||||||
|
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||||
|
--pCross=0.80 # -C : Crossover probability
|
||||||
|
--pMut=0.30 # -M : Mutation probability
|
||||||
|
--vecSize=2 # -V : Vector size
|
||||||
|
--pMin=-2.0 # -N : Init position min
|
||||||
|
--pMax=2.0 # -X : Init position max
|
||||||
|
|
||||||
## miscallenous parameters
|
## miscallenous parameters
|
||||||
|
|
||||||
--debug=false
|
--debug=false
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* <main.cpp>
|
* <main.cpp>
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
* (C) OPAC Team, INRIA, 2007
|
* (C) OPAC Team, INRIA, 2008
|
||||||
*
|
*
|
||||||
* Clive Canape
|
* Clive Canape
|
||||||
*
|
*
|
||||||
|
|
@ -52,18 +52,17 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
const unsigned int VEC_SIZE = 2;
|
eoParser parser(__argc, __argv);
|
||||||
const unsigned int POP_SIZE = 20;
|
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||||
const unsigned int MAX_GEN = 300;
|
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||||
const double INIT_POSITION_MIN = -2.0;
|
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||||
const double INIT_POSITION_MAX = 2.0;
|
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||||
const float CROSS_RATE = 0.8;
|
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||||
const double EPSILON = 0.01;
|
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||||
const float MUT_RATE = 0.3;
|
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||||
// MIG_FREQ define the frequency of the migration.
|
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||||
const unsigned int MIG_FREQ = 10;
|
unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value();
|
||||||
// MIG_SIZE define the size of each migration.
|
unsigned int MIG_SIZE = parser.createParam((unsigned int)(5), "migSize", "Migration size",'S',"Param").value();
|
||||||
const unsigned int MIG_SIZE = 5;
|
|
||||||
rng.reseed (time(0));
|
rng.reseed (time(0));
|
||||||
|
|
||||||
// Define the topology of your island model
|
// Define the topology of your island model
|
||||||
|
|
@ -86,16 +85,24 @@ int main (int __argc, char *__argv[])
|
||||||
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||||
eoPop < Indi > pop;
|
eoPop < Indi > pop;
|
||||||
pop.append (POP_SIZE, random);
|
pop.append (POP_SIZE, random);
|
||||||
eoPlusReplacement<Indi> replace;
|
|
||||||
|
// Define a synchronous island
|
||||||
|
|
||||||
|
// Seclection
|
||||||
eoRandomSelect<Indi> mig_select_one;
|
eoRandomSelect<Indi> mig_select_one;
|
||||||
eoSelector <Indi, eoPop<Indi> > mig_select (mig_select_one,MIG_SIZE,pop);
|
eoSelector <Indi, eoPop<Indi> > mig_select (mig_select_one,MIG_SIZE,pop);
|
||||||
|
// Replacement
|
||||||
|
eoPlusReplacement<Indi> replace;
|
||||||
eoReplace <Indi, eoPop<Indi> > mig_replace (replace,pop);
|
eoReplace <Indi, eoPop<Indi> > mig_replace (replace,pop);
|
||||||
|
// Island
|
||||||
peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig(MIG_FREQ,mig_select,mig_replace,topology);
|
peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig(MIG_FREQ,mig_select,mig_replace,topology);
|
||||||
checkpoint.add(mig);
|
checkpoint.add(mig);
|
||||||
|
|
||||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||||
peoWrapper parallelEA( eaAlg, pop);
|
peoWrapper parallelEA( eaAlg, pop);
|
||||||
eval.setOwner(parallelEA);
|
eval.setOwner(parallelEA);
|
||||||
transform.setOwner(parallelEA);
|
transform.setOwner(parallelEA);
|
||||||
|
// setOwner
|
||||||
mig.setOwner(parallelEA);
|
mig.setOwner(parallelEA);
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* <main.cpp>
|
* <main.cpp>
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
* (C) OPAC Team, INRIA, 2007
|
* (C) OPAC Team, INRIA, 2008
|
||||||
*
|
*
|
||||||
* Clive Canape
|
* Clive Canape
|
||||||
*
|
*
|
||||||
|
|
@ -50,18 +50,19 @@ double f (const Indi & _indi)
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
const unsigned int VEC_SIZE = 2;
|
eoParser parser(__argc, __argv);
|
||||||
const unsigned int POP_SIZE = 20;
|
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||||
const unsigned int NEIGHBORHOOD_SIZE= 6;
|
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||||
const unsigned int MAX_GEN = 100;
|
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||||
const double INIT_POSITION_MIN = -2.0;
|
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||||
const double INIT_POSITION_MAX = 2.0;
|
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||||
const double INIT_VELOCITY_MIN = -1.;
|
double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value();
|
||||||
const double INIT_VELOCITY_MAX = 1.;
|
double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value();
|
||||||
const unsigned int MIG_FREQ = 10;
|
double omega = parser.createParam(1.0, "weight", "Weight",'w',"Param").value();
|
||||||
const double omega = 1;
|
double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value();
|
||||||
const double C1 = 0.5;
|
double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value();
|
||||||
const double C2 = 2.;
|
unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value();
|
||||||
|
unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value();
|
||||||
rng.reseed (time(0));
|
rng.reseed (time(0));
|
||||||
|
|
||||||
// Island model
|
// Island model
|
||||||
|
|
@ -135,7 +136,7 @@ int main (int __argc, char *__argv[])
|
||||||
eoReplace <Indi, eoPop<Indi> > mig_replace2 (mig_replac2,pop2);
|
eoReplace <Indi, eoPop<Indi> > mig_replace2 (mig_replac2,pop2);
|
||||||
|
|
||||||
|
|
||||||
// Island model
|
// Asynchronous island
|
||||||
|
|
||||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig(cont,mig_select, mig_replace, topologyMig);
|
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig(cont,mig_select, mig_replace, topologyMig);
|
||||||
checkpoint.add( mig );
|
checkpoint.add( mig );
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,21 @@
|
||||||
|
###### Param ######
|
||||||
|
--popSize=20 # -P : Population size
|
||||||
|
--maxGen=200 # -G : Maximum number of generations
|
||||||
|
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||||
|
--pCross=0.80 # -C : Crossover probability
|
||||||
|
--pMut=0.30 # -M : Mutation probability
|
||||||
|
--vecSize=2 # -V : Vector size
|
||||||
|
--pMin=-2.0 # -N : Init position min
|
||||||
|
--pMax=2.0 # -X : Init position max
|
||||||
|
--vMin=-1.0 # -n : Init velocity min
|
||||||
|
--vMax=1.0 # -x : Init velocity max
|
||||||
|
--neighSize=6 # -H : Neighborhood size
|
||||||
|
--weight=1.0 # -w : Weight
|
||||||
|
--c1=0.5 # -1 : C1
|
||||||
|
--c2=2.0 # -2 : C2
|
||||||
|
--migFreq=10 # -F : Migration frequency
|
||||||
|
--migSize=5 # -S : Migration size
|
||||||
|
|
||||||
## miscallenous parameters
|
## miscallenous parameters
|
||||||
|
|
||||||
--debug=false
|
--debug=false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue