diff --git a/contribution/branches/MOLS/CMakeLists.txt b/contribution/branches/MOLS/CMakeLists.txt index 3b46805a7..74f69af37 100644 --- a/contribution/branches/MOLS/CMakeLists.txt +++ b/contribution/branches/MOLS/CMakeLists.txt @@ -104,6 +104,7 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${MOEO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/src2) +INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/test) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) ###################################################################################### diff --git a/contribution/branches/MOLS/test/moeoTestClass.h b/contribution/branches/MOLS/test/moeoTestClass.h new file mode 100644 index 000000000..b577339cb --- /dev/null +++ b/contribution/branches/MOLS/test/moeoTestClass.h @@ -0,0 +1,87 @@ +#include +#include +#include + + +class ObjectiveVectorTraits : public moeoObjectiveVectorTraits +{ +public: + static bool minimizing (int i) + { + return true; + } + static bool maximizing (int i) + { + return false; + } + static unsigned int nObjectives () + { + return 2; + } +}; + +typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; + +typedef MOEO < ObjectiveVector, double, double > Solution; + +class testMove : public moMove < Solution > +{ +public : + + void operator () (Solution & _solution) + { + Solution sol=_solution; + counter++; + } + + void setCounter(unsigned int i){ + counter=i; + } + + unsigned int getCounter(){ + return counter; + } + +private: + unsigned int counter; + +} ; + +class testMoveInit : public moMoveInit +{ +public : + void operator () (testMove & _move, const Solution & _solution) + { + _move.setCounter(0); + const Solution sol(_solution); + } +} ; + +class testMoveNext : public moNextMove +{ +public : + + testMoveNext(unsigned int _counter=0):counter(_counter){}; + + bool operator () (testMove & _move, const Solution & _solution) + { + testMove move(_move); + const Solution sol(_solution); + return _move.getCounter() < 5; + } + +private: + unsigned int counter; +} ; + +class testMoveIncrEval : public moMoveIncrEval +{ +public : + ObjectiveVector operator () (const testMove & _move, const Solution & _solution) + { + ObjectiveVector objVec= _solution.objectiveVector(); + objVec[0]+=2; + objVec[1]+=2; + return objVec; + } +} ; diff --git a/contribution/branches/MOLS/test/t-moeoExhaustiveNeighborhoodExplorer.cpp b/contribution/branches/MOLS/test/t-moeoExhaustiveNeighborhoodExplorer.cpp index b7df873f8..cadc020a9 100644 --- a/contribution/branches/MOLS/test/t-moeoExhaustiveNeighborhoodExplorer.cpp +++ b/contribution/branches/MOLS/test/t-moeoExhaustiveNeighborhoodExplorer.cpp @@ -45,91 +45,9 @@ #include #include #include +#include //----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class testMove : public moMove < Solution > -{ -public : - - void operator () (Solution & _solution) - { - Solution sol=_solution; - counter++; - } - - void setCounter(unsigned int i){ - counter=i; - } - - unsigned int getCounter(){ - return counter; - } - -private: - unsigned int counter; - -} ; - -class testMoveInit : public moMoveInit -{ -public : - void operator () (testMove & _move, const Solution & _solution) - { - _move.setCounter(0); - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ -public : - - testMoveNext(unsigned int _counter=0):counter(_counter){}; - - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move(_move); - const Solution sol(_solution); - return _move.getCounter() < 5; - } - -private: - unsigned int counter; -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ -public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - ObjectiveVector objVec= _solution.objectiveVector(); - objVec[0]+=2; - objVec[1]+=2; - return objVec; - } -} ; - //----------------------------------------------------------------------------- int main() diff --git a/contribution/branches/MOLS/test/t-moeoExhaustiveUnvisitedSelect.cpp b/contribution/branches/MOLS/test/t-moeoExhaustiveUnvisitedSelect.cpp index 68f5319b5..9c0702a94 100644 --- a/contribution/branches/MOLS/test/t-moeoExhaustiveUnvisitedSelect.cpp +++ b/contribution/branches/MOLS/test/t-moeoExhaustiveUnvisitedSelect.cpp @@ -44,29 +44,9 @@ #include #include #include +#include //----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - //----------------------------------------------------------------------------- int main() diff --git a/contribution/branches/MOLS/test/t-moeoNumberUnvisitedSelect.cpp b/contribution/branches/MOLS/test/t-moeoNumberUnvisitedSelect.cpp index a0be24ab5..70dc44d7e 100644 --- a/contribution/branches/MOLS/test/t-moeoNumberUnvisitedSelect.cpp +++ b/contribution/branches/MOLS/test/t-moeoNumberUnvisitedSelect.cpp @@ -44,29 +44,9 @@ #include #include #include +#include //----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - //----------------------------------------------------------------------------- int main() diff --git a/contribution/branches/MOLS/test/t-moeoSubNeighborhoodExplorer.cpp b/contribution/branches/MOLS/test/t-moeoSubNeighborhoodExplorer.cpp index 67c427cab..d85a465a5 100644 --- a/contribution/branches/MOLS/test/t-moeoSubNeighborhoodExplorer.cpp +++ b/contribution/branches/MOLS/test/t-moeoSubNeighborhoodExplorer.cpp @@ -45,90 +45,10 @@ #include #include #include +#include //----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class testMove : public moMove < Solution > -{ -public : - - void operator () (Solution & _solution) - { - Solution sol=_solution; - counter++; - } - - void setCounter(unsigned int i){ - counter=i; - } - - unsigned int getCounter(){ - return counter; - } - -private: - unsigned int counter; - -} ; - -class testMoveInit : public moMoveInit -{ -public : - void operator () (testMove & _move, const Solution & _solution) - { - _move.setCounter(0); - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ -public : - - testMoveNext(unsigned int _counter=0):counter(_counter){}; - - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move(_move); - const Solution sol(_solution); - return _move.getCounter() < 5; - } - -private: - unsigned int counter; -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ -public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - ObjectiveVector objVec= _solution.objectiveVector(); - objVec[0]+=2; - objVec[1]+=2; - return objVec; - } -} ; //-----------------------------------------------------------------------------