00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MOEONSGA_II_H_
00014 #define MOEONSGA_II_H_
00015
00016 #include <eoGeneralBreeder.h>
00017 #include <eoBreed.h>
00018 #include <eoContinue.h>
00019 #include <eoEvalFunc.h>
00020 #include <eoGenContinue.h>
00021 #include <eoGenOp.h>
00022 #include <eoPopEvalFunc.h>
00023 #include <eoSelectOne.h>
00024 #include <eoSGAGenOp.h>
00025
00026 #include <moeoNDSorting.h>
00027 #include <moeoReplacement.h>
00028
00031 template < class EOT > class moeoNSGA_II:public eoAlgo < EOT >
00032 {
00033 public:
00034
00046 moeoNSGA_II (unsigned _max_gen, eoEvalFunc < EOT > &_eval, eoGenOp < EOT > &_op):continuator (*(new eoGenContinue < EOT > (_max_gen))), eval (_eval), loopEval (_eval), popEval (loopEval), selectOne (sorting, 2),
00047 replace (sorting), genBreed (selectOne, _op), breed (genBreed)
00048 {
00049 }
00050
00052 moeoNSGA_II (unsigned _max_gen, eoEvalFunc < EOT > &_eval, eoQuadOp < EOT > &crossover, double pCross, eoMonOp < EOT > &mutation, double pMut):continuator (*(new eoGenContinue < EOT > (_max_gen))), eval (_eval), loopEval (_eval), popEval (loopEval), selectOne (sorting, 2),
00053
00054 replace (sorting),
00055 genBreed (selectOne,
00056 *new eoSGAGenOp < EOT > (crossover, pCross, mutation, pMut)),
00057 breed (genBreed)
00058 {
00059 }
00060
00062 moeoNSGA_II (eoContinue < EOT > &_continuator, eoEvalFunc < EOT > &_eval, eoGenOp < EOT > &_op):
00063 continuator (_continuator), eval (_eval), loopEval (_eval), popEval (loopEval), selectOne (sorting, 2),
00064 replace (sorting), genBreed (selectOne, _op), breed (genBreed)
00065 {
00066 }
00067
00069 virtual void operator () (eoPop < EOT > &_pop)
00070 {
00071 eoPop < EOT > offspring, empty_pop;
00072 popEval (empty_pop, _pop);
00073 do
00074 {
00075
00076 breed (_pop, offspring);
00077
00078
00079 popEval (_pop, offspring);
00080
00081
00082 replace (_pop, offspring);
00083
00084 }
00085 while (continuator (_pop));
00086 }
00087
00088 protected:
00089 eoContinue < EOT > &continuator;
00090
00091 eoEvalFunc < EOT > &eval;
00092 eoPopLoopEval < EOT > loopEval;
00093
00094 eoPopEvalFunc < EOT > &popEval;
00095
00097 moeoNDSorting_II < EOT > sorting;
00099 eoDetTournamentWorthSelect < EOT > selectOne;
00101 moeoElitistReplacement < EOT > replace;
00102 eoGeneralBreeder < EOT > genBreed;
00103 eoBreed < EOT > &breed;
00104 };
00105
00106 #endif