git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1581 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
96ac91d0d3
commit
49497e5563
4 changed files with 676 additions and 93 deletions
|
|
@ -45,17 +45,18 @@
|
|||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <moeoPopLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <archive/moeoUnboundedArchive.h>
|
||||
#include <fitness/moeoBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
#include <moMoveIncrEval.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 > & >
|
||||
class moeoIBMOLS : public moeoPopLS < Move>
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -76,16 +77,18 @@ class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
|||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||
moMoveIncrEval < Move , ObjectiveVector > & _moveIncrEval,
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator
|
||||
eoContinue < MOEOT > & _continuator,
|
||||
moeoArchive < MOEOT > & _arch
|
||||
) :
|
||||
moveInit(_moveInit),
|
||||
nextMove(_nextMove),
|
||||
eval(_eval),
|
||||
moveIncrEval(_moveIncrEval),
|
||||
fitnessAssignment (_fitnessAssignment),
|
||||
continuator (_continuator)
|
||||
continuator (_continuator),
|
||||
arch(_arch)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -95,31 +98,31 @@ class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
|||
* @param _pop the initial population
|
||||
* @param _arch the (updated) archive
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _arch)
|
||||
void operator() (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// 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;
|
||||
moeoUnboundedArchive < MOEOT > archive;
|
||||
// creation of another local archive (for the stopping criteria)
|
||||
moeoArchive < MOEOT > previousArchive;
|
||||
moeoUnboundedArchive < MOEOT > previousArchive;
|
||||
// update the archive with the initial population
|
||||
archive.update(_pop);
|
||||
archive(_pop);
|
||||
do
|
||||
{
|
||||
previousArchive.update(archive);
|
||||
previousArchive(archive);
|
||||
oneStep(_pop);
|
||||
archive.update(_pop);
|
||||
archive(_pop);
|
||||
}
|
||||
while ( (! archive.equals(previousArchive)) && (continuator(_arch)) );
|
||||
_arch.update(archive);
|
||||
while ( (! archive.equals(previousArchive)) && (continuator(arch)) );
|
||||
arch(archive);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,12 +135,13 @@ class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
|||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the incremental evaluation */
|
||||
moeoMoveIncrEval < Move > & moveIncrEval;
|
||||
moMoveIncrEval < Move, ObjectiveVector > & moveIncrEval;
|
||||
/** the fitness assignment strategy */
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & fitnessAssignment;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
|
||||
/** archive */
|
||||
moeoArchive < MOEOT > & arch;
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
|
|
@ -176,64 +180,64 @@ class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// extreme solutions (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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
// 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)
|
||||
// {
|
||||
// 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)
|
||||
// {
|
||||
// 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;
|
||||
// }
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue