Migration from SVN

This commit is contained in:
quemy 2012-08-30 11:30:11 +02:00
commit 8cd56f37db
29069 changed files with 0 additions and 4096888 deletions

208
moeo/src/algo/moeoASEEA.h Normal file
View file

@ -0,0 +1,208 @@
/*
* <moeoASEEA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
* Jérémie Humeau
* François Legillon
* Thibaut demaret
*
* 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 MOEOASEEA_H_
#define MOEOASEEA_H_
#include <eoBreed.h>
#include <eoCloneOps.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <archive/moeoArchive.h>
#include <selection/moeoRandomSelect.h>
#include <selection/moeoSelectFromPopAndArch.h>
#include <selection/moeoDetArchiveSelect.h>
/**
* ASEEA (Adaptive Simple Elitist Evolutionary Algorithm).
*/
template < class MOEOT >
class moeoASEEA : public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _max the max size for the pop
*/
moeoASEEA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed (selectTransform), archive(_archive)
{}
/**
* Ctor with a eoContinue.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _max the max size for the pop
*/
moeoASEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed(selectTransform), archive(_archive)
{}
/**
* Ctor with a eoContinue, a eoPopEval.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _max the max size for the pop
*/
moeoASEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive, unsigned int _max) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), transform(_crossover, _pCross, _mutation, _pMut), selectTransform(selectMany, transform), breed(selectTransform), archive(_archive)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
* @param _archive archive
* @param _max the max size for the pop
*/
moeoASEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive, unsigned int _max) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), selectMany(_archive, _max), transform(defaultQuadOp, 0.0, defaultMonOp, 0.0), selectTransform(selectMany, _transform), breed(selectTransform), archive(_archive)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
* @param _archive archive
* @param _max the max size for the pop
*/
moeoASEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive, unsigned int _max) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), selectMany(_archive, _max), transform(defaultQuadOp, 0.0, defaultMonOp, 0.0), selectTransform(selectMany, _transform), breed(selectTransform), archive(_archive)
{}
/**
* Apply a few generation of evolution to the population _pop until the stopping criteria is verified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > empty_pop, offspring;
popEval (empty_pop, _pop); // a first eval of _pop
archive(_pop); // archive update
while (continuator (_pop))
{
// generate offspring
breed (_pop, offspring);
popEval (_pop, offspring); // eval of offspring
// archive (_pop); // archive update
archive (offspring); // archive update
_pop.resize(0);
offspring.resize(0);
}
}
protected:
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >{
public:
void operator()(MOEOT &) {}
}defaultEval;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >{
public :
void operator()(eoPop<MOEOT>&) {}
}defaultTransform;
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select many */
moeoDetArchiveSelect < MOEOT > selectMany; // A REMPLACER !!!!!!!!!!! => add/moeoDetArchiveSelect.h
/** eoTransform */
eoSGATransform < MOEOT > transform;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
//eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** an object for genetic operators (used as default) */
//eoSGAGenOp < MOEOT >& genOp;
/** breeder */
eoBreed < MOEOT > & breed;
/**archive */
moeoArchive < MOEOT > & archive;
};
#endif /*MOEOASEEA_H_*/

47
moeo/src/algo/moeoAlgo.h Normal file
View file

@ -0,0 +1,47 @@
/*
* <moeoAlgo.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef MOEOALGO_H_
#define MOEOALGO_H_
/**
* Abstract class for multi-objective algorithms.
*/
class moeoAlgo
{};
#endif /*MOEOALGO_H_*/

50
moeo/src/algo/moeoEA.h Normal file
View file

@ -0,0 +1,50 @@
/*
* <moeoEA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef MOEOEA_H_
#define MOEOEA_H_
#include <algo/moeoPopAlgo.h>
/**
* Abstract class for multi-objective evolutionary algorithms.
*/
template < class MOEOT >
class moeoEA : public moeoPopAlgo < MOEOT >
{};
#endif /*MOEOEA_H_*/

217
moeo/src/algo/moeoEasyEA.h Executable file
View file

@ -0,0 +1,217 @@
/*
* <moeoEasyEA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef _MOEOEASYEA_H
#define _MOEOEASYEA_H
#include <apply.h>
#include <eoBreed.h>
#include <eoContinue.h>
#include <eoMergeReduce.h>
#include <eoPopEvalFunc.h>
#include <eoSelect.h>
#include <eoTransform.h>
#include <algo/moeoEA.h>
#include <diversity/moeoDiversityAssignment.h>
#include <diversity/moeoDummyDiversityAssignment.h>
#include <fitness/moeoFitnessAssignment.h>
#include <replacement/moeoReplacement.h>
/**
* An easy class to design multi-objective evolutionary algorithms.
*/
template < class MOEOT >
class moeoEasyEA: public moeoEA < MOEOT >
{
public:
/**
* Ctor taking a breed.
* @param _continuator the stopping criteria
* @param _eval the evaluation functions
* @param _breed the breeder
* @param _replace the replacement strategy
* @param _fitnessEval the fitness evaluation scheme
* @param _diversityEval the diversity evaluation scheme
* @param _evalFitAndDivBeforeSelection put this parameter to 'true' if you want to re-evalue the fitness and the diversity of the population before the selection process
*/
moeoEasyEA(eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoBreed < MOEOT > & _breed, moeoReplacement < MOEOT > & _replace, moeoFitnessAssignment < MOEOT > & _fitnessEval, moeoDiversityAssignment < MOEOT > & _diversityEval, bool _evalFitAndDivBeforeSelection = false) :
continuator(_continuator), eval (_eval), loopEval(_eval), popEval(loopEval), selectTransform(dummySelect, dummyTransform), breed(_breed), replace(_replace), fitnessEval(_fitnessEval), diversityEval(_diversityEval), evalFitAndDivBeforeSelection(_evalFitAndDivBeforeSelection)
{}
/**
* Ctor taking a breed and a popEval.
* @param _continuator the stopping criteria
* @param _popEval the evaluation functions for the whole population
* @param _breed the breeder
* @param _replace the replacement strategy
* @param _fitnessEval the fitness evaluation scheme
* @param _diversityEval the diversity evaluation scheme
* @param _evalFitAndDivBeforeSelection put this parameter to 'true' if you want to re-evalue the fitness and the diversity of the population before the selection process
*/
moeoEasyEA(eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoBreed < MOEOT > & _breed, moeoReplacement < MOEOT > & _replace, moeoFitnessAssignment < MOEOT > & _fitnessEval, moeoDiversityAssignment < MOEOT > & _diversityEval, bool _evalFitAndDivBeforeSelection = false) :
continuator(_continuator), eval(dummyEval), loopEval(dummyEval), popEval(_popEval), selectTransform(dummySelect, dummyTransform), breed(_breed), replace(_replace), fitnessEval(_fitnessEval), diversityEval(_diversityEval), evalFitAndDivBeforeSelection(_evalFitAndDivBeforeSelection)
{}
/**
* Ctor taking a select and a transform.
* @param _continuator the stopping criteria
* @param _eval the evaluation functions
* @param _select the selection scheme
* @param _transform the tranformation scheme
* @param _replace the replacement strategy
* @param _fitnessEval the fitness evaluation scheme
* @param _diversityEval the diversity evaluation scheme
* @param _evalFitAndDivBeforeSelection put this parameter to 'true' if you want to re-evalue the fitness and the diversity of the population before the selection process
*/
moeoEasyEA(eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoSelect < MOEOT > & _select, eoTransform < MOEOT > & _transform, moeoReplacement < MOEOT > & _replace, moeoFitnessAssignment < MOEOT > & _fitnessEval, moeoDiversityAssignment < MOEOT > & _diversityEval, bool _evalFitAndDivBeforeSelection = false) :
continuator(_continuator), eval(_eval), loopEval(_eval), popEval(loopEval), selectTransform(_select, _transform), breed(selectTransform), replace(_replace), fitnessEval(_fitnessEval), diversityEval(_diversityEval), evalFitAndDivBeforeSelection(_evalFitAndDivBeforeSelection)
{}
/**
* Ctor taking a select, a transform.and a popEval
* @param _continuator the stopping criteria
* @param _popEval the evaluation functions
* @param _select the selection scheme
* @param _transform the tranformation scheme
* @param _replace the replacement strategy
* @param _fitnessEval the fitness evaluation scheme
* @param _diversityEval the diversity evaluation scheme
* @param _evalFitAndDivBeforeSelection put this parameter to 'true' if you want to re-evalue the fitness and the diversity of the population before the selection process
*/
moeoEasyEA(eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoSelect < MOEOT > & _select, eoTransform < MOEOT > & _transform, moeoReplacement < MOEOT > & _replace, moeoFitnessAssignment < MOEOT > & _fitnessEval, moeoDiversityAssignment < MOEOT > & _diversityEval, bool _evalFitAndDivBeforeSelection = false) :
continuator(_continuator), eval(dummyEval), loopEval(dummyEval), popEval(_popEval), selectTransform(_select, _transform), breed(selectTransform), replace(_replace), fitnessEval(_fitnessEval), diversityEval(_diversityEval), evalFitAndDivBeforeSelection(_evalFitAndDivBeforeSelection)
{}
/**
* Applies a few generation of evolution to the population _pop.
* @param _pop the population
*/
virtual void operator()(eoPop < MOEOT > & _pop)
{
eoPop < MOEOT > offspring, empty_pop;
popEval(empty_pop, _pop); // A first eval of pop.
bool firstTime = true;
do
{
try
{
unsigned int pSize = _pop.size();
offspring.clear(); // new offspring
// fitness and diversity assignment (if you want to or if it is the first generation)
if (evalFitAndDivBeforeSelection || firstTime)
{
firstTime = false;
//std::cout << "fitness eval" << std::endl;
fitnessEval(_pop);
//std::cout << "diversity eval" << std::endl;
diversityEval(_pop);
}
breed(_pop, offspring);
popEval(_pop, offspring); // eval of parents + offspring if necessary
replace(_pop, offspring); // after replace, the new pop. is in _pop
if (pSize > _pop.size())
{
throw std::runtime_error("Population shrinking!");
}
else if (pSize < _pop.size())
{
throw std::runtime_error("Population growing!");
}
}
catch (std::exception& e)
{
std::string s = e.what();
s.append( " in moeoEasyEA");
throw std::runtime_error( s );
}
}
while (continuator(_pop));
}
protected:
/** the stopping criteria */
eoContinue < MOEOT > & continuator;
/** a dummy eval */
class eoDummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
dummyEval;
/** the evaluation functions */
eoEvalFunc < MOEOT > & eval;
/** to evaluate the whole population */
eoPopLoopEval < MOEOT > loopEval;
/** to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** dummy select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
dummySelect;
/** breed: a select followed by a transform */
eoSelectTransform < MOEOT > selectTransform;
/** dummy transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
dummyTransform;
/** the breeder */
eoBreed < MOEOT > & breed;
/** the replacment strategy */
moeoReplacement < MOEOT > & replace;
/** the fitness assignment strategy */
moeoFitnessAssignment < MOEOT > & fitnessEval;
/** the diversity assignment strategy */
moeoDiversityAssignment < MOEOT > & diversityEval;
/** if this parameter is set to 'true', the fitness and the diversity of the whole population will be re-evaluated before the selection process */
bool evalFitAndDivBeforeSelection;
};
#endif /*MOEOEASYEA_H_*/

225
moeo/src/algo/moeoIBEA.h Normal file
View file

@ -0,0 +1,225 @@
/*
* <moeoIBEA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef MOEOIBEA_H_
#define MOEOIBEA_H_
#include <eoBreed.h>
#include <eoCloneOps.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <diversity/moeoDummyDiversityAssignment.h>
#include <fitness/moeoExpBinaryIndicatorBasedFitnessAssignment.h>
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
#include <replacement/moeoEnvironmentalReplacement.h>
#include <selection/moeoDetTournamentSelect.h>
/**
* IBEA (Indicator-Based Evolutionary Algorithm).
* E. Zitzler, S. Künzli, "Indicator-Based Selection in Multiobjective Search", Proc. 8th International Conference on Parallel Problem Solving from Nature (PPSN VIII), pp. 832-842, Birmingham, UK (2004).
* This class builds the IBEA algorithm only by using the fine-grained components of the ParadisEO-MOEO framework.
*/
template < class MOEOT >
class moeoIBEA : public moeoEA < MOEOT >
{
public:
/** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen maximum number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _metric metric
* @param _kappa scaling factor kappa
*/
moeoIBEA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa=0.05) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select (2), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), genBreed (select, defaultSGAGenOp), breed (genBreed), fitnessAssignment(_metric, _kappa), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoGenOp.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op variation operators
* @param _metric metric
* @param _kappa scaling factor kappa
*/
moeoIBEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa=0.05) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), fitnessAssignment(_metric, _kappa), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoGenOp.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _op variation operators
* @param _metric metric
* @param _kappa scaling factor kappa
*/
moeoIBEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoGenOp < MOEOT > & _op, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa=0.05) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), fitnessAssignment(_metric, _kappa), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
* @param _metric metric
* @param _kappa scaling factor kappa
*/
moeoIBEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa=0.05) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), fitnessAssignment(_metric, _kappa), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
* @param _metric metric
* @param _kappa scaling factor kappa
*/
moeoIBEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa=0.05) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), fitnessAssignment(_metric, _kappa), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Apply the algorithm to the population _pop until the stopping criteria is satified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > offspring, empty_pop;
popEval (empty_pop, _pop); // a first eval of _pop
// evaluate fitness and diversity
fitnessAssignment(_pop);
diversityAssignment(_pop);
do
{
// generate offspring, worths are recalculated if necessary
breed (_pop, offspring);
// eval of offspring
popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring);
}
while (continuator (_pop));
}
protected:
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
defaultEval;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
defaultSelect;
/** binary tournament selection */
moeoDetTournamentSelect < MOEOT > select;
/** default select many */
eoSelectMany < MOEOT > selectMany;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
defaultTransform;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** breeder */
eoBreed < MOEOT > & breed;
/** fitness assignment used in IBEA */
moeoExpBinaryIndicatorBasedFitnessAssignment < MOEOT > fitnessAssignment;
/** dummy diversity assignment */
moeoDummyDiversityAssignment < MOEOT > diversityAssignment;
/** environmental replacement */
moeoEnvironmentalReplacement < MOEOT > replace;
};
#endif /*MOEOIBEA_H_*/

213
moeo/src/algo/moeoMOGA.h Normal file
View file

@ -0,0 +1,213 @@
/*
* <moeoNSGA.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 MOEOMOGA_H_
#define MOEOMOGA_H_
#include <eoBreed.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
#include <fitness/moeoDominanceRankFitnessAssignment.h>
#include <replacement/moeoElitistReplacement.h>
#include <selection/moeoDetTournamentSelect.h>
/**
* MOGA.
*/
template < class MOEOT >
class moeoMOGA: public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen maximum number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _nicheSize niche size
*/
moeoMOGA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, double _nicheSize = 0.5) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select (2), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), genBreed (select, defaultSGAGenOp), breed (genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoGenOp.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op variation operators
* @param _nicheSize niche size
*/
moeoMOGA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoGenOp.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _op variation operators
* @param _nicheSize niche size
*/
moeoMOGA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoGenOp < MOEOT > & _op, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
* @param _nicheSize niche size
*/
moeoMOGA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), diversityAssignment(_nicheSize), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
* @param _nicheSize niche size
*/
moeoMOGA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), diversityAssignment(_nicheSize), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Apply the algorithm to the population _pop until the stopping criteria is satified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > offspring, empty_pop;
popEval (empty_pop, _pop); // a first eval of _pop
// evaluate fitness and diversity
fitnessAssignment(_pop);
diversityAssignment(_pop);
do
{
// generate offspring, worths are recalculated if necessary
breed (_pop, offspring);
// eval of offspring
popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring);
}
while (continuator (_pop));
}
protected:
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
defaultEval;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
defaultSelect;
/** binary tournament selection */
moeoDetTournamentSelect < MOEOT > select;
/** default select many */
eoSelectMany < MOEOT > selectMany;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
defaultTransform;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** breeder */
eoBreed < MOEOT > & breed;
/** fitness assignment used in NSGA-II */
moeoDominanceRankFitnessAssignment < MOEOT > fitnessAssignment;
/** diversity assignment used in NSGA-II */
moeoFrontByFrontSharingDiversityAssignment < MOEOT > diversityAssignment;
/** elitist replacement */
moeoElitistReplacement < MOEOT > replace;
};
#endif /*MOEOMOGA_H_*/

215
moeo/src/algo/moeoNSGA.h Normal file
View file

@ -0,0 +1,215 @@
/*
* <moeoNSGA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef MOEONSGA_H_
#define MOEONSGA_H_
#include <eoBreed.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
#include <fitness/moeoDominanceDepthFitnessAssignment.h>
#include <replacement/moeoElitistReplacement.h>
#include <selection/moeoDetTournamentSelect.h>
/**
* NSGA (Non-dominated Sorting Genetic Algorithm).
* N. Srinivas, K. Deb, "Multiobjective Optimization Using Nondominated Sorting in Genetic Algorithms".
* Evolutionary Computation, Vol. 2(3), No 2, pp. 221-248 (1994).
* This class builds the NSGA algorithm only by using the fine-grained components of the ParadisEO-MOEO framework.
*/
template < class MOEOT >
class moeoNSGA: public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen maximum number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _nicheSize niche size
*/
moeoNSGA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, double _nicheSize = 0.5) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select (2), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), genBreed (select, defaultSGAGenOp), breed (genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoGenOp.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op variation operators
* @param _nicheSize niche size
*/
moeoNSGA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoGenOp.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _op variation operators
* @param _nicheSize niche size
*/
moeoNSGA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoGenOp < MOEOT > & _op, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), diversityAssignment(_nicheSize), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
* @param _nicheSize niche size
*/
moeoNSGA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), diversityAssignment(_nicheSize), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
* @param _nicheSize niche size
*/
moeoNSGA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, double _nicheSize = 0.5) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), diversityAssignment(_nicheSize), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Apply the algorithm to the population _pop until the stopping criteria is satified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > offspring, empty_pop;
popEval (empty_pop, _pop); // a first eval of _pop
// evaluate fitness and diversity
fitnessAssignment(_pop);
diversityAssignment(_pop);
do
{
// generate offspring, worths are recalculated if necessary
breed (_pop, offspring);
// eval of offspring
popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring);
}
while (continuator (_pop));
}
protected:
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
defaultEval;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
defaultSelect;
/** binary tournament selection */
moeoDetTournamentSelect < MOEOT > select;
/** default select many */
eoSelectMany < MOEOT > selectMany;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
defaultTransform;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** breeder */
eoBreed < MOEOT > & breed;
/** fitness assignment used in NSGA-II */
moeoDominanceDepthFitnessAssignment < MOEOT > fitnessAssignment;
/** diversity assignment used in NSGA-II */
moeoFrontByFrontSharingDiversityAssignment < MOEOT > diversityAssignment;
/** elitist replacement */
moeoElitistReplacement < MOEOT > replace;
};
#endif /*MOEONSGA_H_*/

210
moeo/src/algo/moeoNSGAII.h Normal file
View file

@ -0,0 +1,210 @@
/*
* <moeoNSGAII.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
#ifndef MOEONSGAII_H_
#define MOEONSGAII_H_
#include <eoBreed.h>
#include <eoCloneOps.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <diversity/moeoFrontByFrontCrowdingDiversityAssignment.h>
#include <fitness/moeoDominanceDepthFitnessAssignment.h>
#include <replacement/moeoElitistReplacement.h>
#include <selection/moeoDetTournamentSelect.h>
/**
* NSGA-II (Non-dominated Sorting Genetic Algorithm II).
* Deb, K., S. Agrawal, A. Pratap, and T. Meyarivan. A fast elitist non-dominated sorting genetic algorithm for multi-objective optimization: NSGA-II. IEEE Transactions on Evolutionary Computation, Vol. 6, No 2, pp 182-197 (2002).
* This class builds the NSGA-II algorithm only by using the fine-grained components of the ParadisEO-MOEO framework.
*/
template < class MOEOT >
class moeoNSGAII: public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen maximum number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
*/
moeoNSGAII (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select (2), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), genBreed (select, defaultSGAGenOp), breed (genBreed), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoGenOp.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op variation operators
*/
moeoNSGAII (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoGenOp.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _op variation operators
*/
moeoNSGAII (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoGenOp < MOEOT > & _op) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(2),
selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), replace (fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
*/
moeoNSGAII (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
*/
moeoNSGAII (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval),
select(2), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), replace(fitnessAssignment, diversityAssignment)
{}
/**
* Apply a the algorithm to the population _pop until the stopping criteria is satified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > offspring, empty_pop;
popEval (empty_pop, _pop); // a first eval of _pop
// evaluate fitness and diversity
fitnessAssignment(_pop);
diversityAssignment(_pop);
do
{
// generate offspring, worths are recalculated if necessary
breed (_pop, offspring);
// eval of offspring
popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring);
}
while (continuator (_pop));
}
protected:
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
defaultEval;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
defaultSelect;
/** binary tournament selection */
moeoDetTournamentSelect < MOEOT > select;
/** default select many */
eoSelectMany < MOEOT > selectMany;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
defaultTransform;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** breeder */
eoBreed < MOEOT > & breed;
/** fitness assignment used in NSGA */
moeoDominanceDepthFitnessAssignment < MOEOT > fitnessAssignment;
/** diversity assignment used in NSGA-II */
moeoFrontByFrontCrowdingDiversityAssignment < MOEOT > diversityAssignment;
/** elitist replacement */
moeoElitistReplacement < MOEOT > replace;
};
#endif /*MOEONSGAII_H_*/

87
moeo/src/algo/moeoPLS1.h Normal file
View file

@ -0,0 +1,87 @@
/*
* <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 177199
*/
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
* @param _neighborhood a neighborhood
* @param _incrEval neighbor evaluation function
*/
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_*/

95
moeo/src/algo/moeoPLS2.h Normal file
View file

@ -0,0 +1,95 @@
/*
* <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 416428
*
* 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 7286
*
* 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 153176
*/
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 _neighborhood a neighborhood
* @param _incrEval neighbor evaluation function
*/
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_*/

View file

@ -0,0 +1,52 @@
/*
* <moeoPopAlgo.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 MOEOPOPALGO_H_
#define MOEOPOPALGO_H_
#include <eoAlgo.h>
#include <algo/moeoAlgo.h>
/**
* Abstract class for population based multi-objective evolutionary algorithms.
*/
template < class MOEOT >
class moeoPopAlgo : public moeoAlgo, public eoAlgo < MOEOT >
{};
#endif /*MOEOPOPALGO_H_*/

50
moeo/src/algo/moeoPopLS.h Executable file
View 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_*/

211
moeo/src/algo/moeoSEEA.h Normal file
View file

@ -0,0 +1,211 @@
/*
* <moeoSEEA.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
#ifndef MOEOSEEA_H_
#define MOEOSEEA_H_
#include <eoBreed.h>
#include <eoCloneOps.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <archive/moeoArchive.h>
#include <replacement/moeoGenerationalReplacement.h>
#include <selection/moeoRandomSelect.h>
#include <selection/moeoSelectFromPopAndArch.h>
/**
* SEEA (Simple Elitist Evolutionary Algorithm).
* Liefooghe A. Jourdan L., Talbi E.-G.. Metaheuristics and Their Hybridization to Solve the Bi-objective Ring Star Problem: a Comparative Study. Technical Report RR-6515, INRIA, 2008
* This class builds SEEA by using the fine-grained components of the ParadisEO-MOEO framework.
*/
template < class MOEOT >
class moeoSEEA : public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
*/
moeoSEEA (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT > & _archive) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(randomSelect, _archive, 0.0), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), genBreed (select, defaultSGAGenOp), breed (genBreed), archive(_archive)
{}
/**
* Ctor with a eoContinue and a eoGenOp.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op variation operators
* @param _archive archive
*/
moeoSEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(randomSelect, _archive, 0.0), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), archive(_archive)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoGenOp.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _op variation operators
* @param _archive archive
*/
moeoSEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(randomSelect, _archive, 0.0), selectMany(select,0.0), selectTransform(defaultSelect, defaultTransform), defaultSGAGenOp(defaultQuadOp, 1.0, defaultMonOp, 1.0), genBreed(select, _op), breed(genBreed), archive(_archive)
{}
/**
* Ctor with a eoContinue and a eoTransform.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _transform variation operator
* @param _archive archive
*/
moeoSEEA (eoContinue < MOEOT > & _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), defaultPopEval(_eval), popEval(defaultPopEval), select(randomSelect, _archive, 0.0), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), archive(_archive)
{}
/**
* Ctor with a eoContinue, a eoPopEval and a eoTransform.
* @param _continuator stopping criteria
* @param _popEval population evaluation function
* @param _transform variation operator
* @param _archive archive
*/
moeoSEEA (eoContinue < MOEOT > & _continuator, eoPopEvalFunc < MOEOT > & _popEval, eoTransform < MOEOT > & _transform, moeoArchive < MOEOT > & _archive) :
defaultGenContinuator(0), continuator(_continuator), eval(defaultEval), defaultPopEval(eval), popEval(_popEval), select(randomSelect, _archive, 0.0), selectMany(select, 1.0), selectTransform(selectMany, _transform), defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), genBreed(select, defaultSGAGenOp), breed(selectTransform), archive(_archive)
{}
/**
* Apply a few generation of evolution to the population _pop until the stopping criteria is verified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT > empty_pop, offspring;
popEval (empty_pop, _pop); // a first eval of _pop
archive(_pop); // archive update
while (continuator (_pop))
{
// generate offspring, worths are recalculated if necessary
genBreed (_pop, offspring);
popEval (_pop, offspring); // eval of offspring
// after replace, the new pop is in _pop
// replace (_pop, offspring);
// archive (_pop); // archive update
archive(offspring);
// _pop.resize(0);
// offspring.resize(0);
}
}
protected:
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** default eval */
class DummyEval : public eoEvalFunc < MOEOT >
{
public:
void operator()(MOEOT &) {}
}
defaultEval;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** default popEval */
eoPopLoopEval < MOEOT > defaultPopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/** default select */
class DummySelect : public eoSelect < MOEOT >
{
public :
void operator()(const eoPop<MOEOT>&, eoPop<MOEOT>&) {}
}
defaultSelect;
/** random select */
moeoRandomSelect < MOEOT > randomSelect;
/** elitist selection */
moeoSelectFromPopAndArch < MOEOT > select;
/** default select many */
eoSelectMany < MOEOT > selectMany;
/** select transform */
eoSelectTransform < MOEOT > selectTransform;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** default transform */
class DummyTransform : public eoTransform < MOEOT >
{
public :
void operator()(eoPop<MOEOT>&) {}
}
defaultTransform;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** breeder */
eoBreed < MOEOT > & breed;
/** generational replacement */
moeoGenerationalReplacement < MOEOT > replace;
/**archive*/
moeoArchive < MOEOT >& archive;
};
#endif /*MOEOSEEA_H_*/

278
moeo/src/algo/moeoSPEA2.h Normal file
View file

@ -0,0 +1,278 @@
/*
* <moeoSPEA2.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie Humeau
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
// moeoSPEA2.h
//-----------------------------------------------------------------------------
#ifndef MOEOSPEA2_H_
#define MOEOSPEA2_H_
#include <eoBreed.h>
#include <eoCloneOps.h>
#include <eoContinue.h>
#include <eoEvalFunc.h>
#include <eoGenContinue.h>
#include <eoGeneralBreeder.h>
#include <eoGenOp.h>
#include <eoPopEvalFunc.h>
#include <eoSGAGenOp.h>
#include <algo/moeoEA.h>
#include <diversity/moeoNearestNeighborDiversityAssignment.h>
#include <fitness/moeoDominanceCountFitnessAssignment.h>
#include <fitness/moeoDominanceCountRankingFitnessAssignment.h>
#include <replacement/moeoGenerationalReplacement.h>
#include <selection/moeoDetTournamentSelect.h>
#include <archive/moeoFixedSizeArchive.h>
#include <distance/moeoEuclideanDistance.h>
#include <selection/moeoSelectFromPopAndArch.h>
/**
* SPEA2 algorithm.
* E. Zitzler, M. Laumanns, and L. Thiele. SPEA2: Improving the Strength Pareto Evolutionary Algorithm. Technical Report 103,
* Computer Engineering and Networks Laboratory (TIK), ETH Zurich, Zurich, Switzerland, 2001.
*/
template < class MOEOT >
class moeoSPEA2: public moeoEA < MOEOT >
{
public:
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _maxGen number of generations before stopping
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (unsigned int _maxGen, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(_maxGen), continuator(defaultGenContinuator), eval(_eval), loopEval(_eval), popEval(loopEval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), fitnessAssignment(_archive, _nocopy),
genBreed(defaultSelect, defaultSGAGenOp),selectMany(defaultSelect,0.0), selectTransform(selectMany, dummyTransform), breed(genBreed), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), loopEval(_eval), popEval(loopEval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), fitnessAssignment(_archive, _nocopy),
genBreed(defaultSelect, defaultSGAGenOp),selectMany(defaultSelect,0.0), selectTransform(selectMany, dummyTransform), breed(genBreed), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval pop evaluation function
* @param _crossover crossover
* @param _pCross crossover probability
* @param _mutation mutation
* @param _pMut mutation probability
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoPopEvalFunc < MOEOT > & _eval, eoQuadOp < MOEOT > & _crossover, double _pCross, eoMonOp < MOEOT > & _mutation, double _pMut, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator), eval(dummyEval), loopEval(dummyEval), popEval(_eval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(_crossover, _pCross, _mutation, _pMut), fitnessAssignment(_archive, _nocopy),
genBreed(defaultSelect, defaultSGAGenOp),selectMany(defaultSelect,0.0), selectTransform(selectMany, dummyTransform), breed(genBreed), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op general operator
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), loopEval(_eval), popEval(loopEval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), fitnessAssignment(_archive, _nocopy),
genBreed(select, _op),selectMany(defaultSelect,0.0), selectTransform(selectMany, dummyTransform), breed(genBreed), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval evaluation function
* @param _op transformer
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _op, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator), eval(_eval), loopEval(_eval), popEval(loopEval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), fitnessAssignment(_archive, _nocopy),
genBreed(defaultSelect, defaultSGAGenOp),selectMany(select,1.0), selectTransform(selectMany, _op), breed(selectTransform), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval pop evaluation function
* @param _op general operator
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoPopEvalFunc < MOEOT > & _eval, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT >& _archive, unsigned int _k=1, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator),eval(dummyEval), loopEval(dummyEval), popEval(_eval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), fitnessAssignment(_archive, _nocopy),
genBreed(select, _op),selectMany(defaultSelect,0.0), selectTransform(selectMany, dummyTransform), breed(genBreed), diversityAssignment(dist,_archive, _k)
{}
/**
* Ctor with a crossover, a mutation and their corresponding rates.
* @param _continuator stopping criteria
* @param _eval pop evaluation function
* @param _op transformer
* @param _archive archive
* @param _k the k-ieme distance used to fixe diversity
* @param _nocopy boolean allow to consider copies and doublons as bad elements whose were dominated by all other MOEOT in fitness assignment.
*/
moeoSPEA2 (eoContinue < MOEOT >& _continuator, eoPopEvalFunc < MOEOT > & _eval, eoTransform < MOEOT > & _op, moeoArchive < MOEOT >& _archive, unsigned int _k=100, bool _nocopy=false) :
defaultGenContinuator(0), continuator(_continuator),eval(dummyEval), loopEval(dummyEval), popEval(_eval), archive(_archive),defaultSelect(2),select(defaultSelect, defaultSelect, _archive, 0.0),
defaultSGAGenOp(defaultQuadOp, 0.0, defaultMonOp, 0.0), fitnessAssignment(_archive, _nocopy),
genBreed(defaultSelect, defaultSGAGenOp),selectMany(select,1.0), selectTransform(selectMany, _op), breed(selectTransform), diversityAssignment(dist,_archive, _k)
{}
/**
* Apply a few generation of evolution to the population _pop until the stopping criteria is verified.
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > &_pop)
{
eoPop < MOEOT >empty_pop, offspring;
popEval (empty_pop, _pop);// a first eval of _pop
fitnessAssignment(_pop); //a first fitness assignment of _pop
diversityAssignment(_pop);//a first diversity assignment of _pop
archive(_pop);//a first filling of archive
while (continuator (_pop))
{
// generate offspring, worths are recalculated if necessary
breed (_pop, offspring);
popEval (_pop, offspring); // eval of offspring
// after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring);
fitnessAssignment(_pop); //fitness assignment of _pop
diversityAssignment(_pop); //diversity assignment of _pop
archive(_pop); //control of archive
}
}
protected:
/** dummy evaluation */
class eoDummyEval : public eoEvalFunc< MOEOT >
{
public:
void operator()(MOEOT &) {}
}
dummyEval;
/** dummy transform */
class eoDummyTransform : public eoTransform<MOEOT>
{
public :
void operator()(eoPop<MOEOT>&) {}
}
dummyTransform;
/** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator;
/** stopping criteria */
eoContinue < MOEOT > & continuator;
/** evaluation function */
eoEvalFunc < MOEOT > & eval;
/** loop eval */
eoPopLoopEval < MOEOT > loopEval;
/** evaluation function used to evaluate the whole population */
eoPopEvalFunc < MOEOT > & popEval;
/**archive*/
moeoArchive < MOEOT >& archive;
/**SelectOne*/
moeoDetTournamentSelect < MOEOT > defaultSelect;
/** binary tournament selection */
moeoSelectFromPopAndArch < MOEOT > select;
/** a default mutation */
eoMonCloneOp < MOEOT > defaultMonOp;
/** a default crossover */
eoQuadCloneOp < MOEOT > defaultQuadOp;
/** an object for genetic operators (used as default) */
eoSGAGenOp < MOEOT > defaultSGAGenOp;
/** fitness assignment used in NSGA-II */
moeoDominanceCountRankingFitnessAssignment < MOEOT > fitnessAssignment;
/** general breeder */
eoGeneralBreeder < MOEOT > genBreed;
/** selectMany */
eoSelectMany <MOEOT> selectMany;
/** select Transform*/
eoSelectTransform <MOEOT> selectTransform;
/** breeder */
eoBreed < MOEOT > & breed;
/** diversity assignment used in NSGA-II */
moeoNearestNeighborDiversityAssignment < MOEOT > diversityAssignment;
/** elitist replacement */
moeoGenerationalReplacement < MOEOT > replace;
/**distance*/
moeoEuclideanDistance < MOEOT > dist;
};
#endif /*MOEOSPEA2_H_*/

View file

@ -0,0 +1,149 @@
/*
* <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 Neighbor >
class moeoUnifiedDominanceBasedLS : public moeoPopLS < Neighbor >
{
public:
/** Alias for the type */
typedef typename Neighbor::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 < Neighbor > & _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 < Neighbor > & 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++;
}
//if (res==false)
//std::cout << "[Natural stop]" << std::endl;
return res;
}
} naturalContinuator;
};
#endif /*MOEOUNIFIEDDOMINANCEBASEDLS_H_*/