From dc83722be4de15305c79dd31e194e813a8e3c921 Mon Sep 17 00:00:00 2001 From: jhumeau Date: Wed, 30 Jun 2010 13:16:28 +0000 Subject: [PATCH] =?UTF-8?q?test=20inutiles=20vir=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1877 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-moeo/test/CMakeLists.txt | 21 -- .../paradiseo-moeo/test/t-moeoASFAMetric.cpp | 128 ------- .../test/t-moeoASFAOrMetric.cpp | 129 ------- .../t-moeoAchievementFitnessAssignment.cpp | 147 -------- .../t-moeoAggregativeFitnessAssignment.cpp | 115 ------ .../test/t-moeoAnytimeWeightStrategy.cpp | 301 ---------------- .../t-moeoAugmentedQexploreWeightStrategy.cpp | 300 ---------------- .../test/t-moeoChebyshevMetric.cpp | 128 ------- .../test/t-moeoChebyshevOrientedMetric.cpp | 128 ------- .../t-moeoConstraintFitnessAssignment.cpp | 122 ------- .../test/t-moeoDichoWeightStrategy.cpp | 305 ---------------- .../test/t-moeoEpsilonHyperboxArchive.cpp | 161 --------- ...eoFixedTimeBothDirectionWeightStrategy.cpp | 295 ---------------- ...oeoFixedTimeOneDirectionWeightStrategy.cpp | 295 ---------------- .../paradiseo-moeo/test/t-moeoHC.cpp | 296 ---------------- .../paradiseo-moeo/test/t-moeoILS_HC.cpp | 300 ---------------- .../paradiseo-moeo/test/t-moeoILS_SA.cpp | 325 ----------------- .../paradiseo-moeo/test/t-moeoILS_TS.cpp | 277 --------------- .../paradiseo-moeo/test/t-moeoMax3Obj.cpp | 113 ------ .../test/t-moeoQexploreWeightStrategy.cpp | 306 ---------------- .../test/t-moeoQuadTreeArchive.cpp | 186 ---------- .../test/t-moeoQuadTreeIndex.cpp | 332 ------------------ .../test/t-moeoQuickUnboundedArchiveIndex.cpp | 180 ---------- .../paradiseo-moeo/test/t-moeoTS.cpp | 274 --------------- .../paradiseo-moeo/test/t-moeoVFAS.cpp | 314 ----------------- .../paradiseo-moeo/test/t-moeoVNS.cpp | 187 ---------- 26 files changed, 5665 deletions(-) delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoASFAMetric.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoASFAOrMetric.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAchievementFitnessAssignment.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAggregativeFitnessAssignment.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAnytimeWeightStrategy.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAugmentedQexploreWeightStrategy.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoChebyshevMetric.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoChebyshevOrientedMetric.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoConstraintFitnessAssignment.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoDichoWeightStrategy.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoEpsilonHyperboxArchive.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoFixedTimeBothDirectionWeightStrategy.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoFixedTimeOneDirectionWeightStrategy.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoHC.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_HC.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_SA.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_TS.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoMax3Obj.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQexploreWeightStrategy.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuadTreeArchive.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuadTreeIndex.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuickUnboundedArchiveIndex.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoTS.cpp delete mode 100644 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoVFAS.cpp delete mode 100755 tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoVNS.cpp diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/CMakeLists.txt b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/CMakeLists.txt index 185b00a05..f83a53b2a 100644 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/CMakeLists.txt +++ b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/CMakeLists.txt @@ -52,7 +52,6 @@ SET (TEST_LIST t-moeoNSGA t-moeoNSGAII t-moeoSEEA - t-moeoMax3Obj t-moeoEasyEA t-moeoDominanceCountFitnessAssignment t-moeoDominanceRankFitnessAssignment @@ -71,28 +70,8 @@ SET (TEST_LIST t-moeoFitDivBoundedArchive t-moeoDetArchiveSelect t-moeoASEEA - t-moeoEpsilonHyperboxArchive #t-moeoQuadTreeIndex - t-moeoQuickUnboundedArchiveIndex t-moeoAggregationFitnessAssignment - t-moeoConstraintFitnessAssignment - t-moeoChebyshevMetric - t-moeoChebyshevOrientedMetric - t-moeoASFAMetric - t-moeoASFAOrMetric - t-moeoHC - t-moeoILS_HC - t-moeoILS_SA - t-moeoILS_TS - t-moeoTS - t-moeoVNS - t-moeoVFAS - t-moeoAnytimeWeightStrategy - t-moeoQexploreWeightStrategy - t-moeoAugmentedQexploreWeightStrategy - t-moeoFixedTimeOneDirectionWeightStrategy - t-moeoFixedTimeBothDirectionWeightStrategy - t-moeoDichoWeightStrategy t-moeoExhaustiveNeighborhoodExplorer t-moeoFirstImprovingNeighborhoodExplorer t-moeoSimpleSubNeighborhoodExplorer diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoASFAMetric.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoASFAMetric.cpp deleted file mode 100755 index 16fafcab7..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoASFAMetric.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* Francois Legillon -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregationFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ - } -} eval; -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoChebyshevMetric] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 3; - obj0[1] = 3; - - obj1[0] = 2; - obj1[1] = 2; - - obj2[0] = 1; - obj2[1] = 1; - - obj4[0] = 0; - obj4[1] = 0; - - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=3; - ObjectiveVector obj_poids(poids); - - - // population - eoPop < Solution > pop; - pop.resize(3); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - Solution reference; - reference.objectiveVector(obj4); - unsigned int rho=2; - - moeoObjectiveVectorNormalizer normalizer(pop,10); - - moeoAchievementScalarizingFunctionMetricFitnessAssignment fitness(rho,obj4,obj_poids,normalizer); - moeoAchievementScalarizingFunctionMetricFitnessAssignment fitness1(rho,obj4,obj_poids,normalizer,eval); - moeoAchievementScalarizingFunctionMetricFitnessAssignment fitness2(rho,obj4,obj_poids); - moeoAchievementScalarizingFunctionMetricFitnessAssignment fitness3(rho,obj4,obj_poids,eval); - fitness(pop); - fitness(reference); - - assert(pop[0].fitness() -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* Francois Legillon -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregationFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ - } -} eval; -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoChebyshevMetric] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 3; - obj0[1] = 3; - - obj1[0] = 2; - obj1[1] = 2; - - obj2[0] = 1; - obj2[1] = 1; - - obj4[0] = 0; - obj4[1] = 0; - - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=3; - ObjectiveVector obj_poids(poids); - - - // population - eoPop < Solution > pop; - pop.resize(3); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - Solution reference; - reference.objectiveVector(obj4); - unsigned int rho=2; - - moeoObjectiveVectorNormalizer normalizer(pop,10); - - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment fitness(rho,obj4,obj_poids,normalizer,eval); - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment fitness1(rho,obj4,obj_poids); - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment fitness2(rho,obj4,obj_poids,normalizer); - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment fitness3(rho,obj4,obj_poids,eval); - fitness(pop); - fitness(reference); - - assert(pop[0].fitness() -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* Arnaud Liefooghe -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAchievementFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoAchievementFitnessAssignment]\t=>\t"; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5; - obj0[0] = 2; - obj0[1] = 5; - obj1[0] = 3; - obj1[1] = 3; - obj2[0] = 4; - obj2[1] = 1; - obj3[0] = 5; - obj3[1] = 5; - obj4[0] = 5; - obj4[1] = 1; - obj5[0] = 3; - obj5[1] = 3; - - // population - eoPop < Solution > pop; - pop.resize(6); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - pop[3].objectiveVector(obj3); - pop[4].objectiveVector(obj4); - pop[5].objectiveVector(obj5); - - // reference point - ObjectiveVector ref; - ref[0] = 3; - ref[1] = 2; - - // fitness assignment - moeoAchievementFitnessAssignment< Solution > fitnessAssignment(ref, 0.0); - fitnessAssignment(pop); - - // pop[0] - if (pop[0].fitness() != -1.5) - { - std::cout << "ERROR (bad fitness for pop[0])" << std::endl; - return EXIT_FAILURE; - } - // pop[1] - if (pop[1].fitness() != -0.5) - { - std::cout << "ERROR (bad fitness for pop[1])" << std::endl; - return EXIT_FAILURE; - } - // pop[2] - if (pop[2].fitness() != -0.5) - { - std::cout << "ERROR (bad fitness for pop[2])" << std::endl; - return EXIT_FAILURE; - } - // pop[3] - if (pop[3].fitness() != -1.5) - { - std::cout << "ERROR (bad fitness for pop[3]) " << std::endl; - return EXIT_FAILURE; - } - // pop[4] - if (pop[4].fitness() != -1.0) - { - std::cout << "ERROR (bad fitness for pop[4])" << std::endl; - return EXIT_FAILURE; - } - // pop[5] - if (pop[5].fitness() != -0.5) - { - std::cout << "ERROR (bad fitness for pop[5])" << std::endl; - return EXIT_FAILURE; - } - - std::cout << "OK" << std::endl; - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAggregativeFitnessAssignment.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAggregativeFitnessAssignment.cpp deleted file mode 100644 index f264f89e4..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAggregativeFitnessAssignment.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregativeFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -//----------------------------------------------------------------------------- - -int main() -{ - int res=EXIT_SUCCESS; - - std::cout << "[moeoAggregativeFitnessAssignment] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 2; - obj0[1] = 5; - obj1[0] = 3; - obj1[1] = 3; - obj2[0] = 4; - obj2[1] = 1; - obj3[0] = 5; - obj3[1] = 5; - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=3; - - // population - eoPop < Solution > pop; - pop.resize(4); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - pop[3].objectiveVector(obj3); - - moeoAggregativeFitnessAssignment < Solution > fitness(poids); - - fitness(pop); - - assert(pop[0].fitness() == 19.0); - assert(pop[1].fitness() == 15.0); - assert(pop[2].fitness() == 11.0); - assert(pop[3].fitness() == 25.0); - - std::cout << "Ok" << std::endl; - - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAnytimeWeightStrategy.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAnytimeWeightStrategy.cpp deleted file mode 100644 index 3ea12ca2c..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoAnytimeWeightStrategy.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moeoAnytimeWeightStrategy.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - moeoAnytimeWeightStrategy strat; - std::vector weight; - weight.resize(2); - - cout << "[ moeoAnytimeWeightStrategy ] ==> "; - strat(weight,solution); - assert(weight[0]==0 && weight[1]==1); - strat(weight,solution); - assert(weight[0]==1 && weight[1]==0); - strat(weight,solution); - assert(weight[0]==0.5 && weight[1]==0.5); - strat(weight,solution); - assert(weight[0]==0.25 && weight[1]==0.75); - strat(weight,solution); - assert(weight[0]==0.75 && weight[1]==0.25); - - std::cout<<"OK"< - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moeoAugmentedQexploreWeightStrategy.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 3; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (3) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - objVec[2] = _sol[2]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - objVec[2] = 1; - _solution[1]=1; - _solution[0]=1; - _solution[2]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - objVec[2] = _solution[2]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - solutionEval eval; - std::vector weight; - weight.resize(3); - cout << "[moeoAugmentedQexploreWeightStrategy] ==> "; - moeoAugmentedQexploreWeightStrategy strat; - for (unsigned int i=0;i<6000;i++){ - eval(solution); - strat(weight,solution); - // std::cout< -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* Francois Legillon -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregationFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return false; - } - static bool maximizing (int i) - { - return true; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ - } -} eval; -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoChebyshevMetric] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 3; - obj0[1] = 3; - - obj1[0] = 2; - obj1[1] = 2; - - obj2[0] = 1; - obj2[1] = 1; - - obj4[0] = 0; - obj4[1] = 0; - - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=3; - ObjectiveVector obj_poids(poids); - - - // population - eoPop < Solution > pop; - pop.resize(3); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - Solution reference; - reference.objectiveVector(obj4); - unsigned int rho=2; - - moeoObjectiveVectorNormalizer normalizer(pop,10); - - moeoWeightedChebychevMetricFitnessAssignment fitness(rho,obj4,obj_poids,normalizer); - moeoWeightedChebychevMetricFitnessAssignment fitness2(rho,obj4,obj_poids); - moeoWeightedChebychevMetricFitnessAssignment fitness3(rho,obj4,obj_poids,eval); - moeoWeightedChebychevMetricFitnessAssignment fitness4(rho,obj4,obj_poids,normalizer,eval); - fitness(pop); - fitness(reference); - - assert(pop[0].fitness() -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* Francois Legillon -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregationFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ - } -} eval; -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoChebyshevMetric] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 3; - obj0[1] = 3; - - obj1[0] = 2; - obj1[1] = 2; - - obj2[0] = 1; - obj2[1] = 1; - - obj4[0] = 0; - obj4[1] = 0; - - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=3; - ObjectiveVector obj_poids(poids); - - - // population - eoPop < Solution > pop; - pop.resize(3); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - Solution reference; - reference.objectiveVector(obj4); - unsigned int rho=2; - - moeoObjectiveVectorNormalizer normalizer(pop,10); - - moeoAugmentedWeightedChebychevMetricFitnessAssignment fitness(rho,obj4,obj_poids,normalizer,eval); - moeoAugmentedWeightedChebychevMetricFitnessAssignment fitness1(rho,obj4,obj_poids,normalizer); - moeoAugmentedWeightedChebychevMetricFitnessAssignment fitness2(rho,obj4,obj_poids,eval); - moeoAugmentedWeightedChebychevMetricFitnessAssignment fitness3(rho,obj4,obj_poids); - fitness(pop); - fitness(reference); - - assert(pop[0].fitness() -* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Arnaud Liefooghe -* Jeremie Humeau -* Francois Legillon -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoAggregationFitnessAssignment.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ - } -} defaultEval; -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoAggregationFitnessAssignment] => "; - - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6; - obj0[0] = 0; - obj0[1] = 2; - - obj1[0] = 2; - obj1[1] = 0; - - obj2[0] = 4; - obj2[1] = 2; - - obj4[0] = 3; - obj4[1] = 0; - - - std::vector poids; - poids.resize(2); - - poids[0]=2; - poids[1]=1; - - // population - eoPop < Solution > pop; - pop.resize(3); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - - moeoObjectiveVectorNormalizer normalizer; - - moeoConstraintFitnessAssignment < Solution > fitness(poids,obj4,1,normalizer); - moeoConstraintFitnessAssignment < Solution > fitness2(poids,obj4,1,normalizer,defaultEval); - - fitness(pop); - - assert(pop[0].fitness()==-2); - assert(pop[1].fitness()==0); - assert(pop[2].fitness()==-4); - - std::cout << "Ok" << std::endl; - - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoDichoWeightStrategy.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoDichoWeightStrategy.cpp deleted file mode 100644 index 319b9f571..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoDichoWeightStrategy.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * François Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - moeoDichoWeightStrategy strat; - solutionEval eval; - std::vector weight; - cout << "[moeoDichoWeightStrategy] ==> "; - weight.resize(2); - ObjectiveVector obj; - obj[0]=1; - obj[1]=0; - solution.objectiveVector(obj); - strat(weight,solution); - assert(weight[0]==0 && weight[1]==1); - obj[0]=0; - obj[1]=1; - solution.objectiveVector(obj); - strat(weight,solution); - assert(weight[0]==1 && weight[1]==0); - strat(weight,solution); - assert(weight[0]==0.5 && weight[1]==0.5); - - - std::cout<<"OK"< -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* 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 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoEpsilonHyperboxArchive.cpp -//----------------------------------------------------------------------------- - -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -//----------------------------------------------------------------------------- - -int main() -{ - //!!!!!!!!!!!!VRAI TEST A FAIRE!!!!!!!!!!!!!! - - std::cout << "[moeoEpsilonHyperboxArchive]\t=>\t"; - - std::cout << std::endl; - - // objective vectors - ObjectiveVector obj; - - // population - eoPop < Solution > pop; - pop.resize(100); - - unsigned int o1=50; - unsigned int o2=50; - unsigned int o3=50; - unsigned int o4=50; - - - - for(int i=0; i< pop.size()/2; i++){ -// tmp=rng.uniform()*100; - obj[0]=o1; - obj[1]=o2; -// obj[0]=tmp; -// obj[1]=100-tmp; - pop[2*i].objectiveVector(obj); - obj[0]=o3; - obj[1]=o4; -// tmp=rng.uniform()*100; -// obj[0]=tmp; -// obj[1]=100-tmp; - pop[2*i + 1].objectiveVector(obj); - o1++; - o2--; - o3--; - o4++; - } -// pop.resize(4); -// obj[0]=0; -// obj[1]=100; -// pop[0].objectiveVector(obj); -// obj[0]=100; -// obj[1]=0; -// pop[1].objectiveVector(obj); -// obj[0]=50; -// obj[1]=50; -// pop[2].objectiveVector(obj); -// obj[0]=49; -// obj[1]=50.5; -// pop[3].objectiveVector(obj); - - std::vector < double > epsilon; - epsilon.push_back(0.05); - epsilon.push_back(0.05); - - // archive - moeoEpsilonHyperboxArchive< Solution > arch(epsilon); - - ObjectiveVector nadir = arch.getNadir(); - ObjectiveVector ideal = arch.getIdeal(); - std::cout << "nadir: " << nadir << std::endl; - std::cout << "ideal: " << ideal << std::endl; - - for(int i=0; i - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - moeoFixedTimeBothDirectionWeightStrategy strat(0.1); - std::vector weight; - weight.resize(2); - for (unsigned int i=0;i<20;i++){ - strat(weight,solution); - std::cout< "; - std::cout<<"OK"< - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - moeoFixedTimeOneDirectionWeightStrategy strat(0.1); - std::vector weight; - weight.resize(2); - for (unsigned int i=0;i<20;i++){ - strat(weight,solution); - std::cout< "; - std::cout<<"OK"< - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * S<-61><-87>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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public moeoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public moSolContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moComparator -{ - public : - bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - selectMove select; - - moeoHC hc(init, next, incrEval, select, singler); - - cout << "[ moeoHC ] ==> "; - - hc(solution); - - cout << "OK" << endl; - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_HC.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_HC.cpp deleted file mode 100644 index 839b5735f..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_HC.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * S<-61><-87>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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public moeoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public moSolContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moComparator -{ - public : - bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - int return_value; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - selectMove select; - - moeoILS ils(init, next, incrEval, singler, select, continu, comparator, perturbation); - - cout << "[ moILS_HC ] ==> "; - - ils(solution); - - test_result=((solution.fitness()!=2)?"KO":"OK"); - return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS); - - cout << test_result << endl; - return return_value; -} - -//----------------------------------------------------------------------------- - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_SA.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_SA.cpp deleted file mode 100644 index 9b83c79ad..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_SA.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * S<-61><-87>bastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - * Legillon François - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public moeoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public moSolContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moComparator -{ - public : - bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; -class testCooling : public moCoolingSchedule -{ -public : - bool operator () (double & _temperature) - { - double temperature; - temperature=_temperature; - - return false; - } -}; - -class testRandMove : public moRandMove -{ -public : - void operator () (testMove & _move) - { - _move=_move; - } -}; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - int return_value; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - selectMove select; - - testRandMove rand; - testCooling cooling; - - // moeoILS ils(init, next, incrEval, singler, select, continu, comparator, perturbation, eval); - moeoILS ils(rand, incrEval,singler, continu, 10.0, cooling, continu_2, comparator, perturbation); - - cout << "[ moILS_HC ] ==> "; - - ils(solution); - - test_result=((solution.fitness()!=2)?"KO":"OK"); - return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS); - - cout << test_result << endl; - return return_value; -} - -//----------------------------------------------------------------------------- - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_TS.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_TS.cpp deleted file mode 100755 index 49a492008..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoILS_TS.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 -* - */ -//----------------------------------------------------------------------------- -// t-moILS_TS.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public moeoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); -// _sol.fitness(_sol[1]+_sol[2]); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public moSolContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moComparator -{ - public : - bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - _solution.invalidate(); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - int return_value; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - - moeoILS ils(init, next, incrEval, singler, tabuList, aspirCrit, continu, continu_2, comparator, perturbation); - - cout << "[ moILS_TS ] ==> "; - - ils(solution); - test_result=((solution.fitness()!=2)?"KO":"OK"); - return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS); - - cout << test_result << endl; - return return_value; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoMax3Obj.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoMax3Obj.cpp deleted file mode 100644 index f0ff1471e..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoMax3Obj.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* Arnaud Liefooghe -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoNSGAII.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return false; - } - static bool maximizing (int i) - { - return true; - } - static unsigned int nObjectives () - { - return 3; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ -public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (1) {} -}; - -class TestEval : public moeoEvalFunc < Solution > -{ -public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[0] * _sol[0]; - objVec[2] = _sol[0] + (_sol[0] * _sol[0]); - _sol.objectiveVector(objVec); - } -}; - -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoNSGAII]" << std::endl; - - TestEval eval; - eoQuadCloneOp < Solution > xover; - eoUniformMutation < Solution > mutation(0.05); - - eoRealVectorBounds bounds(1, 1.0, 2.0); - eoRealInitBounded < Solution > init(bounds); - eoPop < Solution > pop(20, init); - - // build NSGA-II - moeoNSGAII < Solution > algo(20, eval, xover, 1.0, mutation, 1.0); - - // run the algo - algo(pop); - - // final pop - std::cout << "Final population" << std::endl; - std::cout << pop << std::endl; - - std::cout << "[moeoNSGAII] OK" << std::endl; - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQexploreWeightStrategy.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQexploreWeightStrategy.cpp deleted file mode 100644 index 5e5eb1911..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQexploreWeightStrategy.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moeoQexploreWeightStrategy.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - Solution solution; - moeoQexploreWeightStrategy strat; - cout << "[ moeoQexploreWeightStrategy ] ==> "; - std::vector weight; - weight.resize(2); - strat(weight,solution); - assert(weight[0]==0 && weight[1]==1); - strat(weight,solution); - assert(weight[0]==1 && weight[1]==0); - strat(weight,solution); - assert(weight[0]==0.5 && weight[1]==0.5); - strat(weight,solution); - assert(weight[0]==1.0/3.0 && weight[1]==2.0/3.0); - strat(weight,solution); - assert(weight[0]==2.0/3.0 && weight[1]==1.0/3.0); - strat(weight,solution); - assert(weight[0]==1.0/4.0 && weight[1]==3.0/4.0); - strat(weight,solution); - assert(weight[0]==3.0/4.0 && weight[1]==1.0/4.0); - - - - std::cout<<"OK"< -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* Arnaud Liefooghe -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// t-moeoEpsilonHyperboxArchive.cpp -//----------------------------------------------------------------------------- - -#include -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 3; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - - - - - -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoQuadTreeArchive]\t=>\t"; - moeoQuadTree tree; - - bool empty= tree.isEmpty(); - std::cout <<"empty? " << empty << std::endl; - ObjectiveVector obj1; - obj1[0]=10.0; - obj1[1]=10.0; - obj1[2]=10.0; - ObjectiveVector obj2; - obj2[0]=9.0; - obj2[1]=9.0; - obj2[2]=9.0; - ObjectiveVector obj3; - obj3[0]=2.0; - obj3[1]=11.0; - obj3[2]=11.0; - ObjectiveVector obj4; - obj4[0]=1.0; - obj4[1]=10.0; - obj4[2]=10.0; - ObjectiveVector obj5; - obj5[0]=2.0; - obj5[1]=2.0; - obj5[2]=2.0; - ObjectiveVector obj6; - obj6[0]=26.0; - obj6[1]=0.0; - obj6[2]=5.0; - ObjectiveVector obj7; - obj7[0]=56.0; - obj7[1]=22.0; - obj7[2]=0.0; - ObjectiveVector obj8; - obj8[0]=87.0; - obj8[1]=42.0; - obj8[2]=62.0; - ObjectiveVector obj9; - obj9[0]=90.0; - obj9[1]=69.0; - obj9[2]=83.0; - ObjectiveVector obj10; - obj10[0]=68.0; - obj10[1]=89.0; - obj10[2]=22.0; -// QuadTreeNode hop(obj1); -// QuadTreeNode hop2(obj2); -// QuadTreeNode hop3(obj3); -// QuadTreeNode hop4(obj4); -// empty = hop.getSubTree().empty(); -// std::cout <<"empty? " << empty << std::endl; -// std::vector< QuadTreeNode > nodes; -// nodes.push_back(hop); -// nodes.push_back(hop2); -// nodes.push_back(hop3); -// std::cout << nodes[1].getVec() << std::endl; - -// std::cout << "size: " << nodes.size() << std::endl; -// tree.insert(obj1); -// tree.insert(obj2); -// tree.insert(obj3); -// tree.insert(obj4); -// tree.insert(obj5); - std::cout << "\n\n\n"; - -// tree.insert(obj6); -// tree.insert(obj7); -// tree.insert(obj8); -// tree.insert(obj9); -// tree.insert(obj10); - - moeoUnboundedArchive archive(false); - eoPop pop; - pop.resize(1000); - int tmp; - - for(int i= 0; i<1000 ; i++){ - ObjectiveVector obj; - obj[0]=floor(rng.uniform()*100); - obj[1]=floor(rng.uniform()*100); - obj[2]=floor(rng.uniform()*100); - std::cout << obj << std::endl; - pop[i].objectiveVector(obj); - tree.insert(obj); - archive(pop[i]); - tree.printTree(); - std::cout << std::endl; - std::cout << std::endl; - - std::cout << "archive: " << archive << std::endl; -// std::cin >> tmp; - } - - - -// QuadTreeNode * a = tree.getRoot(); -// QuadTreeNode * b = a->getSubTree()[1]; -// QuadTreeNode * c = b->getSubTree()[2]; -// -// tree.reinsert(a,c); - -// std::cout << "achive: " << archive << std::endl; - tree.printTree(); - - - - - std::cout << "OK" << std::endl; - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuadTreeIndex.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuadTreeIndex.cpp deleted file mode 100755 index 65c9b1ccc..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuadTreeIndex.cpp +++ /dev/null @@ -1,332 +0,0 @@ -//----------------------------------------------------------------------------- -// t-moeoQuickUnboundedArchive.cpp -//----------------------------------------------------------------------------- - -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -class ObjectiveVectorTraits3d : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true ; - } - static bool maximizing (int i) - { - return false ; - } - static unsigned int nObjectives () - { - return 3; - } -}; - - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; -typedef moeoRealObjectiveVector < ObjectiveVectorTraits3d > ObjectiveVector3d; - -typedef MOEO < ObjectiveVector, double, double > Solution; -typedef MOEO < ObjectiveVector3d, double, double > Solution3d; - -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoArchive]\t=>\t"; - // First test is just to verify behavior of moeoQuickUnboundedArchive - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5,obj10; - obj0[0] = 12226; - obj0[1] = 427894; - obj1[0] = 12170; - obj1[1] = 431736; - obj2[0] = 11965; - obj2[1] = 435193; - obj3[0] = 11893; - obj3[1] = 441839; - obj4[0] = 11870; - obj4[1] = 450770; - obj5[0] = 11769; - obj5[1] = 460005; - obj10[0] = 11769; - obj10[1] = 46005; - // population - eoPop < Solution > pop; - pop.resize(6); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - pop[3].objectiveVector(obj3); - pop[4].objectiveVector(obj4); - pop[5].objectiveVector(obj5); - - // archive - moeoQuadTree index; - moeoIndexedArchive arch(index); -// moeoQuickUnboundedArchive< Solution > arch; - arch(pop); -// arch.printIndex(); - - // size - if (arch.size() > 6) - { - std::cout << "ERROR1 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - // obj0 must be in - if (! arch.contains(obj0)) - { - std::cout << "ERROR2 (obj0 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj1 must be in - if (! arch.contains(obj1)) - { - std::cout << "ERROR3 (obj1 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj2 must be in - if (! arch.contains(obj2)) - { - std::cout << "ERROR4 (obj2 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj3 must be in - if (! arch.contains(obj3)) - { - std::cout << "ERROR5 (obj3 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj4 must be in - if (!arch.contains(obj4)) - { - std::cout << "ERROR6 (obj4 not in)! " << obj4<< std::endl; -// arch.printIndex(); - return EXIT_FAILURE; - } - // obj5 must be in - if (! arch.contains(obj5)) - { - std::cout << "ERROR7 (obj5 not in)" << std::endl; - return EXIT_FAILURE; - } - - // Second test is to verify behavior with negative and comparator - ObjectiveVector obj6, obj7; - obj6[0] = -12170; - obj6[1] = 427894; - obj7[0] = -12226; - obj7[1] = 431736; - eoPop < Solution > pop2; - pop2.resize(2); - pop2[0].objectiveVector(obj6); - pop2[1].objectiveVector(obj7); - moeoQuadTree< Solution > index2; - moeoIndexedArchive< Solution > arch2(index2); - arch2(pop2); - - // size - if (arch2.size() != 2) - { - std::cout << "ERROR8 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - - //Third test is with two equals values - ObjectiveVector obj8, obj9; - obj8[0] = 10; - obj8[1] = 10; - obj9[0] = 10; - obj9[1] = 10; - eoPop < Solution > pop3; - pop3.resize(2); - pop3[0].objectiveVector(obj8); - pop3[1].objectiveVector(obj9); - - moeoQuadTree< Solution > index3; - moeoIndexedArchive< Solution > arch3(index3); - arch3(pop3); - - if (arch3.size() != 1) - { - std::cout << "ERROR9 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - eoPop < Solution > pop4; - pop4.resize(6); - pop4[0].objectiveVector(obj0); - pop4[1].objectiveVector(obj1); - pop4[2].objectiveVector(obj2); - pop4[3].objectiveVector(obj3); - pop4[4].objectiveVector(obj4); - pop4[5].objectiveVector(obj10); - moeoQuadTree< Solution > index4; - moeoIndexedArchive< Solution > arch4(index4); - arch4(pop4); - if (arch4.size() != 1) - { - std::cout << "ERROR10 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - - std::vectorbobj; - for (unsigned int i=0;i<3;i++){ - bobj.push_back(false); - } - - ObjectiveVectorTraits3d::setup(3,bobj); - moeoQuadTree < Solution3d> index5; - moeoIndexedArchive < Solution3d> arch5(index5); - eoPop pop5; - pop5.resize(6); - ObjectiveVector3d obj3d0, obj3d1, obj3d2, obj3d3, obj3d4, obj3d5, obj3d6,obj3d10; - obj3d0[0] = 12226; - obj3d0[1] = 427894; - obj3d0[2] = 10; - - obj3d1[0] = 12170; - obj3d1[1] = 431736; - obj3d1[2] = 10; - - obj3d2[0] = 11965; - obj3d2[1] = 435193; - obj3d2[2] = 10; - - obj3d3[0] = 11893; - obj3d3[1] = 441839; - obj3d3[2] = 10; - - obj3d4[0] = 11870; - obj3d4[1] = 450770; - obj3d4[2] = 10; - - obj3d5[0] = 11769; - obj3d5[1] = 46005; - obj3d5[2] = 2; - - obj3d10[0] = 11769; - obj3d10[1] = 46005; - obj3d10[2] = 10; - - obj3d6[0] = 11769; - obj3d6[1] = 460005; - obj3d6[2] = 1; - - - pop5[0].objectiveVector(obj3d0); - pop5[1].objectiveVector(obj3d1); - pop5[2].objectiveVector(obj3d2); - pop5[3].objectiveVector(obj3d3); - pop5[4].objectiveVector(obj3d4); - pop5[5].objectiveVector(obj3d10); - - - - arch5(pop5); - pop5.resize(7); - pop5[6].objectiveVector(obj3d5); - arch5(pop5[6]); -// index5.printTree(); -/* for (unsigned int i=0;i index6; - moeoIndexedArchive < Solution3d> arch6(index6); - eoPop pop6; - - ObjectiveVector3d jojo, jojo1, jojo2, jojo3, jojo4, jojo5, jojo6, jojo7, jojo8, jojo9 ; - jojo[0]=10; - jojo[1]=10; - jojo[2]=10; - - jojo1[0]=5; - jojo1[1]=5; - jojo1[2]=23; - - jojo2[0]=3; - jojo2[1]=25; - jojo2[2]=16; - - jojo3[0]=14; - jojo3[1]=18; - jojo3[2]=6; - - jojo4[0]=100; - jojo4[1]=100; - jojo4[2]=100; - - jojo5[0]=4; - jojo5[1]=8; - jojo5[2]=12; - - - jojo6[0]=11; - jojo6[1]=14; - jojo6[2]=9; - - - jojo7[0]=40; - jojo7[1]=12; - jojo7[2]=3; - - jojo8[0]=12; - jojo8[1]=8; - jojo8[2]=4; - - jojo9[0]=4; - jojo9[1]=4; - jojo9[2]=22; - - pop6.resize(8); - pop6[0].objectiveVector(jojo); - pop6[1].objectiveVector(jojo1); - pop6[2].objectiveVector(jojo2); - pop6[3].objectiveVector(jojo3); - pop6[4].objectiveVector(jojo4); - pop6[5].objectiveVector(jojo5); - pop6[6].objectiveVector(jojo6); - pop6[7].objectiveVector(jojo7); - Solution3d add; - Solution3d add2; - add.objectiveVector(jojo8); - add2.objectiveVector(jojo9); - /* pop[1].objectiveVector(jojo1); - pop[1].objectiveVector(jojo1); - pop[1].objectiveVector(jojo1);*/ - arch6(pop6); - - assert(arch6.size()==7); - bool res=arch6(add); - assert(res && arch6.size()==7); - res=arch6(add2); - assert(res && arch6.size()==7); - std::cout << "OK" << std::endl; - return EXIT_SUCCESS; -} - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuickUnboundedArchiveIndex.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuickUnboundedArchiveIndex.cpp deleted file mode 100755 index ea0d99fe8..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoQuickUnboundedArchiveIndex.cpp +++ /dev/null @@ -1,180 +0,0 @@ -//----------------------------------------------------------------------------- -// t-moeoQuickUnboundedArchive.cpp -//----------------------------------------------------------------------------- - -#include -#include - -//----------------------------------------------------------------------------- - -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ -public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -typedef MOEO < ObjectiveVector, double, double > Solution; - -//----------------------------------------------------------------------------- - -int main() -{ - std::cout << "[moeoArchive]\t=>\t"; - // First test is just to verify behavior of moeoQuickUnboundedArchive - // objective vectors - ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5,obj10; - obj0[0] = 12226; - obj0[1] = 427894; - obj1[0] = 12170; - obj1[1] = 431736; - obj2[0] = 11965; - obj2[1] = 435193; - obj3[0] = 11893; - obj3[1] = 441839; - obj4[0] = 11870; - obj4[1] = 450770; - obj5[0] = 11769; - obj5[1] = 460005; - obj10[0] = 11769; - obj10[1] = 46005; - // population - eoPop < Solution > pop; - pop.resize(6); - pop[0].objectiveVector(obj0); - pop[1].objectiveVector(obj1); - pop[2].objectiveVector(obj2); - pop[3].objectiveVector(obj3); - pop[4].objectiveVector(obj4); - pop[5].objectiveVector(obj5); - - // archive - moeoQuickUnboundedArchiveIndex< Solution> index; - moeoIndexedArchive arch(index); -// moeoQuickUnboundedArchive< Solution > arch; - arch(pop); -// arch.printIndex(); - - // size - if (arch.size() > 6) - { - std::cout << "ERROR1 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - // obj0 must be in - if (! arch.contains(obj0)) - { - std::cout << "ERROR2 (obj0 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj1 must be in - if (! arch.contains(obj1)) - { - std::cout << "ERROR3 (obj1 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj2 must be in - if (! arch.contains(obj2)) - { - std::cout << "ERROR4 (obj2 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj3 must be in - if (! arch.contains(obj3)) - { - std::cout << "ERROR5 (obj3 not in)" << std::endl; - return EXIT_FAILURE; - } - // obj4 must be in - if (!arch.contains(obj4)) - { - std::cout << "ERROR6 (obj4 not in)! " << obj4<< std::endl; -// arch.printIndex(); - return EXIT_FAILURE; - } - // obj5 must be in - if (! arch.contains(obj5)) - { - std::cout << "ERROR7 (obj5 not in)" << std::endl; - return EXIT_FAILURE; - } - - // Second test is to verify behavior with negative and comparator - ObjectiveVector obj6, obj7; - std::cout<<"test neg"< pop2; - pop2.resize(2); - pop2[0].objectiveVector(obj6); - pop2[1].objectiveVector(obj7); - std::cout<<"archive 2"< index2; - moeoIndexedArchive< Solution > arch2(index2); - arch2(pop2); - - // size - if (arch2.size() != 2) - { - std::cout << "ERROR8 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - - //Third test is with two equals values - ObjectiveVector obj8, obj9; - obj8[0] = 10; - obj8[1] = 10; - obj9[0] = 10; - obj9[1] = 10; - eoPop < Solution > pop3; - pop3.resize(2); - pop3[0].objectiveVector(obj8); - pop3[1].objectiveVector(obj9); - - std::cout<<"archive 3"< index3; - moeoIndexedArchive< Solution > arch3(index3); - arch3(pop3); - - if (arch3.size() != 1) - { - std::cout << "ERROR9 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - eoPop < Solution > pop4; - pop4.resize(6); - pop4[0].objectiveVector(obj0); - pop4[1].objectiveVector(obj1); - pop4[2].objectiveVector(obj2); - pop4[3].objectiveVector(obj3); - pop4[4].objectiveVector(obj4); - pop4[5].objectiveVector(obj10); - std::cout<<"archive 4"< index4; - moeoIndexedArchive< Solution > arch4(index4); - arch4(pop4); - if (arch4.size() != 1) - { - std::cout << "ERROR10 (too much solutions)" << std::endl; - return EXIT_FAILURE; - } - - - std::cout << "OK" << std::endl; - return EXIT_SUCCESS; -} - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoTS.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoTS.cpp deleted file mode 100644 index b8c6e310c..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoTS.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 -* - */ -//----------------------------------------------------------------------------- -// t-moILS_TS.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public moeoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); -// _sol.fitness(_sol[1]+_sol[2]); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public moSolContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moComparator -{ - public : - bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - _solution.invalidate(); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - moeoIncrEvalSingleObjectivizer sincrEval(singler,incrEval); - moeoTSMoveLoopExpl expl(init,next,sincrEval,tabuList,aspirCrit); - moeoTS ts(init,next,incrEval,tabuList,aspirCrit,continu,singler); - - - cout << "[ moeoTS ] ==> "; - ts(solution); - cout << "OK" << endl; - return EXIT_SUCCESS; -} - -//----------------------------------------------------------------------------- diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoVFAS.cpp b/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoVFAS.cpp deleted file mode 100644 index c5e2f5079..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/test/t-moeoVFAS.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2008 - * - * Fraéncçois Legillon - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// t-moILS_HC.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - -typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; - -class Solution : public moeoRealVector < ObjectiveVector, double, double > -{ - public: - Solution() : moeoRealVector < ObjectiveVector, double, double > (2) {} -}; - -class solutionEval : public eoEvalFunc < Solution > -{ - public: - void operator () (Solution & _sol) - { - ObjectiveVector objVec; - objVec[0] = _sol[0]; - objVec[1] = _sol[1]; - _sol.objectiveVector(objVec); - } -}; - - -class testMove : public moMove -{ - public : - void operator () (Solution & _solution) - { - Solution sol=_solution; - } -} ; - -class testMoveInit : public moMoveInit -{ - public : - void operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - } -} ; - -class testMoveNext : public moNextMove -{ - public : - bool operator () (testMove & _move, const Solution & _solution) - { - testMove move=_move; - const Solution sol(_solution); - - return false; - } -} ; - -class testMoveIncrEval : public moMoveIncrEval -{ - public : - ObjectiveVector operator () (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution solution(_solution); - - - return _solution.objectiveVector(); - } -} ; - -class testTabuList : public moTabuList -{ - public: - bool operator() (const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - - return false; - } - - void add(const testMove & _move, const Solution & _solution) - { - const testMove move(_move); - const Solution sol(_solution); - } - - void update() - {} - - void init() - {} -}; - -class testAspirCrit : public moAspirCrit -{ - public: - bool operator() (const testMove & _move, const double & _fitness) - { - double fitness; - const testMove move(_move); - fitness=_fitness; - - return false; - } - - void init() - {} -}; - -class solutionContinue : public eoContinue -{ - public : - solutionContinue(): counter(0) - {} - - bool operator () (const eoPop & _solution) - { - if(counter==0) - { - counter++; - return true; - } - return false; - } - - - bool operator () (const Solution & _solution) - { - const Solution sol(_solution); - - if(counter==0) - { - counter++; - return true; - } - return false; - } - - void init() - {} - private : - unsigned int counter; -} ; - -class solutionComparator : public moeoComparator -{ - public : - const bool operator () (const Solution & _solution1 , const Solution & _solution2) - { - const Solution sol1(_solution1); - const Solution sol2(_solution2); - - return sol1.fitness()>sol2.fitness(); - } -} ; - -class solutionPerturbation : public eoMonOp -{ - public : - bool operator () (Solution & _solution) - { - ObjectiveVector objVec; - objVec[0] = 1; - objVec[1] = 1; - _solution[1]=1; - _solution[0]=1; - _solution.objectiveVector(objVec); - _solution.fitness(2); - return true; - } -} ; - -class solutionSingler : public moeoSingleObjectivization -{ - void operator () (Solution & _solution){ - ObjectiveVector objVec; - objVec[0] = _solution[0]; - objVec[1] = _solution[1]; - _solution.objectiveVector(objVec); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - double operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - -} ; - -class selectMove: public moMoveSelect -{ - public: - void init(const double &d){ - max_fit=d; - } - bool update(const testMove &move,const double &fitness){ - if (fitness>max_fit){ - max_fit=fitness; - best_move=move; - return false; - }else - return true; - } - void operator()(testMove &move,double &fitness){ - move=best_move; - fitness=max_fit; - } - private: - double max_fit; - testMove best_move; -}; - -//----------------------------------------------------------------------------- - -int main() -{ - std::string test_result; - - Solution solution; - - testMoveInit init; - testMoveNext next; - testMoveIncrEval incrEval; - testTabuList tabuList; - testAspirCrit aspirCrit; - solutionEval eval; - solutionContinue continu; - solutionContinue continu_2; - solutionComparator comparator; - solutionPerturbation perturbation; - solutionSingler singler; - selectMove select; - moeoDetTournamentSelect selectOne(comparator); - eoPop pop; - pop.push_back(solution); - moeoRandWeightStrategy strat; - std::vector weights; - weights.push_back(0); - weights.push_back(1); - - moeoHC hc(init,next,incrEval,select,singler); - moeoVFAS vfas(hc,continu,selectOne,eval,strat); - moeoVFAS vfas1(hc,continu,selectOne,weights,eval,strat); - - cout << "[ moeo_VFAS ] ==> "; - vfas(pop); - std::cout<<"OK"< -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2007-2008 -* (C) OPAC Team, LIFL, 2002-2008 -* -* Salma Mesmoudi (salma.mesmoudi@inria.fr), Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) -* Jeremie Humeau (jeremie.humeau@inria.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 -* -*/ -//----------------------------------------------------------------------------- -// t-moVNS.cpp -//----------------------------------------------------------------------------- - -#include // EO -#include // MO -#include -#include - -using std::cout; -using std::endl; - -//----------------------------------------------------------------------------- -class ObjectiveVectorTraits : public moeoObjectiveVectorTraits -{ - public: - static bool minimizing (int i) - { - return true; - } - static bool maximizing (int i) - { - return false; - } - static unsigned int nObjectives () - { - return 2; - } -}; - - -typedef EO solution; -typedef moeoRealObjectiveVector ObjectiveVector; -typedef eoScalarFitness< float, std::greater > tspFitness ; -typedef moeoRealVector Route ; - -int cpt=0; -int tableau[8]={1.0, 2.0, 8.0, 8.0, 11.0, 11.0, 11.0,30.0}; - -class testMove : public moMove -{ -public : - - void operator () (solution & _solution) - { - solution sol=_solution; - } -} ; - - -class solutionAlgo : public moAlgo -{ -public : - bool operator () (solution & _solution) - { - solution solution(_solution); - return true; - } -} ; - -class Voisinage : public eoMonOp -{ -public : - bool operator () (Route & _solution) - { - _solution.invalidate(); - //_solution.fitness(); - - return true; - } -} ; - -class Explorer : public moExpl -{ -public: - Explorer(eoMonOp & expl): moExpl( expl) - { - - } -}; - -class solutionEval : public eoEvalFunc -{ -public : - void operator () (Route & _solution) - { - ObjectiveVector obj; - obj[0]=(tableau[0]); - obj[1]=(tableau[cpt]); - _solution.objectiveVector(obj); - _solution.fitness(obj[0]+obj[1]); - cpt++; - } -}; - -class solutionSingler : public moeoSingleObjectivization -{ - public: - solutionSingler(solutionEval &_eval):eval(_eval){} - void operator () (Route & _solution){ - eval(_solution); - _solution.fitness(_solution.objectiveVector()[0]+_solution.objectiveVector()[1]); - } - void operator()(eoPop &_pop){ - } - - Route::Fitness operator() (const ObjectiveVector &_obj){ - return _obj[0]+_obj[1]; - } - void updateByDeleting(eoPop& pop, ObjectiveVector& obj){} - solutionEval &eval; - -} ; - - -//----------------------------------------------------------------------------- - -int -main() -{ - std::string test_result; - - //solution solution; - Route so ; - - Voisinage sol1; - Voisinage sol2; - Explorer explorer(sol1); - explorer.addExplorer(sol2); - solutionEval eval; - std::vector poids; - poids.push_back(1); - poids.push_back(1); - solutionSingler singler(eval); - - moeoVNS vns(explorer, singler); - - cout << "[moeoVNS] ==> "; - - so.fitness(5.0); - - vns(so); - - assert(so.fitness()==12.0); - - cout << "OK" << endl; - - return EXIT_SUCCESS; -} - -//-----------------------------------------------------------------------------