FlowShopEA.cpp

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 //-----------------------------------------------------------------------------
00004 // FlowShopEA.cpp
00005 // (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
00006 /*
00007     This library...
00008 
00009     Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
00010  */
00011 //-----------------------------------------------------------------------------
00012 
00013 
00014 // moeo general include
00015 #include <moeo>
00016 // for the creation of an evaluator
00017 #include <make_eval_FlowShop.h>
00018 // for the creation of an initializer
00019 #include <make_genotype_FlowShop.h>
00020 // for the creation of the variation operators
00021 #include <make_op_FlowShop.h>
00022 // how to initialize the population
00023 #include <do/make_pop.h>
00024 // the stopping criterion
00025 #include <do/make_continue_moeo.h>
00026 // outputs (stats, population dumps, ...)
00027 #include <do/make_checkpoint_moeo.h>
00028 // evolution engine (selection and replacement)
00029 #include <do/make_ea_moeo.h>
00030 // simple call to the algo
00031 #include <do/make_run.h>
00032 // checks for help demand, and writes the status file and make_help; in libutils
00033 void make_help(eoParser & _parser);
00034 // definition of the representation
00035 #include <FlowShop.h>
00036 
00037 
00038 using namespace std;
00039 
00040 
00041 int main(int argc, char* argv[])
00042 {
00043     try
00044     {
00045     
00046         eoParser parser(argc, argv);  // for user-parameter reading
00047         eoState state;                // to keep all things allocated
00048 
00049 
00050         /*** the representation-dependent things ***/
00051 
00052         // The fitness evaluation
00053         eoEvalFuncCounter<FlowShop>& eval = do_make_eval(parser, state);
00054         // the genotype (through a genotype initializer)
00055         eoInit<FlowShop>& init = do_make_genotype(parser, state);
00056         // the variation operators
00057         eoGenOp<FlowShop>& op = do_make_op(parser, state);
00058 
00059 
00060         /*** the representation-independent things ***/
00061 
00062         // initialization of the population
00063         eoPop<FlowShop>& pop = do_make_pop(parser, state, init);
00064         // definition of the archive
00065         moeoArchive<FlowShop> arch;
00066         // stopping criteria
00067         eoContinue<FlowShop>& term = do_make_continue_moeo(parser, state, eval);
00068         // output
00069         eoCheckPoint<FlowShop>& checkpoint = do_make_checkpoint_moeo(parser, state, eval, term, pop, arch);
00070         // algorithm
00071         eoAlgo<FlowShop>& algo = do_make_ea_moeo(parser, state, eval, checkpoint, op, arch);
00072 
00073 
00074         /*** Go ! ***/
00075 
00076         // help ?
00077         make_help(parser);
00078 
00079         // first evalution
00080         apply<FlowShop>(eval, pop);
00081 
00082         // printing of the initial population
00083         cout << "Initial Population\n";
00084         pop.sortedPrintOn(cout);
00085         cout << endl;
00086 
00087         // run the algo
00088         do_run(algo, pop);
00089 
00090         // printing of the final population
00091         cout << "Final Population\n";
00092         pop.sortedPrintOn(cout);
00093         cout << endl;
00094 
00095         // printing of the final archive
00096         cout << "Final Archive\n";
00097         arch.sortedPrintOn(cout);
00098         cout << endl;
00099 
00100 
00101     }
00102     catch (exception& e)
00103     {
00104         cout << e.what() << endl;
00105     }
00106     return EXIT_SUCCESS;
00107 }

Generated on Mon Oct 8 10:35:51 2007 for ParadisEO-MOEOMovingObjects by  doxygen 1.4.7