diff --git a/trunk/install.cmake b/trunk/install.cmake index 43ebf9209..e78c80030 100644 --- a/trunk/install.cmake +++ b/trunk/install.cmake @@ -3,7 +3,7 @@ ###################################################################################### # check cmake version compatibility -CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) # regular expression checking INCLUDE_REGULAR_EXPRESSION("^.*$" "^$") @@ -26,7 +26,9 @@ INCLUDE(FindGnuplot) INCLUDE(CheckLibraryExists) -INCLUDE(Dart OPTIONAL) +INCLUDE(Dart OPTIONAL) + +INCLUDE(CPack) # Set a special flag if the environment is windows (should do the same in a config.g file) IF (WIN32) @@ -70,7 +72,7 @@ IF(WIN32 AND NOT CYGWIN) ENDIF(CMAKE_CXX_COMPILER MATCHES cl) ELSE(WIN32 AND NOT CYGWIN) IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6") ENDIF(CMAKE_COMPILER_IS_GNUCXX) @@ -82,6 +84,11 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) ##################################################################################### +###################################################################################### +### compilation of examples? +###################################################################################### + +SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?") ###################################################################################### ### Test config diff --git a/trunk/paradiseo-mo/CMakeLists.txt b/trunk/paradiseo-mo/CMakeLists.txt index 6013d3ab4..e5ba2b042 100644 --- a/trunk/paradiseo-mo/CMakeLists.txt +++ b/trunk/paradiseo-mo/CMakeLists.txt @@ -1,3 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) ########################################################################################################################################## ### 0) If you want to set your own variables in mo-conf.cmake and avoid the cmd line @@ -17,10 +18,10 @@ PROJECT(ParadisEO-MO) SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE) SET(PACKAGE_NAME "ParadisEO-MO - Moving Objects" CACHE STRING "Package name" FORCE) -SET(PACKAGE_STRING "ParadisEO-MO 1.1" CACHE STRING "MO Package string full name" FORCE) -SET(PACKAGE_VERSION "1.1" CACHE STRING "Package version" FORCE) -SET(GLOBAL_VERSION "1.1" CACHE STRING "Global version" FORCE) -SET(VERSION "1.1" CACHE STRING "Version" FORCE) +SET(PACKAGE_STRING "ParadisEO-MO 1.2" CACHE STRING "MO Package string full name" FORCE) +SET(PACKAGE_VERSION "1.2" CACHE STRING "Package version" FORCE) +SET(GLOBAL_VERSION "1.2" CACHE STRING "Global version" FORCE) +SET(VERSION "1.2" CACHE STRING "Version" FORCE) ########################################################################################################################################## diff --git a/trunk/paradiseo-mo/doc/mo.doxyfile.cmake b/trunk/paradiseo-mo/doc/mo.doxyfile.cmake index 60e84efda..ab30c3021 100644 --- a/trunk/paradiseo-mo/doc/mo.doxyfile.cmake +++ b/trunk/paradiseo-mo/doc/mo.doxyfile.cmake @@ -156,6 +156,13 @@ JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. diff --git a/trunk/paradiseo-mo/src/mo.h b/trunk/paradiseo-mo/src/mo.h index 2811cd14a..448080cd5 100755 --- a/trunk/paradiseo-mo/src/mo.h +++ b/trunk/paradiseo-mo/src/mo.h @@ -41,11 +41,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -72,9 +72,8 @@ #include #include #include -#include #include #include - +#include #endif diff --git a/trunk/paradiseo-mo/src/moBestImprSelect.h b/trunk/paradiseo-mo/src/moBestImprSelect.h index 9919f3b4b..c3aa6c2b5 100755 --- a/trunk/paradiseo-mo/src/moBestImprSelect.h +++ b/trunk/paradiseo-mo/src/moBestImprSelect.h @@ -57,6 +57,14 @@ class moBestImprSelect:public moMoveSelect < M > */ void init (const Fitness & _fitness) { + //Code only used to avoid warning because _fitness is not used in this procedure. + Fitness fitness; + fitness=(Fitness)_fitness; + + //std::cout.precision(10); + + //std::cout << "old fitness = " << _fitness << std::endl; + first_time = true; } @@ -80,6 +88,8 @@ class moBestImprSelect:public moMoveSelect < M > first_time = false; } + //std::cout << "best fitness = " << best_fitness << std::endl; + return true; } @@ -97,7 +107,9 @@ class moBestImprSelect:public moMoveSelect < M > _move = best_move; _fitness = best_fitness; - + + + //std::cout << "Final fitness = " << best_fitness << std::endl; } private: diff --git a/trunk/paradiseo-mo/src/moExpl.h b/trunk/paradiseo-mo/src/moExpl.h index 1f12d5a17..b86a8d177 100644 --- a/trunk/paradiseo-mo/src/moExpl.h +++ b/trunk/paradiseo-mo/src/moExpl.h @@ -49,27 +49,28 @@ public: //Neighborhoods vector std::vector< eoMonOp* > explore; - + //! Generic constructor /*! Generic constructor using a eoMonOp \param _expl Algorithme or mutation. - + */ moExpl(eoMonOp & expl){ i=0; + explore.resize(0); add(expl); } - + //! Generic constructor /*! Generic constructor using a eoMonOp \param _expl Algorithme or mutation. - + */ - + //! Procedure which launches the moExpl. /*! The exploration starts from an old solution and provides a new solution. @@ -98,7 +99,7 @@ public: //return the size of the class unsigned int size(){ return explore.size(); - } + } }; diff --git a/trunk/paradiseo-mo/src/moExponentialCoolingSchedule.h b/trunk/paradiseo-mo/src/moExponentialCoolingSchedule.h new file mode 100644 index 000000000..038f438fe --- /dev/null +++ b/trunk/paradiseo-mo/src/moExponentialCoolingSchedule.h @@ -0,0 +1,79 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 + (C) OPAC Team, LIFL, 2002-2008 + + Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + ParadisEO WebSite : http://paradiseo.gforge.inria.fr + Contact: paradiseo-help@lists.gforge.inria.fr +*/ + +#ifndef _moExponentialCoolingSchedule_h +#define _moExponentialCoolingSchedule_h + +#include + +//! One of the possible moCoolingSchedule +/*! + An other very simple cooling schedule, the temperature decrease according to a ratio while + the temperature is greater than a given threshold. +*/ +class moExponentialCoolingSchedule: public moCoolingSchedule +{ + public: + + //! Simple constructor + /*! + \param _threshold the threshold. + \param _ratio the ratio used to descrease the temperature. + */ + moExponentialCoolingSchedule (double _threshold, double _ratio):threshold (_threshold), ratio (_ratio) + {} + + //! Function which proceeds to the cooling. + /*! + It decreases the temperature and indicates if it is greater than the threshold. + + \param _temperature the current temperature. + \return if the new temperature (current temperature * ratio) is greater than the threshold. + */ + bool operator() (double & _temperature) + { + return (_temperature *= ratio) > threshold; + } + + private: + + //! The temperature threhold. + double threshold; + + //! The decreasing factor of the temperature. + double ratio; +}; + +#endif diff --git a/trunk/paradiseo-mo/src/moGenSolContinue.h b/trunk/paradiseo-mo/src/moGenSolContinue.h index 476b28022..f838e5447 100755 --- a/trunk/paradiseo-mo/src/moGenSolContinue.h +++ b/trunk/paradiseo-mo/src/moGenSolContinue.h @@ -65,6 +65,9 @@ class moGenSolContinue:public moSolContinue < EOT > */ bool operator () (const EOT & _solution) { + //code only used for avoiding warning because _sol is not used in this function. + const EOT solution(_solution); + return (++generationNumber < generationMaximumNumber); } diff --git a/trunk/paradiseo-mo/src/moHCMoveLoopExpl.h b/trunk/paradiseo-mo/src/moHCMoveLoopExpl.h index 18e12b444..44f806ecb 100755 --- a/trunk/paradiseo-mo/src/moHCMoveLoopExpl.h +++ b/trunk/paradiseo-mo/src/moHCMoveLoopExpl.h @@ -116,7 +116,7 @@ class moHCMoveLoopExpl:public moMoveLoopExpl < M > //The best move is applied on the new solution. best_move(_new_solution); - //The fitness is set (avoid an additional fitness computation). + //The fitness is set (avoid an additional fitness compuation). _new_solution.fitness (best_fitness); } diff --git a/trunk/paradiseo-mo/src/moImprBestFitAspirCrit.h b/trunk/paradiseo-mo/src/moImprBestFitAspirCrit.h index 386115713..5f98dca38 100755 --- a/trunk/paradiseo-mo/src/moImprBestFitAspirCrit.h +++ b/trunk/paradiseo-mo/src/moImprBestFitAspirCrit.h @@ -68,10 +68,13 @@ class moImprBestFitAspirCrit:public moAspirCrit < M > \param _move A move. \param _fitness A fitness linked to the move. - \return true The first time and if _fitness > best_fitness, else false. + \return true The first time and if _fitntess > best_fitness, else false. */ bool operator () (const M & _move, const Fitness & _fitness) { + //code only used for avoiding warning because _move is not used in this function. + const M move(_move); + if (first_time) { best_fitness = _fitness; @@ -80,12 +83,14 @@ class moImprBestFitAspirCrit:public moAspirCrit < M > return true; } - if (_fitness > best_fitness) + if (_fitness < best_fitness) { - best_fitness = _fitness; - return true; + return false; } - return false; + + best_fitness = _fitness; + + return true; } private: diff --git a/trunk/paradiseo-mo/src/moItRandNextMove.h b/trunk/paradiseo-mo/src/moItRandNextMove.h index 7799e6c9e..0bb3ef155 100755 --- a/trunk/paradiseo-mo/src/moItRandNextMove.h +++ b/trunk/paradiseo-mo/src/moItRandNextMove.h @@ -72,6 +72,9 @@ class moItRandNextMove:public moNextMove < M > */ bool operator () (M & _move, const EOT & _solution) { + //code only used to avoid warning because _solution is not used in this function. + const EOT solution(_solution); + if (iteration_number > iteration_maximum_number) { iteration_number = 0; diff --git a/trunk/paradiseo-mo/src/moNoAspirCrit.h b/trunk/paradiseo-mo/src/moNoAspirCrit.h index 701a4564a..cbff69ec7 100755 --- a/trunk/paradiseo-mo/src/moNoAspirCrit.h +++ b/trunk/paradiseo-mo/src/moNoAspirCrit.h @@ -58,6 +58,11 @@ class moNoAspirCrit:public moAspirCrit < M > */ bool operator () (const M & _move, const typename M::EOType::Fitness & _fitness) { + //Code only used to avoid warning because _move and _fitness are not used in this procedure. + const M move(_move); + typename M::EOType::Fitness fitness; + fitness=(typename M::EOType::Fitness)_fitness; + return false; } diff --git a/trunk/paradiseo-mo/src/moSimpleMoveTabuList.h b/trunk/paradiseo-mo/src/moSimpleMoveTabuList.h index 47d9592b9..e7f51c032 100755 --- a/trunk/paradiseo-mo/src/moSimpleMoveTabuList.h +++ b/trunk/paradiseo-mo/src/moSimpleMoveTabuList.h @@ -69,6 +69,8 @@ class moSimpleMoveTabuList: public moTabuList < M > bool operator () (const M & _move, const EOT & _solution) { moveIterator it; + //code only used to avoid warning because _solution is not used in this function. + EOT solution=(EOT)_solution; it=tabuList.begin(); // The code is !(*it)==_move instead of (*it)!=_move because people designing their specific move representation @@ -83,6 +85,8 @@ class moSimpleMoveTabuList: public moTabuList < M > void add(const M & _move, const EOT & _solution) { + //code only used to avoid warning because _solution is not used in this function. + const EOT solution(_solution); if (memory_size!=0) { diff --git a/trunk/paradiseo-mo/src/moTS.h b/trunk/paradiseo-mo/src/moTS.h index 0f57a5e76..f17aadd3f 100755 --- a/trunk/paradiseo-mo/src/moTS.h +++ b/trunk/paradiseo-mo/src/moTS.h @@ -2,20 +2,20 @@ Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 (C) OPAC Team, LIFL, 2002-2008 - + Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - + This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - + As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. - + In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, @@ -28,7 +28,7 @@ same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. - + ParadisEO WebSite : http://paradiseo.gforge.inria.fr Contact: paradiseo-help@lists.gforge.inria.fr */ @@ -54,9 +54,9 @@ class moTS:public moAlgo < typename M::EOType > //!Alias for the fitness typedef typename EOT::Fitness Fitness; - + public: - + //!Constructor of a moTS specifying all the boxes /*! In this constructor, a moTSMoveLoopExpl is instanciated. @@ -69,15 +69,15 @@ class moTS:public moAlgo < typename M::EOType > \param _continue The stopping criterion. \param _full_evaluation A full evaluation function. */ - moTS (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, - moMoveIncrEval < M > & _incremental_evaluation, moTabuList < M > & _tabu_list, - moAspirCrit < M > & _aspiration_criterion, moSolContinue < EOT > & _continue, - eoEvalFunc < EOT > & _full_evaluation): + moTS (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, + moMoveIncrEval < M > & _incremental_evaluation, moTabuList < M > & _tabu_list, + moAspirCrit < M > & _aspiration_criterion, moSolContinue < EOT > & _continue, + eoEvalFunc < EOT > & _full_evaluation): move_explorer (new moTSMoveLoopExpl < M >(_move_initializer, _next_move_generator, _incremental_evaluation, _tabu_list,_aspiration_criterion) ), continu (_continue), full_evaluation (_full_evaluation), move_explorer_memory_allocation(true) {} - + //! Constructor with less parameters /*! The explorer is given in the parameters. @@ -98,44 +98,44 @@ class moTS:public moAlgo < typename M::EOType > delete(move_explorer); } } - + //! Function which launchs the Tabu Search /*! Algorithm of the tabu search. As a moSA or a moHC, it can be used for HYBRIDATION in an evolutionary algorithm. - For security a lock (pthread_mutex_t) is closed during the algorithm. - + For security a lock (pthread_mutex_t) is closed during the algorithm. + \param _solution a solution to improve. \return TRUE. */ bool operator ()(EOT & _solution) { M move; - + EOT best_solution, new_solution; if ( _solution.invalid () ) { full_evaluation (_solution); } - + best_solution=_solution; // code used for avoiding warning because new_solution is indirectly initialized by move_expl. new_solution=_solution; - + continu.init (); do { (*move_explorer) (_solution, new_solution); - + // Updating the best solution found until now ? - if (new_solution.fitness() > best_solution.fitness()) + if (new_solution.fitness() > _solution.fitness()) { best_solution = new_solution; } - + _solution = new_solution; } while ( continu (_solution) ); diff --git a/trunk/paradiseo-mo/src/moVNS.h b/trunk/paradiseo-mo/src/moVNS.h index f8487f81b..98695f27b 100644 --- a/trunk/paradiseo-mo/src/moVNS.h +++ b/trunk/paradiseo-mo/src/moVNS.h @@ -52,7 +52,7 @@ class moVNS : public moAlgo < EOT> typedef typename EOT::Fitness Fitness; public: - + //! Generic constructor /*! Generic constructor using a moExpl @@ -62,7 +62,7 @@ public: */ moVNS(moExpl< EOT> & _explorer, eoEvalFunc < EOT> & _full_evaluation): explorer(_explorer), full_evaluation(_full_evaluation) {} - + //! Function which launches the VNS /*! @@ -79,17 +79,16 @@ public: EOT solution_initial=_solution; EOT solution_prime, solution_second; + explorer.setIndice(i); while(i solution_initial) { solution_initial=solution_second; change=true; @@ -103,7 +102,6 @@ public: if(i { public : - + testMoveIncrEval() : counter(0) {} @@ -94,17 +94,17 @@ public : solutionContinue() : counter(0) {} - + bool operator () (const solution & _solution) { const solution sol(_solution); - + if(counter==0) { counter++; return true; } - + return false; } @@ -145,17 +145,17 @@ main() int return_value; solution solution; - + testRandMove rand; testMoveIncrEval incrEval; solutionContinue continu; testCooling cooling; solutionEval eval; - + moTA ta(rand, incrEval, continu, 10.0, cooling, eval); - - cout << "[ moTA ] ==> "; - + + cout << "[ moTA ] ==> "; + ta(solution); test_result=((solution.fitness()!=2)?"KO":"OK"); diff --git a/trunk/paradiseo-mo/tutorial/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/CMakeLists.txt index 3718d96ca..6b1468059 100644 --- a/trunk/paradiseo-mo/tutorial/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/CMakeLists.txt @@ -1,4 +1,6 @@ - +IF(COMMAND cmake_policy) + CMAKE_POLICY(SET CMP0003 NEW) +ENDIF(COMMAND cmake_policy) ###################################################################################### ### 1) Definitions (required for tsp target) ###################################################################################### @@ -12,82 +14,209 @@ SET(FUNCTION_BIN_DIR ${MO_BIN_DIR}/tutorial/examples/function CACHE PATH "FUNCTI ###################################################################################### ###################################################################################### -### 2) Where must cmake go now ? +### 2) How to manage copy of benchs ? ###################################################################################### -#SUBDIRS(examples Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 Lesson6) +IF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SET(BENCH_LIST + berlin52.tsp + eil101.tsp + pr2392.tsp + rl5915.tsp + usa13509.tsp + ) + + FOREACH (bench ${BENCH_LIST}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/${bench} + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/${bench} + ) + ENDFOREACH (bench) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/param + ${MO_BIN_DIR}/tutorial/Lesson1/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson2/param + ${MO_BIN_DIR}/tutorial/Lesson2/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson3/param + ${MO_BIN_DIR}/tutorial/Lesson3/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson4/param + ${MO_BIN_DIR}/tutorial/Lesson4/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson5/param + ${MO_BIN_DIR}/tutorial/Lesson5/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/HybridLesson/param + ${MO_BIN_DIR}/tutorial/HybridLesson/param + ) +ENDIF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + +###################################################################################### +### 3) Where must cmake go now ? +###################################################################################### + +MACRO(ADD_COMMANDS_MO) + ADD_CUSTOM_COMMAND( + OUTPUT + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson2/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson2/param + ${MO_BIN_DIR}/tutorial/Lesson2 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson3/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson3/param + ${MO_BIN_DIR}/tutorial/Lesson3 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson4/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson4/param + ${MO_BIN_DIR}/tutorial/Lesson4 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson5/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson5/param + ${MO_BIN_DIR}/tutorial/Lesson5 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/HybridLesson/param + ${MO_BIN_DIR}/tutorial/HybridLesson + ) +ENDMACRO(ADD_COMMANDS_MO) + +MACRO(ADD_TARGET_MO n) + IF(${n} STREQUAL "lesson1") + ADD_CUSTOM_TARGET(lesson1 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson1/param + ${MO_BIN_DIR}/tutorial/Lesson1/hill_climbing + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "lesson2") + ADD_CUSTOM_TARGET(lesson2 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson2/param + ${MO_BIN_DIR}/tutorial/Lesson2/tabu_search + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "lesson3") + ADD_CUSTOM_TARGET(lesson3 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson3/param + ${MO_BIN_DIR}/tutorial/Lesson3/simulated_annealing + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "lesson4") + ADD_CUSTOM_TARGET(lesson4 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson4/param + ${MO_BIN_DIR}/tutorial/Lesson4/iterated_local_search + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "lesson5") + ADD_CUSTOM_TARGET(lesson5 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson5/param + ${MO_BIN_DIR}/tutorial/Lesson5/variable_neighborhood_search + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "hybridlesson") + ADD_CUSTOM_TARGET(hybridlesson DEPENDS + ${MO_BIN_DIR}/tutorial/HybridLesson/param + ${MO_BIN_DIR}/tutorial/HybridLesson/hybrid_ga + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "install") + ADD_CUSTOM_TARGET(install DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson1/param + ${MO_BIN_DIR}/tutorial/Lesson2/param + ${MO_BIN_DIR}/tutorial/Lesson3/param + ${MO_BIN_DIR}/tutorial/Lesson4/param + ${MO_BIN_DIR}/tutorial/Lesson5/param + ${MO_BIN_DIR}/tutorial/HybridLesson/param + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ELSEIF(${n} STREQUAL "benchs") + ADD_CUSTOM_TARGET(benchs DEPENDS + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/berlin52.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/eil101.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/pr2392.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/rl5915.tsp + ${MO_BIN_DIR}/tutorial/examples/tsp/benchs/usa13509.tsp + ) + ENDIF(${n} STREQUAL "lesson1") +ENDMACRO(ADD_TARGET_MO) + +IF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(install) + ADD_TARGET_MO(benchs) +ENDIF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_SUBDIRECTORY(examples) ADD_SUBDIRECTORY(Lesson1) ADD_SUBDIRECTORY(Lesson2) ADD_SUBDIRECTORY(Lesson3) ADD_SUBDIRECTORY(Lesson4) ADD_SUBDIRECTORY(Lesson5) -ADD_SUBDIRECTORY(Lesson6) - - -###################################################################################### - - -ADD_CUSTOM_TARGET(install DEPENDS ${MO_SRC_DIR}/tutorial/examples/tsp/benchs - ${MO_SRC_DIR}/tutorial/Lesson1/param - ${MO_SRC_DIR}/tutorial/Lesson2/param - ${MO_SRC_DIR}/tutorial/Lesson3/param - ${MO_SRC_DIR}/tutorial/Lesson4/param - ${MO_SRC_DIR}/tutorial/Lesson5/param - ${MO_SRC_DIR}/tutorial/Lesson6/param ) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_directory - ${MO_SRC_DIR}/tutorial/examples/tsp/benchs - ${MO_BIN_DIR}/tutorial/examples/tsp/benchs) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson1/param - ${MO_BIN_DIR}/tutorial/Lesson1) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson2/param - ${MO_BIN_DIR}/tutorial/Lesson2) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson3/param - ${MO_BIN_DIR}/tutorial/Lesson3) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson4/param - ${MO_BIN_DIR}/tutorial/Lesson4) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson5/param - ${MO_BIN_DIR}/tutorial/Lesson5) - -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${MO_SRC_DIR}/tutorial/Lesson6/param - ${MO_BIN_DIR}/tutorial/Lesson6) +ADD_SUBDIRECTORY(HybridLesson) diff --git a/trunk/paradiseo-mo/tutorial/HybridLesson/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/HybridLesson/CMakeLists.txt new file mode 100644 index 000000000..e9a0ec83d --- /dev/null +++ b/trunk/paradiseo-mo/tutorial/HybridLesson/CMakeLists.txt @@ -0,0 +1,65 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) +INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) +INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES hybrid_ga.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(hybrid_ga + hybrid_ga.cpp + ${MO_BIN_DIR}/tutorial/Lesson6/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson6) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hybrid_ga hybrid_ga.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hybrid_ga EXCLUDE_FROM_ALL hybrid_ga.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + +ADD_DEPENDENCIES(hybrid_ga tsp) + +###################################################################################### +### 4) Optionnal: define your target(s)'s version: no effect for windows +###################################################################################### + +SET(HYBRIDGA_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(hybrid_ga PROPERTIES VERSION "${HYBRIDGA_VERSION}") + +###################################################################################### +### 5) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(hybrid_ga tsp eo eoutils) + +###################################################################################### diff --git a/trunk/paradiseo-mo/tutorial/Lesson6/hybrid_ga.cpp b/trunk/paradiseo-mo/tutorial/HybridLesson/hybrid_ga.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson6/hybrid_ga.cpp rename to trunk/paradiseo-mo/tutorial/HybridLesson/hybrid_ga.cpp diff --git a/trunk/paradiseo-mo/tutorial/Lesson6/param b/trunk/paradiseo-mo/tutorial/HybridLesson/param similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson6/param rename to trunk/paradiseo-mo/tutorial/HybridLesson/param diff --git a/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt index f522b0634..3f018e4ee 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt @@ -5,46 +5,63 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) -INCLUDE_DIRECTORIES(${FUNCTION_SRC_DIR}) - -###################################################################################### +INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### -LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${FUNCTION_BIN_DIR}/lib) - -###################################################################################### - - +LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(minimize_function minimize_function.cpp) - -ADD_DEPENDENCIES(minimize_function function) - -###################################################################################### +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES hill_climbing.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(hill_climbing + hill_climbing.cpp + ${MO_BIN_DIR}/tutorial/Lesson1/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson1) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hill_climbing hill_climbing.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hill_climbing EXCLUDE_FROM_ALL hill_climbing.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") +ADD_DEPENDENCIES(hill_climbing tsp) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### -SET(MINIMIZEFUNCTION_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(minimize_function PROPERTIES VERSION "${MINIMIZEFUNCTION_VERSION}") -###################################################################################### - - +SET(HILLCLIMBING_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(hill_climbing PROPERTIES VERSION "${HILLCLIMBING_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(minimize_function function eo eoutils) +TARGET_LINK_LIBRARIES(hill_climbing tsp eo eoutils) ###################################################################################### + diff --git a/trunk/paradiseo-mo/tutorial/Lesson2/hill_climbing.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/hill_climbing.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson2/hill_climbing.cpp rename to trunk/paradiseo-mo/tutorial/Lesson1/hill_climbing.cpp diff --git a/trunk/paradiseo-mo/tutorial/Lesson1/param b/trunk/paradiseo-mo/tutorial/Lesson1/param index 726b2e29f..8bdb97f37 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson1/param +++ b/trunk/paradiseo-mo/tutorial/Lesson1/param @@ -4,7 +4,6 @@ # --stopOnUnknownParam=1 # Stop if unkown param entered ###### Configuration ###### -# --initialBound=1 # Bound for the initial affectation. -# --searchBound=1 # Bound for neighbourhood exploration. -# --searchStep=1 # Step between two values during the neighbourhood exploration. -# --selectionType=First # Type of the selection: 'Best', 'First' or 'Random'. +# --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance. +# --seed=1203517190 # Seed for rand. +# --selectionType=Best # Type of the selection: 'Best', 'First' or 'Random'. diff --git a/trunk/paradiseo-mo/tutorial/Lesson2/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson2/CMakeLists.txt index fc7baddb1..0f240ebd3 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson2/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/Lesson2/CMakeLists.txt @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -8,7 +6,6 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) -###################################################################################### ###################################################################################### ### 2) Specify where CMake can find the libraries @@ -16,36 +13,54 @@ INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(hill_climbing hill_climbing.cpp) - -ADD_DEPENDENCIES(hill_climbing tsp) -###################################################################################### - +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES tabu_search.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(tabu_search + tabu_search.cpp + ${MO_BIN_DIR}/tutorial/Lesson2/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson2) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(tabu_search tabu_search.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(tabu_search EXCLUDE_FROM_ALL tabu_search.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") +ADD_DEPENDENCIES(tabu_search tsp) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### -SET(HILLCLIMBING_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(hill_climbing PROPERTIES VERSION "${HILLCLIMBING_VERSION}") -###################################################################################### - - +SET(TABUSEARCH_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(tabu_search PROPERTIES VERSION "${TABUSEARCH_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(hill_climbing tsp eo eoutils) +TARGET_LINK_LIBRARIES(tabu_search tsp eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-mo/tutorial/Lesson2/param b/trunk/paradiseo-mo/tutorial/Lesson2/param index 8bdb97f37..53d46bed9 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson2/param +++ b/trunk/paradiseo-mo/tutorial/Lesson2/param @@ -4,6 +4,8 @@ # --stopOnUnknownParam=1 # Stop if unkown param entered ###### Configuration ###### -# --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance. -# --seed=1203517190 # Seed for rand. -# --selectionType=Best # Type of the selection: 'Best', 'First' or 'Random'. +# --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance +# --seed=1202917905 # Seed for rand +# --tabuListSize=10 # Size of the tabu list +# --maxIter=1000 # Maximum number of iterations +# --tabuListType=TwoOpt # Type of the tabu list: 'TwoOpt', 'SimpleMove' or 'SimpleSolution' diff --git a/trunk/paradiseo-mo/tutorial/Lesson3/tabu_search.cpp b/trunk/paradiseo-mo/tutorial/Lesson2/tabu_search.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson3/tabu_search.cpp rename to trunk/paradiseo-mo/tutorial/Lesson2/tabu_search.cpp diff --git a/trunk/paradiseo-mo/tutorial/Lesson3/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson3/CMakeLists.txt index d33d78b7c..41e048ef4 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson3/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/Lesson3/CMakeLists.txt @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -8,44 +6,61 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) -###################################################################################### ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### - + LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(tabu_search tabu_search.cpp) - -ADD_DEPENDENCIES(tabu_search tsp) -###################################################################################### - +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES simulated_annealing.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(simulated_annealing + simulated_annealing.cpp + ${MO_BIN_DIR}/tutorial/Lesson3/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson3) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(simulated_annealing simulated_annealing.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(simulated_annealing EXCLUDE_FROM_ALL simulated_annealing.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") +ADD_DEPENDENCIES(simulated_annealing tsp) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### -SET(TABUSEARCH_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(tabu_search PROPERTIES VERSION "${TABUSEARCH_VERSION}") -###################################################################################### - - +SET(SIMULATEDANNEALING_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(simulated_annealing PROPERTIES VERSION "${SIMULATEDANNEALING_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(tabu_search tsp eo eoutils) +TARGET_LINK_LIBRARIES(simulated_annealing tsp eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-mo/tutorial/Lesson3/param b/trunk/paradiseo-mo/tutorial/Lesson3/param index 53d46bed9..d80626b17 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson3/param +++ b/trunk/paradiseo-mo/tutorial/Lesson3/param @@ -4,8 +4,11 @@ # --stopOnUnknownParam=1 # Stop if unkown param entered ###### Configuration ###### -# --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance -# --seed=1202917905 # Seed for rand -# --tabuListSize=10 # Size of the tabu list -# --maxIter=1000 # Maximum number of iterations -# --tabuListType=TwoOpt # Type of the tabu list: 'TwoOpt', 'SimpleMove' or 'SimpleSolution' +# --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance. +# --seed=1202919978 # Seed for rand. +# --maxIter=1000 # Maximum number of iterations. +# --initialTemp=1000 # Initial temperature. +# --threshold=0.1 # Minimum temperature allowed. +# --expoRatio=0.98 # Ratio used if exponential cooling schedule is chosen. +# --lineaRatio=0.5 # Ratio used if linear cooling schedule is chosen. +# --coolSchedType=Expo # Type the cooling schedule: 'Expo' or 'Linear'. diff --git a/trunk/paradiseo-mo/tutorial/Lesson4/simulated_annealing.cpp b/trunk/paradiseo-mo/tutorial/Lesson3/simulated_annealing.cpp similarity index 95% rename from trunk/paradiseo-mo/tutorial/Lesson4/simulated_annealing.cpp rename to trunk/paradiseo-mo/tutorial/Lesson3/simulated_annealing.cpp index 3b006de99..5f5274806 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson4/simulated_annealing.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson3/simulated_annealing.cpp @@ -83,9 +83,9 @@ main (int _argc, char* _argv []) moCoolingSchedule* coolingSchedule; - if(value.compare("Geometric")==0) + if(value.compare("Expo")==0) { - coolingSchedule=new moGeometricCoolingSchedule(threshold, exponentialRatio); + coolingSchedule=new moExponentialCoolingSchedule(threshold, exponentialRatio); } else if (value.compare("Linear")==0) { @@ -129,7 +129,7 @@ manage_configuration_file(eoParser & _parser) _parser.getORcreateParam((double)0.5, "lineaRatio", "Ratio used if linear cooling schedule is chosen.", 0, "Configuration", false); - _parser.getORcreateParam(std::string("Geometric"), "coolSchedType", "Type the cooling schedule: 'Geometric' or 'Linear'.", + _parser.getORcreateParam(std::string("Expo"), "coolSchedType", "Type the cooling schedule: 'Expo' or 'Linear'.", 0, "Configuration", false); if (_parser.userNeedsHelp()) diff --git a/trunk/paradiseo-mo/tutorial/Lesson4/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson4/CMakeLists.txt index 9790bace6..a8435bd79 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson4/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/Lesson4/CMakeLists.txt @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -8,44 +6,60 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) -###################################################################################### ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### - -LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) - -###################################################################################### - +LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(simulated_annealing simulated_annealing.cpp) - -ADD_DEPENDENCIES(simulated_annealing tsp) -###################################################################################### - +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES iterated_local_search.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(iterated_local_search + iterated_local_search.cpp + ${MO_BIN_DIR}/tutorial/Lesson4/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson4) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(iterated_local_search iterated_local_search.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(iterated_local_search EXCLUDE_FROM_ALL iterated_local_search.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") +ADD_DEPENDENCIES(iterated_local_search tsp) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### -SET(SIMULATEDANNEALING_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(simulated_annealing PROPERTIES VERSION "${SIMULATEDANNEALING_VERSION}") -###################################################################################### - - +SET(ITERATEDLOCALSEARCH_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(iterated_local_search PROPERTIES VERSION "${ITERATEDLOCALSEARCH_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(simulated_annealing tsp eo eoutils) +TARGET_LINK_LIBRARIES(iterated_local_search tsp eo eoutils) ###################################################################################### - diff --git a/trunk/paradiseo-mo/tutorial/Lesson5/iterated_local_search.cpp b/trunk/paradiseo-mo/tutorial/Lesson4/iterated_local_search.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson5/iterated_local_search.cpp rename to trunk/paradiseo-mo/tutorial/Lesson4/iterated_local_search.cpp diff --git a/trunk/paradiseo-mo/tutorial/Lesson4/param b/trunk/paradiseo-mo/tutorial/Lesson4/param index d80626b17..91a5284c8 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson4/param +++ b/trunk/paradiseo-mo/tutorial/Lesson4/param @@ -5,10 +5,5 @@ ###### Configuration ###### # --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance. -# --seed=1202919978 # Seed for rand. +# --seed=1203080388 # Seed for rand. # --maxIter=1000 # Maximum number of iterations. -# --initialTemp=1000 # Initial temperature. -# --threshold=0.1 # Minimum temperature allowed. -# --expoRatio=0.98 # Ratio used if exponential cooling schedule is chosen. -# --lineaRatio=0.5 # Ratio used if linear cooling schedule is chosen. -# --coolSchedType=Expo # Type the cooling schedule: 'Expo' or 'Linear'. diff --git a/trunk/paradiseo-mo/tutorial/Lesson5/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson5/CMakeLists.txt index 6b83e5e48..191112d9f 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson5/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/Lesson5/CMakeLists.txt @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -8,7 +6,6 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) -###################################################################################### ###################################################################################### ### 2) Specify where CMake can find the libraries @@ -16,36 +13,53 @@ INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(iterated_local_search iterated_local_search.cpp) - -ADD_DEPENDENCIES(iterated_local_search tsp) - -###################################################################################### - +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES iterated_local_search.cpp) + + SOURCE_GROUP(benchs FILES + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) + + ADD_EXECUTABLE(iterated_local_search + variable_neighborhood_search.cpp + ${MO_BIN_DIR}/tutorial/Lesson5/param + ${TSP_BIN_DIR}/benchs/berlin52.tsp + ${TSP_BIN_DIR}/benchs/eil101.tsp + ${TSP_BIN_DIR}/benchs/pr2392.tsp + ${TSP_BIN_DIR}/benchs/rl5915.tsp + ${TSP_BIN_DIR}/benchs/usa13509.tsp + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MO() + ADD_TARGET_MO(lesson5) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(variable_neighborhood_search variable_neighborhood_search.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(variable_neighborhood_search EXCLUDE_FROM_ALL variable_neighborhood_search.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") +ADD_DEPENDENCIES(variable_neighborhood_search tsp) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### SET(ITERATEDLOCALSEARCH_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(iterated_local_search PROPERTIES VERSION "${ITERATEDLOCALSEARCH_VERSION}") -###################################################################################### - - +SET_TARGET_PROPERTIES(variable_neighborhood_search PROPERTIES VERSION "${ITERATEDLOCALSEARCH_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(iterated_local_search tsp eo eoutils) +TARGET_LINK_LIBRARIES(variable_neighborhood_search tsp eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-mo/tutorial/Lesson5/param b/trunk/paradiseo-mo/tutorial/Lesson5/param index 91a5284c8..d81cd02b9 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson5/param +++ b/trunk/paradiseo-mo/tutorial/Lesson5/param @@ -1,9 +1,8 @@ - ###### General ###### # --help=0 # -h : Prints this message # --stopOnUnknownParam=1 # Stop if unkown param entered ###### Configuration ###### # --instancePath=../examples/tsp/benchs/berlin52.tsp # Path to the instance. -# --seed=1203080388 # Seed for rand. -# --maxIter=1000 # Maximum number of iterations. +# --seed=1231949999 # Seed for rand. +# --selectionType=Best # Type of the selection: 'Best', 'First' or 'Random'. diff --git a/trunk/paradiseo-mo/tutorial/Lesson5/variable_neighborhood_search.cpp b/trunk/paradiseo-mo/tutorial/Lesson5/variable_neighborhood_search.cpp new file mode 100644 index 000000000..bbcd19e12 --- /dev/null +++ b/trunk/paradiseo-mo/tutorial/Lesson5/variable_neighborhood_search.cpp @@ -0,0 +1,160 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 + (C) OPAC Team, LIFL, 2002-2008 + + Salma Mesmoudi (salma.mesmoudi@inria.fr), Jean-Charles Boisson + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + ParadisEO WebSite : http://paradiseo.gforge.inria.fr + Contact: paradiseo-help@lists.gforge.inria.fr +*/ + +#include +#include +#include +#include + + +//template void add(T& var, P& vect); +void manage_configuration_file(eoParser & _parser); +//void ajouter (std::vector > >& V, moMove& K)const ; + +int +main (int _argc, char* _argv []) +{ + std::string instancePath, selectionType; + unsigned int seed; + + eoParser parser(_argc, _argv); + + manage_configuration_file(parser); + + seed=atoi( (parser.getParamWithLongName("seed")->getValue()).c_str() ); + instancePath=parser.getParamWithLongName("instancePath")->getValue(); + selectionType=parser.getParamWithLongName("selectionType")->getValue(); + + srand (seed); + Graph::load(instancePath.c_str()); + + Route solution; + + RouteInit initializer; + initializer (solution); + + RouteEval full_evaluation; + full_evaluation (solution); + + std :: cout << "[From] " << solution << std :: endl; + //A neighbor is a local search or mutation + + /*Tools for an efficient (? :-)) + local search ! */ + //---------------------first neighbor---------------------------------- + + TwoOptInit two_opt_initializer; + + TwoOptNext two_opt_next_move_generator; + + TwoOptIncrEval two_opt_incremental_evaluation; + + moMoveSelect* two_opt_selection; + + if(selectionType.compare("Best")==0) + { + two_opt_selection= new moBestImprSelect(); + } + else if (selectionType.compare("First")==0) + { + two_opt_selection= new moFirstImprSelect(); + } + else if (selectionType.compare("Random")==0) + { + two_opt_selection= new moRandImprSelect(); + } + else + { + throw std::runtime_error("[hill_climbing.cpp]: the type of selection '"+selectionType+"' is not correct."); + } + + + moHC hill_climbing (two_opt_initializer, two_opt_next_move_generator, two_opt_incremental_evaluation, + *two_opt_selection, full_evaluation); + + + //--------------------second neighbor----------------- + + CitySwap perturbation; + + //-----------neighbor vector-------------------------- + + moExpl explorer(perturbation); + explorer.add(hill_climbing); + explorer.add(perturbation); + + //------------VNS application-------------------------- + + moVNS vns(explorer, full_evaluation); + vns(solution); + //hill_climbing(solution); + std :: cout << "[To] " << solution << std :: endl; + + delete(two_opt_selection); + + return EXIT_SUCCESS; +} + + +void +manage_configuration_file(eoParser & _parser) +{ + std::ofstream os; + + _parser.createParam(std::string("../examples/tsp/benchs/berlin52.tsp"), "instancePath", "Path to the instance.", + 0, "Configuration", false); + + _parser.getORcreateParam((unsigned int)time(0), "seed", "Seed for rand.", 0, "Configuration", false); + + _parser.getORcreateParam(std::string("Best"), "selectionType", "Type of the selection: 'Best', 'First' or 'Random'.", + 0, "Configuration", false); + + if (_parser.userNeedsHelp()) + { + _parser.printHelp(std::cout); + exit(EXIT_FAILURE); + } + + os.open("current_param"); + if(!os.is_open()) + { + throw std::runtime_error("[hill_climbing.cpp]: the file current_param cannot be created."); + } + os <<_parser; + os.close(); +} + + + diff --git a/trunk/paradiseo-mo/tutorial/Lesson6/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/OldLesson/CMakeLists.txt similarity index 65% rename from trunk/paradiseo-mo/tutorial/Lesson6/CMakeLists.txt rename to trunk/paradiseo-mo/tutorial/OldLesson/CMakeLists.txt index c65ae30f0..ca24b6c37 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson6/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/OldLesson/CMakeLists.txt @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -7,45 +5,32 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils) INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src) -INCLUDE_DIRECTORIES(${TSP_SRC_DIR}) -###################################################################################### +INCLUDE_DIRECTORIES(${FUNCTION_SRC_DIR}) ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### -LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BIN_DIR}/lib) - -###################################################################################### - - +LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${FUNCTION_BIN_DIR}/lib) ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(hybrid_ga hybrid_ga.cpp) - -ADD_DEPENDENCIES(hybrid_ga tsp) - -###################################################################################### - - +ADD_EXECUTABLE(minimize_function +ADD_DEPENDENCIES(minimize_function function) ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows ###################################################################################### -SET(ITERATEDLOCALSEARCH_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(hybrid_ga PROPERTIES VERSION "${HYBRIDGA_VERSION}") -###################################################################################### - - +SET(MINIMIZEFUNCTION_VERSION ${GLOBAL_VERSION}) +SET_TARGET_PROPERTIES(minimize_function PROPERTIES VERSION "${MINIMIZEFUNCTION_VERSION}") ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### -TARGET_LINK_LIBRARIES(hybrid_ga tsp eo eoutils) +TARGET_LINK_LIBRARIES(minimize_function function eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-mo/tutorial/Lesson1/minimize_function.cpp b/trunk/paradiseo-mo/tutorial/OldLesson/minimize_function.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/Lesson1/minimize_function.cpp rename to trunk/paradiseo-mo/tutorial/OldLesson/minimize_function.cpp diff --git a/trunk/paradiseo-mo/tutorial/OldLesson/param b/trunk/paradiseo-mo/tutorial/OldLesson/param new file mode 100644 index 000000000..726b2e29f --- /dev/null +++ b/trunk/paradiseo-mo/tutorial/OldLesson/param @@ -0,0 +1,10 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered + +###### Configuration ###### +# --initialBound=1 # Bound for the initial affectation. +# --searchBound=1 # Bound for neighbourhood exploration. +# --searchStep=1 # Step between two values during the neighbourhood exploration. +# --selectionType=First # Type of the selection: 'Best', 'First' or 'Random'. diff --git a/trunk/paradiseo-moeo/CMakeLists.txt b/trunk/paradiseo-moeo/CMakeLists.txt index 8728e0a0c..84d1006af 100644 --- a/trunk/paradiseo-moeo/CMakeLists.txt +++ b/trunk/paradiseo-moeo/CMakeLists.txt @@ -1,3 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) ########################################################################################################################################## ### 0) If you want to set your own variables in moeo-conf.cmake and avoid the cmd line @@ -17,10 +18,10 @@ PROJECT(ParadisEO-MOEO) SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE) SET(PACKAGE_NAME "ParadisEO-MOEO - Multi Objective Evolving Objects" CACHE STRING "Package name" FORCE) -SET(PACKAGE_STRING "ParadisEO-MOEO 1.1" CACHE STRING "MOEO Package string full name" FORCE) -SET(PACKAGE_VERSION "1.1" CACHE STRING "Package version" FORCE) -SET(GLOBAL_VERSION "1.1" CACHE STRING "Global version" FORCE) -SET(VERSION "1.1" CACHE STRING "Version" FORCE) +SET(PACKAGE_STRING "ParadisEO-MOEO 1.2" CACHE STRING "MOEO Package string full name" FORCE) +SET(PACKAGE_VERSION "1.2" CACHE STRING "Package version" FORCE) +SET(GLOBAL_VERSION "1.2" CACHE STRING "Global version" FORCE) +SET(VERSION "1.2" CACHE STRING "Version" FORCE) ########################################################################################################################################## diff --git a/trunk/paradiseo-moeo/doc/moeo.doxyfile.cmake b/trunk/paradiseo-moeo/doc/moeo.doxyfile.cmake index ba2339925..3f56ae1a2 100644 --- a/trunk/paradiseo-moeo/doc/moeo.doxyfile.cmake +++ b/trunk/paradiseo-moeo/doc/moeo.doxyfile.cmake @@ -8,6 +8,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@ OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ @@ -29,6 +30,7 @@ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 @@ -222,6 +224,8 @@ DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO diff --git a/trunk/paradiseo-moeo/src/algo/moeoSPEA2.h b/trunk/paradiseo-moeo/src/algo/moeoSPEA2.h index b887d3bf1..2296d1ad0 100644 --- a/trunk/paradiseo-moeo/src/algo/moeoSPEA2.h +++ b/trunk/paradiseo-moeo/src/algo/moeoSPEA2.h @@ -129,7 +129,7 @@ public: /** * Ctor with a crossover, a mutation and their corresponding rates. * @param _continuator stopping criteria - * @param _eval evaluation function + popEval * @param _eval evaluation function * @param _op general operator * @param _archive archive * @param _k the k-ieme distance used to fixe diversity @@ -241,14 +241,16 @@ class eoDummyTransform : public eoTransform eoPopLoopEval < MOEOT > loopEval; /** evaluation function used to evaluate the whole population */ eoPopEvalFunc < MOEOT > & popEval; + /**archive*/ + moeoArchive < MOEOT >& archive; /** selectMany */ eoSelectMany selectMany; /** select Transform*/ eoSelectTransform selectTransform; - /** binary tournament selection */ - moeoSelectFromPopAndArch < MOEOT > select; /**SelectOne*/ moeoDetTournamentSelect < MOEOT > defaultSelect; + /** binary tournament selection */ + moeoSelectFromPopAndArch < MOEOT > select; /** fitness assignment used in NSGA-II */ moeoDominanceCountRankingFitnessAssignment < MOEOT > fitnessAssignment; /** diversity assignment used in NSGA-II */ @@ -267,8 +269,7 @@ class eoDummyTransform : public eoTransform eoBreed < MOEOT > & breed; /**distance*/ moeoEuclideanDistance < MOEOT > dist; - /**archive*/ - moeoArchive < MOEOT >& archive; + }; diff --git a/trunk/paradiseo-moeo/src/archive/moeoSPEA2Archive.h b/trunk/paradiseo-moeo/src/archive/moeoSPEA2Archive.h index d9f3a2762..182303e92 100644 --- a/trunk/paradiseo-moeo/src/archive/moeoSPEA2Archive.h +++ b/trunk/paradiseo-moeo/src/archive/moeoSPEA2Archive.h @@ -141,12 +141,12 @@ public: */ void operator()(const eoPop < MOEOT > & _pop) { - unsigned int i=0; + unsigned int i; unsigned int foo=0; //Creation of the vector that contains minimal pop's informations std::vector copy_pop(_pop.size()); - for (i;i<_pop.size(); i++) + for (i=0;i<_pop.size(); i++) { copy_pop[i].index=i; copy_pop[i].fitness=_pop[i].fitness(); @@ -250,7 +250,7 @@ public: for (l=0; l #include #include -#include -#include -#include #include #include #include + bool testDirRes(std::string _dirName, bool _erase); /** @@ -197,57 +195,6 @@ eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state.storeFunctor(entropy_updater); checkpoint.add(*entropy_updater); } - - // store the hyperVolume of the non-dominated solutions - bool hyp = _parser.getORcreateParam(false, "hyperVolume", "Store the hyperVolume of the archive at each gen.", '\0', "Output").value(); - if (hyp) - { - if (! dirOK ) - dirOK = testDirRes(dirName, eraseParam.value()); // TRUE - #ifdef _MSVC - std::string stmp = dirName + "\hyperVolume"; - #else - std::string stmp = dirName + "/hyperVolume"; - #endif - moeoHyperVolumeDifferenceMetric < ObjectiveVector > * hyperVolume = new moeoHyperVolumeDifferenceMetric < ObjectiveVector >(true, 1.1); - moeoBinaryMetricSavingUpdater < MOEOT > * hyperVolume_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*hyperVolume, _archive, stmp); - _state.storeFunctor(hyperVolume_updater); - checkpoint.add(*hyperVolume_updater); - } - - // store the Multiplicative Epsilon of the non-dominated solutions - bool multeps = _parser.getORcreateParam(false, "multEpsilon", "Store the Multiplicative Epsilon of the archive at each gen.", '\0', "Output").value(); - if (multeps) - { - if (! dirOK ) - dirOK = testDirRes(dirName, eraseParam.value()); // TRUE - #ifdef _MSVC - std::string stmp = dirName + "\multepsilon"; - #else - std::string stmp = dirName + "/multepsilon"; - #endif - moeoVecVsVecMultiplicativeEpsilonBinaryMetric < ObjectiveVector > * multepsilon = new moeoVecVsVecMultiplicativeEpsilonBinaryMetric < ObjectiveVector >; - moeoBinaryMetricSavingUpdater < MOEOT > * multepsilon_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*multepsilon, _archive, stmp); - _state.storeFunctor(multepsilon_updater); - checkpoint.add(*multepsilon_updater); - } - - // store the Additive Epsilon of the non-dominated solutions - bool addeps = _parser.getORcreateParam(false, "addEpsilon", "Store the Additive Epsilon of the archive at each gen.", '\0', "Output").value(); - if (addeps) - { - if (! dirOK ) - dirOK = testDirRes(dirName, eraseParam.value()); // TRUE - #ifdef _MSVC - std::string stmp = dirName + "\addepsilon"; - #else - std::string stmp = dirName + "/addepsilon"; - #endif - moeoVecVsVecAdditiveEpsilonBinaryMetric < ObjectiveVector > * addepsilon = new moeoVecVsVecAdditiveEpsilonBinaryMetric < ObjectiveVector >; - moeoBinaryMetricSavingUpdater < MOEOT > * addepsilon_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*addepsilon, _archive, stmp); - _state.storeFunctor(addepsilon_updater); - checkpoint.add(*addepsilon_updater); - } // and that's it for the (control and) output return checkpoint; diff --git a/trunk/paradiseo-moeo/src/do/make_ea_moeo.h b/trunk/paradiseo-moeo/src/do/make_ea_moeo.h index daa82404e..aa5a38ad9 100755 --- a/trunk/paradiseo-moeo/src/do/make_ea_moeo.h +++ b/trunk/paradiseo-moeo/src/do/make_ea_moeo.h @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -95,7 +94,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF /* the fitness assignment strategy */ std::string & fitnessParam = _parser.createParam(std::string("DomDepth"), "fitness", - "Fitness assignment scheme: Dummy, DomDepth, DomCount, DomRank, DomCountRanking or IndicatorBased", 'F', + "Fitness assignment scheme: Dummy, DomDepth or IndicatorBased", 'F', "Evolution Engine").value(); std::string & indicatorParam = _parser.createParam(std::string("Epsilon"), "indicator", "Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i', @@ -113,18 +112,6 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF { fitnessAssignment = new moeoDominanceDepthFitnessAssignment < MOEOT> (); } - else if (fitnessParam == std::string("DomCount")) - { - fitnessAssignment = new moeoDominanceCountFitnessAssignment < MOEOT> (); - } - else if (fitnessParam == std::string("DomRank")) - { - fitnessAssignment = new moeoDominanceRankFitnessAssignment < MOEOT> (); - } - else if (fitnessParam == std::string("DomCountRanking")) - { - fitnessAssignment = new moeoDominanceCountRankingFitnessAssignment < MOEOT> (); - } else if (fitnessParam == std::string("IndicatorBased")) { // metric @@ -154,7 +141,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF /* the diversity assignment strategy */ eoValueParam & diversityParam = _parser.createParam(eoParamParamType("Dummy"), "diversity", - "Diversity assignment scheme: Dummy, Sharing(nicheSize), NearestNeighbor(k) or Crowding", 'D', "Evolution Engine"); + "Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine"); eoParamParamType & diversityParamValue = diversityParam.value(); moeoDiversityAssignment < MOEOT > * diversityAssignment; if (diversityParamValue.first == std::string("Dummy")) @@ -176,21 +163,6 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF } diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize); } - else if (diversityParamValue.first == std::string("NearestNeighbor")) - { - unsigned int k; - if (!diversityParamValue.second.size()) // no parameter added - { - std::cerr << "WARNING, no k-th distance for Sharing, using 1" << std::endl; - k = 1; - diversityParamValue.second.push_back(std::string("1")); - } - else - { - k = atoi(diversityParamValue.second[0].c_str()); - } - diversityAssignment = new moeoNearestNeighborDiversityAssignment < MOEOT> (k); - } else if (diversityParamValue.first == std::string("Crowding")) { diversityAssignment = new moeoFrontByFrontCrowdingDiversityAssignment < MOEOT> (); diff --git a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h index 14b218dd6..22426bdd3 100644 --- a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h +++ b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h @@ -70,7 +70,7 @@ public: * Default ctor * @param _nocopy boolean to move away copies */ - moeoDominanceCountRankingFitnessAssignment(bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy) + moeoDominanceCountRankingFitnessAssignment(bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy) {} @@ -79,7 +79,7 @@ public: * @param _archive the archive used * @param _nocopy boolean to move away copies */ - moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), matrix(_nocopy) + moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), matrix(_nocopy) {} @@ -88,7 +88,7 @@ public: * @param _comparator the functor used to compare objective vectors * @param _nocopy boolean to move away copies */ - moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy) + moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy) {} @@ -98,7 +98,7 @@ public: * @param _archive the archive used * @param _nocopy boolean to move away copies */ - moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy) + moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy) {} diff --git a/trunk/paradiseo-moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h b/trunk/paradiseo-moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h index 1ff4502d5..8e650c8c5 100644 --- a/trunk/paradiseo-moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h +++ b/trunk/paradiseo-moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h @@ -173,7 +173,7 @@ class moeoDominanceDepthFitnessAssignment : public moeoDominanceBasedFitnessAssi // assign fitness values unsigned int rank = 1; _pop[_pop.size()-1].fitness(rank); - for (int i=((int)_pop.size())-2; i>=0; i--) + for (int i=_pop.size()-2; i>=0; i--) { if (_pop[i].objectiveVector() != _pop[i+1].objectiveVector()) { diff --git a/trunk/paradiseo-moeo/src/fitness/moeoDominanceRankFitnessAssignment.h b/trunk/paradiseo-moeo/src/fitness/moeoDominanceRankFitnessAssignment.h index 205ecdb3e..e67d76658 100644 --- a/trunk/paradiseo-moeo/src/fitness/moeoDominanceRankFitnessAssignment.h +++ b/trunk/paradiseo-moeo/src/fitness/moeoDominanceRankFitnessAssignment.h @@ -66,7 +66,7 @@ public: * @param _start a start value used to determine the fitness (default _start = 1.0) * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceRankFitnessAssignment(double _start=1.0, bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy) + moeoDominanceRankFitnessAssignment(double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy) {} @@ -76,7 +76,7 @@ public: * @param _start a start value used to determine the fitness (default _start = 1.0) * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceRankFitnessAssignment(moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy) + moeoDominanceRankFitnessAssignment(moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy) {} @@ -86,7 +86,7 @@ public: * @param _start a start value used to determine the fitness (default _start = 1.0) * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, double _start=1.0, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy) + moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy) {} @@ -97,7 +97,7 @@ public: * @param _start a start value used to determine the fitness (default _start = 1.0) * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=false) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy) + moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy) {} diff --git a/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeDifferenceMetric.h b/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeDifferenceMetric.h index c34cb5dd8..8ca9fce1a 100644 --- a/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeDifferenceMetric.h +++ b/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeDifferenceMetric.h @@ -135,8 +135,7 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric < */ void setup(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2){ if(_set1.size() < 1 || _set2.size() < 1) - std::cout << "Warning!!! In moeoHyperVolumeUnaryMetric::setup -> argument1: vector size must be greater than 0" << std::endl; - //throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector size must be greater than 0"); + throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector size must be greater than 0"); else{ double min, max; unsigned int nbObj=ObjectiveVector::Traits::nObjectives(); diff --git a/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeMetric.h b/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeMetric.h index 237b8f98d..b9acaa419 100644 --- a/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeMetric.h +++ b/trunk/paradiseo-moeo/src/metric/moeoHyperVolumeMetric.h @@ -49,7 +49,7 @@ template < class ObjectiveVector > class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , double > { public: - + /** * Constructor with a coefficient (rho) * @param _normalize allow to normalize data (default true) @@ -63,7 +63,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d bounds[i] = eoRealInterval(0,1); } } - + /** * Constructor with a reference point * @param _normalize allow to normalize data (default true) @@ -77,22 +77,22 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d bounds[i] = eoRealInterval(0,1); } } - + /** * Constructor with a reference point * @param _normalize allow to normalize data (default true) * @param _ref_point the reference point */ - moeoHyperVolumeMetric(ObjectiveVector& _ref_point=NULL, std::vector < eoRealInterval >& _bounds=NULL): normalize(false), rho(0.0), ref_point(_ref_point), bounds(_bounds){} - + moeoHyperVolumeMetric(ObjectiveVector& _ref_point=NULL, std::vector < eoRealInterval >& _bounds=NULL): normalize(false), rho(0.0), ref_point(_ref_point), bounds(_bounds){} + /** * calculates and returns the HyperVolume value of a pareto front - * @param _set the vector contains all objective Vector of pareto front + * @param _set the vector contains all objective Vector of pareto front */ double operator()(const std::vector < ObjectiveVector > & _set) { std::vector < std::vector > front; - + //determine the reference point if a coefficient is passed in paremeter if(rho >= 1.0){ //determine bounds @@ -112,7 +112,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d ref_point[i]= bounds[i].maximum() * (1-rho); } } - //if no normalization, reinit bounds to O..1 for + //if no normalization, reinit bounds to O..1 for if(!normalize) for (unsigned int i=0; i getBounds(){ return bounds; } - + /** * method caclulate bounds for the normalization * @param _set the vector of objective vectors @@ -166,7 +166,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d } } } - + /** * method calculate if a point dominates another one regarding the x first objective * @param _point1 a vector of distances @@ -178,18 +178,18 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d unsigned int i; bool better_in_any_objective = false; bool worse_in_any_objective = false; - + for(i=0; i < _no_objectives && !worse_in_any_objective; i++){ if(_point1[i] > _point2[i]) better_in_any_objective = true; else if(_point1[i] < _point2[i]) worse_in_any_objective = true; - } + } //_point1 dominates _point2 if it is better than _point2 on a objective and if it is never worse in any other objectives return(!worse_in_any_objective && better_in_any_objective); - + } - + /** * swap two elements of a vector * @param _front the vector @@ -197,18 +197,13 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d * @param _j index of the second element to swap */ void swap(std::vector< std::vector >& _front, unsigned int _i, unsigned int _j){ - std::vector _tmp; - _tmp= _front[_i]; + _front.push_back(_front[_i]); _front[_i]= _front[_j]; - _front[_j]=_tmp; - - //other way which don't work on windows - //_front.push_back(_front[_i]); - //front.back(); - //_front.pop_back(); + _front[_j]=_front.back(); + _front.pop_back(); } - - + + /** * collect all nondominated points regarding the first '_no_objectives' objectives (dominated points are stored at the end of _front) * @param _front the front @@ -218,7 +213,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d */ unsigned int filter_nondominated_set( std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _no_objectives){ unsigned int i,j,n; - + n=_no_points; i=0; while(i < n){ @@ -243,7 +238,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d } return n; } - + /** * @param _front the front * @param _no_points the number of points of the front to consider (index 0 to _no_points are considered) @@ -253,20 +248,20 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d double surface_unchanged_to(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _objective){ unsigned int i; double min, value; - + if(_no_points < 1) throw("Error in moeoHyperVolumeUnaryMetric::surface_unchanged_to -> argument2: _no_points must be greater than 0"); min = _front[0][_objective]; - + for(i=1; i < _no_points; i++){ value = _front[i][_objective]; if(value < min) - min = value; + min = value; } return min; } - - + + /** * remove all points having a value <= 'threshold' regarding the dimension 'objective', only points of index 0 to _no_points are considered. * points removed are swap at the end of the front. @@ -278,7 +273,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d */ unsigned int reduce_nondominated_set(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _objective, double _threshold){ unsigned int i,n ; - + n=_no_points; for(i=0; i < n ; i++) if(_front[i][_objective] <= _threshold){ @@ -286,35 +281,35 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d swap(_front, i, n); i--; //ATTENTION I had this to reconsider the point copied to index i (it can be useless verify algorythimic in calc_hypervolume) } - + return n; } - - + + /** * calculate hypervolume of the front (data are redrafted before) * @param _front the front * @param _no_points the number of points of the front to consider (index 0 to _no_points are considered) * @param _no_objectives the number of objective to consider - * @return the hypervolume of the front + * @return the hypervolume of the front */ double calc_hypervolume(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _no_objectives){ unsigned int n; double volume, distance; - + volume=0; distance=0; n=_no_points; while(n > 0){ unsigned int no_nondominated_points; double temp_vol, temp_dist; - + //get back the index of non dominated points of the front regarding the first "_nb_objectives - 1" objectives - //So one dimension is not determinante for the dominance + //So one dimension is not determinante for the dominance no_nondominated_points = filter_nondominated_set(_front, n, _no_objectives - 1); - + temp_vol=0; - + //if there are less than 3 objectifs take the fisrt objectif of the first point of front to begin computation of hypervolume if(_no_objectives < 3){ if(_no_objectives < 1) @@ -324,7 +319,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d //else if there at least 3 objectives, a recursive computation of hypervolume starts with _no_objectives -1 on the filter_nondominated_set calculating previously. else temp_vol= calc_hypervolume(_front, no_nondominated_points, _no_objectives - 1); - + //search the next minimum distance on the dimension _no_objectives -1 temp_dist = surface_unchanged_to(_front, n, _no_objectives - 1); //calculate the area @@ -332,27 +327,24 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d //change distance to have the good lenght on next step distance= temp_dist; //remove all points <= distance on dimension _no_objectives - n=reduce_nondominated_set(_front, n , _no_objectives - 1, distance); + n=reduce_nondominated_set(_front, n , _no_objectives - 1, distance); } return volume; } - + private: /*boolean indicates if data must be normalized or not*/ bool normalize; - + double rho; - - - ObjectiveVector ref_point; - + /*vectors contains bounds for normalization*/ std::vector < eoRealInterval > bounds; - - + + ObjectiveVector ref_point; }; diff --git a/trunk/paradiseo-moeo/src/moeo b/trunk/paradiseo-moeo/src/moeo index 46fc42a1d..6a12ce121 100644 --- a/trunk/paradiseo-moeo/src/moeo +++ b/trunk/paradiseo-moeo/src/moeo @@ -52,7 +52,6 @@ #include #include #include -#include #include #include @@ -111,7 +110,6 @@ #include #include #include -#include #include #include diff --git a/trunk/paradiseo-moeo/src/utils/moeoDominanceMatrix.h b/trunk/paradiseo-moeo/src/utils/moeoDominanceMatrix.h index afde3bafb..15bdb5412 100644 --- a/trunk/paradiseo-moeo/src/utils/moeoDominanceMatrix.h +++ b/trunk/paradiseo-moeo/src/utils/moeoDominanceMatrix.h @@ -63,14 +63,14 @@ public: * Default constructor with paretoComparator * @param _nocopy boolean allow to consider copy and doublons as bad element whose were dominated by all other MOEOT */ - moeoDominanceMatrix(bool _nocopy=false):std::vector < std::vector >(), nocopy(_nocopy), comparator(paretoComparator) {} + moeoDominanceMatrix(bool _nocopy=false):std::vector < std::vector >(),comparator(paretoComparator), nocopy(_nocopy) {} /** * Constructor which allow to choose the comparator * @param _nocopy boolean allow to consider copy and doublons as bad element whose were dominated by all other MOEOT * @param _comparator the comparator you want to use for the comparaison of two MOEOT */ - moeoDominanceMatrix(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true):std::vector < std::vector >(), nocopy(_nocopy) , comparator(_comparator) {} + moeoDominanceMatrix(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true):std::vector < std::vector >(),comparator(_comparator), nocopy(_nocopy) {} /** * Filling up the Dominance Matrix on one population diff --git a/trunk/paradiseo-moeo/test/CMakeLists.txt b/trunk/paradiseo-moeo/test/CMakeLists.txt index 8d0311240..4ed526941 100644 --- a/trunk/paradiseo-moeo/test/CMakeLists.txt +++ b/trunk/paradiseo-moeo/test/CMakeLists.txt @@ -66,8 +66,6 @@ SET (TEST_LIST t-moeoHyperVolumeDifferenceMetric t-moeoIntVector t-moeoBoundedArchive - t-moeoMOGA - t-moeoAggregativeFitnessAssignment ) FOREACH (test ${TEST_LIST}) diff --git a/trunk/paradiseo-moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp b/trunk/paradiseo-moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp index 8de48b007..e7c691417 100644 --- a/trunk/paradiseo-moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp +++ b/trunk/paradiseo-moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp @@ -154,9 +154,9 @@ int main() // fitness assignment - moeoDominanceCountRankingFitnessAssignment fitnessAssignment(true); + moeoDominanceCountRankingFitnessAssignment fitnessAssignment; - moeoDominanceCountRankingFitnessAssignment fitnessAssignment2(archive, true); + moeoDominanceCountRankingFitnessAssignment fitnessAssignment2(archive); moeoDominanceCountRankingFitnessAssignment fitnessAssignment3(paretoComparator,false); diff --git a/trunk/paradiseo-moeo/tutorial/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/CMakeLists.txt index c0e9c67b4..83be7f039 100644 --- a/trunk/paradiseo-moeo/tutorial/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/CMakeLists.txt @@ -8,11 +8,221 @@ SET(FLOWSHOP_BINARY_DIR ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop) ###################################################################################### - ###################################################################################### -### 2) Where must cmake go now ? +### 2) How to manage copy of benchs ? ###################################################################################### -SUBDIRS(examples Lesson1 Lesson2 Lesson3) +IF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SET(BENCH_LIST + 020_05_01.txt + 020_05_02.txt + 020_10_01.txt + 020_10_02.txt + 020_20_01.txt + 050_05_01.txt + 050_10_01.txt + 050_20_01.txt + 100_05_01.txt + 100_10_01.txt + 100_20_01.txt + 200_10_01.txt + README + ) + + FOREACH (bench ${BENCH_LIST}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/${bench} + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/${bench} + ) + ENDFOREACH (bench) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson1/Sch1.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson2/FlowShopEA.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson3/FlowShopEA2.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2.param + ) +ENDIF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + +MACRO(ADD_COMMANDS_MOEO) + ADD_CUSTOM_COMMAND( + OUTPUT + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/README + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/examples/flowshop/benchs/README + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/README + ) + + ADD_CUSTOM_COMMAND( + OUTPUT ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson1/Sch1.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1 + ) + + ADD_CUSTOM_COMMAND( + OUTPUT ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson2/FlowShopEA.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2 + ) + + ADD_CUSTOM_COMMAND( + OUTPUT ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson3/FlowShopEA2.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3 + ) +ENDMACRO(ADD_COMMANDS_MOEO) + +MACRO(ADD_TARGET_MOEO n) + IF(${n} STREQUAL "lesson1") + ADD_CUSTOM_TARGET(lesson1 DEPENDS + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1 + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1.param + ) + ELSEIF(${n} STREQUAL "lesson2") + ADD_CUSTOM_TARGET(lesson2 DEPENDS + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) + ELSEIF(${n} STREQUAL "lesson3") + ADD_CUSTOM_TARGET(lesson3 DEPENDS + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2 + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) + ELSEIF(${n} STREQUAL "install") + ADD_CUSTOM_TARGET(install DEPENDS + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/README + ) + ELSEIF(${n} STREQUAL "benchs") + ADD_CUSTOM_TARGET(benchs DEPENDS + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/README + ) + ENDIF(${n} STREQUAL "lesson1") +ENDMACRO(ADD_TARGET_MOEO) ###################################################################################### +### 3) Where must cmake go now ? +###################################################################################### + +ADD_SUBDIRECTORY(examples) +ADD_SUBDIRECTORY(Lesson1) +ADD_SUBDIRECTORY(Lesson2) +ADD_SUBDIRECTORY(Lesson3) + +###################################################################################### + +###################################################################################### +### 4) Target to copy benchs and parameters file +###################################################################################### + +IF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MOEO() + ADD_TARGET_MOEO(install) + ADD_TARGET_MOEO(benchs) +ENDIF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") \ No newline at end of file diff --git a/trunk/paradiseo-moeo/tutorial/Lesson1/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/Lesson1/CMakeLists.txt index 5798074c9..fb1fea46c 100644 --- a/trunk/paradiseo-moeo/tutorial/Lesson1/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/Lesson1/CMakeLists.txt @@ -1,20 +1,3 @@ - -###################################################################################### -### 0) Copy the Sch1.param file in the build path for an easy use. -###################################################################################### - -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson1/Sch1.param) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson1/Sch1.param - ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1) -###################################################################################### - - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -22,9 +5,6 @@ ADD_CUSTOM_COMMAND( INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${EO_SRC_DIR}/utils) INCLUDE_DIRECTORIES(${ParadisEO-MOEO_SOURCE_DIR}/src) -###################################################################################### - - ###################################################################################### ### 2) Specify where CMake can find the libraries @@ -32,19 +12,26 @@ INCLUDE_DIRECTORIES(${ParadisEO-MOEO_SOURCE_DIR}/src) LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MOEO_BINARY_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES Sch1.cpp) + ADD_EXECUTABLE(Sch1 + Sch1.cpp + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson1/Sch1.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MOEO() + ADD_TARGET_MOEO(lesson1) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(Sch1 Sch1.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(Sch1 EXCLUDE_FROM_ALL Sch1.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") -ADD_EXECUTABLE(Sch1 Sch1.cpp) ADD_DEPENDENCIES(Sch1 moeo) -###################################################################################### - - ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows @@ -52,15 +39,11 @@ ADD_DEPENDENCIES(Sch1 moeo) SET(SCH1_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(Sch1 PROPERTIES VERSION "${SCH1_VERSION}") -###################################################################################### - - ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### - TARGET_LINK_LIBRARIES(Sch1 moeo eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-moeo/tutorial/Lesson2/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/Lesson2/CMakeLists.txt index a30bace99..5950028cc 100644 --- a/trunk/paradiseo-moeo/tutorial/Lesson2/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/Lesson2/CMakeLists.txt @@ -1,20 +1,3 @@ - -###################################################################################### -### 0) Copy the FlowShop.param file in the build path for an easy use. -###################################################################################### - -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson2/FlowShopEA.param) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson2/FlowShopEA.param - ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2) -###################################################################################### - - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -23,29 +6,59 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${ParadisEO-MOEO_SOURCE_DIR}/src) INCLUDE_DIRECTORIES(${FLOWSHOP_SRC_DIR}) -###################################################################################### - - - ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MOEO_BINARY_DIR}/lib ${FLOWSHOP_BINARY_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(FlowShopEA FlowShopEA.cpp) +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES FlowShopEA.cpp) + SOURCE_GROUP(benchs FILES + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) + ADD_EXECUTABLE(FlowShopEA + FlowShopEA.cpp + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson2/FlowShopEA.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MOEO() + ADD_TARGET_MOEO(lesson2) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(FlowShopEA FlowShopEA.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(FlowShopEA EXCLUDE_FROM_ALL FlowShopEA.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_DEPENDENCIES(FlowShopEA flowshop moeo) -###################################################################################### - - ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows @@ -53,15 +66,11 @@ ADD_DEPENDENCIES(FlowShopEA flowshop moeo) SET(FLOWSHOPEA_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(FlowShopEA PROPERTIES VERSION "${FLOWSHOPEA_VERSION}") -###################################################################################### - - ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### - TARGET_LINK_LIBRARIES(FlowShopEA moeo flowshop eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-moeo/tutorial/Lesson3/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/Lesson3/CMakeLists.txt index c8b54a7d7..da3de04c1 100644 --- a/trunk/paradiseo-moeo/tutorial/Lesson3/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/Lesson3/CMakeLists.txt @@ -1,20 +1,3 @@ - -###################################################################################### -### 0) Copy the FlowShop.param file in the build path for an easy use. -###################################################################################### - -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson3/FlowShopEA2.param) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-MOEO_SOURCE_DIR}/tutorial/Lesson3/FlowShopEA2.param - ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3) -###################################################################################### - - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -23,29 +6,59 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src) INCLUDE_DIRECTORIES(${ParadisEO-MOEO_SOURCE_DIR}/src) INCLUDE_DIRECTORIES(${FLOWSHOP_SRC_DIR}) -###################################################################################### - - - ###################################################################################### ### 2) Specify where CMake can find the libraries ###################################################################################### LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MOEO_BINARY_DIR}/lib ${FLOWSHOP_BINARY_DIR}/lib) -###################################################################################### - - - ###################################################################################### ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(FlowShopEA2 FlowShopEA2.cpp) +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + SOURCE_GROUP(src FILES FlowShopEA2.cpp) + SOURCE_GROUP(benchs FILES + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) + ADD_EXECUTABLE(FlowShopEA2 + FlowShopEA2.cpp + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/Lesson3/FlowShopEA2.param + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_05_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_10_02.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/020_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/050_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_05_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_10_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/100_20_01.txt + ${ParadisEO-MOEO_BINARY_DIR}/tutorial/examples/flowshop/benchs/200_10_01.txt + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_COMMANDS_MOEO() + ADD_TARGET_MOEO(lesson3) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(FlowShopEA2 FlowShopEA2.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(FlowShopEA2 EXCLUDE_FROM_ALL FlowShopEA2.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") + ADD_DEPENDENCIES(FlowShopEA2 flowshop moeo) -###################################################################################### - - ###################################################################################### ### 4) Optionnal: define your target(s)'s version: no effect for windows @@ -53,15 +66,11 @@ ADD_DEPENDENCIES(FlowShopEA2 flowshop moeo) SET(FlowShopEA2_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(FlowShopEA2 PROPERTIES VERSION "${FlowShopEA2_VERSION}") -###################################################################################### - - ###################################################################################### ### 5) Link the librairies for your target(s) ###################################################################################### - TARGET_LINK_LIBRARIES(FlowShopEA2 moeo flowshop eo eoutils) ###################################################################################### diff --git a/trunk/paradiseo-moeo/tutorial/Lesson3/FlowShopEA2.param b/trunk/paradiseo-moeo/tutorial/Lesson3/FlowShopEA2.param index 885600e47..50175a972 100644 --- a/trunk/paradiseo-moeo/tutorial/Lesson3/FlowShopEA2.param +++ b/trunk/paradiseo-moeo/tutorial/Lesson3/FlowShopEA2.param @@ -7,7 +7,7 @@ ###### Evolution Engine ###### --popSize=100 # -P : Population Size --updateArch=1 # Update the archive at each gen. ---fitness=FastNonDominatedSorting # -F : Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased +--fitness=IndicatorBased # -F : Fitness assignment scheme: Dummy, DomDepth or IndicatorBased --indicator=Epsilon # -i : Binary indicator for IndicatorBased: Epsilon, Hypervolume --rho=1.1 # -r : reference point for the hypervolume indicator --kappa=0.05 # -k : Scaling factor kappa for IndicatorBased diff --git a/trunk/paradiseo-moeo/tutorial/examples/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/examples/CMakeLists.txt index eae35f629..12436951d 100644 --- a/trunk/paradiseo-moeo/tutorial/examples/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/examples/CMakeLists.txt @@ -4,6 +4,6 @@ ### 1) Where must cmake go now ? ###################################################################################### -SUBDIRS(flowshop) +ADD_SUBDIRECTORY(flowshop) ###################################################################################### \ No newline at end of file diff --git a/trunk/paradiseo-moeo/tutorial/examples/flowshop/CMakeLists.txt b/trunk/paradiseo-moeo/tutorial/examples/flowshop/CMakeLists.txt index 3400a98a0..afa830922 100644 --- a/trunk/paradiseo-moeo/tutorial/examples/flowshop/CMakeLists.txt +++ b/trunk/paradiseo-moeo/tutorial/examples/flowshop/CMakeLists.txt @@ -1,20 +1,3 @@ - -###################################################################################### -### 0) Copy the "benchs" directory in the build directory to easily run the lessons -###################################################################################### - -ADD_CUSTOM_TARGET(install DEPENDS ${FLOWSHOP_SRC_DIR}/benchs) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_directory - ${FLOWSHOP_SRC_DIR}/benchs - ${FLOWSHOP_BINARY_DIR}/benchs) - -###################################################################################### - - ###################################################################################### ### 1) Include the sources ###################################################################################### diff --git a/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_eval_FlowShop.h b/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_eval_FlowShop.h index 680615af7..6836b2d6b 100644 --- a/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_eval_FlowShop.h +++ b/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_eval_FlowShop.h @@ -54,14 +54,7 @@ eoEvalFuncCounter & do_make_eval(eoParser& _parser, eoState& _state) { // benchmark file name - std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value(); - if (benchmarkFileName == "") - { - std::string stmp = "*** Missing name of the benchmark file\n"; - stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n"; - stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks"; - throw std::runtime_error(stmp.c_str()); - } + std::string benchmarkFileName = _parser.getORcreateParam(std::string("../examples/flowshop/benchs/020_20_01.txt"), "BenchmarkFile", "Benchmark file name", 'B',"Representation", false).value(); // reading of the parameters contained in the benchmark file FlowShopBenchmarkParser fParser(benchmarkFileName); unsigned int M = fParser.getM(); diff --git a/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_genotype_FlowShop.h b/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_genotype_FlowShop.h index 5487a0f17..d1af7d8e4 100644 --- a/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_genotype_FlowShop.h +++ b/trunk/paradiseo-moeo/tutorial/examples/flowshop/make_genotype_FlowShop.h @@ -52,14 +52,7 @@ eoInit & do_make_genotype(eoParser& _parser, eoState& _state) { // benchmark file name - std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks/)", 'B',"Representation", true).value(); - if (benchmarkFileName == "") - { - std::string stmp = "*** Missing name of the benchmark file\n"; - stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n"; - stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks"; - throw std::runtime_error(stmp.c_str()); - } + std::string benchmarkFileName = _parser.getORcreateParam(std::string("../examples/flowshop/benchs/020_20_01.txt"), "BenchmarkFile", "Benchmark file name", 'B',"Representation", false).value(); // reading of number of jobs to schedule contained in the benchmark file FlowShopBenchmarkParser fParser(benchmarkFileName); unsigned int N = fParser.getN(); diff --git a/trunk/paradiseo-peo/CMakeLists.txt b/trunk/paradiseo-peo/CMakeLists.txt index 104cec08a..646b46cd8 100644 --- a/trunk/paradiseo-peo/CMakeLists.txt +++ b/trunk/paradiseo-peo/CMakeLists.txt @@ -1,3 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) ########################################################################################################################################## ### 0) If you want to set your own variables in peo-conf.cmake and avoid the cmd line @@ -15,15 +16,18 @@ INCLUDE(peo-conf.cmake OPTIONAL) # check libxml2 FIND_PROGRAM(XML2_CONFIG_PROGRAM NAMES xml2-config PATHS /usr/local/bin /usr/bin DOC "The libxml2 (www.xmlsoft.org) configuration tool") -IF(NOT XML2_CONFIG_PROGRAM) +#IF(NOT XML2_CONFIG_PROGRAM) #MESSAGE(FATAL_ERROR "Libxml2 cannot be found on your system. Libxml2 is required for ParadisEO-PEO install") -ENDIF(NOT XML2_CONFIG_PROGRAM) +#ENDIF(NOT XML2_CONFIG_PROGRAM) # set libxml2 cflags in XML2_CFLAGS EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --cflags OUTPUT_VARIABLE XML2_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) -# set libxml2 libs in XML2_LIBS -EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --libs OUTPUT_VARIABLE XML2_LIBS) +# set libxml2 libs in XML2_LIBSINCLUDE(FindLibXml2) +EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --libs OUTPUT_VARIABLE XML2_LIBS) + +STRING(STRIP ${XML2_LIBS} XML2_LIBS) + ###################################################################################### @@ -36,10 +40,10 @@ PROJECT(ParadisEO-PEO) SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE) SET(PACKAGE_NAME "ParadisEO-PEO - Parallel and distributed Evolving Objects" CACHE STRING "Package name" FORCE) -SET(PACKAGE_STRING "ParadisEO-PEO 1.1" CACHE STRING "PEO Package string full name" FORCE) -SET(PACKAGE_VERSION "1.1" CACHE STRING "Package version" FORCE) -SET(GLOBAL_VERSION "1.1" CACHE STRING "Global version" FORCE) -SET(VERSION "1.1" CACHE STRING "Version" FORCE) +SET(PACKAGE_STRING "ParadisEO-PEO 1.2" CACHE STRING "PEO Package string full name" FORCE) +SET(PACKAGE_VERSION "1.2" CACHE STRING "Package version" FORCE) +SET(GLOBAL_VERSION "1.2" CACHE STRING "Global version" FORCE) +SET(VERSION "1.2" CACHE STRING "Version" FORCE) ########################################################################################################################################## diff --git a/trunk/paradiseo-peo/doc/peo.doxyfile.cmake b/trunk/paradiseo-peo/doc/peo.doxyfile.cmake index 43b378470..3ce2bd9c0 100644 --- a/trunk/paradiseo-peo/doc/peo.doxyfile.cmake +++ b/trunk/paradiseo-peo/doc/peo.doxyfile.cmake @@ -8,6 +8,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@ OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ @@ -29,6 +30,7 @@ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 @@ -224,6 +226,8 @@ DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO diff --git a/trunk/paradiseo-peo/src/CMakeLists.txt b/trunk/paradiseo-peo/src/CMakeLists.txt index 67c2c2478..9752fb783 100644 --- a/trunk/paradiseo-peo/src/CMakeLists.txt +++ b/trunk/paradiseo-peo/src/CMakeLists.txt @@ -3,6 +3,7 @@ ### 1) Where must cmake go now ? ###################################################################################### -SUBDIRS(core rmc) +ADD_SUBDIRECTORY(core) +ADD_SUBDIRECTORY(rmc) ###################################################################################### diff --git a/trunk/paradiseo-peo/src/peoAsyncIslandMig.h b/trunk/paradiseo-peo/src/peoAsyncIslandMig.h index f4a10e357..b6a2278a1 100644 --- a/trunk/paradiseo-peo/src/peoAsyncIslandMig.h +++ b/trunk/paradiseo-peo/src/peoAsyncIslandMig.h @@ -101,11 +101,10 @@ template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public //! @param std :: queue< TYPEREPLACE > imm //! @param std :: queue< TYPESELECT > em //! @param std :: queue< Cooperative* > coop_em - + continuator & cont; selector & select; replacement & replace; Topology& topology; - continuator & cont; std :: queue< TYPEREPLACE > imm; std :: queue< TYPESELECT > em; std :: queue< Cooperative* > coop_em; diff --git a/trunk/paradiseo-peo/src/peoPSO.h b/trunk/paradiseo-peo/src/peoPSO.h index 5d0bb50eb..13933a1bb 100644 --- a/trunk/paradiseo-peo/src/peoPSO.h +++ b/trunk/paradiseo-peo/src/peoPSO.h @@ -68,7 +68,8 @@ template class peoPSOSelect: public eoSelectOne //! @return POT& virtual const POT& operator()(const eoPop& _pop) { - return topology.globalBest(_pop); +//return topology.globalBest(_pop); + return topology.globalBest(); } private: diff --git a/trunk/paradiseo-peo/src/rmc/CMakeLists.txt b/trunk/paradiseo-peo/src/rmc/CMakeLists.txt index cff45bfa7..360b37370 100644 --- a/trunk/paradiseo-peo/src/rmc/CMakeLists.txt +++ b/trunk/paradiseo-peo/src/rmc/CMakeLists.txt @@ -4,6 +4,6 @@ ### 1) Where must cmake go now ? ###################################################################################### -SUBDIRS(mpi) +ADD_SUBDIRECTORY(mpi) ###################################################################################### \ No newline at end of file diff --git a/trunk/paradiseo-peo/test/t-Mpdallexit.cpp b/trunk/paradiseo-peo/test/t-Mpdallexit.cpp index 6a9db0b3a..57d4d66dd 100644 --- a/trunk/paradiseo-peo/test/t-Mpdallexit.cpp +++ b/trunk/paradiseo-peo/test/t-Mpdallexit.cpp @@ -35,7 +35,6 @@ */ #include -#include int main (int __argc, char *__argv[]) { diff --git a/trunk/paradiseo-peo/test/t-Mpdboot.cpp b/trunk/paradiseo-peo/test/t-Mpdboot.cpp index 094e899f2..83b2637ac 100644 --- a/trunk/paradiseo-peo/test/t-Mpdboot.cpp +++ b/trunk/paradiseo-peo/test/t-Mpdboot.cpp @@ -35,7 +35,6 @@ */ #include -#include int main (int __argc, char *__argv[]) { diff --git a/trunk/paradiseo-peo/tutorial/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/CMakeLists.txt index d0d58822a..89b0f628b 100644 --- a/trunk/paradiseo-peo/tutorial/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/CMakeLists.txt @@ -14,6 +14,12 @@ SET(FLOWSHOP_BIN_DIR "${MOEO_BIN_DIR}/tutorial/examples/flowshop" CACHE PATH "Fl ### 2) Where must cmake go now ? ###################################################################################### -SUBDIRS(examples Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 Lesson6 Meta-models) - +ADD_SUBDIRECTORY(examples) +ADD_SUBDIRECTORY(Lesson1) +ADD_SUBDIRECTORY(Lesson2) +ADD_SUBDIRECTORY(Lesson3) +ADD_SUBDIRECTORY(Lesson4) +ADD_SUBDIRECTORY(Lesson5) +ADD_SUBDIRECTORY(Lesson6) +ADD_SUBDIRECTORY(Meta-models) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson1/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson1/CMakeLists.txt index 4d69b0c5f..717546ae3 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson1/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson1/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1) + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1 +) ###################################################################################### @@ -48,7 +57,7 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib) ###################################################################################### ADD_EXECUTABLE(pso mainPSO.cpp) -ADD_DEPENDENCIES(pso peo rmc_mpi) +ADD_DEPENDENCIES(pso peo rmc_mpi) ADD_EXECUTABLE(ea mainEA.cpp) ADD_DEPENDENCIES(ea peo rmc_mpi) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson2/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson2/CMakeLists.txt index c56626d8a..ecabfb23f 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson2/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson2/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2 +) ###################################################################################### @@ -47,8 +56,8 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib) ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(ea mainEA.cpp) -ADD_DEPENDENCIES(ea peo rmc_mpi) +ADD_EXECUTABLE(ea2 mainEA.cpp) +ADD_DEPENDENCIES(ea2 peo rmc_mpi) ###################################################################################### @@ -57,7 +66,7 @@ ADD_DEPENDENCIES(ea peo rmc_mpi) ###################################################################################### SET(LESSON2_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON2_VERSION}") +SET_TARGET_PROPERTIES(ea2 PROPERTIES VERSION "${LESSON2_VERSION}") ###################################################################################### @@ -65,6 +74,6 @@ SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON2_VERSION}") ### 5) Link the librairies ###################################################################################### -TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils peo) +TARGET_LINK_LIBRARIES(ea2 ${XML2_LIBS} peo rmc_mpi eo eoutils peo) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson3/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson3/CMakeLists.txt index 1e7fd406f..b241e316f 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson3/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson3/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3 +) ###################################################################################### @@ -47,10 +56,10 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib) ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(pso mainPSO.cpp) -ADD_DEPENDENCIES(pso peo rmc_mpi) -ADD_EXECUTABLE(ea mainEA.cpp) -ADD_DEPENDENCIES(ea peo rmc_mpi) +ADD_EXECUTABLE(pso3 mainPSO.cpp) +ADD_DEPENDENCIES(pso3 peo rmc_mpi) +ADD_EXECUTABLE(ea3 mainEA.cpp) +ADD_DEPENDENCIES(ea3 peo rmc_mpi) ###################################################################################### @@ -59,8 +68,8 @@ ADD_DEPENDENCIES(ea peo rmc_mpi) ###################################################################################### SET(LESSON3_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(pso PROPERTIES VERSION "${LESSON3_VERSION}") -SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON3_VERSION}") +SET_TARGET_PROPERTIES(pso3 PROPERTIES VERSION "${LESSON3_VERSION}") +SET_TARGET_PROPERTIES(ea3 PROPERTIES VERSION "${LESSON3_VERSION}") ###################################################################################### @@ -68,8 +77,8 @@ SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON3_VERSION}") ### 5) Link the librairies ###################################################################################### -TARGET_LINK_LIBRARIES(pso ${XML2_LIBS} peo rmc_mpi eo eoutils peo) -TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils peo) +TARGET_LINK_LIBRARIES(pso3 ${XML2_LIBS} peo rmc_mpi eo eoutils peo) +TARGET_LINK_LIBRARIES(ea3 ${XML2_LIBS} peo rmc_mpi eo eoutils peo) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson4/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson4/CMakeLists.txt index a7badf015..87f45c1a3 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson4/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson4/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4 +) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson5/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson5/CMakeLists.txt index a9dc0750a..9c6803ba1 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson5/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson5/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5 +) ###################################################################################### @@ -47,8 +56,8 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib) ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(ea main.cpp) -ADD_DEPENDENCIES(ea peo rmc_mpi) +ADD_EXECUTABLE(ea5 main.cpp) +ADD_DEPENDENCIES(ea5 peo rmc_mpi) ###################################################################################### @@ -58,7 +67,7 @@ ADD_DEPENDENCIES(ea peo rmc_mpi) ###################################################################################### SET(Lesson5_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${Lesson5_VERSION}") +SET_TARGET_PROPERTIES(ea5 PROPERTIES VERSION "${Lesson5_VERSION}") ###################################################################################### @@ -66,7 +75,7 @@ SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${Lesson5_VERSION}") ### 5) Link the librairies ###################################################################################### -TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils peo) +TARGET_LINK_LIBRARIES(ea5 ${XML2_LIBS} peo rmc_mpi eo eoutils peo) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Lesson6/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Lesson6/CMakeLists.txt index 8bb48d4ef..bc7e8cff0 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson6/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Lesson6/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6 +) ###################################################################################### @@ -47,8 +56,8 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib ${TSP_BINARY_ ### 3) Define your target(s): just an executable here ###################################################################################### -ADD_EXECUTABLE(ea main.cpp) -ADD_DEPENDENCIES(ea peo rmc_mpi) +ADD_EXECUTABLE(ea6 main.cpp) +ADD_DEPENDENCIES(ea6 peo rmc_mpi) ###################################################################################### @@ -58,7 +67,7 @@ ADD_DEPENDENCIES(ea peo rmc_mpi) ###################################################################################### SET(Lesson6_VERSION ${GLOBAL_VERSION}) -SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${Lesson6_VERSION}") +SET_TARGET_PROPERTIES(ea6 PROPERTIES VERSION "${Lesson6_VERSION}") ###################################################################################### @@ -66,7 +75,7 @@ SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${Lesson6_VERSION}") ### 5) Link the librairies ###################################################################################### -TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} tsp peo rmc_mpi eo eoutils peo) +TARGET_LINK_LIBRARIES(ea6 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils peo) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Meta-models/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/Meta-models/CMakeLists.txt index eef9cbd3e..53cd2df5f 100644 --- a/trunk/paradiseo-peo/tutorial/Meta-models/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/Meta-models/CMakeLists.txt @@ -5,22 +5,31 @@ SET (CMAKE_CXX_COMPILER mpicxx) -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/schema.xml) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/schema.xml) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/param - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/schema.xml - ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/param +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/schema.xml +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/param + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Meta-models/schema.xml + ${ParadisEO-PEO_BINARY_DIR}/tutorial/Meta-models +) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/Meta-models/cooperation.cpp b/trunk/paradiseo-peo/tutorial/Meta-models/cooperation.cpp index 001e59968..d0e61d98f 100644 --- a/trunk/paradiseo-peo/tutorial/Meta-models/cooperation.cpp +++ b/trunk/paradiseo-peo/tutorial/Meta-models/cooperation.cpp @@ -1,5 +1,5 @@ #include -#include +#include int main(int __argc, char *__argv[]) diff --git a/trunk/paradiseo-peo/tutorial/Meta-models/multistart.cpp b/trunk/paradiseo-peo/tutorial/Meta-models/multistart.cpp index 001e59968..d0e61d98f 100644 --- a/trunk/paradiseo-peo/tutorial/Meta-models/multistart.cpp +++ b/trunk/paradiseo-peo/tutorial/Meta-models/multistart.cpp @@ -1,5 +1,5 @@ #include -#include +#include int main(int __argc, char *__argv[]) diff --git a/trunk/paradiseo-peo/tutorial/examples/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/examples/CMakeLists.txt index c7dbb5197..8fb873244 100644 --- a/trunk/paradiseo-peo/tutorial/examples/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/examples/CMakeLists.txt @@ -4,7 +4,7 @@ ### 1) Where must cmake go now ? ###################################################################################### -SUBDIRS(tsp) +ADD_SUBDIRECTORY(tsp) ###################################################################################### diff --git a/trunk/paradiseo-peo/tutorial/examples/tsp/CMakeLists.txt b/trunk/paradiseo-peo/tutorial/examples/tsp/CMakeLists.txt index bc82988f8..1a6c2184e 100644 --- a/trunk/paradiseo-peo/tutorial/examples/tsp/CMakeLists.txt +++ b/trunk/paradiseo-peo/tutorial/examples/tsp/CMakeLists.txt @@ -3,14 +3,30 @@ ### 0) Copy the "benchs" directory in the build directory to easily run the lessons ###################################################################################### -ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs) -ADD_CUSTOM_COMMAND( - TARGET install - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_directory - ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs - ${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp/benchs) +#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs) +#ADD_CUSTOM_COMMAND( +# TARGET install +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_directory +# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs +# ${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp/benchs) + + + SET(BENCH_LIST + eil101.opt.tour + eil101.tsp + eil101.tsp.hc + ) + + FOREACH (bench ${BENCH_LIST}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs/${bench} + ${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp/benchs/${bench} + ) + ENDFOREACH (bench) + ######################################################################################