config test + debut des dmls ajoutées
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1722 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
383407edca
commit
df12bd9604
13 changed files with 811 additions and 5 deletions
|
|
@ -35,6 +35,11 @@ IF(NOT DEFINED config OR NOT config)
|
|||
give the path of the install configuration file. ")
|
||||
ENDIF(NOT DEFINED config OR NOT config)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-MOEO_SOURCE_DIR}/CTestCustom.cmake
|
||||
${ParadisEO-MOEO_BINARY_DIR}/CTestCustom.cmake)
|
||||
|
||||
# Need the config file whose full path is given thanks to the "config" variable
|
||||
INCLUDE(${config})
|
||||
##########################################################################################################################################
|
||||
|
|
|
|||
7
trunk/paradiseo-moeo/CTestCustom.cmake
Normal file
7
trunk/paradiseo-moeo/CTestCustom.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
"test/"
|
||||
"paradiseo-eo/"
|
||||
"paradiseo-mo/"
|
||||
"paradiseo-old-mo/"
|
||||
)
|
||||
50
trunk/paradiseo-moeo/src/algo/moeoPopLS.h
Executable file
50
trunk/paradiseo-moeo/src/algo/moeoPopLS.h
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <moeoPopLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
* Jérémie Humeau
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOPOPLS_H_
|
||||
#define MOEOPOPLS_H_
|
||||
|
||||
#include <algo/moeoPopAlgo.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Population based multi-objective local search.
|
||||
*/
|
||||
template < class Neighborhhod >
|
||||
class moeoPopLS : public moeoPopAlgo < typename Neighborhhod::EOT > {};
|
||||
|
||||
#endif /*MOEOPOPLS_H_*/
|
||||
147
trunk/paradiseo-moeo/src/algo/moeoUnifiedDominanceBasedLS.h
Executable file
147
trunk/paradiseo-moeo/src/algo/moeoUnifiedDominanceBasedLS.h
Executable file
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* <moeoUnifiedDominanceBasedLS.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 _MOEOUNIFIEDDOMINANCEBASEDLS_H
|
||||
#define _MOEOUNIFIEDDOMINANCEBASEDLS_H
|
||||
|
||||
#include <eoPop.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoPopEvalFunc.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <algo/moeoPopLS.h>
|
||||
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||
#include <selection/moeoUnvisitedSelect.h>
|
||||
|
||||
/**
|
||||
* A class to design dominance based local searches
|
||||
*/
|
||||
template < class Neighborhood >
|
||||
class moeoUnifiedDominanceBasedLS : public moeoPopLS < Neighborhood >
|
||||
{
|
||||
public:
|
||||
|
||||
/** Alias for the type */
|
||||
typedef typename Neighborhood::EOT MOEOT;
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _continuator a stop creterion
|
||||
* @param _eval a evaluation function
|
||||
* @param _archive a archive to store no-dominated individuals
|
||||
* @param _explorer a neighborhood explorer
|
||||
* @param _select a selector of unvisited individuals of a population
|
||||
*/
|
||||
moeoUnifiedDominanceBasedLS(
|
||||
eoContinue < MOEOT > & _continuator,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoArchive < MOEOT > & _archive,
|
||||
moeoPopNeighborhoodExplorer < Neighborhood > & _explorer,
|
||||
moeoUnvisitedSelect < MOEOT > & _select) :
|
||||
continuator(_continuator), loopEval(_eval), popEval(loopEval), archive(_archive), explorer(_explorer), select(_select) {}
|
||||
|
||||
/**
|
||||
* Applies a few generation of evolution to the population _pop.
|
||||
* @param _pop the population
|
||||
*/
|
||||
virtual void operator()(eoPop < MOEOT > & _pop)
|
||||
{
|
||||
std::vector < unsigned int> selectionVector;
|
||||
eoPop < MOEOT > tmp_pop;
|
||||
popEval(tmp_pop, _pop);
|
||||
archive(_pop);
|
||||
do{
|
||||
tmp_pop.resize(0);
|
||||
//selection
|
||||
selectionVector = select(archive);
|
||||
//exploration
|
||||
explorer(archive, selectionVector, tmp_pop);
|
||||
//archivage
|
||||
archive(tmp_pop);
|
||||
}
|
||||
while (continuator(archive) && naturalContinuator(archive));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/** continuator */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
/** loopEval */
|
||||
eoPopLoopEval < MOEOT > loopEval;
|
||||
/** popEval */
|
||||
eoPopEvalFunc < MOEOT > & popEval;
|
||||
/** archive */
|
||||
moeoArchive < MOEOT > & archive;
|
||||
/** explorer */
|
||||
moeoPopNeighborhoodExplorer < Neighborhood > & explorer;
|
||||
/** selector */
|
||||
moeoUnvisitedSelect < MOEOT > & select;
|
||||
|
||||
/**
|
||||
* Natural Continuator (Stop when all individuals of the population are visited)
|
||||
*/
|
||||
class moeoContinue : public eoUF < eoPop < MOEOT > &, bool >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
*/
|
||||
moeoContinue(){}
|
||||
|
||||
/**
|
||||
* functor which evaluate if the algorithm continue or not
|
||||
* @param _pop the population
|
||||
* @return true if the algorithm continue, else return false
|
||||
*/
|
||||
virtual bool operator()(eoPop < MOEOT > & _pop)
|
||||
{
|
||||
bool res = false;
|
||||
unsigned int i=0;
|
||||
while (!res && i < _pop.size()){
|
||||
res = (_pop[i].flag() != 1);
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} naturalContinuator;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOUNIFIEDDOMINANCEBASEDLS_H_*/
|
||||
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* <moeoExhaustiveNeighborhoodExplorer.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 _MOEOEXHAUSTIVENEIGHBORHOODEXPLORER_H
|
||||
#define _MOEOEXHAUSTIVENEIGHBORHOODEXPLORER_H
|
||||
|
||||
#include <eoPop.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||
#include <eval/moEval.h>
|
||||
|
||||
/**
|
||||
* Explorer which explore all the neighborhood
|
||||
*/
|
||||
template < class Neighborhood >
|
||||
class moeoExhaustiveNeighborhoodExplorer : public moeoPopNeighborhoodExplorer < Neighborhood >
|
||||
{
|
||||
/** Alias for the type */
|
||||
typedef typename Neighborhood::EOT MOEOT;
|
||||
typedef typename Neighborhood::Neighbor Neighbor;
|
||||
/** Alias for the objeciveVector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove allow to do or not a move
|
||||
* @param _incrEval a (generally) efficient evaluation fonction
|
||||
*/
|
||||
moeoExhaustiveNeighborhoodExplorer(
|
||||
moNeighborhood<Neighbor>& _neighborhood,
|
||||
moEval < Neighbor > & _eval):
|
||||
neighborhood(_neighborhood), eval(_eval){}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
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(neighborhood.hasNeighbor(_src)){
|
||||
neighborhood.init(_src, neighbor);
|
||||
_dest.push_back(_src);
|
||||
eval(_dest.back(),neighbor);
|
||||
neighbor.move(_dest.back());
|
||||
_dest.back().objectiveVector(neighbor.fitness());
|
||||
_dest.back().flag(0);
|
||||
while (neighborhood.cont(_src)){
|
||||
neighborhood.next(_src, neighbor);
|
||||
_dest.push_back(_src);
|
||||
eval(_dest.back(),neighbor);
|
||||
neighbor.move(_dest.back());
|
||||
_dest.back().objectiveVector(neighbor.fitness());
|
||||
_dest.back().flag(0);
|
||||
}
|
||||
_src.flag(1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Neighbor */
|
||||
Neighbor neighbor;
|
||||
/** Neighborhood */
|
||||
moNeighborhood<Neighbor>& neighborhood;
|
||||
/** ObjectiveVector */
|
||||
ObjectiveVector objVec;
|
||||
/** the incremental evaluation */
|
||||
moEval < Neighbor > & eval;
|
||||
|
||||
};
|
||||
|
||||
#endif /*_MOEOEXHAUSTIVENEIGHBORHOODEXPLORER_H_*/
|
||||
58
trunk/paradiseo-moeo/src/explorer/moeoPopNeighborhoodExplorer.h
Executable file
58
trunk/paradiseo-moeo/src/explorer/moeoPopNeighborhoodExplorer.h
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* <moeoPopNeighborhoodExplorer.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 _MOEOPOPNEIGHBORHOODEXPLORER_H
|
||||
#define _MOEOPOPNEIGHBORHOODEXPLORER_H
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
/**
|
||||
* Abstract class for multi-objective local search neighborhood exploration
|
||||
*/
|
||||
template < class Neighborhood >
|
||||
class moeoPopNeighborhoodExplorer: public eoFunctorBase{
|
||||
|
||||
public:
|
||||
/**
|
||||
* abstract functor which realise exploration
|
||||
*/
|
||||
virtual void operator()(eoPop < typename Neighborhood::EOT > &, std::vector <unsigned int>, eoPop < typename Neighborhood::EOT > &) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEONEIGHBORHOODEXPLORER_H_*/
|
||||
|
|
@ -58,7 +58,8 @@
|
|||
#include <algo/moeoSA.h>
|
||||
#include <algo/moeoILS.h>
|
||||
#include <algo/moeoVFAS.h>
|
||||
|
||||
#include <algo/moeoPopLS.h>
|
||||
#include <algo/moeoUnifiedDominanceBasedLS.h>
|
||||
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <archive/moeoArchiveIndex.h>
|
||||
|
|
@ -118,6 +119,14 @@
|
|||
#include <diversity/moeoNearestNeighborDiversityAssignment.h>
|
||||
#include <diversity/moeoSharingDiversityAssignment.h>
|
||||
|
||||
#include <dmls/moeoDMLSArchive.h>
|
||||
#include <dmls/moeoNewArchive.h>
|
||||
|
||||
#include <explorer/moeoHCMoveLoopExpl.h>
|
||||
#include <explorer/moeoTSMoveLoopExpl.h>
|
||||
#include <explorer/moeoPopNeighborhoodExplorer.h>
|
||||
#include <explorer/moeoExhaustiveNeighborhoodExplorer.h>
|
||||
|
||||
#include <fitness/moeoAchievementFitnessAssignment.h>
|
||||
#include <fitness/moeoAggregationFitnessAssignment.h>
|
||||
#include <fitness/moeoAggregativeFitnessAssignment.h>
|
||||
|
|
@ -169,6 +178,9 @@
|
|||
#include <selection/moeoSelectors.h>
|
||||
#include <selection/moeoStochTournamentSelect.h>
|
||||
#include <selection/moeoDetArchiveSelect.h>
|
||||
#include <selection/moeoUnvisitedSelect.h>
|
||||
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||
#include <selection/moeoNumberUnvisitedSelect.h>
|
||||
|
||||
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <utils/moeoArchiveUpdater.h>
|
||||
|
|
@ -191,9 +203,5 @@
|
|||
#include <utils/moeoDichoWeightStrategy.h>
|
||||
|
||||
|
||||
#include <explorer/moeoHCMoveLoopExpl.h>
|
||||
#include <explorer/moeoTSMoveLoopExpl.h>
|
||||
|
||||
|
||||
|
||||
#endif /*MOEO_*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* <moeoExhaustiveUnvisitedSelect.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 _MOEOEXHAUSTIVEUNVISITEDSELECT_H
|
||||
#define _MOEOEXHAUSTIVEUNVISITEDSELECT_H
|
||||
|
||||
#include <eoPop.h>
|
||||
#include <selection/moeoUnvisitedSelect.h>
|
||||
|
||||
/**
|
||||
* Selector which select all unvisited individuals of a population
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoExhaustiveUnvisitedSelect : public moeoUnvisitedSelect < MOEOT >
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default ctor
|
||||
*/
|
||||
moeoExhaustiveUnvisitedSelect(){}
|
||||
|
||||
/**
|
||||
* functor which return index of selected individuals of a population
|
||||
* @param _src the population
|
||||
* @return the vector contains index of all unvisited individuals of the population
|
||||
*/
|
||||
std::vector <unsigned int> operator()(eoPop < MOEOT > & _src)
|
||||
{
|
||||
std::vector <unsigned int> res;
|
||||
res.resize(0);
|
||||
for (unsigned int i=0; i<_src.size(); i++)
|
||||
{
|
||||
if (_src[i].flag() == 0)
|
||||
res.push_back(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*_MOEOEXHAUSTIVEUNVISITEDSELECT_H_*/
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* <moeoNumberUnvisitedSelect.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 _MOEONUMBERUNVISITEDSELECT_H
|
||||
#define _MOEONUMBERUNVISITEDSELECT_H
|
||||
|
||||
#include <eoPop.h>
|
||||
#include <selection/moeoUnvisitedSelect.h>
|
||||
|
||||
/**
|
||||
* Selector which select a part of unvisited individuals of a population
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoNumberUnvisitedSelect : public moeoUnvisitedSelect < MOEOT >
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _number the number of individuals to select
|
||||
*/
|
||||
moeoNumberUnvisitedSelect(unsigned int _number): number(_number){}
|
||||
|
||||
/**
|
||||
* functor which return index of selected individuals of a population
|
||||
* @param _src the population
|
||||
* @return the vector contains index of the part of unvisited individuals of the population
|
||||
*/
|
||||
std::vector <unsigned int> operator()(eoPop < MOEOT > & _src)
|
||||
{
|
||||
std::vector <unsigned int> res;
|
||||
res.resize(0);
|
||||
for (unsigned int i=0; i<_src.size(); i++)
|
||||
{
|
||||
if (_src[i].flag() == 0)
|
||||
res.push_back(i);
|
||||
}
|
||||
if(number < res.size()){
|
||||
UF_random_generator<unsigned int> rndGen;
|
||||
std::random_shuffle(res.begin(), res.end(), rndGen);
|
||||
res.resize(number);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
/** number of individuals to select */
|
||||
unsigned int number;
|
||||
|
||||
};
|
||||
|
||||
#endif /*_MOEONUMBERUNVISITEDSELECT_H_*/
|
||||
50
trunk/paradiseo-moeo/src/selection/moeoUnvisitedSelect.h
Normal file
50
trunk/paradiseo-moeo/src/selection/moeoUnvisitedSelect.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <moeoUnvisitedSelect.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 _MOEOUNVISITEDSELECT_H
|
||||
#define _MOEOUNVISITEDSELECT_H
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
/**
|
||||
* Abstract Selector
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoUnvisitedSelect: public eoUF < eoPop < MOEOT > &, std::vector< unsigned int > >{};
|
||||
|
||||
#endif /*MOEOUNVISITEDSELECT_H_*/
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${OLDMO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${ParadisEO-MOEO_SOURCE_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
|
@ -92,6 +93,7 @@ SET (TEST_LIST
|
|||
t-moeoFixedTimeOneDirectionWeightStrategy
|
||||
t-moeoFixedTimeBothDirectionWeightStrategy
|
||||
t-moeoDichoWeightStrategy
|
||||
t-moeoExhaustiveNeighborhoodExplorer
|
||||
)
|
||||
|
||||
FOREACH (test ${TEST_LIST})
|
||||
|
|
|
|||
108
trunk/paradiseo-moeo/test/moeoTestClass.h
Normal file
108
trunk/paradiseo-moeo/test/moeoTestClass.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
<moeoTestClass.h>
|
||||
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 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 _moeoTestClass_h
|
||||
#define _moeoTestClass_h
|
||||
|
||||
#include <moeo>
|
||||
#include <EO.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <neighborhood/moRndNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
|
||||
#include <ga/eoBit.h>
|
||||
#include <eoScalarFitness.h>
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
#include <neighborhood/moBitNeighbor.h>
|
||||
|
||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
||||
{
|
||||
public:
|
||||
static bool minimizing (int i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
static bool maximizing (int i)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static unsigned int nObjectives ()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
|
||||
|
||||
typedef moeoBitVector<ObjectiveVector> Solution;
|
||||
|
||||
class SolNeighbor : public moIndexNeighbor <Solution, ObjectiveVector>
|
||||
{
|
||||
public:
|
||||
virtual void move(Solution & _solution) {
|
||||
_solution[key] = !_solution[key];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef moOrderNeighborhood<SolNeighbor> SolNeighborhood;
|
||||
|
||||
class evalSolution : public moEval< SolNeighbor >
|
||||
{
|
||||
private:
|
||||
unsigned size;
|
||||
|
||||
public:
|
||||
evalSolution(unsigned _size) : size(_size) {};
|
||||
|
||||
~evalSolution(void) {} ;
|
||||
|
||||
void operator() (Solution& _sol, SolNeighbor& _n){
|
||||
ObjectiveVector objVec=_sol.objectiveVector();
|
||||
if (_sol[_n.index()]){
|
||||
objVec[0]--;
|
||||
objVec[1]++;
|
||||
}
|
||||
else{
|
||||
objVec[0]++;
|
||||
objVec[1]--;
|
||||
}
|
||||
_n.fitness(objVec);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
<t-moeoExhaustiveNeighborhoodExplorer.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 <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moeoExhaustiveNeighborhoodExplorer] => START" << std::endl;
|
||||
|
||||
Solution s;
|
||||
evalSolution eval(8);
|
||||
ObjectiveVector o;
|
||||
SolNeighbor n;
|
||||
SolNeighborhood nh(8);
|
||||
moeoExhaustiveNeighborhoodExplorer<SolNeighborhood> explorer(nh, eval);
|
||||
eoPop<Solution> src;
|
||||
eoPop<Solution> dest;
|
||||
std::vector<unsigned int> v;
|
||||
v.push_back(0);
|
||||
|
||||
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);
|
||||
|
||||
o[0]=8;
|
||||
o[1]=0;
|
||||
s.objectiveVector(o);
|
||||
|
||||
n.index(3);
|
||||
eval(s,n);
|
||||
n.move(s);
|
||||
s.objectiveVector(n.fitness());
|
||||
|
||||
std::cout << s << std::endl;
|
||||
|
||||
src.push_back(s);
|
||||
|
||||
explorer(src, v, dest);
|
||||
|
||||
for(unsigned int i=0; i<dest.size(); i++)
|
||||
std::cout << dest[i] << std::endl;
|
||||
|
||||
std::cout << "[t-moeoExhaustiveNeighborhoodExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue