00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __moHCMoveLoopExpl_h
00013 #define __moHCMoveLoopExpl_h
00014
00015 #include "moMoveLoopExpl.h"
00016
00017 #include "moMoveInit.h"
00018 #include "moNextMove.h"
00019 #include "moMoveIncrEval.h"
00020 #include "moMoveSelect.h"
00021
00023 template < class M > class moHCMoveLoopExpl:public moMoveLoopExpl < M >
00024 {
00025
00027 typedef typename M::EOType EOT;
00028
00030 typedef typename M::EOType::Fitness Fitness;
00031
00032 public:
00033
00035
00043 moHCMoveLoopExpl (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moMoveSelect < M > &__move_select):
00044
00045 move_init (__move_init),
00046 next_move (__next_move),
00047 incr_eval (__incr_eval), move_select (__move_select)
00048 {
00049
00050 }
00051
00053
00059 void operator () (const EOT & __old_sol, EOT & __new_sol)
00060 {
00061
00062 M move;
00063
00064
00065 move_init (move, __old_sol);
00066
00067
00068 move_select.init (__old_sol.fitness ());
00069
00070 while (move_select.update (move, incr_eval (move, __old_sol))
00071 && next_move (move, __old_sol));
00072
00073 try
00074 {
00075
00076 M best_move;
00077
00078 Fitness best_move_fit;
00079
00080 move_select (best_move, best_move_fit);
00081 __new_sol.fitness (best_move_fit);
00082 best_move (__new_sol);
00083
00084 }
00085 catch (EmptySelection & __ex)
00086 {
00087
00088
00089 }
00090 }
00091
00092 private:
00093
00095 moMoveInit < M > &move_init;
00096
00098 moNextMove < M > &next_move;
00099
00101 moMoveIncrEval < M > &incr_eval;
00102
00104 moMoveSelect < M > &move_select;
00105
00106 };
00107
00108 #endif