Style for PEO

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@906 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
canape 2008-01-25 16:14:06 +00:00
commit b74a446baa
82 changed files with 1946 additions and 1663 deletions

View file

@ -78,7 +78,7 @@ int main (int __argc, char *__argv[])
eoCheckPoint<Indi> checkpoint(continuatorPara);
// For a parallel evaluation
peoEvalFunc<Indi> plainEval(f);
peoPopEval <Indi> eval(plainEval);
@ -95,26 +95,26 @@ int main (int __argc, char *__argv[])
eoSegmentCrossover<Indi> crossover; // Crossover
eoUniformMutation<Indi> mutation(EPSILON); // Mutation
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
// Replacement
eoPlusReplacement<Indi> replace;
// Creation of the population
eoPop < Indi > pop;
pop.append (POP_SIZE, random);
// Algorithm
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
//Parallel algorithm
peoWrapper parallelEA( eaAlg, pop);
eval.setOwner(parallelEA);
peo :: run();
peo :: finalize();
if (getNodeRank()==1)
{
pop.sort();
std::cout << "Final population :\n" << pop << std::endl;
}
{
pop.sort();
std::cout << "Final population :\n" << pop << std::endl;
}
}

View file

@ -71,11 +71,11 @@ int main (int __argc, char *__argv[])
const double INIT_POSITION_MIN = -2.0; // For initialize x
const double INIT_POSITION_MAX = 2.0; // In the case of the Rosenbrock function : -2 < x[i] < 2
const double INIT_VELOCITY_MIN = -1.;
const double INIT_VELOCITY_MAX = 1.;
const double INIT_VELOCITY_MIN = -1.;
const double INIT_VELOCITY_MAX = 1.;
const double weight = 1;
const double C1 = 0.5;
const double C2 = 2.;
const double C1 = 0.5;
const double C2 = 2.;
rng.reseed (time(0));
// Stopping
@ -92,14 +92,14 @@ int main (int __argc, char *__argv[])
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
// Velocity
// Velocity
eoUniformGenerator < double >sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen);
// Initializing the best
// Initializing the best
eoFirstIsBestInit < Indi > localInit;
// Flight
// Flight
eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
eoStandardFlight < Indi > flight(bndsFlight);
@ -111,20 +111,20 @@ int main (int __argc, char *__argv[])
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
eoStandardVelocity < Indi > velocity (topology,weight,C1,C2,bnds);
// Initialization
eoInitializer <Indi> init(eval,veloRandom,localInit,topology,pop);
//Parallel algorithm
eoSyncEasyPSO <Indi> psa(init,checkpoint,eval, velocity, flight);
peoWrapper parallelPSO( psa, pop);
eval.setOwner(parallelPSO);
peo :: run();
peo :: finalize();
if (getNodeRank()==1)
{
pop.sort();
std::cout << "Final population :\n" << pop << std::endl;
}
{
pop.sort();
std::cout << "Final population :\n" << pop << std::endl;
}
}