00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __moHC_h
00037 #define __moHC_h
00038
00039 #include <eoEvalFunc.h>
00040
00041 #include <moAlgo.h>
00042 #include <moHCMoveLoopExpl.h>
00043
00045
00048 template < class M >
00049 class moHC:public moAlgo < typename M::EOType >
00050 {
00052 typedef typename M::EOType EOT;
00053
00055 typedef typename EOT::Fitness Fitness;
00056
00057 public:
00058
00060
00069 moHC (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator,
00070 moMoveIncrEval < M > & _incremental_evaluation, moMoveSelect < M > & _move_selection, eoEvalFunc < EOT > & _full_evaluation) :
00071 move_explorer ( *new moHCMoveLoopExpl < M > (_move_initializer, _next_move_generator, _incremental_evaluation, _move_selection) ),
00072 full_evaluation (_full_evaluation)
00073 {}
00074
00076
00082 moHC (moMoveExpl < M > & _move_explorer, eoEvalFunc < EOT > & _full_evaluation):
00083 move_explorer (_move_explorer), full_evaluation (_full_evaluation)
00084 {}
00085
00087
00094 bool operator ()(EOT & _solution)
00095 {
00096 EOT new_solution;
00097
00098 if ( _solution.invalid() )
00099 {
00100 full_evaluation(_solution);
00101 }
00102
00103 new_solution=_solution;
00104
00105 do
00106 {
00107 _solution=new_solution;
00108 move_explorer (_solution, new_solution);
00109 }
00110 while ( new_solution.fitness() > _solution.fitness() );
00111
00112 return true;
00113 }
00114
00115 private:
00116
00118 moMoveExpl < M > & move_explorer;
00119
00121 eoEvalFunc < EOT > & full_evaluation;
00122 };
00123
00124 #endif