DMLS intégré et testé
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1817 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
2a102a5cf7
commit
6720152ff7
24 changed files with 1977 additions and 29 deletions
84
trunk/paradiseo-moeo/src/algo/moeoPLS1.h
Normal file
84
trunk/paradiseo-moeo/src/algo/moeoPLS1.h
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* <moeoPLS1.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEOPLS1_H
|
||||||
|
#define _MOEOPLS1_H
|
||||||
|
|
||||||
|
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||||
|
#include <selection/moeoNumberUnvisitedSelect.h>
|
||||||
|
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PLS1 algorithm
|
||||||
|
*
|
||||||
|
* Paquete L, Chiarandini M, St ̈ tzle T (2004) Pareto local optimum sets in the biobjective
|
||||||
|
* traveling salesman problem: An experimental study. In: Metaheuristics for Multiobjective
|
||||||
|
* Optimisation, Lecture Notes in Economics and Mathematical Systems, vol 535, Springer-
|
||||||
|
* Verlag, Berlin, Germany, chap 7, pp 177–199
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoPLS1 : public moeoUnifiedDominanceBasedLS < Neighbor >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _continuator a stop creterion
|
||||||
|
* @param _eval a evaluation function
|
||||||
|
* @param _archive a archive to store no-dominated individuals
|
||||||
|
*/
|
||||||
|
moeoPLS1(
|
||||||
|
eoContinue < MOEOT > & _continuator,
|
||||||
|
eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoArchive < MOEOT > & _archive,
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
moEval < Neighbor > & _incrEval):
|
||||||
|
moeoUnifiedDominanceBasedLS<Neighbor>(
|
||||||
|
_continuator,
|
||||||
|
_eval,
|
||||||
|
_archive,
|
||||||
|
*(new moeoExhaustiveNeighborhoodExplorer<Neighbor>(_neighborhood, _incrEval)),
|
||||||
|
*(new moeoNumberUnvisitedSelect<MOEOT>(1))
|
||||||
|
){}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEOPLS1_H_*/
|
||||||
96
trunk/paradiseo-moeo/src/algo/moeoPLS2.h
Normal file
96
trunk/paradiseo-moeo/src/algo/moeoPLS2.h
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* <moeoPLS2.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEOPLS2_H
|
||||||
|
#define _MOEOPLS2_H
|
||||||
|
|
||||||
|
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||||
|
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||||
|
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PLS2 algorithm
|
||||||
|
*
|
||||||
|
* Talbi EG, Rahoual M, Mabed MH, Dhaenens C (2001) A hybrid evolutionary approach for
|
||||||
|
* multicriteria optimization problems : Application to the fow shop. In: First International
|
||||||
|
* Conference on Evolutionary Multi-criterion Optimization (EMO 2001), Springer-Verlag,
|
||||||
|
* Zurich, Switzerland, Lecture Notes in Computer Science, vol 1993, pp 416–428
|
||||||
|
*
|
||||||
|
* Basseur M, Seynhaeve F, Talbi E (2003) Adaptive mechanisms for multiobjective evolution-
|
||||||
|
* ary algorithms. In: Congress on Engineering in System Application (CESA 2003), Lille,
|
||||||
|
* France, pp 72–86
|
||||||
|
*
|
||||||
|
* Angel E, Bampis E, Gourv ́ s L (2004) A dynasearch neighbohood for the bicriteria travel-
|
||||||
|
* ing salesman problem. In: Metaheuristics for Multiobjective Optimisation, Lecture Notes
|
||||||
|
* in Economics and Mathematical Systems, vol 535, Springer-Verlag, Berlin, Germany,
|
||||||
|
* chap 6, pp 153–176
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoPLS2 : public moeoUnifiedDominanceBasedLS < Neighbor >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _continuator a stop creterion
|
||||||
|
* @param _eval a evaluation function
|
||||||
|
* @param _archive a archive to store no-dominated individuals
|
||||||
|
* @param _moveInit the move initializer
|
||||||
|
* @param _nextMove allow to do or not a move
|
||||||
|
* @param _incrEval a (generally) efficient evaluation fonction
|
||||||
|
*/
|
||||||
|
moeoPLS2(
|
||||||
|
eoContinue < MOEOT > & _continuator,
|
||||||
|
eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoArchive < MOEOT > & _archive,
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
moEval < Neighbor > & _incrEval):
|
||||||
|
moeoUnifiedDominanceBasedLS<Neighbor>(
|
||||||
|
_continuator,
|
||||||
|
_eval,
|
||||||
|
_archive,
|
||||||
|
*(new moeoExhaustiveNeighborhoodExplorer<Neighbor>(_neighborhood, _incrEval)),
|
||||||
|
*(new moeoExhaustiveUnvisitedSelect<MOEOT>())
|
||||||
|
){}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEOPLS2_H_*/
|
||||||
|
|
@ -51,13 +51,13 @@
|
||||||
/**
|
/**
|
||||||
* A class to design dominance based local searches
|
* A class to design dominance based local searches
|
||||||
*/
|
*/
|
||||||
template < class Neighborhood >
|
template < class Neighbor >
|
||||||
class moeoUnifiedDominanceBasedLS : public moeoPopLS < Neighborhood >
|
class moeoUnifiedDominanceBasedLS : public moeoPopLS < Neighbor >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Alias for the type */
|
/** Alias for the type */
|
||||||
typedef typename Neighborhood::EOT MOEOT;
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ctor
|
* Ctor
|
||||||
|
|
@ -71,7 +71,7 @@ public:
|
||||||
eoContinue < MOEOT > & _continuator,
|
eoContinue < MOEOT > & _continuator,
|
||||||
eoEvalFunc < MOEOT > & _eval,
|
eoEvalFunc < MOEOT > & _eval,
|
||||||
moeoArchive < MOEOT > & _archive,
|
moeoArchive < MOEOT > & _archive,
|
||||||
moeoPopNeighborhoodExplorer < Neighborhood > & _explorer,
|
moeoPopNeighborhoodExplorer < Neighbor > & _explorer,
|
||||||
moeoUnvisitedSelect < MOEOT > & _select) :
|
moeoUnvisitedSelect < MOEOT > & _select) :
|
||||||
continuator(_continuator), loopEval(_eval), popEval(loopEval), archive(_archive), explorer(_explorer), select(_select) {}
|
continuator(_continuator), loopEval(_eval), popEval(loopEval), archive(_archive), explorer(_explorer), select(_select) {}
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ protected:
|
||||||
/** archive */
|
/** archive */
|
||||||
moeoArchive < MOEOT > & archive;
|
moeoArchive < MOEOT > & archive;
|
||||||
/** explorer */
|
/** explorer */
|
||||||
moeoPopNeighborhoodExplorer < Neighborhood > & explorer;
|
moeoPopNeighborhoodExplorer < Neighbor > & explorer;
|
||||||
/** selector */
|
/** selector */
|
||||||
moeoUnvisitedSelect < MOEOT > & select;
|
moeoUnvisitedSelect < MOEOT > & select;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,11 @@
|
||||||
/**
|
/**
|
||||||
* Explorer which explore all the neighborhood
|
* Explorer which explore all the neighborhood
|
||||||
*/
|
*/
|
||||||
template < class Neighborhood >
|
template < class Neighbor>
|
||||||
class moeoExhaustiveNeighborhoodExplorer : public moeoPopNeighborhoodExplorer < Neighborhood >
|
class moeoExhaustiveNeighborhoodExplorer : public moeoPopNeighborhoodExplorer <Neighbor>
|
||||||
{
|
{
|
||||||
/** Alias for the type */
|
/** Alias for the type */
|
||||||
typedef typename Neighborhood::EOT MOEOT;
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
typedef typename Neighborhood::Neighbor Neighbor;
|
|
||||||
/** Alias for the objeciveVector */
|
/** Alias for the objeciveVector */
|
||||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
|
@ -90,13 +89,21 @@ private:
|
||||||
*/
|
*/
|
||||||
void explore(MOEOT & _src , eoPop < MOEOT > & _dest)
|
void explore(MOEOT & _src , eoPop < MOEOT > & _dest)
|
||||||
{
|
{
|
||||||
|
//if the neighborhood is not empty
|
||||||
if(neighborhood.hasNeighbor(_src)){
|
if(neighborhood.hasNeighbor(_src)){
|
||||||
|
//init the neighborhood
|
||||||
neighborhood.init(_src, neighbor);
|
neighborhood.init(_src, neighbor);
|
||||||
|
//copy the solution (_src) at the end of the destination (_dest)
|
||||||
_dest.push_back(_src);
|
_dest.push_back(_src);
|
||||||
|
//eval the neighbor
|
||||||
eval(_dest.back(),neighbor);
|
eval(_dest.back(),neighbor);
|
||||||
|
//move the copy
|
||||||
neighbor.move(_dest.back());
|
neighbor.move(_dest.back());
|
||||||
|
//affect objective vector to the copy
|
||||||
_dest.back().objectiveVector(neighbor.fitness());
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
|
//fix its flag to 0 (unvisited solution)
|
||||||
_dest.back().flag(0);
|
_dest.back().flag(0);
|
||||||
|
//repeat all instructions for each neighbor in the neighborhood
|
||||||
while (neighborhood.cont(_src)){
|
while (neighborhood.cont(_src)){
|
||||||
neighborhood.next(_src, neighbor);
|
neighborhood.next(_src, neighbor);
|
||||||
_dest.push_back(_src);
|
_dest.push_back(_src);
|
||||||
|
|
@ -105,6 +112,7 @@ private:
|
||||||
_dest.back().objectiveVector(neighbor.fitness());
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
_dest.back().flag(0);
|
_dest.back().flag(0);
|
||||||
}
|
}
|
||||||
|
//fix the source flag to 1 (visited solution)
|
||||||
_src.flag(1);
|
_src.flag(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +121,6 @@ private:
|
||||||
Neighbor neighbor;
|
Neighbor neighbor;
|
||||||
/** Neighborhood */
|
/** Neighborhood */
|
||||||
moNeighborhood<Neighbor>& neighborhood;
|
moNeighborhood<Neighbor>& neighborhood;
|
||||||
/** ObjectiveVector */
|
|
||||||
ObjectiveVector objVec;
|
|
||||||
/** the incremental evaluation */
|
/** the incremental evaluation */
|
||||||
moEval < Neighbor > & eval;
|
moEval < Neighbor > & eval;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* <moeoFirstImprovingNeighborhoodExplorer.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEOFIRSTIMPROVINGNEIGHBORHOODEXPLORER_H
|
||||||
|
#define _MOEOFIRSTIMPROVINGNEIGHBORHOODEXPLORER_H
|
||||||
|
|
||||||
|
#include <explorer/moeoSubNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer which explore a part of the neighborhood
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoFirstImprovingNeighborhoodExplorer : public moeoSubNeighborhoodExplorer < Neighbor >
|
||||||
|
{
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
/** Alias for the objeciveVector */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighbor;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _moveInit the move initializer
|
||||||
|
* @param _nextMove allow to do or not a move
|
||||||
|
* @param _incrEval a (generally) efficient evaluation fonction
|
||||||
|
*/
|
||||||
|
moeoFirstImprovingNeighborhoodExplorer(
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
moEval < Neighbor > & _eval):
|
||||||
|
moeoSubNeighborhoodExplorer< Neighbor >(_neighborhood, 0), eval(_eval){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* explorer of one individual
|
||||||
|
* @param _src the individual to explore
|
||||||
|
* @param _dest contains new generated individuals
|
||||||
|
*/
|
||||||
|
void explore(MOEOT & _src, eoPop < MOEOT > & _dest)
|
||||||
|
{
|
||||||
|
//if the neighborhood is not empty
|
||||||
|
if(neighborhood.hasNeighbor(_src)){
|
||||||
|
//init the neighborhood
|
||||||
|
neighborhood.init(_src, neighbor);
|
||||||
|
//eval the neighbor
|
||||||
|
cycle(_src, _dest);
|
||||||
|
//repeat all instructions for each neighbor in the neighborhood until a best neighbor is found
|
||||||
|
while (!comparator(_src.objectiveVector(), neighbor.fitness()) && neighborhood.cont(_src)){
|
||||||
|
neighborhood.next(_src, neighbor);
|
||||||
|
cycle(_src, _dest);
|
||||||
|
}
|
||||||
|
//if all neighbors are been visited, fix the source flag to 1 (visited solution)
|
||||||
|
if(!neighborhood.cont(_src))
|
||||||
|
_src.flag(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cycle(MOEOT & _src, eoPop < MOEOT > & _dest){
|
||||||
|
eval(_src, neighbor);
|
||||||
|
if(!comparator(neighbor.fitness(), _src.objectiveVector())){
|
||||||
|
//copy the solution (_src) at the end of the destination (_dest)
|
||||||
|
_dest.push_back(_src);
|
||||||
|
//move the copy
|
||||||
|
neighbor.move(_dest.back());
|
||||||
|
//affect objective vector to the copy
|
||||||
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
|
//fix its flag to 0 (unvisited solution)
|
||||||
|
_dest.back().flag(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Objective Vector Pareto Comparator */
|
||||||
|
moeoParetoObjectiveVectorComparator<ObjectiveVector> comparator;
|
||||||
|
/** Incremental evaluation of a neighbor */
|
||||||
|
moEval < Neighbor > & eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*_MOEOFIRSTIMPROVINGNEIGHBORHOODEXPLORER_H_*/
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* <moeoNoDesimprovingNeighborhoodExplorer.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEONODESIMPROVINGNEIGHBORHOODEXPLORER_H
|
||||||
|
#define _MOEONODESIMPROVINGNEIGHBORHOODEXPLORER_H
|
||||||
|
|
||||||
|
#include <explorer/moeoSubNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer which explore a part of the neighborhood
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoNoDesimprovingNeighborhoodExplorer : public moeoSubNeighborhoodExplorer < Neighbor >
|
||||||
|
{
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
/** Alias for the objeciveVector */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighbor;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
*/
|
||||||
|
moeoNoDesimprovingNeighborhoodExplorer(
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
moEval < Neighbor > & _eval)
|
||||||
|
: moeoSubNeighborhoodExplorer< Neighbor >(_neighborhood, 0), eval(_eval){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* explorer of one individual
|
||||||
|
* @param _src the individual to explore
|
||||||
|
* @param _dest contains new generated individuals
|
||||||
|
*/
|
||||||
|
void explore(MOEOT & _src, eoPop < MOEOT > & _dest)
|
||||||
|
{
|
||||||
|
bool tmp=true;
|
||||||
|
if(neighborhood.hasNeighbor(_src)){
|
||||||
|
neighborhood.init(_src, neighbor);
|
||||||
|
eval(_src,neighbor);
|
||||||
|
if(!comparator(neighbor.fitness(), _src.objectiveVector())){
|
||||||
|
_dest.push_back(_src);
|
||||||
|
neighbor.move(_dest.back());
|
||||||
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
|
_dest.back().flag(0);
|
||||||
|
tmp=false;
|
||||||
|
}
|
||||||
|
while (neighborhood.cont(_src) && tmp){
|
||||||
|
neighborhood.next(_src, neighbor);
|
||||||
|
eval(_src,neighbor);
|
||||||
|
if(!comparator(neighbor.fitness(), _src.objectiveVector())){
|
||||||
|
_dest.push_back(_src);
|
||||||
|
neighbor.move(_dest.back());
|
||||||
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
|
_dest.back().flag(0);
|
||||||
|
tmp=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!neighborhood.cont(_src))
|
||||||
|
_src.flag(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Objective Vector Pareto Comparator */
|
||||||
|
moeoParetoObjectiveVectorComparator<ObjectiveVector> comparator;
|
||||||
|
/** Incremental evaluation of a neighbor */
|
||||||
|
moEval < Neighbor > & eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*_MOEONODESIMPROVINGNEIGHBORHOODEXPLORER_H_*/
|
||||||
|
|
@ -44,14 +44,16 @@
|
||||||
/**
|
/**
|
||||||
* Abstract class for multi-objective local search neighborhood exploration
|
* Abstract class for multi-objective local search neighborhood exploration
|
||||||
*/
|
*/
|
||||||
template < class Neighborhood >
|
template < class Neighbor >
|
||||||
class moeoPopNeighborhoodExplorer: public eoFunctorBase{
|
class moeoPopNeighborhoodExplorer: public eoFunctorBase{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
/**
|
/**
|
||||||
* abstract functor which realise exploration
|
* abstract functor which realise exploration
|
||||||
*/
|
*/
|
||||||
virtual void operator()(eoPop < typename Neighborhood::EOT > &, std::vector <unsigned int>, eoPop < typename Neighborhood::EOT > &) = 0;
|
virtual void operator()(eoPop<MOEOT> &, std::vector <unsigned int>, eoPop<MOEOT> &) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* <moeoSubNeighborhoodExplorer.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEOSIMPLESUBNEIGHBORHOODEXPLORER_H
|
||||||
|
#define _MOEOSIMPLESUBNEIGHBORHOODEXPLORER_H
|
||||||
|
|
||||||
|
#include <explorer/moeoSubNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer which explore a part of the neighborhood
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoSimpleSubNeighborhoodExplorer : public moeoSubNeighborhoodExplorer < Neighbor >
|
||||||
|
{
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
/** Alias for the objeciveVector */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::neighbor;
|
||||||
|
using moeoSubNeighborhoodExplorer<Neighbor>::number;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _moveInit the move initializer
|
||||||
|
* @param _nextMove allow to do or not a move
|
||||||
|
* @param _incrEval a (generally) efficient evaluation fonction
|
||||||
|
* @param _number the number of neighbor to explore
|
||||||
|
*/
|
||||||
|
moeoSimpleSubNeighborhoodExplorer(
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
unsigned int _number,
|
||||||
|
moEval < Neighbor > & _eval)
|
||||||
|
: moeoSubNeighborhoodExplorer<Neighbor>(_neighborhood, _number), eval(_eval){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* explorer of one individual
|
||||||
|
* @param _src the individual to explore
|
||||||
|
* @param _dest contains new generated individuals
|
||||||
|
*/
|
||||||
|
void explore(MOEOT & _src, eoPop < MOEOT > & _dest)
|
||||||
|
{
|
||||||
|
unsigned int tmp=number;
|
||||||
|
//if the neighborhood is not empty
|
||||||
|
if(neighborhood.hasNeighbor(_src) && tmp>0){
|
||||||
|
//init the neighborhood
|
||||||
|
neighborhood.init(_src, neighbor);
|
||||||
|
//eval the neighbor
|
||||||
|
cycle(_src, _dest);
|
||||||
|
tmp--;
|
||||||
|
//repeat all instructions for each neighbor in the neighborhood until a best neighbor is found
|
||||||
|
while (neighborhood.cont(_src) && tmp>0){
|
||||||
|
neighborhood.next(_src, neighbor);
|
||||||
|
cycle(_src, _dest);
|
||||||
|
tmp--;
|
||||||
|
}
|
||||||
|
//if all neighbors are been visited, fix the source flag to 1 (visited solution)
|
||||||
|
if(!neighborhood.cont(_src))
|
||||||
|
_src.flag(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cycle(MOEOT & _src, eoPop < MOEOT > & _dest){
|
||||||
|
eval(_src, neighbor);
|
||||||
|
//copy the solution (_src) at the end of the destination (_dest)
|
||||||
|
_dest.push_back(_src);
|
||||||
|
//move the copy
|
||||||
|
neighbor.move(_dest.back());
|
||||||
|
//affect objective vector to the copy
|
||||||
|
_dest.back().objectiveVector(neighbor.fitness());
|
||||||
|
//fix its flag to 0 (unvisited solution)
|
||||||
|
_dest.back().flag(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Incremental evaluation of a neighbor */
|
||||||
|
moEval < Neighbor > & eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*_MOEOSIMPLESUBNEIGHBORHOODEXPLORER_H_*/
|
||||||
101
trunk/paradiseo-moeo/src/explorer/moeoSubNeighborhoodExplorer.h
Normal file
101
trunk/paradiseo-moeo/src/explorer/moeoSubNeighborhoodExplorer.h
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* <moeoSubNeighborhoodExplorer.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEOSUBNEIGHBORHOODEXPLORER_H
|
||||||
|
#define _MOEOSUBNEIGHBORHOODEXPLORER_H
|
||||||
|
|
||||||
|
#include <eoPop.h>
|
||||||
|
#include <neighborhood/moNeighbor.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer which explore a part of the neighborhood
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoSubNeighborhoodExplorer : public moeoPopNeighborhoodExplorer < Neighbor >
|
||||||
|
{
|
||||||
|
/** Alias for the type */
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
/** Alias for the objeciveVector */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _number the number of neighbor to explore
|
||||||
|
*/
|
||||||
|
moeoSubNeighborhoodExplorer(
|
||||||
|
moNeighborhood<Neighbor>& _neighborhood,
|
||||||
|
unsigned int _number)
|
||||||
|
: neighborhood(_neighborhood), number(_number){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* functor to explore the neighborhood
|
||||||
|
* @param _src the population to explore
|
||||||
|
* @param _select contains index of individuals from the population to explore
|
||||||
|
* @param _dest contains new generated individuals
|
||||||
|
*/
|
||||||
|
void operator()(eoPop < MOEOT > & _src, std::vector <unsigned int> _select, eoPop < MOEOT > & _dest)
|
||||||
|
{
|
||||||
|
for(unsigned int i=0; i<_select.size(); i++)
|
||||||
|
explore(_src[_select[i]], _dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* explorer of one individual
|
||||||
|
* @param _src the individual to explore
|
||||||
|
* @param _dest contains new generated individuals
|
||||||
|
*/
|
||||||
|
virtual void explore(MOEOT & _src, eoPop < MOEOT > & _dest) = 0;
|
||||||
|
|
||||||
|
/** Neighbor */
|
||||||
|
Neighbor neighbor;
|
||||||
|
/** Neighborhood */
|
||||||
|
moNeighborhood<Neighbor> & neighborhood;
|
||||||
|
|
||||||
|
/** number of neighbor to explore for each selected individual*/
|
||||||
|
unsigned int number;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*_MOEOSUBNEIGHBORHOODEXPLORER_H_*/
|
||||||
150
trunk/paradiseo-moeo/src/hybridization/moeoDMLSGenUpdater.h
Normal file
150
trunk/paradiseo-moeo/src/hybridization/moeoDMLSGenUpdater.h
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
* <moeoDMLSGenUpdater.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEODMLSGENUPDATER_H
|
||||||
|
#define _MOEODMLSGENUPDATER_H
|
||||||
|
|
||||||
|
#include <eoGenContinue.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <archive/moeoArchive.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||||
|
#include <selection/moeoUnvisitedSelect.h>
|
||||||
|
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||||
|
|
||||||
|
/** updater allowing hybridization with a dmls at checkpointing*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoDMLSGenUpdater : public eoUpdater
|
||||||
|
{
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
|
||||||
|
public :
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _dmls the dmls use for the hybridization (!!! Special care is needed when choosing the continuator of the dmls !!!)
|
||||||
|
* @param _dmlsArchive an archive (used to instantiate the dmls)
|
||||||
|
* @param _globalArchive the same archive used in the other algorithm
|
||||||
|
* @param _continuator is a Generational Continuator which allow to run dmls on the global archive each X generation(s)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSGenUpdater(moeoUnifiedDominanceBasedLS <Neighbor> & _dmls,
|
||||||
|
moeoArchive < MOEOT > & _dmlsArchive,
|
||||||
|
moeoArchive < MOEOT > & _globalArchive,
|
||||||
|
eoGenContinue < MOEOT > & _continuator,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(0), dmlsArchive(_dmlsArchive), dmls(_dmls), globalArchive(_globalArchive), continuator(_continuator), verbose(_verbose){}
|
||||||
|
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _eval a evaluation function (used to instantiate the dmls)
|
||||||
|
* @param _explorer a neighborhood explorer (used to instantiate the dmls)
|
||||||
|
* @param _select a selector of unvisited individuals of a population (used to instantiate the dmls)
|
||||||
|
* @param _globalArchive the same archive used in the other algorithm
|
||||||
|
* @param _continuator is a Generational Continuator which allow to run dmls on the global archive each X generation(s)
|
||||||
|
* @param _step (default=1) is the number of Generation of dmls (used to instantiate the defaultContinuator for the dmls)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSGenUpdater(eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoPopNeighborhoodExplorer < Neighbor > & _explorer,
|
||||||
|
moeoUnvisitedSelect < MOEOT > & _select,
|
||||||
|
moeoArchive < MOEOT > & _globalArchive,
|
||||||
|
eoGenContinue < MOEOT > & _continuator,
|
||||||
|
unsigned int _step=1,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(_step), dmlsArchive(defaultArchive), dmls(defaultContinuator, _eval, defaultArchive, _explorer, _select), globalArchive(_globalArchive), continuator(_continuator), verbose(_verbose){}
|
||||||
|
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _eval a evaluation function (used to instantiate the dmls)
|
||||||
|
* @param _dmlsArchive an archive (used to instantiate the dmls)
|
||||||
|
* @param _explorer a neighborhood explorer (used to instantiate the dmls)
|
||||||
|
* @param _select a selector of unvisited individuals of a population (used to instantiate the dmls)
|
||||||
|
* @param _globalArchive the same archive used in the other algorithm
|
||||||
|
* @param _continuator is a Generational Continuator which allow to run dmls on the global archive each X generation(s)
|
||||||
|
* @param _step (default=1) is the number of Generation of dmls (used to instantiate the defaultContinuator for the dmls)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSGenUpdater(eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoArchive < MOEOT > & _dmlsArchive,
|
||||||
|
moeoPopNeighborhoodExplorer < Neighbor > & _explorer,
|
||||||
|
moeoUnvisitedSelect < MOEOT > & _select,
|
||||||
|
moeoArchive < MOEOT > & _globalArchive,
|
||||||
|
eoGenContinue < MOEOT > & _continuator,
|
||||||
|
unsigned int _step=1,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(_step), dmlsArchive(_dmlsArchive), dmls(defaultContinuator, _eval, _dmlsArchive, _explorer, _select), globalArchive(_globalArchive), continuator(_continuator), verbose(_verbose){}
|
||||||
|
|
||||||
|
/** functor which allow to run the dmls*/
|
||||||
|
virtual void operator()()
|
||||||
|
{
|
||||||
|
if(!continuator(globalArchive)){
|
||||||
|
if(verbose)
|
||||||
|
std::cout << std::endl << "moeoDMLSGenUpdater: dmls start" << std::endl;
|
||||||
|
dmls(globalArchive);
|
||||||
|
globalArchive(dmlsArchive);
|
||||||
|
if(verbose)
|
||||||
|
std::cout << "moeoDMLSGenUpdater: dmls stop" << std::endl;
|
||||||
|
defaultContinuator.totalGenerations(defaultContinuator.totalGenerations());
|
||||||
|
if(verbose)
|
||||||
|
std::cout << "the other algorithm restart for " << continuator.totalGenerations() << " generation(s)" << std::endl << std::endl;
|
||||||
|
continuator.totalGenerations(continuator.totalGenerations());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const { return "moeoDMLSGenUpdater"; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** defaultContinuator used for the dmls */
|
||||||
|
eoGenContinue < MOEOT > defaultContinuator;
|
||||||
|
/** dmls archive */
|
||||||
|
moeoArchive < MOEOT > & dmlsArchive;
|
||||||
|
/** default archive used for the dmls */
|
||||||
|
moeoUnboundedArchive < MOEOT > defaultArchive;
|
||||||
|
/** the dmls */
|
||||||
|
moeoUnifiedDominanceBasedLS <Neighbor> dmls;
|
||||||
|
/** the global archive */
|
||||||
|
moeoArchive < MOEOT > & globalArchive;
|
||||||
|
/** continuator used to run the dmls each X generation(s) */
|
||||||
|
eoGenContinue < MOEOT > & continuator;
|
||||||
|
/** verbose mode */
|
||||||
|
bool verbose;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*_MOEODMLSGENUPDATER_H_*/
|
||||||
134
trunk/paradiseo-moeo/src/hybridization/moeoDMLSMonOp.h
Normal file
134
trunk/paradiseo-moeo/src/hybridization/moeoDMLSMonOp.h
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
* <moeoDMLSMonOp.h>
|
||||||
|
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||||
|
* (C) OPAC Team, LIFL, 2002-2008
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef _MOEODMLSMONOP_H
|
||||||
|
#define _MOEODMLSMONOP_H
|
||||||
|
|
||||||
|
#include <eoGenContinue.h>
|
||||||
|
#include <utils/eoRNG.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <archive/moeoArchive.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||||
|
#include <selection/moeoUnvisitedSelect.h>
|
||||||
|
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||||
|
|
||||||
|
/** eoMonOp allowing hybridization with a dmls at mutation */
|
||||||
|
template < class Neighbor >
|
||||||
|
class moeoDMLSMonOp : public eoMonOp < typename Neighbor::EOT >
|
||||||
|
{
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT MOEOT;
|
||||||
|
|
||||||
|
public :
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _dmls the dmls use for the hybridization (!!! Special care is needed when choosing the continuator of the dmls !!!)
|
||||||
|
* @param _dmlsArchive an archive (used to instantiate the dmls)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSMonOp(moeoUnifiedDominanceBasedLS <Neighbor> & _dmls,
|
||||||
|
moeoArchive < MOEOT > & _dmlsArchive,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(0), dmlsArchive(_dmlsArchive), dmls(_dmls), verbose(_verbose) {}
|
||||||
|
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _eval a evaluation function (used to instantiate the dmls)
|
||||||
|
* @param _explorer a neighborhood explorer (used to instantiate the dmls)
|
||||||
|
* @param _select a selector of unvisited individuals of a population (used to instantiate the dmls)
|
||||||
|
* @param _step (default=1) is the number of Generation of dmls (used to instantiate the defaultContinuator for the dmls)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSMonOp(eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoPopNeighborhoodExplorer < Neighbor > & _explorer,
|
||||||
|
moeoUnvisitedSelect < MOEOT > & _select,
|
||||||
|
unsigned int _step=1,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(_step), dmlsArchive(defaultArchive), dmls(defaultContinuator, _eval, defaultArchive, _explorer, _select), verbose(_verbose){}
|
||||||
|
|
||||||
|
/** Ctor with a dmls.
|
||||||
|
* @param _eval a evaluation function (used to instantiate the dmls)
|
||||||
|
* @param _dmlsArchive an archive (used to instantiate the dmls)
|
||||||
|
* @param _explorer a neighborhood explorer (used to instantiate the dmls)
|
||||||
|
* @param _select a selector of unvisited individuals of a population (used to instantiate the dmls)
|
||||||
|
* @param _step (default=1) is the number of Generation of dmls (used to instantiate the defaultContinuator for the dmls)
|
||||||
|
* @param _verbose verbose mode
|
||||||
|
*/
|
||||||
|
moeoDMLSMonOp(eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoArchive < MOEOT > & _dmlsArchive,
|
||||||
|
moeoPopNeighborhoodExplorer < Neighbor > & _explorer,
|
||||||
|
moeoUnvisitedSelect < MOEOT > & _select,
|
||||||
|
unsigned int _step=1,
|
||||||
|
bool _verbose = true):
|
||||||
|
defaultContinuator(_step), dmlsArchive(_dmlsArchive), dmls(defaultContinuator, _eval, _dmlsArchive, _explorer, _select), verbose(_verbose){}
|
||||||
|
|
||||||
|
/** functor which allow to run the dmls on a MOEOT and return one of the resulting archive*/
|
||||||
|
bool operator()( MOEOT & _moeo)
|
||||||
|
{
|
||||||
|
if(verbose)
|
||||||
|
std::cout << std::endl << "moeoDMLSMonOp: dmls start" << std::endl;
|
||||||
|
unsigned int tmp;
|
||||||
|
eoPop < MOEOT> pop;
|
||||||
|
pop.push_back(_moeo);
|
||||||
|
dmls(pop);
|
||||||
|
tmp = rng.random(dmlsArchive.size());
|
||||||
|
_moeo = dmlsArchive[tmp];
|
||||||
|
defaultContinuator.totalGenerations(defaultContinuator.totalGenerations());
|
||||||
|
if(verbose)
|
||||||
|
std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const { return "moeoDMLSMonOp"; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** defaultContinuator used for the dmls */
|
||||||
|
eoGenContinue < MOEOT > defaultContinuator;
|
||||||
|
/** dmls archive */
|
||||||
|
moeoArchive < MOEOT > & dmlsArchive;
|
||||||
|
/** default archive used for the dmls */
|
||||||
|
moeoUnboundedArchive < MOEOT > defaultArchive;
|
||||||
|
/** the dmls */
|
||||||
|
moeoUnifiedDominanceBasedLS <Neighbor> dmls;
|
||||||
|
/** verbose mode */
|
||||||
|
bool verbose;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*_MOEODMLSMONOP_H_*/
|
||||||
|
|
@ -60,6 +60,8 @@
|
||||||
#include <algo/moeoVFAS.h>
|
#include <algo/moeoVFAS.h>
|
||||||
#include <algo/moeoPopLS.h>
|
#include <algo/moeoPopLS.h>
|
||||||
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||||
|
#include <algo/moeoPLS1.h>
|
||||||
|
#include <algo/moeoPLS2.h>
|
||||||
|
|
||||||
#include <archive/moeoArchive.h>
|
#include <archive/moeoArchive.h>
|
||||||
#include <archive/moeoArchiveIndex.h>
|
#include <archive/moeoArchiveIndex.h>
|
||||||
|
|
@ -119,13 +121,15 @@
|
||||||
#include <diversity/moeoNearestNeighborDiversityAssignment.h>
|
#include <diversity/moeoNearestNeighborDiversityAssignment.h>
|
||||||
#include <diversity/moeoSharingDiversityAssignment.h>
|
#include <diversity/moeoSharingDiversityAssignment.h>
|
||||||
|
|
||||||
#include <dmls/moeoDMLSArchive.h>
|
|
||||||
#include <dmls/moeoNewArchive.h>
|
|
||||||
|
|
||||||
#include <explorer/moeoHCMoveLoopExpl.h>
|
#include <explorer/moeoHCMoveLoopExpl.h>
|
||||||
#include <explorer/moeoTSMoveLoopExpl.h>
|
#include <explorer/moeoTSMoveLoopExpl.h>
|
||||||
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||||
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
#include <explorer/moeoFirstImprovingNeighborhoodExplorer.h>
|
||||||
|
#include <explorer/moeoSimpleSubNeighborhoodExplorer.h>
|
||||||
|
#include <explorer/moeoNoDesimprovingNeighborhoodExplorer.h>
|
||||||
|
#include <explorer/moeoSubNeighborhoodExplorer.h>
|
||||||
|
|
||||||
#include <fitness/moeoAchievementFitnessAssignment.h>
|
#include <fitness/moeoAchievementFitnessAssignment.h>
|
||||||
#include <fitness/moeoAggregationFitnessAssignment.h>
|
#include <fitness/moeoAggregationFitnessAssignment.h>
|
||||||
|
|
@ -151,6 +155,8 @@
|
||||||
#include <fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h>
|
#include <fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h>
|
||||||
#include <fitness/moeoIncrEvalSingleObjectivizer.h>
|
#include <fitness/moeoIncrEvalSingleObjectivizer.h>
|
||||||
|
|
||||||
|
#include <hybridization/moeoDMLSGenUpdater.h>
|
||||||
|
#include <hybridization/moeoDMLSMonOp.h>
|
||||||
|
|
||||||
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
||||||
#include <metric/moeoContributionMetric.h>
|
#include <metric/moeoContributionMetric.h>
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ SET (TEST_LIST
|
||||||
t-moeoDetArchiveSelect
|
t-moeoDetArchiveSelect
|
||||||
t-moeoASEEA
|
t-moeoASEEA
|
||||||
#t-moeoEpsilonHyperboxArchive
|
#t-moeoEpsilonHyperboxArchive
|
||||||
t-moeoQuadTreeIndex
|
#t-moeoQuadTreeIndex
|
||||||
t-moeoQuickUnboundedArchiveIndex
|
t-moeoQuickUnboundedArchiveIndex
|
||||||
t-moeoAggregationFitnessAssignment
|
t-moeoAggregationFitnessAssignment
|
||||||
t-moeoConstraintFitnessAssignment
|
t-moeoConstraintFitnessAssignment
|
||||||
|
|
@ -94,6 +94,15 @@ SET (TEST_LIST
|
||||||
t-moeoFixedTimeBothDirectionWeightStrategy
|
t-moeoFixedTimeBothDirectionWeightStrategy
|
||||||
t-moeoDichoWeightStrategy
|
t-moeoDichoWeightStrategy
|
||||||
t-moeoExhaustiveNeighborhoodExplorer
|
t-moeoExhaustiveNeighborhoodExplorer
|
||||||
|
t-moeoFirstImprovingNeighborhoodExplorer
|
||||||
|
t-moeoSimpleSubNeighborhoodExplorer
|
||||||
|
t-moeoNoDesimprovingNeighborhoodExplorer
|
||||||
|
t-moeoPLS1
|
||||||
|
t-moeoPLS2
|
||||||
|
t-moeoExhaustiveUnvisitedSelect
|
||||||
|
t-moeoNumberUnvisitedSelect
|
||||||
|
t-moeoDMLSMonOp
|
||||||
|
t-moeoDMLSGenUpdater
|
||||||
)
|
)
|
||||||
|
|
||||||
FOREACH (test ${TEST_LIST})
|
FOREACH (test ${TEST_LIST})
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
#include <ga/eoBit.h>
|
#include <ga/eoBit.h>
|
||||||
#include <eoScalarFitness.h>
|
#include <eoScalarFitness.h>
|
||||||
#include <neighborhood/moOrderNeighborhood.h>
|
#include <neighborhood/moOrderNeighborhood.h>
|
||||||
#include <neighborhood/moBitNeighbor.h>
|
#include <problems/bitString/moBitNeighbor.h>
|
||||||
|
|
||||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
||||||
{
|
{
|
||||||
|
|
@ -85,14 +85,16 @@ class evalSolution : public moEval< SolNeighbor >
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
unsigned size;
|
unsigned size;
|
||||||
|
int flag;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
evalSolution(unsigned _size) : size(_size) {};
|
evalSolution(unsigned _size, int _flag=1) : size(_size), flag(_flag) {};
|
||||||
|
|
||||||
~evalSolution(void) {} ;
|
~evalSolution(void) {} ;
|
||||||
|
|
||||||
void operator() (Solution& _sol, SolNeighbor& _n){
|
void operator() (Solution& _sol, SolNeighbor& _n){
|
||||||
ObjectiveVector objVec=_sol.objectiveVector();
|
ObjectiveVector objVec=_sol.objectiveVector();
|
||||||
|
if(flag>0){
|
||||||
if (_sol[_n.index()]){
|
if (_sol[_n.index()]){
|
||||||
objVec[0]--;
|
objVec[0]--;
|
||||||
objVec[1]++;
|
objVec[1]++;
|
||||||
|
|
@ -103,6 +105,54 @@ public:
|
||||||
}
|
}
|
||||||
_n.fitness(objVec);
|
_n.fitness(objVec);
|
||||||
}
|
}
|
||||||
|
else if(flag==0){
|
||||||
|
if (_sol[_n.index()]){
|
||||||
|
objVec[0]--;
|
||||||
|
objVec[1]--;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
objVec[0]++;
|
||||||
|
objVec[1]--;
|
||||||
|
}
|
||||||
|
_n.fitness(objVec);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (_sol[_n.index()]){
|
||||||
|
objVec[0]++;
|
||||||
|
objVec[1]++;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
objVec[0]++;
|
||||||
|
objVec[1]--;
|
||||||
|
}
|
||||||
|
_n.fitness(objVec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class fullEvalSolution : public eoEvalFunc< Solution >
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
unsigned size;
|
||||||
|
|
||||||
|
public:
|
||||||
|
fullEvalSolution(unsigned _size) : size(_size){};
|
||||||
|
|
||||||
|
~fullEvalSolution(void) {} ;
|
||||||
|
|
||||||
|
void operator() (Solution& _sol){
|
||||||
|
ObjectiveVector o;
|
||||||
|
for(unsigned int i=0; i<size; i++)
|
||||||
|
if(_sol[i])
|
||||||
|
o[0]++;
|
||||||
|
else
|
||||||
|
o[1]++;
|
||||||
|
_sol.objectiveVector(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
106
trunk/paradiseo-moeo/test/t-moeoDMLSGenUpdater.cpp
Normal file
106
trunk/paradiseo-moeo/test/t-moeoDMLSGenUpdater.cpp
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
<t-moeoDMLSGenUpdater.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <algo/moeoPLS1.h>
|
||||||
|
#include <eoTimeContinue.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
#include <hybridization/moeoDMLSGenUpdater.h>
|
||||||
|
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||||
|
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
#include <eoGenContinue.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoDMLSGenUpdater] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
moeoUnboundedArchive<Solution> arch(false);
|
||||||
|
moeoUnboundedArchive<Solution> globalArch(false);
|
||||||
|
eoTimeContinue<Solution> cont(1);
|
||||||
|
fullEvalSolution fullEval(8);
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoPLS1<SolNeighbor> pls1(cont, fullEval, arch, nh, eval);
|
||||||
|
moeoExhaustiveUnvisitedSelect<Solution> select;
|
||||||
|
moeoExhaustiveNeighborhoodExplorer<SolNeighbor> explorer(nh, eval);
|
||||||
|
eoGenContinue<Solution> genCont(2);
|
||||||
|
|
||||||
|
//Create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//Set its objective Vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
globalArch(s);
|
||||||
|
assert(globalArch.size()==1);
|
||||||
|
|
||||||
|
//test constructor 1 with a dmls, its archive, a global archive and a generational continuator
|
||||||
|
moeoDMLSGenUpdater<SolNeighbor> test1(pls1, arch, globalArch, genCont);
|
||||||
|
|
||||||
|
//test constructor 2 with a full evaluation function, an explorer, a selector, a global archive and a generational continuator
|
||||||
|
moeoDMLSGenUpdater<SolNeighbor> test2(fullEval, explorer, select, globalArch, genCont);
|
||||||
|
|
||||||
|
//test constructor 3 with a full evaluation function, an explorer, a selector, a global archive and a generational continuator
|
||||||
|
moeoDMLSGenUpdater<SolNeighbor> test3(fullEval, arch, explorer, select, globalArch, genCont);
|
||||||
|
|
||||||
|
std::cout << "initial solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
test1();
|
||||||
|
assert(globalArch.size()==1);
|
||||||
|
test1();
|
||||||
|
assert(globalArch.size()==9);
|
||||||
|
|
||||||
|
std::cout << "global arch:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<globalArch.size(); i++)
|
||||||
|
std::cout << globalArch[i] << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moeoDMLSGenUpdater] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
95
trunk/paradiseo-moeo/test/t-moeoDMLSMonOp.cpp
Normal file
95
trunk/paradiseo-moeo/test/t-moeoDMLSMonOp.cpp
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
<t-moeoDMLSMonOp.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <algo/moeoPLS1.h>
|
||||||
|
#include <eoTimeContinue.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
#include <hybridization/moeoDMLSMonOp.h>
|
||||||
|
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||||
|
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoDMLSMonOp] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
moeoUnboundedArchive<Solution> arch(false);
|
||||||
|
eoTimeContinue<Solution> cont(1);
|
||||||
|
fullEvalSolution fullEval(8);
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoPLS1<SolNeighbor> pls1(cont, fullEval, arch, nh, eval);
|
||||||
|
moeoExhaustiveUnvisitedSelect<Solution> select;
|
||||||
|
moeoExhaustiveNeighborhoodExplorer<SolNeighbor> explorer(nh, eval);
|
||||||
|
|
||||||
|
//Create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//Set its objective Vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
//test constructor 1 with a dmls and its archive
|
||||||
|
moeoDMLSMonOp<SolNeighbor> test1(pls1, arch);
|
||||||
|
|
||||||
|
//test constructor 2 with an incremental evaluation function, a selector and an explorer
|
||||||
|
moeoDMLSMonOp<SolNeighbor> test2(fullEval, explorer, select, 2, true);
|
||||||
|
|
||||||
|
//test constructor 3 with an incremental evaluation function, a selector and an explorer and the dmls archive
|
||||||
|
moeoDMLSMonOp<SolNeighbor> test3(fullEval, arch, explorer, select, 2, true);
|
||||||
|
|
||||||
|
std::cout << "initial solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
test1(s);
|
||||||
|
|
||||||
|
std::cout << "mutate solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
std::cout << "[t-moeoDMLSMonOp] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<t-moeoExhaustiveNeighborhoodExplorer.cpp>
|
<t-moeoExhaustiveNeighborhoodExplorer.cpp>
|
||||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can ue,
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
|
@ -36,17 +36,23 @@ int main(){
|
||||||
|
|
||||||
std::cout << "[t-moeoExhaustiveNeighborhoodExplorer] => START" << std::endl;
|
std::cout << "[t-moeoExhaustiveNeighborhoodExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
Solution s;
|
Solution s;
|
||||||
evalSolution eval(8);
|
evalSolution eval(8);
|
||||||
ObjectiveVector o;
|
ObjectiveVector o;
|
||||||
SolNeighbor n;
|
SolNeighbor n;
|
||||||
SolNeighborhood nh(8);
|
SolNeighborhood nh(8);
|
||||||
moeoExhaustiveNeighborhoodExplorer<SolNeighborhood> explorer(nh, eval);
|
moeoExhaustiveNeighborhoodExplorer<SolNeighbor> explorer(nh, eval);
|
||||||
|
|
||||||
|
//create source and destination population
|
||||||
eoPop<Solution> src;
|
eoPop<Solution> src;
|
||||||
eoPop<Solution> dest;
|
eoPop<Solution> dest;
|
||||||
|
|
||||||
|
//create a vector for selection
|
||||||
std::vector<unsigned int> v;
|
std::vector<unsigned int> v;
|
||||||
v.push_back(0);
|
v.push_back(0);
|
||||||
|
|
||||||
|
//create a solution
|
||||||
s.push_back(true);
|
s.push_back(true);
|
||||||
s.push_back(true);
|
s.push_back(true);
|
||||||
s.push_back(true);
|
s.push_back(true);
|
||||||
|
|
@ -56,21 +62,49 @@ int main(){
|
||||||
s.push_back(true);
|
s.push_back(true);
|
||||||
s.push_back(true);
|
s.push_back(true);
|
||||||
|
|
||||||
|
//set its objective vector
|
||||||
o[0]=8;
|
o[0]=8;
|
||||||
o[1]=0;
|
o[1]=0;
|
||||||
s.objectiveVector(o);
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
// aplly a move on th solution
|
||||||
n.index(3);
|
n.index(3);
|
||||||
eval(s,n);
|
eval(s,n);
|
||||||
n.move(s);
|
n.move(s);
|
||||||
s.objectiveVector(n.fitness());
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//print initial sol
|
||||||
|
std::cout << "solution:" << std::endl;
|
||||||
std::cout << s << std::endl;
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
src.push_back(s);
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test the explorer
|
||||||
explorer(src, v, dest);
|
explorer(src, v, dest);
|
||||||
|
|
||||||
|
//verify the destination population
|
||||||
|
assert(dest.size()==8);
|
||||||
|
|
||||||
|
assert(dest[0].objectiveVector()[0]==6);
|
||||||
|
assert(dest[1].objectiveVector()[0]==6);
|
||||||
|
assert(dest[2].objectiveVector()[0]==6);
|
||||||
|
assert(dest[3].objectiveVector()[0]==8);
|
||||||
|
assert(dest[4].objectiveVector()[0]==6);
|
||||||
|
assert(dest[5].objectiveVector()[0]==6);
|
||||||
|
assert(dest[6].objectiveVector()[0]==6);
|
||||||
|
assert(dest[7].objectiveVector()[0]==6);
|
||||||
|
|
||||||
|
assert(dest[0].objectiveVector()[1]==2);
|
||||||
|
assert(dest[1].objectiveVector()[1]==2);
|
||||||
|
assert(dest[2].objectiveVector()[1]==2);
|
||||||
|
assert(dest[3].objectiveVector()[1]==0);
|
||||||
|
assert(dest[4].objectiveVector()[1]==2);
|
||||||
|
assert(dest[5].objectiveVector()[1]==2);
|
||||||
|
assert(dest[6].objectiveVector()[1]==2);
|
||||||
|
assert(dest[7].objectiveVector()[1]==2);
|
||||||
|
|
||||||
|
std::cout << "destination:" << std::endl;
|
||||||
for(unsigned int i=0; i<dest.size(); i++)
|
for(unsigned int i=0; i<dest.size(); i++)
|
||||||
std::cout << dest[i] << std::endl;
|
std::cout << dest[i] << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
<t-moeoExhaustiveUnvisitedSelect.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoExhaustiveUnvisitedSelect] => START" << std::endl;
|
||||||
|
|
||||||
|
// objective vectors
|
||||||
|
eoPop < Solution > pop;
|
||||||
|
pop.resize(5);
|
||||||
|
pop[0].flag(1);
|
||||||
|
pop[1].flag(0);
|
||||||
|
pop[2].flag(0);
|
||||||
|
pop[3].flag(1);
|
||||||
|
pop[4].flag(0);
|
||||||
|
|
||||||
|
moeoExhaustiveUnvisitedSelect < Solution > select;
|
||||||
|
|
||||||
|
std::vector <unsigned int> res;
|
||||||
|
|
||||||
|
res=select(pop);
|
||||||
|
assert(res.size()==3);
|
||||||
|
assert(res[0]==1);
|
||||||
|
assert(res[1]==2);
|
||||||
|
assert(res[2]==4);
|
||||||
|
|
||||||
|
std::cout << "[t-moeoExhaustiveUnvisitedSelect] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
<t-moeoFirstImprovingNeighborhoodExplorer.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <explorer/moeoFirstImprovingNeighborhoodExplorer.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoFirstImprovingNeighborhoodExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
evalSolution eval2(8, 0);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoFirstImprovingNeighborhoodExplorer<SolNeighbor> explorer(nh, eval);
|
||||||
|
moeoFirstImprovingNeighborhoodExplorer<SolNeighbor> explorer2(nh, eval2);
|
||||||
|
|
||||||
|
//create source and destination population
|
||||||
|
eoPop<Solution> src;
|
||||||
|
eoPop<Solution> dest;
|
||||||
|
|
||||||
|
//create a vector for selection
|
||||||
|
std::vector<unsigned int> v;
|
||||||
|
v.push_back(0);
|
||||||
|
|
||||||
|
//create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//set its objective vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
// aplly a move on th solution
|
||||||
|
n.index(3);
|
||||||
|
eval(s,n);
|
||||||
|
n.move(s);
|
||||||
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//print initial sol
|
||||||
|
std::cout << "solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test the explorer
|
||||||
|
explorer(src, v, dest);
|
||||||
|
|
||||||
|
assert(dest.size()==8);
|
||||||
|
assert(dest[0].objectiveVector()[0]==6);
|
||||||
|
assert(dest[1].objectiveVector()[0]==6);
|
||||||
|
assert(dest[2].objectiveVector()[0]==6);
|
||||||
|
assert(dest[3].objectiveVector()[0]==8);
|
||||||
|
assert(dest[4].objectiveVector()[0]==6);
|
||||||
|
assert(dest[5].objectiveVector()[0]==6);
|
||||||
|
assert(dest[6].objectiveVector()[0]==6);
|
||||||
|
assert(dest[7].objectiveVector()[0]==6);
|
||||||
|
|
||||||
|
assert(dest[0].objectiveVector()[1]==2);
|
||||||
|
assert(dest[1].objectiveVector()[1]==2);
|
||||||
|
assert(dest[2].objectiveVector()[1]==2);
|
||||||
|
assert(dest[3].objectiveVector()[1]==0);
|
||||||
|
assert(dest[4].objectiveVector()[1]==2);
|
||||||
|
assert(dest[5].objectiveVector()[1]==2);
|
||||||
|
assert(dest[6].objectiveVector()[1]==2);
|
||||||
|
assert(dest[7].objectiveVector()[1]==2);
|
||||||
|
|
||||||
|
std::cout << "destination:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<dest.size(); i++)
|
||||||
|
std::cout << dest[i] << std::endl;
|
||||||
|
|
||||||
|
//test explorer2 (eval function is changed to have solutions dominates other ones
|
||||||
|
explorer2(dest, v, src);
|
||||||
|
|
||||||
|
assert(src.size()==3);
|
||||||
|
|
||||||
|
assert(src[1].objectiveVector()[0]==7);
|
||||||
|
assert(src[2].objectiveVector()[0]==5);
|
||||||
|
|
||||||
|
assert(src[1].objectiveVector()[1]==1);
|
||||||
|
assert(src[2].objectiveVector()[1]==1);
|
||||||
|
|
||||||
|
std::cout << "source: (after an exploration dest -> src)" << std::endl;
|
||||||
|
for(unsigned int i=0; i<src.size(); i++)
|
||||||
|
std::cout << src[i] << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moeoFirstImprovingNeighborhoodExplorer] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
<t-moeoNoDesimprovingNeighborhoodExplorer.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <explorer/moeoNoDesimprovingNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoNoDesimprovingNeighborhoodExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8, -1);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoNoDesimprovingNeighborhoodExplorer<SolNeighbor> explorer(nh, eval);
|
||||||
|
|
||||||
|
//create source and destination population
|
||||||
|
eoPop<Solution> src;
|
||||||
|
eoPop<Solution> dest;
|
||||||
|
|
||||||
|
//create a vector for selection
|
||||||
|
std::vector<unsigned int> v;
|
||||||
|
v.push_back(0);
|
||||||
|
|
||||||
|
//create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//set its objective vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
// aplly a move on th solution
|
||||||
|
n.index(3);
|
||||||
|
eval(s,n);
|
||||||
|
n.move(s);
|
||||||
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//print initial sol
|
||||||
|
std::cout << "solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test explorer, the evaluation function is adapt to test this explorer
|
||||||
|
explorer(src, v, dest);
|
||||||
|
|
||||||
|
//verify destination population
|
||||||
|
assert(dest.size()==1);
|
||||||
|
assert(dest[0].objectiveVector()[0]==10);
|
||||||
|
assert(dest[0].objectiveVector()[1]==0);
|
||||||
|
|
||||||
|
std::cout << "destination:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<dest.size(); i++)
|
||||||
|
std::cout << dest[i] << std::endl;
|
||||||
|
|
||||||
|
std::cout << "[t-moeoNoDesimprovingNeighborhoodExplorer] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
83
trunk/paradiseo-moeo/test/t-moeoNumberUnvisitedSelect.cpp
Normal file
83
trunk/paradiseo-moeo/test/t-moeoNumberUnvisitedSelect.cpp
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
<t-moeoNumberUnvisitedSelect.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <selection/moeoNumberUnvisitedSelect.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoNumberUnvisitedSelect] => START" << std::endl;
|
||||||
|
|
||||||
|
// objective vectors
|
||||||
|
eoPop < Solution > pop;
|
||||||
|
pop.resize(5);
|
||||||
|
pop[0].flag(1);
|
||||||
|
pop[1].flag(0);
|
||||||
|
pop[2].flag(0);
|
||||||
|
pop[3].flag(1);
|
||||||
|
pop[4].flag(0);
|
||||||
|
|
||||||
|
moeoNumberUnvisitedSelect < Solution > select(2);
|
||||||
|
|
||||||
|
std::vector <unsigned int> res;
|
||||||
|
|
||||||
|
//test general
|
||||||
|
res=select(pop);
|
||||||
|
assert(res.size()==2);
|
||||||
|
assert(res[0]==1 || res[0]==2 || res[0]==4);
|
||||||
|
assert(res[1]==1 || res[1]==2 || res[1]==4);
|
||||||
|
assert(res[0] != res[1]);
|
||||||
|
|
||||||
|
//test au bornes
|
||||||
|
moeoNumberUnvisitedSelect < Solution > select2(6);
|
||||||
|
res.resize(0);
|
||||||
|
res=select2(pop);
|
||||||
|
assert(res.size()==3);
|
||||||
|
assert(res[0]==1 || res[0]==2 || res[0]==4);
|
||||||
|
assert(res[1]==1 || res[1]==2 || res[1]==4);
|
||||||
|
assert(res[2]==1 || res[2]==2 || res[2]==4);
|
||||||
|
assert(res[0] != res[1]);
|
||||||
|
assert(res[0] != res[2]);
|
||||||
|
assert(res[1] != res[2]);
|
||||||
|
|
||||||
|
moeoNumberUnvisitedSelect < Solution > select3(0);
|
||||||
|
res.resize(0);
|
||||||
|
res=select3(pop);
|
||||||
|
assert(res.size()==0);
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moeoNumberUnvisitedSelect] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
118
trunk/paradiseo-moeo/test/t-moeoPLS1.cpp
Normal file
118
trunk/paradiseo-moeo/test/t-moeoPLS1.cpp
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
<t-moeoPLS1.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <algo/moeoPLS1.h>
|
||||||
|
#include <eoTimeContinue.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoPLS1] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
moeoUnboundedArchive<Solution> arch(false);
|
||||||
|
eoTimeContinue<Solution> cont(1);
|
||||||
|
fullEvalSolution fullEval(8);
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoPLS1<SolNeighbor> test(cont, fullEval, arch, nh, eval);
|
||||||
|
|
||||||
|
//create source population
|
||||||
|
eoPop<Solution> src;
|
||||||
|
|
||||||
|
//Create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//Set its objective Vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
//apply a move on the solution and compute new objective vector
|
||||||
|
n.index(3);
|
||||||
|
eval(s,n);
|
||||||
|
n.move(s);
|
||||||
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test PLS1
|
||||||
|
test(src);
|
||||||
|
|
||||||
|
//verify all objective vector was found.
|
||||||
|
assert(arch.size()==9);
|
||||||
|
assert(arch[0].objectiveVector()[0]==7);
|
||||||
|
assert(arch[1].objectiveVector()[0]==6);
|
||||||
|
assert(arch[2].objectiveVector()[0]==8);
|
||||||
|
assert(arch[3].objectiveVector()[0]==5);
|
||||||
|
assert(arch[4].objectiveVector()[0]==4);
|
||||||
|
assert(arch[5].objectiveVector()[0]==3);
|
||||||
|
assert(arch[6].objectiveVector()[0]==2);
|
||||||
|
assert(arch[7].objectiveVector()[0]==1);
|
||||||
|
assert(arch[8].objectiveVector()[0]==0);
|
||||||
|
|
||||||
|
assert(arch[0].objectiveVector()[1]==1);
|
||||||
|
assert(arch[1].objectiveVector()[1]==2);
|
||||||
|
assert(arch[2].objectiveVector()[1]==0);
|
||||||
|
assert(arch[3].objectiveVector()[1]==3);
|
||||||
|
assert(arch[4].objectiveVector()[1]==4);
|
||||||
|
assert(arch[5].objectiveVector()[1]==5);
|
||||||
|
assert(arch[6].objectiveVector()[1]==6);
|
||||||
|
assert(arch[7].objectiveVector()[1]==7);
|
||||||
|
assert(arch[8].objectiveVector()[1]==8);
|
||||||
|
|
||||||
|
//Print
|
||||||
|
std::cout << "source:" << std::endl;
|
||||||
|
std::cout << src << std::endl;
|
||||||
|
|
||||||
|
std::cout << "archive:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<arch.size(); i++)
|
||||||
|
std::cout << arch[i] << std::endl;
|
||||||
|
|
||||||
|
std::cout << "[t-moeoPLS1] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
119
trunk/paradiseo-moeo/test/t-moeoPLS2.cpp
Normal file
119
trunk/paradiseo-moeo/test/t-moeoPLS2.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
<t-moeoPLS2.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <algo/moeoPLS2.h>
|
||||||
|
#include <eoTimeContinue.h>
|
||||||
|
#include <archive/moeoUnboundedArchive.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoPLS2] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
moeoUnboundedArchive<Solution> arch(false);
|
||||||
|
eoTimeContinue<Solution> cont(1);
|
||||||
|
fullEvalSolution fullEval(8);
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoPLS2<SolNeighbor> test(cont, fullEval, arch, nh, eval);
|
||||||
|
|
||||||
|
//create source population
|
||||||
|
eoPop<Solution> src;
|
||||||
|
|
||||||
|
//Create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//Set its objective Vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
//apply a move on the solution and compute new objective vector
|
||||||
|
n.index(3);
|
||||||
|
eval(s,n);
|
||||||
|
n.move(s);
|
||||||
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test PLS2
|
||||||
|
test(src);
|
||||||
|
|
||||||
|
//verify all objective vector was found.
|
||||||
|
assert(arch.size()==9);
|
||||||
|
assert(arch[0].objectiveVector()[0]==7);
|
||||||
|
assert(arch[1].objectiveVector()[0]==6);
|
||||||
|
assert(arch[2].objectiveVector()[0]==8);
|
||||||
|
assert(arch[3].objectiveVector()[0]==5);
|
||||||
|
assert(arch[4].objectiveVector()[0]==4);
|
||||||
|
assert(arch[5].objectiveVector()[0]==3);
|
||||||
|
assert(arch[6].objectiveVector()[0]==2);
|
||||||
|
assert(arch[7].objectiveVector()[0]==1);
|
||||||
|
assert(arch[8].objectiveVector()[0]==0);
|
||||||
|
|
||||||
|
assert(arch[0].objectiveVector()[1]==1);
|
||||||
|
assert(arch[1].objectiveVector()[1]==2);
|
||||||
|
assert(arch[2].objectiveVector()[1]==0);
|
||||||
|
assert(arch[3].objectiveVector()[1]==3);
|
||||||
|
assert(arch[4].objectiveVector()[1]==4);
|
||||||
|
assert(arch[5].objectiveVector()[1]==5);
|
||||||
|
assert(arch[6].objectiveVector()[1]==6);
|
||||||
|
assert(arch[7].objectiveVector()[1]==7);
|
||||||
|
assert(arch[8].objectiveVector()[1]==8);
|
||||||
|
|
||||||
|
//Print
|
||||||
|
std::cout << "source:" << std::endl;
|
||||||
|
std::cout << src << std::endl;
|
||||||
|
|
||||||
|
std::cout << "archive:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<arch.size(); i++)
|
||||||
|
std::cout << arch[i] << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moeoPLS2] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
/*
|
||||||
|
<t-moeoSimpleSubNeighborhoodExplorer.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "moeoTestClass.h"
|
||||||
|
#include <explorer/moeoSimpleSubNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moeoSimpleSubNeighborhoodExplorer] => START" << std::endl;
|
||||||
|
|
||||||
|
//init all components
|
||||||
|
Solution s;
|
||||||
|
evalSolution eval(8);
|
||||||
|
ObjectiveVector o;
|
||||||
|
SolNeighbor n;
|
||||||
|
SolNeighborhood nh(8);
|
||||||
|
moeoSimpleSubNeighborhoodExplorer<SolNeighbor> explorer(nh, 4, eval);
|
||||||
|
|
||||||
|
//create source and destination population
|
||||||
|
eoPop<Solution> src;
|
||||||
|
eoPop<Solution> dest;
|
||||||
|
|
||||||
|
//create a vector for selection
|
||||||
|
std::vector<unsigned int> v;
|
||||||
|
v.push_back(0);
|
||||||
|
|
||||||
|
//create a solution
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
s.push_back(true);
|
||||||
|
|
||||||
|
//set its objective vector
|
||||||
|
o[0]=8;
|
||||||
|
o[1]=0;
|
||||||
|
s.objectiveVector(o);
|
||||||
|
|
||||||
|
// aplly a move on th solution
|
||||||
|
n.index(3);
|
||||||
|
eval(s,n);
|
||||||
|
n.move(s);
|
||||||
|
s.objectiveVector(n.fitness());
|
||||||
|
|
||||||
|
//print initial sol
|
||||||
|
std::cout << "solution:" << std::endl;
|
||||||
|
std::cout << s << std::endl;
|
||||||
|
|
||||||
|
//copy the solution in the source population
|
||||||
|
src.push_back(s);
|
||||||
|
|
||||||
|
//test the explorer (only 4 neighbors are visited)
|
||||||
|
explorer(src, v, dest);
|
||||||
|
|
||||||
|
//verify the destination population
|
||||||
|
assert(dest.size()==4);
|
||||||
|
|
||||||
|
assert(dest[0].objectiveVector()[0]==6);
|
||||||
|
assert(dest[1].objectiveVector()[0]==6);
|
||||||
|
assert(dest[2].objectiveVector()[0]==6);
|
||||||
|
assert(dest[3].objectiveVector()[0]==8);
|
||||||
|
|
||||||
|
assert(dest[0].objectiveVector()[1]==2);
|
||||||
|
assert(dest[1].objectiveVector()[1]==2);
|
||||||
|
assert(dest[2].objectiveVector()[1]==2);
|
||||||
|
assert(dest[3].objectiveVector()[1]==0);
|
||||||
|
|
||||||
|
std::cout << "destination:" << std::endl;
|
||||||
|
for(unsigned int i=0; i<dest.size(); i++)
|
||||||
|
std::cout << dest[i] << std::endl;
|
||||||
|
|
||||||
|
std::cout << "[t-moeoSimpleSubNeighborhoodExplorer] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue