[Paradiseo-help] Parallel MOEO?

paradiseo-help paradiseo-help at lists.gforge.inria.fr
Mar 13 Mai 15:19:07 CEST 2008


Windo Hutabarat a écrit :
> Dear all,
>
> Thank you very much for giving us ParadisEO!  I am interested in MOEO, 
> especially the possibility of using the ParadisEO machinery to make my 
> life easier!  
>
> One of my main requirements, however, is to be able to perform 
> parallel multiobjective evaluation.  Everything with PEO and MOEO runs 
> cleanly, so it occurred to me that PMOEO (if you like) might be 
> possible using existing ParadisEO infrastructure.  I tried this by 
> modifying the Schaffer MOEO example into something similar to the PEO 
> tutorial example (code attached).
>
> Since the stock NSGA-II code does not accept peoPopEval, I used 
> moeoEasyEA to put an implementation of NSGA-II that do use peoPopEval.
>
> The code looks OK (to me), compiles cleanly, and initially appears to 
> run well.  However, it encounters problems when it tries to harvest 
> the result from the slave nodes, giving a lot of this:
>
> rank 7 in job 5 grunt_24087 caused collective abort of all ranks
>   exit status of rank 7: killed by signal 9
>
> I've checked the source and header files, but I'm afraid it's not 
> clear to me what may have caused this.  It also occurred to me that 
> perhaps ParadisEO-PEO is not yet equipped to handle PMOEO.  Can 
> somebody please set me straight?  Any suggestion/comments would be 
> gratefully received!
>
> Many thanks for your kind attention.
>
> Windo
>
> -- 
> Windo Hutabarat
> Research Student - Engineering Design Centre, University of Cambridge
> www-edc.eng.cam.ac.uk <http://www-edc.eng.cam.ac.uk> - www.i-d-c.info 
> <http://www.i-d-c.info>
> ------------------------------------------------------------------------
>
>
> #include <iostream>
> #include <moeo>
> #include <peo>
> #include <es.h>
>
> using namespace std;
>
> //-----------------------------------------------------------------------------
> // the moeoObjectiveVectorTraits: minimising 2 objectives
> //-----------------------------------------------------------------------------
> class Sch1ObjectiveVectorTraits : public moeoObjectiveVectorTraits {
> public:
>     static bool minimizing(int i) {
>         return true;
>     }
>     static bool maximizing(int i) {
>         return false;
>     }
>     static unsigned int nObjectives(void) {
>         return 2;
>     }
> };
>
> //-----------------------------------------------------------------------------
> // objective vector of real values
> //-----------------------------------------------------------------------------
> typedef moeoRealObjectiveVector <Sch1ObjectiveVectorTraits> Sch1ObjectiveVector;
>
> //-----------------------------------------------------------------------------
> // multi-objective evolving object for the Sch1 problem
> //-----------------------------------------------------------------------------
> class Sch1 : public moeoRealVector< Sch1ObjectiveVector, double, double> {
> public:
>     Sch1() : moeoRealVector<Sch1ObjectiveVector, double, double> (1) {}
> };
>
> //-----------------------------------------------------------------------------
> // evaluation of objective functions
> //-----------------------------------------------------------------------------
> class Sch1Eval : public moeoEvalFunc<Sch1> {
> public:
>     void operator() (Sch1 & _sch1) {
>         if (_sch1.invalidObjectiveVector()) {
>             Sch1ObjectiveVector objVec;
>             double x = _sch1[0];
>             objVec[0] = x * x;
>             objVec[1] = (x - 2.0) * (x - 2.0);
>             _sch1.objectiveVector(objVec);
>         }
>     }
> };
>
> int main(int argc, char **argv)
> {
>     peo::init(argc, argv);
>
>     eoParser parser(argc, argv);
>     eoState state;
>
>     //-------------------------------------------------------------------------
>     // parameters
>     //-------------------------------------------------------------------------
>     unsigned int POP_SIZE = parser.createParam(
>             (unsigned int)(100), "popSize", "Population size", 'P',"Param"
>             ).value();
>     unsigned int MAX_GEN = parser.createParam(
>             (unsigned int)(100), "maxGen", "Maximum number of generations", 'G', "Param"
>             ).value();
>     double M_EPSILON = parser.createParam(
>             0.01, "mutEpsilon", "epsilon for mutation", 'e', "Param"
>             ).value();
>     double P_CROSS = parser.createParam(
>             0.25, "pCross", "Crossover probability", 'C', "Param"
>             ).value();
>     double P_MUT = parser.createParam(
>             0.35, "pMut", "Mutation probability", 'M', "Param"
>             ).value();
>     int EA_TYPE = parser.createParam(
>             0, "eaType", "Type of EA, 0 for NSGA-II, 1 for IBEA", 'T', "Param"
>             ).value();
>
>     //-------------------------------------------------------------------------
>     // objective functions evaluation
>     //-------------------------------------------------------------------------
>
>     Sch1Eval moEval;
>     peoPopEval<Sch1> eval(moEval);
>
>     //-------------------------------------------------------------------------
>     // crossover and mutation
>     //-------------------------------------------------------------------------
>     eoQuadCloneOp <Sch1> xover;
>     eoUniformMutation <Sch1> mutation (M_EPSILON);
>
>     //-------------------------------------------------------------------------
>     // generate initial population
>     //-------------------------------------------------------------------------
>     eoRealVectorBounds bounds(1, 0.0, 2.0);
>     eoRealInitBounded <Sch1> init(bounds);
>     eoPop<Sch1> pop(POP_SIZE, init);
>
>     if(getNodeRank()==1) cout << "NSGA-II from components selected" << endl;
>     //-------------------------------------------------------------------------
>     // build NSGA-II from components
>     //-------------------------------------------------------------------------
>     moeoArchive<Sch1> arch;
>     eoGenContinue<Sch1> terminator(MAX_GEN);   // fixed generations
>
>     eoCheckPoint<Sch1> checkpoint(terminator); // if need be
>     moeoArchiveUpdater<Sch1> updater(arch,pop);
>     checkpoint.add(updater);
>
>     moeoFastNonDominatedSortingFitnessAssignment<Sch1> fitness;
>     moeoFrontByFrontCrowdingDiversityAssignment<Sch1> diversity;
>     moeoFitnessThenDiversityComparator<Sch1> comparator;
>     moeoDetTournamentSelect<Sch1> select(2);    // binary
>     moeoElitistReplacement<Sch1> replace(fitness, diversity, comparator);
>     eoSGAGenOp<Sch1> op(xover, P_CROSS, mutation, P_MUT);
>     eoGeneralBreeder<Sch1> breeder(select, op);
>
>     moeoEasyEA<Sch1> moea(terminator,eval,breeder,replace,fitness,diversity);
>
>     peoWrapper parallelEA(moea, pop);
>     eval.setOwner(parallelEA);
>
>     // help
>     make_help(parser);
>
>     peo::run();
>     peo::finalize();
>
>     if(getNodeRank()==1) {
>         // extract first front of the final population
>         moeoArchive<Sch1> arch;
>         arch.update(pop);
>
>         cout << "Final Archive" << endl;
>         arch.sortedPrintOn(cout);
>         cout << endl;
>     }
>     return EXIT_SUCCESS;
> }
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Paradiseo-help mailing list
> Paradiseo-help at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/paradiseo-help
>   
Dear,

The component peoMoeoPopEval recently developped in our team has been 
successfully tested with your application. The only additional thing you 
really need is the "peoMoeoPopEval.h" file but we have joined a test 
package.


Here are the instuctions to run the example:

- Extract the archive using "tar -xvf test-pmoeo-13052008.tgz"
- Edit the "install.cmake" and set your own path to paradiseo-1.1
- From the "build" directory, run "cmake .." (I assume you use Unix 
makefiles)
- Copy "schema.xml" to "build"
- Compile from "build" with "make"
- Run it from "build": "mpiexec -n 4 ./pmoeo"

In fact, when having "peoMoeoPopEval.h", you just need to include it and 
replace in the code:

"peoPopEval<Sch1> eval(moEval);" by "peoMoeoPopEval<Sch1> eval(moEval);"


Let us know if it works and if your problem is solved.

Regards,
ParadisEO Team

-------------- section suivante --------------
Une pièce jointe autre que texte a été nettoyée...
Nom: test-pmoeo-13052008.tgz
Type: application/x-gzip
Taille: 30720 octets
Desc: non disponible
URL: <http://lists.gforge.inria.fr/pipermail/paradiseo-help/attachments/20080513/a382d6e2/attachment.bin>


Plus d'informations sur la liste de diffusion Paradiseo-help