deleted files dedicated to 1.0
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@562 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
16bc4e9ab9
commit
83492c77ff
5 changed files with 0 additions and 735 deletions
|
|
@ -1,280 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// moeoIBMOLS.h
|
||||
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||
/*
|
||||
This library...
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOIBMOLS_H_
|
||||
#define MOEOIBMOLS_H_
|
||||
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoPop.h>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* Indicator-Based Multi-Objective Local Search (IBMOLS) as described in
|
||||
* Basseur M., Burke K. : "Indicator-Based Multi-Objective Local Search" (2007).
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the neighborhood explorer
|
||||
* @param _eval the full evaluation
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _fitnessAssignment the fitness assignment strategy
|
||||
* @param _continuator the stopping criteria
|
||||
*/
|
||||
moeoIBMOLS(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||
moeoIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator
|
||||
) :
|
||||
moveInit(_moveInit),
|
||||
nextMove(_nextMove),
|
||||
eval(_eval),
|
||||
moveIncrEval(_moveIncrEval),
|
||||
fitnessAssignment (_fitnessAssignment),
|
||||
continuator (_continuator)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the local search until a local archive does not change or
|
||||
* another stopping criteria is met and update the archive _arch with new non-dominated solutions.
|
||||
* @param _pop the initial population
|
||||
* @param _arch the (updated) archive
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
// evaluation of the objective values
|
||||
/*
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
eval(_pop[i]);
|
||||
}
|
||||
*/
|
||||
// fitness assignment for the whole population
|
||||
fitnessAssignment(_pop);
|
||||
// creation of a local archive
|
||||
moeoArchive < MOEOT > archive;
|
||||
// creation of another local archive (for the stopping criteria)
|
||||
moeoArchive < MOEOT > previousArchive;
|
||||
// update the archive with the initial population
|
||||
archive.update(_pop);
|
||||
do
|
||||
{
|
||||
previousArchive.update(archive);
|
||||
oneStep(_pop);
|
||||
archive.update(_pop);
|
||||
} while ( (! archive.equals(previousArchive)) && (continuator(_arch)) );
|
||||
_arch.update(archive);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the move initializer */
|
||||
moMoveInit < Move > & moveInit;
|
||||
/** the neighborhood explorer */
|
||||
moNextMove < Move > & nextMove;
|
||||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the incremental evaluation */
|
||||
moeoMoveIncrEval < Move > & moveIncrEval;
|
||||
/** the fitness assignment strategy */
|
||||
moeoIndicatorBasedFitnessAssignment < MOEOT > & fitnessAssignment;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void oneStep (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
////////////////////////////////////////////
|
||||
int ext_0_idx, ext_1_idx;
|
||||
ObjectiveVector ext_0_objVec, ext_1_objVec;
|
||||
///////////////////////////////////////////
|
||||
// the move
|
||||
Move move;
|
||||
// the objective vector and the fitness of the current solution
|
||||
ObjectiveVector x_objVec;
|
||||
double x_fitness;
|
||||
// the index, the objective vector and the fitness of the worst solution in the population (-1 implies that the worst is the newly created one)
|
||||
int worst_idx;
|
||||
ObjectiveVector worst_objVec;
|
||||
double worst_fitness;
|
||||
// the index current of the current solution to be explored
|
||||
unsigned int i=0;
|
||||
// initilization of the move for the first individual
|
||||
moveInit(move, _pop[i]);
|
||||
while (i<_pop.size() && continuator(_pop))
|
||||
{
|
||||
// x = one neigbour of pop[i]
|
||||
// evaluate x in the objective space
|
||||
x_objVec = moveIncrEval(move, _pop[i]);
|
||||
// update every fitness values to take x into account and compute the fitness of x
|
||||
x_fitness = fitnessAssignment.updateByAdding(_pop, x_objVec);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// qui sont les extremes ? (=> min only !!!)
|
||||
ext_0_idx = -1;
|
||||
ext_0_objVec = x_objVec;
|
||||
ext_1_idx = -1;
|
||||
ext_1_objVec = x_objVec;
|
||||
for (unsigned int k=0; k<_pop.size(); k++)
|
||||
{
|
||||
// ext_0
|
||||
if (_pop[k].objectiveVector()[0] < ext_0_objVec[0])
|
||||
{
|
||||
ext_0_idx = k;
|
||||
ext_0_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
else if ( (_pop[k].objectiveVector()[0] == ext_0_objVec[0]) && (_pop[k].objectiveVector()[1] < ext_0_objVec[1]) )
|
||||
{
|
||||
ext_0_idx = k;
|
||||
ext_0_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
// ext_1
|
||||
else if (_pop[k].objectiveVector()[1] < ext_1_objVec[1])
|
||||
{
|
||||
ext_1_idx = k;
|
||||
ext_1_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
else if ( (_pop[k].objectiveVector()[1] == ext_1_objVec[1]) && (_pop[k].objectiveVector()[0] < ext_1_objVec[0]) )
|
||||
{
|
||||
ext_1_idx = k;
|
||||
ext_1_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
}
|
||||
// worst init
|
||||
if (ext_0_idx == -1)
|
||||
{
|
||||
unsigned int ind = 0;
|
||||
while (ind == ext_1_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else if (ext_1_idx == -1)
|
||||
{
|
||||
unsigned int ind = 0;
|
||||
while (ind == ext_0_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else
|
||||
{
|
||||
worst_idx = -1;
|
||||
worst_objVec = x_objVec;
|
||||
worst_fitness = x_fitness;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// who is the worst ?
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
if ( (j!=ext_0_idx) && (j!=ext_1_idx) )
|
||||
{
|
||||
if (_pop[j].fitness() < worst_fitness)
|
||||
{
|
||||
worst_idx = j;
|
||||
worst_objVec = _pop[j].objectiveVector();
|
||||
worst_fitness = _pop[j].fitness();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is the new one
|
||||
if (worst_idx == -1)
|
||||
{
|
||||
// if all its neighbours have been explored,
|
||||
// let's explore the neighborhoud of the next individual
|
||||
if (! nextMove(move, _pop[i]))
|
||||
{
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is located before _pop[i]
|
||||
else if (worst_idx <= i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[worst_idx]
|
||||
_pop[worst_idx] = _pop[i];
|
||||
move(_pop[worst_idx]);
|
||||
_pop[worst_idx].objectiveVector(x_objVec);
|
||||
_pop[worst_idx].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the next individual
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// if the worst solution is located after _pop[i]
|
||||
else if (worst_idx > i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[i+1] and _pop[worst_idx] is deleted
|
||||
_pop[worst_idx] = _pop[i+1];
|
||||
_pop[i+1] = _pop[i];
|
||||
move(_pop[i+1]);
|
||||
_pop[i+1].objectiveVector(x_objVec);
|
||||
_pop[i+1].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the individual _pop[i+2]
|
||||
i += 2;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// update fitness values
|
||||
fitnessAssignment.updateByDeleting(_pop, worst_objVec);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOIBMOLS_H_*/
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// moeoIteratedIBMOLS.h
|
||||
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||
/*
|
||||
This library...
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOITERATEDIBMOLS_H_
|
||||
#define MOEOITERATEDIBMOLS_H_
|
||||
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoOp.h>
|
||||
#include <eoPop.h>
|
||||
#include <utils/rnd_generators.h>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <algo/moeoIBMOLS.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
|
||||
|
||||
|
||||
//#include <rsCrossQuad.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Iterated version of IBMOLS as described in
|
||||
* Basseur M., Burke K. : "Indicator-Based Multi-Objective Local Search" (2007).
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
class moeoIteratedIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the neighborhood explorer
|
||||
* @param _eval the full evaluation
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _fitnessAssignment the fitness assignment strategy
|
||||
* @param _continuator the stopping criteria
|
||||
* @param _monOp the monary operator
|
||||
* @param _randomMonOp the random monary operator (or random initializer)
|
||||
* @param _nNoiseIterations the number of iterations to apply the random noise
|
||||
*/
|
||||
moeoIteratedIBMOLS(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||
moeoIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator,
|
||||
eoMonOp < MOEOT > & _monOp,
|
||||
eoMonOp < MOEOT > & _randomMonOp,
|
||||
unsigned int _nNoiseIterations=1
|
||||
) :
|
||||
ibmols(_moveInit, _nextMove, _eval, _moveIncrEval, _fitnessAssignment, _continuator),
|
||||
eval(_eval),
|
||||
continuator(_continuator),
|
||||
monOp(_monOp),
|
||||
randomMonOp(_randomMonOp),
|
||||
nNoiseIterations(_nNoiseIterations)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the local search iteratively until the stopping criteria is met.
|
||||
* @param _pop the initial population
|
||||
* @param _arch the (updated) archive
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
_arch.update(_pop);
|
||||
ibmols(_pop, _arch);
|
||||
while (continuator(_arch))
|
||||
{
|
||||
// generate new solutions from the archive
|
||||
generateNewSolutions(_pop, _arch);
|
||||
// apply the local search (the global archive is updated in the sub-function)
|
||||
ibmols(_pop, _arch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the local search to iterate */
|
||||
moeoIBMOLS < MOEOT, Move > ibmols;
|
||||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
/** the monary operator */
|
||||
eoMonOp < MOEOT > & monOp;
|
||||
/** the random monary operator (or random initializer) */
|
||||
eoMonOp < MOEOT > & randomMonOp;
|
||||
/** the number of iterations to apply the random noise */
|
||||
unsigned int nNoiseIterations;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new population randomly initialized and/or initialized from the archive _arch.
|
||||
* @param _pop the output population
|
||||
* @param _arch the archive
|
||||
*/
|
||||
void generateNewSolutions(eoPop < MOEOT > & _pop, const moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
// shuffle vector for the random selection of individuals
|
||||
vector<unsigned int> shuffle;
|
||||
shuffle.resize(std::max(_pop.size(), _arch.size()));
|
||||
// init shuffle
|
||||
for (unsigned int i=0; i<shuffle.size(); i++)
|
||||
{
|
||||
shuffle[i] = i;
|
||||
}
|
||||
// randomize shuffle
|
||||
UF_random_generator <unsigned int> gen;
|
||||
std::random_shuffle(shuffle.begin(), shuffle.end(), gen);
|
||||
// start the creation of new solutions
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
if (shuffle[i] < _arch.size())
|
||||
// the given archive contains the individual i
|
||||
{
|
||||
// add it to the resulting pop
|
||||
_pop[i] = _arch[shuffle[i]];
|
||||
// then, apply the operator nIterationsNoise times
|
||||
for (unsigned int j=0; j<nNoiseIterations; j++)
|
||||
{
|
||||
monOp(_pop[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
// a randomly generated solution needs to be added
|
||||
{
|
||||
// random initialization
|
||||
randomMonOp(_pop[i]);
|
||||
}
|
||||
// evaluation of the new individual
|
||||
_pop[i].invalidate();
|
||||
eval(_pop[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// A DEVELOPPER RAPIDEMENT POUR TESTER AVEC CROSSOVER //
|
||||
/*
|
||||
void generateNewSolutions2(eoPop < MOEOT > & _pop, const moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
// here, we must have a QuadOp !
|
||||
//eoQuadOp < MOEOT > quadOp;
|
||||
rsCrossQuad quadOp;
|
||||
// shuffle vector for the random selection of individuals
|
||||
vector<unsigned int> shuffle;
|
||||
shuffle.resize(_arch.size());
|
||||
// init shuffle
|
||||
for (unsigned int i=0; i<shuffle.size(); i++)
|
||||
{
|
||||
shuffle[i] = i;
|
||||
}
|
||||
// randomize shuffle
|
||||
UF_random_generator <unsigned int int> gen;
|
||||
std::random_shuffle(shuffle.begin(), shuffle.end(), gen);
|
||||
// start the creation of new solutions
|
||||
unsigned int i=0;
|
||||
while ((i<_pop.size()-1) && (i<_arch.size()-1))
|
||||
{
|
||||
_pop[i] = _arch[shuffle[i]];
|
||||
_pop[i+1] = _arch[shuffle[i+1]];
|
||||
// then, apply the operator nIterationsNoise times
|
||||
for (unsigned int j=0; j<nNoiseIterations; j++)
|
||||
{
|
||||
quadOp(_pop[i], _pop[i+1]);
|
||||
}
|
||||
eval(_pop[i]);
|
||||
eval(_pop[i+1]);
|
||||
i=i+2;
|
||||
}
|
||||
// do we have to add some random solutions ?
|
||||
while (i<_pop.size())
|
||||
{
|
||||
randomMonOp(_pop[i]);
|
||||
eval(_pop[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOITERATEDIBMOLS_H_*/
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// make_ls_moeo.h
|
||||
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||
/*
|
||||
This library...
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_LS_MOEO_H_
|
||||
#define MAKE_LS_MOEO_H_
|
||||
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoGenOp.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <algo/moeoIBMOLS.h>
|
||||
#include <algo/moeoIteratedIBMOLS.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* This functions allows to build a moeoLS from the parser
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _continue the stopping crietria
|
||||
* @param _op the variation operators
|
||||
* @param _opInit the initilization operator
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the move incrementor
|
||||
* @param _archive the archive of non-dominated solutions
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
moeoLS < MOEOT, eoPop<MOEOT> & > & do_make_ls_moeo (
|
||||
eoParser & _parser,
|
||||
eoState & _state,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||
eoContinue < MOEOT > & _continue,
|
||||
eoMonOp < MOEOT > & _op,
|
||||
eoMonOp < MOEOT > & _opInit,
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
moeoArchive < MOEOT > & _archive
|
||||
)
|
||||
{
|
||||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
/* the fitness assignment strategy */
|
||||
std::string & fitnessParam = _parser.getORcreateParam(std::string("IndicatorBased"), "fitness",
|
||||
"Fitness assignment strategy parameter: IndicatorBased...", 'F',
|
||||
"Evolution Engine").value();
|
||||
std::string & indicatorParam = _parser.getORcreateParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator to use with the IndicatorBased assignment: Epsilon, Hypervolume", 'i',
|
||||
"Evolution Engine").value();
|
||||
double rho = _parser.getORcreateParam(1.1, "rho", "reference point for the hypervolume indicator",
|
||||
'r', "Evolution Engine").value();
|
||||
double kappa = _parser.getORcreateParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased",
|
||||
'k', "Evolution Engine").value();
|
||||
moeoIndicatorBasedFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||
if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||
if (indicatorParam == std::string("Epsilon"))
|
||||
{
|
||||
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
}
|
||||
else if (indicatorParam == std::string("Hypervolume"))
|
||||
{
|
||||
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
fitnessAssignment = new moeoIndicatorBasedFitnessAssignment < MOEOT> (*metric, kappa);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(fitnessAssignment);
|
||||
// number of iterations
|
||||
unsigned int n = _parser.getORcreateParam(1, "n", "Number of iterations for population Initialization", 'n', "Evolution Engine").value();
|
||||
// LS
|
||||
std::string & lsParam = _parser.getORcreateParam(std::string("I-IBMOLS"), "ls",
|
||||
"Local Search: IBMOLS, I-IBMOLS (Iterated-IBMOLS)...", 'L',
|
||||
"Evolution Engine").value();
|
||||
moeoLS < MOEOT, eoPop<MOEOT> & > * ls;
|
||||
if (lsParam == std::string("IBMOLS"))
|
||||
{
|
||||
ls = new moeoIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);;
|
||||
}
|
||||
else if (lsParam == std::string("I-IBMOLS"))
|
||||
{
|
||||
ls = new moeoIteratedIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue, _op, _opInit, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(ls);
|
||||
// that's it !
|
||||
return *ls;
|
||||
}
|
||||
|
||||
#endif /*MAKE_LS_MOEO_H_*/
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// moeoReferencePointIndicatorBasedFitnessAssignment.h
|
||||
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||
/*
|
||||
This library...
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_
|
||||
#define MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <eoPop.h>
|
||||
#include <fitness/moeoFitnessAssignment.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
|
||||
/**
|
||||
* Fitness assignment sheme based a Reference Point and a Quality Indicator.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoReferencePointIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _refPoint the reference point
|
||||
* @param _metric the quality indicator
|
||||
*/
|
||||
moeoReferencePointIndicatorBasedFitnessAssignment (ObjectiveVector & _refPoint, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric) :
|
||||
refPoint(_refPoint), metric(_metric)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the fitness values for every solution contained in the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void operator()(eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// 1 - setting of the bounds
|
||||
setup(_pop);
|
||||
// 2 - setting fitnesses
|
||||
setFitnesses(_pop);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
|
||||
* @param _pop the population
|
||||
* @param _objVec the objective vector
|
||||
*/
|
||||
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
|
||||
{
|
||||
// nothing to do ;-)
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/** the reference point */
|
||||
ObjectiveVector & refPoint;
|
||||
/** the quality indicator */
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & metric;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the bounds for every objective using the min and the max value for every objective vector of _pop (and the reference point)
|
||||
* @param _pop the population
|
||||
*/
|
||||
void setup(const eoPop < MOEOT > & _pop)
|
||||
{
|
||||
double min, max;
|
||||
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||
{
|
||||
min = refPoint[i];
|
||||
max = refPoint[i];
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
min = std::min(min, _pop[j].objectiveVector()[i]);
|
||||
max = std::max(max, _pop[j].objectiveVector()[i]);
|
||||
}
|
||||
// setting of the bounds for the objective i
|
||||
metric.setup(min, max, i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fitness of every individual contained in the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void setFitnesses(eoPop < MOEOT > & _pop)
|
||||
{
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
_pop[i].fitness(- metric(_pop[i].objectiveVector(), refPoint) );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_*/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
#ifndef _MOEOMOVEINCREVAL_H
|
||||
#define _MOEOMOVEINCREVAL_H
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
template < class Move >
|
||||
class moeoMoveIncrEval : public eoBF < const Move &, const typename Move::EOType &, typename Move::EOType::ObjectiveVector > {};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue