Lesson DMLS updated
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1841 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
ff7b15fe22
commit
734012789b
1 changed files with 9 additions and 9 deletions
|
|
@ -67,10 +67,11 @@ int main(int argc, char* argv[])
|
||||||
//define a neighbor
|
//define a neighbor
|
||||||
typedef moShiftNeighbor<FlowShop, FlowShopObjectiveVector> Neighbor;
|
typedef moShiftNeighbor<FlowShop, FlowShopObjectiveVector> Neighbor;
|
||||||
|
|
||||||
|
|
||||||
eoParser parser(argc, argv); // for user-parameter reading
|
eoParser parser(argc, argv); // for user-parameter reading
|
||||||
eoState state; // to keep all things allocated
|
eoState state; // to keep all things allocated
|
||||||
|
|
||||||
|
unsigned int maxGen = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of gen.",'G',"Stopping criterion").value();
|
||||||
|
unsigned int nhSize = parser.createParam((unsigned int)(20), "nhSize", "neighborhood size",'G',"Evolution Engine").value();
|
||||||
|
|
||||||
/*** the representation-dependent things ***/
|
/*** the representation-dependent things ***/
|
||||||
|
|
||||||
|
|
@ -78,9 +79,6 @@ int main(int argc, char* argv[])
|
||||||
eoEvalFuncCounter<FlowShop>& eval = do_make_eval(parser, state);
|
eoEvalFuncCounter<FlowShop>& eval = do_make_eval(parser, state);
|
||||||
// the genotype (through a genotype initializer)
|
// the genotype (through a genotype initializer)
|
||||||
eoInit<FlowShop>& init = do_make_genotype(parser, state);
|
eoInit<FlowShop>& init = do_make_genotype(parser, state);
|
||||||
// the variation operators
|
|
||||||
eoGenOp<FlowShop>& op = do_make_op(parser, state);
|
|
||||||
|
|
||||||
|
|
||||||
/*** the representation-independent things ***/
|
/*** the representation-independent things ***/
|
||||||
|
|
||||||
|
|
@ -89,23 +87,26 @@ int main(int argc, char* argv[])
|
||||||
// definition of the archive
|
// definition of the archive
|
||||||
moeoUnboundedArchive<FlowShop> arch;
|
moeoUnboundedArchive<FlowShop> arch;
|
||||||
// stopping criteria
|
// stopping criteria
|
||||||
unsigned int maxGen = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of gen.",'G',"Stopping criterion").value();
|
|
||||||
|
//Continuator
|
||||||
eoGenContinue<FlowShop> term(maxGen);
|
eoGenContinue<FlowShop> term(maxGen);
|
||||||
unsigned int nhSize = parser.createParam((unsigned int)(20), "nhSize", "neighborhood size",'G',"Evolution Engine").value();
|
|
||||||
// checkpointing
|
// checkpointing
|
||||||
eoCheckPoint<FlowShop> checkpoint(term);
|
eoCheckPoint<FlowShop> checkpoint(term);
|
||||||
moeoArchiveUpdater < FlowShop > updater(arch, pop);
|
moeoArchiveUpdater < FlowShop > updater(arch, pop);
|
||||||
checkpoint.add(updater);
|
checkpoint.add(updater);
|
||||||
|
|
||||||
//neighborhood
|
//neighborhood
|
||||||
moOrderNeighborhood<Neighbor> neighborhood((nhSize-1) * (nhSize-1)); //!!!!!!!!!!!!!!!CHANGER CET VALEUR PAR RAPPORT AU PARAM
|
moOrderNeighborhood<Neighbor> neighborhood((nhSize-1) * (nhSize-1));
|
||||||
//neighbor Evaluation function
|
//neighbor Evaluation function
|
||||||
moeoFullEvalByCopy<Neighbor> moEval(eval);
|
moeoFullEvalByCopy<Neighbor> moEval(eval);
|
||||||
|
|
||||||
//Selection in the archive
|
//Selection in the archive
|
||||||
moeoNumberUnvisitedSelect<FlowShop> select(1);
|
moeoNumberUnvisitedSelect<FlowShop> select(1);
|
||||||
//explorer
|
//explorer
|
||||||
moeoFirstImprovingNeighborhoodExplorer<Neighbor> explor(neighborhood, moEval);
|
moeoFirstImprovingNeighborhoodExplorer<Neighbor> explor(neighborhood, moEval);
|
||||||
|
|
||||||
|
//DMLS(1.1>)
|
||||||
moeoUnifiedDominanceBasedLS<Neighbor> algo(checkpoint, eval, arch, explor, select);
|
moeoUnifiedDominanceBasedLS<Neighbor> algo(checkpoint, eval, arch, explor, select);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -116,10 +117,9 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// first evalution (for printing)
|
// first evalution (for printing)
|
||||||
apply<FlowShop>(eval, pop);
|
apply<FlowShop>(eval, pop);
|
||||||
for(int i=0; i<pop.size(); i++)
|
for(unsigned int i=0; i<pop.size(); i++)
|
||||||
pop[i].fitness(0);
|
pop[i].fitness(0);
|
||||||
|
|
||||||
//arch(pop);
|
|
||||||
|
|
||||||
// printing of the initial population
|
// printing of the initial population
|
||||||
cout << "Initial Population\n";
|
cout << "Initial Population\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue