00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __moSimpleSolutionTabuList_h
00013 #define __moSimpleSolutionTabuList_h
00014
00015 #include <list>
00016 #include <iterator>
00017
00018 #include "moTabuList.h"
00019
00021 template <class M>
00022 class moSimpleSolutionTabuList: public moTabuList < M >
00023 {
00024
00025 public:
00026
00028 typedef typename M::EOType EOT;
00029
00031
00034 moSimpleSolutionTabuList(unsigned __size): maxSize(__size)
00035 {
00036 currentSize=0;
00037 }
00038
00040
00045 bool operator () (const M & __move, const EOT & __sol)
00046 {
00047 typename std::list<EOT>::iterator it;
00048
00049 M _move=(M)__move;
00050 EOT _sol=(EOT) __sol;
00051
00052 _move(_sol);
00053
00054 it=tabuList.begin();
00055 while(it!=tabuList.end()&&(!((*it)==_sol)))
00056 {
00057 it++;
00058 }
00059
00060 return it!=tabuList.end();
00061 }
00062
00063 void
00064 add (const M & __move, const EOT & __sol)
00065 {
00066 M _move=(M)__move;
00067 EOT _sol=(EOT) _sol;
00068
00069 _move(_sol);
00070
00071 tabuList.push_back(_sol);
00072
00073 if(currentSize==maxSize)
00074 {
00075 tabuList.erase(tabuList.begin());
00076 }
00077 else
00078 {
00079 currentSize++;
00080 }
00081 }
00082
00083 void
00084 update ()
00085 {
00086
00087 }
00088
00089 void
00090 init ()
00091 {
00092
00093 }
00094
00095 private:
00096
00098 unsigned maxSize;
00099
00101 unsigned currentSize;
00102
00104 std::list<EOT> tabuList;
00105 };
00106
00107 #endif