diff --git a/trunk/paradiseo-mo/src/problems/eval/oneMaxFullEval.h b/trunk/paradiseo-mo/src/problems/eval/oneMaxFullEval.h new file mode 100644 index 000000000..b7f680885 --- /dev/null +++ b/trunk/paradiseo-mo/src/problems/eval/oneMaxFullEval.h @@ -0,0 +1,53 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can ue, +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". + +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 _oneMaxFullEval_h +#define _oneMaxFullEval_h + +/** + * Full evalution Function for OneMax problem + */ +template< class EOT > +class oneMaxFullEval : public eoEvalFunc +{ +public: + + /** + * Count the number of 1 in a bitString + * @param _sol the solution to evaluate + */ + void operator() (EOT& _sol) { + unsigned int sum = 0; + for (unsigned int i = 0; i < _sol.size(); i++) + sum += _sol[i]; + _sol.fitness(sum); + } +}; + +#endif diff --git a/trunk/paradiseo-mo/tutorial/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/CMakeLists.txt index 2fc13942e..b242b3b36 100644 --- a/trunk/paradiseo-mo/tutorial/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/CMakeLists.txt @@ -1 +1 @@ -ADD_SUBDIRECTORY(oneMax) \ No newline at end of file +ADD_SUBDIRECTORY(Lesson1) \ No newline at end of file diff --git a/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt new file mode 100644 index 000000000..5156da175 --- /dev/null +++ b/trunk/paradiseo-mo/tutorial/Lesson1/CMakeLists.txt @@ -0,0 +1,18 @@ +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + +ADD_EXECUTABLE(testSimpleHC testSimpleHC.cpp) +ADD_EXECUTABLE(testFirstImpr testFirstImpr.cpp) +ADD_EXECUTABLE(testRandomBestHC testRandomBestHC.cpp) +ADD_EXECUTABLE(testHCneutral testHCneutral.cpp) + +TARGET_LINK_LIBRARIES(testSimpleHC eoutils ga eo) +TARGET_LINK_LIBRARIES(testFirstImpr eoutils ga eo) +TARGET_LINK_LIBRARIES(testRandomBestHC eoutils ga eo) +TARGET_LINK_LIBRARIES(testHCneutral eoutils ga eo) + + + diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/testFirstImpr.cpp similarity index 97% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp rename to trunk/paradiseo-mo/tutorial/Lesson1/testFirstImpr.cpp index d37538700..637e46e7f 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson1/testFirstImpr.cpp @@ -23,10 +23,10 @@ using namespace std; //----------------------------------------------------------------------------- // fitness function -#include +#include +#include #include #include -#include #include #include @@ -98,7 +98,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - FuncOneMax eval(vecSize); + oneMaxFullEval eval; /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/testHCneutral.cpp similarity index 98% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp rename to trunk/paradiseo-mo/tutorial/Lesson1/testHCneutral.cpp index 0b053efde..bb99a5ce0 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson1/testHCneutral.cpp @@ -23,10 +23,10 @@ using namespace std; //----------------------------------------------------------------------------- // fitness function -#include +#include +#include #include #include -#include #include #include @@ -102,7 +102,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - FuncOneMax eval(vecSize); + oneMaxFullEval eval; /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomBestHC.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/testRandomBestHC.cpp similarity index 97% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testRandomBestHC.cpp rename to trunk/paradiseo-mo/tutorial/Lesson1/testRandomBestHC.cpp index fda13d9c7..67e0f94df 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomBestHC.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson1/testRandomBestHC.cpp @@ -23,10 +23,10 @@ using namespace std; //----------------------------------------------------------------------------- // fitness function -#include +#include +#include #include #include -#include #include #include @@ -98,7 +98,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - FuncOneMax eval(vecSize); + oneMaxFullEval eval; /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/testSimpleHC.cpp similarity index 97% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp rename to trunk/paradiseo-mo/tutorial/Lesson1/testSimpleHC.cpp index 5fc728d2e..bacd6f311 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson1/testSimpleHC.cpp @@ -23,10 +23,10 @@ using namespace std; //----------------------------------------------------------------------------- // fitness function -#include +#include +#include #include #include -#include #include #include @@ -98,7 +98,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - FuncOneMax eval(vecSize); + oneMaxFullEval eval; /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp b/trunk/paradiseo-mo/tutorial/Lesson3/testSimulatedAnnealing.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp rename to trunk/paradiseo-mo/tutorial/Lesson3/testSimulatedAnnealing.cpp diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp b/trunk/paradiseo-mo/tutorial/Lesson4/testSimpleTS.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp rename to trunk/paradiseo-mo/tutorial/Lesson4/testSimpleTS.cpp diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp b/trunk/paradiseo-mo/tutorial/Lesson5/testILS.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp rename to trunk/paradiseo-mo/tutorial/Lesson5/testILS.cpp diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp b/trunk/paradiseo-mo/tutorial/Lesson6/testMetropolisHasting.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp rename to trunk/paradiseo-mo/tutorial/Lesson6/testMetropolisHasting.cpp diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp b/trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp rename to trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp b/trunk/paradiseo-mo/tutorial/Lesson6/testRandomWalk.cpp similarity index 100% rename from trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp rename to trunk/paradiseo-mo/tutorial/Lesson6/testRandomWalk.cpp