Style for PEO
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@906 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
f4740e571c
commit
b74a446baa
82 changed files with 1946 additions and 1663 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue