New style for MOEO

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@788 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
canape 2007-11-16 11:29:25 +00:00
commit 39709d3d12
103 changed files with 2607 additions and 2521 deletions

View file

@ -41,6 +41,7 @@
/** /**
* Abstract class for multi-objective algorithms. * Abstract class for multi-objective algorithms.
*/ */
class moeoAlgo {}; class moeoAlgo
{};
#endif /*MOEOALGO_H_*/ #endif /*MOEOALGO_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class MOEOT, class Type > template < class MOEOT, class Type >
class moeoCombinedLS : public moeoLS < MOEOT, Type > class moeoCombinedLS : public moeoLS < MOEOT, Type >
{ {
public: public:
/** /**
* Ctor * Ctor
@ -82,11 +82,11 @@ public:
} }
private: private:
/** the vector that contains the combined LS */ /** the vector that contains the combined LS */
std::vector< moeoLS < MOEOT, Type > * > combinedLS; std::vector< moeoLS < MOEOT, Type > * > combinedLS;
}; };
#endif /*MOEOCOMBINEDLS_H_*/ #endif /*MOEOCOMBINEDLS_H_*/

View file

@ -45,6 +45,7 @@
* Abstract class for multi-objective evolutionary algorithms. * Abstract class for multi-objective evolutionary algorithms.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoEA : public moeoAlgo, public eoAlgo < MOEOT > {}; class moeoEA : public moeoAlgo, public eoAlgo < MOEOT >
{};
#endif /*MOEOEA_H_*/ #endif /*MOEOEA_H_*/

View file

@ -56,8 +56,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoEasyEA: public moeoEA < MOEOT > class moeoEasyEA: public moeoEA < MOEOT >
{ {
public: public:
/** /**
* Ctor taking a breed and merge. * Ctor taking a breed and merge.
@ -193,11 +193,12 @@ public:
s.append( " in moeoEasyEA"); s.append( " in moeoEasyEA");
throw std::runtime_error( s ); throw std::runtime_error( s );
} }
} while (continuator(_pop)); }
while (continuator(_pop));
} }
protected: protected:
/** the stopping criteria */ /** the stopping criteria */
eoContinue < MOEOT > & continuator; eoContinue < MOEOT > & continuator;
@ -223,21 +224,33 @@ protected:
bool evalFitAndDivBeforeSelection; bool evalFitAndDivBeforeSelection;
/** a dummy eval */ /** a dummy eval */
class eoDummyEval : public eoEvalFunc < MOEOT > class eoDummyEval : public eoEvalFunc < MOEOT >
{ public: /** the dummy functor */ {
void operator()(MOEOT &) {}} dummyEval; public: /** the dummy functor */
void operator()(MOEOT &)
{}
}
dummyEval;
/** a dummy select */ /** a dummy select */
class eoDummySelect : public eoSelect < MOEOT > class eoDummySelect : public eoSelect < MOEOT >
{ public: /** the dummy functor */ {
void operator()(const eoPop < MOEOT > &, eoPop < MOEOT > &) {} } dummySelect; public: /** the dummy functor */
void operator()(const eoPop < MOEOT > &, eoPop < MOEOT > &)
{}
}
dummySelect;
/** a dummy transform */ /** a dummy transform */
class eoDummyTransform : public eoTransform < MOEOT > class eoDummyTransform : public eoTransform < MOEOT >
{ public: /** the dummy functor */ {
void operator()(eoPop < MOEOT > &) {} } dummyTransform; public: /** the dummy functor */
void operator()(eoPop < MOEOT > &)
{}
}
dummyTransform;
/** a dummy merge */ /** a dummy merge */
eoNoElitism < MOEOT > dummyMerge; eoNoElitism < MOEOT > dummyMerge;
/** a dummy reduce */ /** a dummy reduce */
eoTruncate < MOEOT > dummyReduce; eoTruncate < MOEOT > dummyReduce;
}; };
#endif /*MOEOEASYEA_H_*/ #endif /*MOEOEASYEA_H_*/

View file

@ -51,8 +51,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoHybridLS : public eoUpdater class moeoHybridLS : public eoUpdater
{ {
public: public:
/** /**
* Ctor * Ctor
@ -85,7 +85,7 @@ public:
} }
private: private:
/** stopping criteria */ /** stopping criteria */
eoContinue < MOEOT > & term; eoContinue < MOEOT > & term;
@ -96,6 +96,6 @@ private:
/** archive */ /** archive */
moeoArchive < MOEOT > & arch; moeoArchive < MOEOT > & arch;
}; };
#endif /*MOEOHYBRIDLS_H_*/ #endif /*MOEOHYBRIDLS_H_*/

View file

@ -61,8 +61,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoIBEA : public moeoEA < MOEOT > class moeoIBEA : public moeoEA < MOEOT >
{ {
public: public:
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -161,11 +161,12 @@ public:
popEval (_pop, offspring); popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary // after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring); replace (_pop, offspring);
} while (continuator (_pop)); }
while (continuator (_pop));
} }
protected: protected:
/** a continuator based on the number of generations (used as default) */ /** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator; eoGenContinue < MOEOT > defaultGenContinuator;
@ -188,6 +189,6 @@ protected:
/** breeder */ /** breeder */
eoBreed < MOEOT > & breed; eoBreed < MOEOT > & breed;
}; };
#endif /*MOEOIBEA_H_*/ #endif /*MOEOIBEA_H_*/

View file

@ -56,8 +56,8 @@
*/ */
template < class MOEOT, class Move > template < class MOEOT, class Move >
class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & > class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
{ {
public: public:
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -117,12 +117,13 @@ public:
previousArchive.update(archive); previousArchive.update(archive);
oneStep(_pop); oneStep(_pop);
archive.update(_pop); archive.update(_pop);
} while ( (! archive.equals(previousArchive)) && (continuator(_arch)) ); }
while ( (! archive.equals(previousArchive)) && (continuator(_arch)) );
_arch.update(archive); _arch.update(archive);
} }
private: private:
/** the move initializer */ /** the move initializer */
moMoveInit < Move > & moveInit; moMoveInit < Move > & moveInit;
@ -484,7 +485,7 @@ private:
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
class OneObjectiveComparator : public moeoComparator < MOEOT > class OneObjectiveComparator : public moeoComparator < MOEOT >
{ {
public: public:
OneObjectiveComparator(unsigned int _obj) : obj(_obj) OneObjectiveComparator(unsigned int _obj) : obj(_obj)
@ -513,6 +514,6 @@ class OneObjectiveComparator : public moeoComparator < MOEOT >
}; };
#endif /*MOEOIBMOLS_H_*/ #endif /*MOEOIBMOLS_H_*/

View file

@ -64,8 +64,8 @@
*/ */
template < class MOEOT, class Move > template < class MOEOT, class Move >
class moeoIteratedIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & > class moeoIteratedIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
{ {
public: public:
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -122,7 +122,7 @@ public:
} }
private: private:
/** the local search to iterate */ /** the local search to iterate */
moeoIBMOLS < MOEOT, Move > ibmols; moeoIBMOLS < MOEOT, Move > ibmols;
@ -233,6 +233,6 @@ private:
}; };
#endif /*MOEOITERATEDIBMOLS_H_*/ #endif /*MOEOITERATEDIBMOLS_H_*/

View file

@ -47,6 +47,7 @@
* Starting from a Type (i.e.: an individual, a pop, an archive...), it produces a set of new non-dominated solutions. * Starting from a Type (i.e.: an individual, a pop, an archive...), it produces a set of new non-dominated solutions.
*/ */
template < class MOEOT, class Type > template < class MOEOT, class Type >
class moeoLS: public moeoAlgo, public eoBF < Type, moeoArchive < MOEOT > &, void > {}; class moeoLS: public moeoAlgo, public eoBF < Type, moeoArchive < MOEOT > &, void >
{};
#endif /*MOEOLS_H_*/ #endif /*MOEOLS_H_*/

View file

@ -60,8 +60,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoNSGA: public moeoEA < MOEOT > class moeoNSGA: public moeoEA < MOEOT >
{ {
public: public:
/** /**
* Simple ctor with a eoGenOp. * Simple ctor with a eoGenOp.
@ -151,11 +151,12 @@ public:
popEval (_pop, offspring); popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary // after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring); replace (_pop, offspring);
} while (continuator (_pop)); }
while (continuator (_pop));
} }
protected: protected:
/** a continuator based on the number of generations (used as default) */ /** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator; eoGenContinue < MOEOT > defaultGenContinuator;
@ -178,6 +179,6 @@ protected:
/** breeder */ /** breeder */
eoBreed < MOEOT > & breed; eoBreed < MOEOT > & breed;
}; };
#endif /*MOEONSGAII_H_*/ #endif /*MOEONSGAII_H_*/

View file

@ -63,8 +63,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoNSGAII: public moeoEA < MOEOT > class moeoNSGAII: public moeoEA < MOEOT >
{ {
public: public:
/** /**
* Simple ctor with a eoGenOp. * Simple ctor with a eoGenOp.
@ -153,11 +153,12 @@ public:
popEval (_pop, offspring); popEval (_pop, offspring);
// after replace, the new pop is in _pop. Worths are recalculated if necessary // after replace, the new pop is in _pop. Worths are recalculated if necessary
replace (_pop, offspring); replace (_pop, offspring);
} while (continuator (_pop)); }
while (continuator (_pop));
} }
protected: protected:
/** a continuator based on the number of generations (used as default) */ /** a continuator based on the number of generations (used as default) */
eoGenContinue < MOEOT > defaultGenContinuator; eoGenContinue < MOEOT > defaultGenContinuator;
@ -184,6 +185,6 @@ protected:
/** breeder */ /** breeder */
eoBreed < MOEOT > & breed; eoBreed < MOEOT > & breed;
}; };
#endif /*MOEONSGAII_H_*/ #endif /*MOEONSGAII_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoArchive : public eoPop < MOEOT > class moeoArchive : public eoPop < MOEOT >
{ {
public: public:
using eoPop < MOEOT > :: size; using eoPop < MOEOT > :: size;
using eoPop < MOEOT > :: operator[]; using eoPop < MOEOT > :: operator[];
@ -193,13 +193,13 @@ public:
} }
private: private:
/** The moeoObjectiveVectorComparator used to compare solutions */ /** The moeoObjectiveVectorComparator used to compare solutions */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator; moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
/** A moeoObjectiveVectorComparator based on Pareto dominance (used as default) */ /** A moeoObjectiveVectorComparator based on Pareto dominance (used as default) */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
}; };
#endif /*MOEOARCHIVE_H_ */ #endif /*MOEOARCHIVE_H_ */

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoAggregativeComparator : public moeoComparator < MOEOT > class moeoAggregativeComparator : public moeoComparator < MOEOT >
{ {
public: public:
/** /**
* Ctor. * Ctor.
@ -68,13 +68,13 @@ public:
} }
private: private:
/** the weight for fitness */ /** the weight for fitness */
double weightFitness; double weightFitness;
/** the weight for diversity */ /** the weight for diversity */
double weightDiversity; double weightDiversity;
}; };
#endif /*MOEOAGGREGATIVECOMPARATOR_H_*/ #endif /*MOEOAGGREGATIVECOMPARATOR_H_*/

View file

@ -44,6 +44,7 @@
* Functor allowing to compare two solutions. * Functor allowing to compare two solutions.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoComparator : public eoBF < const MOEOT &, const MOEOT &, const bool > {}; class moeoComparator : public eoBF < const MOEOT &, const MOEOT &, const bool >
{};
#endif /*MOEOCOMPARATOR_H_*/ #endif /*MOEOCOMPARATOR_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT > class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
{ {
public: public:
/** /**
* Returns true if _moeo1 < _moeo2 according to their diversity values, then according to their fitness values * Returns true if _moeo1 < _moeo2 according to their diversity values, then according to their fitness values
@ -65,6 +65,6 @@ public:
} }
} }
}; };
#endif /*MOEODIVERSITYTHENFITNESSCOMPARATOR_H_*/ #endif /*MOEODIVERSITYTHENFITNESSCOMPARATOR_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT > class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
{ {
public: public:
/** /**
* Returns true if _moeo1 < _moeo2 according to their fitness values, then according to their diversity values * Returns true if _moeo1 < _moeo2 according to their fitness values, then according to their diversity values
@ -65,6 +65,6 @@ public:
} }
} }
}; };
#endif /*MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_*/ #endif /*MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoGDominanceObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector > class moeoGDominanceObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
{ {
public: public:
/** /**
* Ctor. * Ctor.
@ -86,7 +86,7 @@ public:
} }
private: private:
/** the reference point */ /** the reference point */
ObjectiveVector & ref; ObjectiveVector & ref;
@ -122,6 +122,6 @@ private:
return result; return result;
} }
}; };
#endif /*MOEOGDOMINANCEOBJECTIVEVECTORCOMPARATOR_H_*/ #endif /*MOEOGDOMINANCEOBJECTIVEVECTORCOMPARATOR_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoObjectiveObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector > class moeoObjectiveObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
{ {
public: public:
/** /**
* Returns true if _objectiveVector1 < _objectiveVector2 on the first objective, then on the second, and so on * Returns true if _objectiveVector1 < _objectiveVector2 on the first objective, then on the second, and so on
@ -72,6 +72,6 @@ public:
return false; return false;
} }
}; };
#endif /*MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_*/ #endif /*MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_*/

View file

@ -46,6 +46,7 @@
* The template argument ObjectiveVector have to be a moeoObjectiveVector. * The template argument ObjectiveVector have to be a moeoObjectiveVector.
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoObjectiveVectorComparator : public eoBF < const ObjectiveVector &, const ObjectiveVector &, const bool > {}; class moeoObjectiveVectorComparator : public eoBF < const ObjectiveVector &, const ObjectiveVector &, const bool >
{};
#endif /*MOEOOBJECTIVEVECTORCOMPARATOR_H_*/ #endif /*MOEOOBJECTIVEVECTORCOMPARATOR_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoOneObjectiveComparator : public moeoComparator < MOEOT > class moeoOneObjectiveComparator : public moeoComparator < MOEOT >
{ {
public: public:
/** /**
* Ctor. * Ctor.
@ -72,11 +72,11 @@ public:
} }
private: private:
/** the index of objective */ /** the index of objective */
unsigned int obj; unsigned int obj;
}; };
#endif /*MOEOONEOBJECTIVECOMPARATOR_H_*/ #endif /*MOEOONEOBJECTIVECOMPARATOR_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoParetoObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector > class moeoParetoObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
{ {
public: public:
/** /**
* Returns true if _objectiveVector1 is dominated by _objectiveVector2 * Returns true if _objectiveVector1 is dominated by _objectiveVector2
@ -90,6 +90,6 @@ public:
return dom; return dom;
} }
}; };
#endif /*MOEOPARETOOBJECTIVEVECTORCOMPARATOR_H_*/ #endif /*MOEOPARETOOBJECTIVEVECTORCOMPARATOR_H_*/

View file

@ -57,8 +57,8 @@
*/ */
template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity > template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity >
class MOEO : public EO < MOEOObjectiveVector > class MOEO : public EO < MOEOObjectiveVector >
{ {
public: public:
/** the objective vector type of a solution */ /** the objective vector type of a solution */
typedef MOEOObjectiveVector ObjectiveVector; typedef MOEOObjectiveVector ObjectiveVector;
@ -87,7 +87,8 @@ public:
/** /**
* Virtual dtor * Virtual dtor
*/ */
virtual ~MOEO() {}; virtual ~MOEO()
{};
/** /**
@ -296,7 +297,7 @@ public:
} }
private: private:
/** the objective vector of this solution */ /** the objective vector of this solution */
ObjectiveVector objectiveVectorValue; ObjectiveVector objectiveVectorValue;
@ -311,6 +312,6 @@ private:
/** true if the diversity value is invalid */ /** true if the diversity value is invalid */
bool invalidDiversityValue; bool invalidDiversityValue;
}; };
#endif /*MOEO_H_*/ #endif /*MOEO_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity > template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity >
class moeoBitVector : public moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool > class moeoBitVector : public moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool >
{ {
public: public:
using moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool > :: begin; using moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool > :: begin;
using moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool > :: end; using moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, bool > :: end;
@ -103,6 +103,6 @@ public:
} }
} }
}; };
#endif /*MOEOBITVECTOR_H_*/ #endif /*MOEOBITVECTOR_H_*/

View file

@ -44,6 +44,7 @@
* Functor that evaluates one MOEO by setting all its objective values. * Functor that evaluates one MOEO by setting all its objective values.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoEvalFunc : public eoEvalFunc< MOEOT > {}; class moeoEvalFunc : public eoEvalFunc< MOEOT >
{};
#endif /*MOEOEVALFUNC_H_*/ #endif /*MOEOEVALFUNC_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class ObjectiveVectorTraits, class ObjectiveVectorType > template < class ObjectiveVectorTraits, class ObjectiveVectorType >
class moeoObjectiveVector : public std::vector < ObjectiveVectorType > class moeoObjectiveVector : public std::vector < ObjectiveVectorType >
{ {
public: public:
/** The traits of objective vectors */ /** The traits of objective vectors */
typedef ObjectiveVectorTraits Traits; typedef ObjectiveVectorTraits Traits;
@ -111,6 +111,6 @@ public:
return ObjectiveVectorTraits::maximizing(_i); return ObjectiveVectorTraits::maximizing(_i);
} }
}; };
#endif /*MOEOOBJECTIVEVECTOR_H_*/ #endif /*MOEOOBJECTIVEVECTOR_H_*/

View file

@ -46,8 +46,8 @@
* A traits class for moeoObjectiveVector to specify the number of objectives and which ones have to be minimized or maximized. * A traits class for moeoObjectiveVector to specify the number of objectives and which ones have to be minimized or maximized.
*/ */
class moeoObjectiveVectorTraits class moeoObjectiveVectorTraits
{ {
public: public:
/** /**
* Parameters setting * Parameters setting
@ -57,7 +57,8 @@ public:
static void setup(unsigned int _nObjectives, std::vector < bool > & _bObjectives) static void setup(unsigned int _nObjectives, std::vector < bool > & _bObjectives)
{ {
// in case the number of objectives was already set to a different value // in case the number of objectives was already set to a different value
if ( nObj && (nObj != _nObjectives) ) { if ( nObj && (nObj != _nObjectives) )
{
std::cout << "WARNING\n"; std::cout << "WARNING\n";
std::cout << "WARNING : the number of objectives are changing\n"; std::cout << "WARNING : the number of objectives are changing\n";
std::cout << "WARNING : Make sure all existing objects are destroyed\n"; std::cout << "WARNING : Make sure all existing objects are destroyed\n";
@ -102,7 +103,8 @@ public:
* Returns true if the _ith objective have to be maximized * Returns true if the _ith objective have to be maximized
* @param _i the index * @param _i the index
*/ */
static bool maximizing(unsigned int _i) { static bool maximizing(unsigned int _i)
{
return (! minimizing(_i)); return (! minimizing(_i));
} }
@ -116,13 +118,13 @@ public:
} }
private: private:
/** The number of objectives */ /** The number of objectives */
static unsigned int nObj; static unsigned int nObj;
/** The min/max vector */ /** The min/max vector */
static std::vector < bool > bObj; static std::vector < bool > bObj;
}; };
#endif /*MOEOOBJECTIVEVECTORTRAITS_H_*/ #endif /*MOEOOBJECTIVEVECTORTRAITS_H_*/

View file

@ -50,8 +50,8 @@
*/ */
template < class ObjectiveVectorTraits > template < class ObjectiveVectorTraits >
class moeoRealObjectiveVector : public moeoObjectiveVector < ObjectiveVectorTraits, double > class moeoRealObjectiveVector : public moeoObjectiveVector < ObjectiveVectorTraits, double >
{ {
public: public:
using moeoObjectiveVector < ObjectiveVectorTraits, double >::size; using moeoObjectiveVector < ObjectiveVectorTraits, double >::size;
using moeoObjectiveVector < ObjectiveVectorTraits, double >::operator[]; using moeoObjectiveVector < ObjectiveVectorTraits, double >::operator[];
@ -154,7 +154,7 @@ public:
return operator==(_other) || operator>(_other); return operator==(_other) || operator>(_other);
} }
}; };
/** /**

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity > template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity >
class moeoRealVector : public moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, double > class moeoRealVector : public moeoVector < MOEOObjectiveVector, MOEOFitness, MOEODiversity, double >
{ {
public: public:
/** /**
* Ctor * Ctor
@ -65,6 +65,6 @@ public:
return "moeoRealVector"; return "moeoRealVector";
} }
}; };
#endif /*MOEOREALVECTOR_H_*/ #endif /*MOEOREALVECTOR_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity, class GeneType > template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity, class GeneType >
class moeoVector : public MOEO < MOEOObjectiveVector, MOEOFitness, MOEODiversity >, public std::vector < GeneType > class moeoVector : public MOEO < MOEOObjectiveVector, MOEOFitness, MOEODiversity >, public std::vector < GeneType >
{ {
public: public:
using MOEO < MOEOObjectiveVector, MOEOFitness, MOEODiversity > :: invalidate; using MOEO < MOEOObjectiveVector, MOEOFitness, MOEODiversity > :: invalidate;
using std::vector < GeneType > :: operator[]; using std::vector < GeneType > :: operator[];
@ -139,7 +139,7 @@ public:
} }
} }
}; };
/** /**

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT , class Type > template < class MOEOT , class Type >
class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type > class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type >
{ {
public: public:
/** /**
* Nothing to do * Nothing to do
@ -74,6 +74,6 @@ public:
virtual void setup(eoRealInterval _realInterval, unsigned int _obj) virtual void setup(eoRealInterval _realInterval, unsigned int _obj)
{} {}
}; };
#endif /*MOEODISTANCE_H_*/ #endif /*MOEODISTANCE_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT , class Type > template < class MOEOT , class Type >
class moeoDistanceMatrix : public eoUF < const eoPop < MOEOT > &, void > , public std::vector< std::vector < Type > > class moeoDistanceMatrix : public eoUF < const eoPop < MOEOT > &, void > , public std::vector< std::vector < Type > >
{ {
public: public:
using std::vector< std::vector < Type > > :: size; using std::vector< std::vector < Type > > :: size;
using std::vector< std::vector < Type > > :: operator[]; using std::vector< std::vector < Type > > :: operator[];
@ -91,11 +91,11 @@ public:
} }
private: private:
/** the distance to use */ /** the distance to use */
moeoDistance < MOEOT , Type > & distance; moeoDistance < MOEOT , Type > & distance;
}; };
#endif /*MOEODISTANCEMATRIX_H_*/ #endif /*MOEODISTANCEMATRIX_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoEuclideanDistance : public moeoNormalizedDistance < MOEOT > class moeoEuclideanDistance : public moeoNormalizedDistance < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -73,11 +73,11 @@ public:
} }
private: private:
/** the bounds for every objective */ /** the bounds for every objective */
using moeoNormalizedDistance < MOEOT > :: bounds; using moeoNormalizedDistance < MOEOT > :: bounds;
}; };
#endif /*MOEOEUCLIDEANDISTANCE_H_*/ #endif /*MOEOEUCLIDEANDISTANCE_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoManhattanDistance : public moeoNormalizedDistance < MOEOT > class moeoManhattanDistance : public moeoNormalizedDistance < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -73,11 +73,11 @@ public:
} }
private: private:
/** the bounds for every objective */ /** the bounds for every objective */
using moeoNormalizedDistance < MOEOT > :: bounds; using moeoNormalizedDistance < MOEOT > :: bounds;
}; };
#endif /*MOEOMANHATTANDISTANCE_H_*/ #endif /*MOEOMANHATTANDISTANCE_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT , class Type = double > template < class MOEOT , class Type = double >
class moeoNormalizedDistance : public moeoDistance < MOEOT , Type > class moeoNormalizedDistance : public moeoDistance < MOEOT , Type >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -127,11 +127,11 @@ public:
} }
protected: protected:
/** the bounds for every objective (bounds[i] = bounds for the objective i) */ /** the bounds for every objective (bounds[i] = bounds for the objective i) */
std::vector < eoRealInterval > bounds; std::vector < eoRealInterval > bounds;
}; };
#endif /*MOEONORMALIZEDDISTANCE_H_*/ #endif /*MOEONORMALIZEDDISTANCE_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoCrowdingDiversityAssignment : public moeoDiversityAssignment < MOEOT > class moeoCrowdingDiversityAssignment : public moeoDiversityAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -106,7 +106,7 @@ public:
} }
protected: protected:
/** /**
* Sets the distance values * Sets the distance values
@ -142,6 +142,6 @@ protected:
} }
} }
}; };
#endif /*MOEOCROWDINGDIVERSITYASSIGNMENT_H_*/ #endif /*MOEOCROWDINGDIVERSITYASSIGNMENT_H_*/

View file

@ -46,8 +46,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoDiversityAssignment : public eoUF < eoPop < MOEOT > &, void > class moeoDiversityAssignment : public eoUF < eoPop < MOEOT > &, void >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -71,6 +71,6 @@ public:
updateByDeleting(_pop, _moeo.objectiveVector()); updateByDeleting(_pop, _moeo.objectiveVector());
} }
}; };
#endif /*MOEODIVERSITYASSIGNMENT_H_*/ #endif /*MOEODIVERSITYASSIGNMENT_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoDummyDiversityAssignment : public moeoDiversityAssignment < MOEOT > class moeoDummyDiversityAssignment : public moeoDiversityAssignment < MOEOT >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -79,6 +79,6 @@ public:
// nothing to do... ;-) // nothing to do... ;-)
} }
}; };
#endif /*MOEODUMMYDIVERSITYASSIGNMENT_H_*/ #endif /*MOEODUMMYDIVERSITYASSIGNMENT_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoFrontByFrontCrowdingDiversityAssignment : public moeoCrowdingDiversityAssignment < MOEOT > class moeoFrontByFrontCrowdingDiversityAssignment : public moeoCrowdingDiversityAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -68,7 +68,7 @@ public:
} }
private: private:
using moeoCrowdingDiversityAssignment < MOEOT >::inf; using moeoCrowdingDiversityAssignment < MOEOT >::inf;
using moeoCrowdingDiversityAssignment < MOEOT >::tiny; using moeoCrowdingDiversityAssignment < MOEOT >::tiny;
@ -153,6 +153,6 @@ private:
return i; return i;
} }
}; };
#endif /*MOEOFRONTBYFRONTCROWDINGDIVERSITYASSIGNMENT_H_*/ #endif /*MOEOFRONTBYFRONTCROWDINGDIVERSITYASSIGNMENT_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoFrontByFrontSharingDiversityAssignment : public moeoSharingDiversityAssignment < MOEOT > class moeoFrontByFrontSharingDiversityAssignment : public moeoSharingDiversityAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -84,7 +84,7 @@ public:
} }
private: private:
using moeoSharingDiversityAssignment < MOEOT >::distance; using moeoSharingDiversityAssignment < MOEOT >::distance;
using moeoSharingDiversityAssignment < MOEOT >::nicheSize; using moeoSharingDiversityAssignment < MOEOT >::nicheSize;
@ -126,6 +126,6 @@ private:
} }
} }
}; };
#endif /*MOEOFRONTBYFRONTSHARINGDIVERSITYASSIGNMENT_H_*/ #endif /*MOEOFRONTBYFRONTSHARINGDIVERSITYASSIGNMENT_H_*/

View file

@ -51,8 +51,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoSharingDiversityAssignment : public moeoDiversityAssignment < MOEOT > class moeoSharingDiversityAssignment : public moeoDiversityAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -108,7 +108,7 @@ public:
} }
protected: protected:
/** the distance used to compute the neighborhood of solutions */ /** the distance used to compute the neighborhood of solutions */
moeoDistance < MOEOT , double > & distance; moeoDistance < MOEOT , double > & distance;
@ -161,7 +161,7 @@ protected:
return result; return result;
} }
}; };
#endif /*MOEOSHARINGDIVERSITYASSIGNMENT_H_*/ #endif /*MOEOSHARINGDIVERSITYASSIGNMENT_H_*/

View file

@ -127,7 +127,8 @@ moeoLS < MOEOT, eoPop<MOEOT> & > & do_make_ls_moeo (
moeoLS < MOEOT, eoPop<MOEOT> & > * ls; moeoLS < MOEOT, eoPop<MOEOT> & > * ls;
if (lsParam == std::string("IBMOLS")) if (lsParam == std::string("IBMOLS"))
{ {
ls = new moeoIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);; ls = new moeoIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);
;
} }
else if (lsParam == std::string("I-IBMOLS")) else if (lsParam == std::string("I-IBMOLS"))
{ {

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MOEOT > class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -127,7 +127,7 @@ public:
} }
private: private:
/** the reference point */ /** the reference point */
ObjectiveVector reference; ObjectiveVector reference;
@ -165,6 +165,6 @@ private:
_moeo.fitness(min + spn*sum); _moeo.fitness(min + spn*sum);
} }
}; };
#endif /*MOEOACHIEVEMENTFITNESSASSIGNMENT_H_*/ #endif /*MOEOACHIEVEMENTFITNESSASSIGNMENT_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoBinaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT > class moeoBinaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -60,6 +60,6 @@ public:
*/ */
virtual double updateByAdding(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0; virtual double updateByAdding(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0;
}; };
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -44,6 +44,7 @@
* moeoCriterionBasedFitnessAssignment is a moeoFitnessAssignment for criterion-based strategies. * moeoCriterionBasedFitnessAssignment is a moeoFitnessAssignment for criterion-based strategies.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoCriterionBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT > {}; class moeoCriterionBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOCRITERIONBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOCRITERIONBASEDFITNESSASSIGNMENT_H_*/

View file

@ -45,8 +45,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT > class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -79,6 +79,6 @@ public:
// nothing to do... ;-) // nothing to do... ;-)
} }
}; };
#endif /*MOEODUMMYFITNESSASSIGNMENT_H_*/ #endif /*MOEODUMMYFITNESSASSIGNMENT_H_*/

View file

@ -52,8 +52,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorBasedFitnessAssignment < MOEOT >
{ {
public: public:
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -138,7 +138,7 @@ public:
} }
protected: protected:
/** the quality indicator */ /** the quality indicator */
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & metric; moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & metric;
@ -222,6 +222,6 @@ protected:
return result; return result;
} }
}; };
#endif /*MOEOEXPBINARYINDICATORBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOEXPBINARYINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -55,8 +55,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoFastNonDominatedSortingFitnessAssignment : public moeoParetoBasedFitnessAssignment < MOEOT > class moeoFastNonDominatedSortingFitnessAssignment : public moeoParetoBasedFitnessAssignment < MOEOT >
{ {
public: public:
/** the objective vector type of the solutions */ /** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -136,7 +136,7 @@ public:
} }
private: private:
/** Functor to compare two objective vectors */ /** Functor to compare two objective vectors */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator; moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
@ -158,7 +158,8 @@ private:
private: private:
/** the corresponding comparator for objective vectors */ /** the corresponding comparator for objective vectors */
moeoObjectiveObjectiveVectorComparator < ObjectiveVector > cmp; moeoObjectiveObjectiveVectorComparator < ObjectiveVector > cmp;
} objComparator; }
objComparator;
/** /**
@ -259,6 +260,6 @@ private:
} }
} }
}; };
#endif /*MOEOFASTNONDOMINATEDSORTINGFITNESSASSIGNMENT_H_*/ #endif /*MOEOFASTNONDOMINATEDSORTINGFITNESSASSIGNMENT_H_*/

View file

@ -46,8 +46,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoFitnessAssignment : public eoUF < eoPop < MOEOT > &, void > class moeoFitnessAssignment : public eoUF < eoPop < MOEOT > &, void >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -71,6 +71,6 @@ public:
updateByDeleting(_pop, _moeo.objectiveVector()); updateByDeleting(_pop, _moeo.objectiveVector());
} }
}; };
#endif /*MOEOFITNESSASSIGNMENT_H_*/ #endif /*MOEOFITNESSASSIGNMENT_H_*/

View file

@ -44,6 +44,7 @@
* moeoIndicatorBasedFitnessAssignment is a moeoFitnessAssignment for Indicator-based strategies. * moeoIndicatorBasedFitnessAssignment is a moeoFitnessAssignment for Indicator-based strategies.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT > {}; class moeoIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -44,6 +44,7 @@
* moeoParetoBasedFitnessAssignment is a moeoFitnessAssignment for Pareto-based strategies. * moeoParetoBasedFitnessAssignment is a moeoFitnessAssignment for Pareto-based strategies.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoParetoBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT > {}; class moeoParetoBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOPARETOBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOPARETOBASEDFITNESSASSIGNMENT_H_*/

View file

@ -48,8 +48,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoReferencePointIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT > class moeoReferencePointIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{ {
public: public:
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -88,7 +88,7 @@ public:
} }
protected: protected:
/** the reference point */ /** the reference point */
ObjectiveVector & refPoint; ObjectiveVector & refPoint;
@ -129,6 +129,6 @@ protected:
} }
} }
}; };
#endif /*MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -44,6 +44,7 @@
* moeoScalarFitnessAssignment is a moeoFitnessAssignment for scalar strategies. * moeoScalarFitnessAssignment is a moeoFitnessAssignment for scalar strategies.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoScalarFitnessAssignment : public moeoFitnessAssignment < MOEOT > {}; class moeoScalarFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOSCALARFITNESSASSIGNMENT_H_*/ #endif /*MOEOSCALARFITNESSASSIGNMENT_H_*/

View file

@ -44,6 +44,7 @@
* moeoIndicatorBasedFitnessAssignment for unary indicators. * moeoIndicatorBasedFitnessAssignment for unary indicators.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoUnaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT > {}; class moeoUnaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT >
{};
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/ #endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoAdditiveEpsilonBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > class moeoAdditiveEpsilonBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double >
{ {
public: public:
/** /**
* Returns the minimal distance by which the objective vector _o1 must be translated in all objectives * Returns the minimal distance by which the objective vector _o1 must be translated in all objectives
@ -73,7 +73,7 @@ public:
} }
private: private:
/** the bounds for every objective */ /** the bounds for every objective */
using moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > :: bounds; using moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > :: bounds;
@ -104,6 +104,6 @@ private:
return result; return result;
} }
}; };
#endif /*MOEOADDITIVEEPSILONBINARYMETRIC_H_*/ #endif /*MOEOADDITIVEEPSILONBINARYMETRIC_H_*/

View file

@ -47,15 +47,16 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoContributionMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > class moeoContributionMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double >
{ {
public: public:
/** /**
* Returns the contribution of the Pareto set '_set1' relatively to the Pareto set '_set2' * Returns the contribution of the Pareto set '_set1' relatively to the Pareto set '_set2'
* @param _set1 the first Pareto set * @param _set1 the first Pareto set
* @param _set2 the second Pareto set * @param _set2 the second Pareto set
*/ */
double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) { double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{
unsigned int c = card_C(_set1, _set2); unsigned int c = card_C(_set1, _set2);
unsigned int w1 = card_W(_set1, _set2); unsigned int w1 = card_W(_set1, _set2);
unsigned int n1 = card_N(_set1, _set2); unsigned int n1 = card_N(_set1, _set2);
@ -65,7 +66,7 @@ public:
} }
private: private:
/** Functor to compare two objective vectors according to Pareto dominance relation */ /** Functor to compare two objective vectors according to Pareto dominance relation */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
@ -76,11 +77,13 @@ private:
* @param _set1 the first Pareto set * @param _set1 the first Pareto set
* @param _set2 the second Pareto set * @param _set2 the second Pareto set
*/ */
unsigned int card_C (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) { unsigned int card_C (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{
unsigned int c=0; unsigned int c=0;
for (unsigned int i=0; i<_set1.size(); i++) for (unsigned int i=0; i<_set1.size(); i++)
for (unsigned int j=0; j<_set2.size(); j++) for (unsigned int j=0; j<_set2.size(); j++)
if (_set1[i] == _set2[j]) { if (_set1[i] == _set2[j])
{
c++; c++;
break; break;
} }
@ -93,7 +96,8 @@ private:
* @param _set1 the first Pareto set * @param _set1 the first Pareto set
* @param _set2 the second Pareto set * @param _set2 the second Pareto set
*/ */
unsigned int card_W (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) { unsigned int card_W (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{
unsigned int w=0; unsigned int w=0;
for (unsigned int i=0; i<_set1.size(); i++) for (unsigned int i=0; i<_set1.size(); i++)
for (unsigned int j=0; j<_set2.size(); j++) for (unsigned int j=0; j<_set2.size(); j++)
@ -111,9 +115,11 @@ private:
* @param _set1 the first Pareto set * @param _set1 the first Pareto set
* @param _set2 the second Pareto set * @param _set2 the second Pareto set
*/ */
unsigned int card_N (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) { unsigned int card_N (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{
unsigned int n=0; unsigned int n=0;
for (unsigned int i=0; i<_set1.size(); i++) { for (unsigned int i=0; i<_set1.size(); i++)
{
bool domin_rel = false; bool domin_rel = false;
for (unsigned int j=0; j<_set2.size(); j++) for (unsigned int j=0; j<_set2.size(); j++)
if ( (paretoComparator(_set2[j], _set1[i])) || (paretoComparator(_set1[i], _set2[j])) ) if ( (paretoComparator(_set2[j], _set1[i])) || (paretoComparator(_set1[i], _set2[j])) )
@ -127,6 +133,6 @@ private:
return n; return n;
} }
}; };
#endif /*MOEOCONTRIBUTIONMETRIC_H_*/ #endif /*MOEOCONTRIBUTIONMETRIC_H_*/

View file

@ -48,15 +48,16 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoEntropyMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > class moeoEntropyMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double >
{ {
public: public:
/** /**
* Returns the entropy of the Pareto set '_set1' relatively to the Pareto set '_set2' * Returns the entropy of the Pareto set '_set1' relatively to the Pareto set '_set2'
* @param _set1 the first Pareto set * @param _set1 the first Pareto set
* @param _set2 the second Pareto set * @param _set2 the second Pareto set
*/ */
double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) { double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2)
{
// normalization // normalization
std::vector< ObjectiveVector > set1 = _set1; std::vector< ObjectiveVector > set1 = _set1;
std::vector< ObjectiveVector > set2= _set2; std::vector< ObjectiveVector > set2= _set2;
@ -79,10 +80,12 @@ public:
float omega=0; float omega=0;
float entropy=0; float entropy=0;
for (unsigned int i=0 ; i<C ; i++) { for (unsigned int i=0 ; i<C ; i++)
{
unsigned int N_i = howManyInNicheOf (union_set1_star, union_set1_star[i], star.size()); unsigned int N_i = howManyInNicheOf (union_set1_star, union_set1_star[i], star.size());
unsigned int n_i = howManyInNicheOf (set1, union_set1_star[i], star.size()); unsigned int n_i = howManyInNicheOf (set1, union_set1_star[i], star.size());
if (n_i > 0) { if (n_i > 0)
{
omega += 1.0 / N_i; omega += 1.0 / N_i;
entropy += (float) n_i / (N_i * C) * log (((float) n_i / C) / log (2.0)); entropy += (float) n_i / (N_i * C) * log (((float) n_i / C) / log (2.0));
} }
@ -93,7 +96,7 @@ public:
} }
private: private:
/** vector of min values */ /** vector of min values */
std::vector<double> vect_min_val; std::vector<double> vect_min_val;
@ -107,8 +110,10 @@ private:
* Removes the dominated individuals contained in _f * Removes the dominated individuals contained in _f
* @param _f a Pareto set * @param _f a Pareto set
*/ */
void removeDominated(std::vector < ObjectiveVector > & _f) { void removeDominated(std::vector < ObjectiveVector > & _f)
for (unsigned int i=0 ; i<_f.size(); i++) { {
for (unsigned int i=0 ; i<_f.size(); i++)
{
bool dom = false; bool dom = false;
for (unsigned int j=0; j<_f.size(); j++) for (unsigned int j=0; j<_f.size(); j++)
if (i != j && paretoComparator(_f[i],_f[j])) if (i != j && paretoComparator(_f[i],_f[j]))
@ -116,7 +121,8 @@ private:
dom = true; dom = true;
break; break;
} }
if (dom) { if (dom)
{
_f[i] = _f.back(); _f[i] = _f.back();
_f.pop_back(); _f.pop_back();
i--; i--;
@ -129,13 +135,16 @@ private:
* Prenormalization * Prenormalization
* @param _f a Pareto set * @param _f a Pareto set
*/ */
void prenormalize (const std::vector< ObjectiveVector > & _f) { void prenormalize (const std::vector< ObjectiveVector > & _f)
{
vect_min_val.clear(); vect_min_val.clear();
vect_max_val.clear(); vect_max_val.clear();
for (unsigned int i=0 ; i<ObjectiveVector::nObjectives(); i++) { for (unsigned int i=0 ; i<ObjectiveVector::nObjectives(); i++)
{
float min_val = _f.front()[i], max_val = min_val; float min_val = _f.front()[i], max_val = min_val;
for (unsigned int j=1 ; j<_f.size(); j++) { for (unsigned int j=1 ; j<_f.size(); j++)
{
if (_f[j][i] < min_val) if (_f[j][i] < min_val)
min_val = _f[j][i]; min_val = _f[j][i];
if (_f[j][i]>max_val) if (_f[j][i]>max_val)
@ -151,7 +160,8 @@ private:
* Normalization * Normalization
* @param _f a Pareto set * @param _f a Pareto set
*/ */
void normalize (std::vector< ObjectiveVector > & _f) { void normalize (std::vector< ObjectiveVector > & _f)
{
for (unsigned int i=0 ; i<ObjectiveVector::nObjectives(); i++) for (unsigned int i=0 ; i<ObjectiveVector::nObjectives(); i++)
for (unsigned int j=0; j<_f.size(); j++) for (unsigned int j=0; j<_f.size(); j++)
_f[j][i] = (_f[j][i] - vect_min_val[i]) / (vect_max_val[i] - vect_min_val[i]); _f[j][i] = (_f[j][i] - vect_min_val[i]) / (vect_max_val[i] - vect_min_val[i]);
@ -164,12 +174,15 @@ private:
* @param _f2 the second Pareto set * @param _f2 the second Pareto set
* @param _f the final Pareto set * @param _f the final Pareto set
*/ */
void computeUnion(const std::vector< ObjectiveVector > & _f1, const std::vector< ObjectiveVector > & _f2, std::vector< ObjectiveVector > & _f) { void computeUnion(const std::vector< ObjectiveVector > & _f1, const std::vector< ObjectiveVector > & _f2, std::vector< ObjectiveVector > & _f)
{
_f = _f1 ; _f = _f1 ;
for (unsigned int i=0; i<_f2.size(); i++) { for (unsigned int i=0; i<_f2.size(); i++)
{
bool b = false; bool b = false;
for (unsigned int j=0; j<_f1.size(); j ++) for (unsigned int j=0; j<_f1.size(); j ++)
if (_f1[j] == _f2[i]) { if (_f1[j] == _f2[i])
{
b = true; b = true;
break; break;
} }
@ -182,9 +195,11 @@ private:
/** /**
* How many in niche * How many in niche
*/ */
unsigned int howManyInNicheOf (const std::vector< ObjectiveVector > & _f, const ObjectiveVector & _s, unsigned int _size) { unsigned int howManyInNicheOf (const std::vector< ObjectiveVector > & _f, const ObjectiveVector & _s, unsigned int _size)
{
unsigned int n=0; unsigned int n=0;
for (unsigned int i=0 ; i<_f.size(); i++) { for (unsigned int i=0 ; i<_f.size(); i++)
{
if (euclidianDistance(_f[i], _s) < (_s.size() / (double) _size)) if (euclidianDistance(_f[i], _s) < (_s.size() / (double) _size))
n++; n++;
} }
@ -195,13 +210,14 @@ private:
/** /**
* Euclidian distance * Euclidian distance
*/ */
double euclidianDistance (const ObjectiveVector & _set1, const ObjectiveVector & _to, unsigned int _deg = 2) { double euclidianDistance (const ObjectiveVector & _set1, const ObjectiveVector & _to, unsigned int _deg = 2)
{
double dist=0; double dist=0;
for (unsigned int i=0; i<_set1.size(); i++) for (unsigned int i=0; i<_set1.size(); i++)
dist += pow(fabs(_set1[i] - _to[i]), (int)_deg); dist += pow(fabs(_set1[i] - _to[i]), (int)_deg);
return pow(dist, 1.0 / _deg); return pow(dist, 1.0 / _deg);
} }
}; };
#endif /*MOEOENTROPYMETRIC_H_*/ #endif /*MOEOENTROPYMETRIC_H_*/

View file

@ -52,8 +52,8 @@
*/ */
template < class ObjectiveVector > template < class ObjectiveVector >
class moeoHypervolumeBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > class moeoHypervolumeBinaryMetric : public moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double >
{ {
public: public:
/** /**
* Ctor * Ctor
@ -101,7 +101,7 @@ public:
} }
private: private:
/** value used to compute the reference point from the worst values for each objective */ /** value used to compute the reference point from the worst values for each objective */
double rho; double rho;
@ -161,6 +161,6 @@ private:
return result; return result;
} }
}; };
#endif /*MOEOHYPERVOLUMEBINARYMETRIC_H_*/ #endif /*MOEOHYPERVOLUMEBINARYMETRIC_H_*/

View file

@ -44,49 +44,56 @@
/** /**
* Base class for performance metrics (also known as quality indicators). * Base class for performance metrics (also known as quality indicators).
*/ */
class moeoMetric : public eoFunctorBase {}; class moeoMetric : public eoFunctorBase
{};
/** /**
* Base class for unary metrics. * Base class for unary metrics.
*/ */
template < class A, class R > template < class A, class R >
class moeoUnaryMetric : public eoUF < A, R >, public moeoMetric {}; class moeoUnaryMetric : public eoUF < A, R >, public moeoMetric
{};
/** /**
* Base class for binary metrics. * Base class for binary metrics.
*/ */
template < class A1, class A2, class R > template < class A1, class A2, class R >
class moeoBinaryMetric : public eoBF < A1, A2, R >, public moeoMetric {}; class moeoBinaryMetric : public eoBF < A1, A2, R >, public moeoMetric
{};
/** /**
* Base class for unary metrics dedicated to the performance evaluation of a single solution's objective vector. * Base class for unary metrics dedicated to the performance evaluation of a single solution's objective vector.
*/ */
template < class ObjectiveVector, class R > template < class ObjectiveVector, class R >
class moeoSolutionUnaryMetric : public moeoUnaryMetric < const ObjectiveVector &, R > {}; class moeoSolutionUnaryMetric : public moeoUnaryMetric < const ObjectiveVector &, R >
{};
/** /**
* Base class for unary metrics dedicated to the performance evaluation of a Pareto set (a vector of objective vectors) * Base class for unary metrics dedicated to the performance evaluation of a Pareto set (a vector of objective vectors)
*/ */
template < class ObjectiveVector, class R > template < class ObjectiveVector, class R >
class moeoVectorUnaryMetric : public moeoUnaryMetric < const std::vector < ObjectiveVector > &, R > {}; class moeoVectorUnaryMetric : public moeoUnaryMetric < const std::vector < ObjectiveVector > &, R >
{};
/** /**
* Base class for binary metrics dedicated to the performance comparison between two solutions's objective vectors. * Base class for binary metrics dedicated to the performance comparison between two solutions's objective vectors.
*/ */
template < class ObjectiveVector, class R > template < class ObjectiveVector, class R >
class moeoSolutionVsSolutionBinaryMetric : public moeoBinaryMetric < const ObjectiveVector &, const ObjectiveVector &, R > {}; class moeoSolutionVsSolutionBinaryMetric : public moeoBinaryMetric < const ObjectiveVector &, const ObjectiveVector &, R >
{};
/** /**
* Base class for binary metrics dedicated to the performance comparison between two Pareto sets (two vectors of objective vectors) * Base class for binary metrics dedicated to the performance comparison between two Pareto sets (two vectors of objective vectors)
*/ */
template < class ObjectiveVector, class R > template < class ObjectiveVector, class R >
class moeoVectorVsVectorBinaryMetric : public moeoBinaryMetric < const std::vector < ObjectiveVector > &, const std::vector < ObjectiveVector > &, R > {}; class moeoVectorVsVectorBinaryMetric : public moeoBinaryMetric < const std::vector < ObjectiveVector > &, const std::vector < ObjectiveVector > &, R >
{};
#endif /*MOEOMETRIC_H_*/ #endif /*MOEOMETRIC_H_*/

View file

@ -49,8 +49,8 @@
*/ */
template < class ObjectiveVector, class R > template < class ObjectiveVector, class R >
class moeoNormalizedSolutionVsSolutionBinaryMetric : public moeoSolutionVsSolutionBinaryMetric < ObjectiveVector, R > class moeoNormalizedSolutionVsSolutionBinaryMetric : public moeoSolutionVsSolutionBinaryMetric < ObjectiveVector, R >
{ {
public: public:
/** /**
* Default ctr for any moeoNormalizedSolutionVsSolutionBinaryMetric object * Default ctr for any moeoNormalizedSolutionVsSolutionBinaryMetric object
@ -103,11 +103,11 @@ public:
} }
protected: protected:
/** the bounds for every objective (bounds[i] = bounds for the objective i) */ /** the bounds for every objective (bounds[i] = bounds for the objective i) */
std::vector < eoRealInterval > bounds; std::vector < eoRealInterval > bounds;
}; };
#endif /*MOEONORMALIZEDSOLUTIONVSSOLUTIONBINARYMETRIC_H_*/ #endif /*MOEONORMALIZEDSOLUTIONVSSOLUTIONBINARYMETRIC_H_*/

View file

@ -41,6 +41,7 @@
#include <eoFunctor.h> #include <eoFunctor.h>
template < class Move > template < class Move >
class moeoMoveIncrEval : public eoBF < const Move &, const typename Move::EOType &, typename Move::EOType::ObjectiveVector > {}; class moeoMoveIncrEval : public eoBF < const Move &, const typename Move::EOType &, typename Move::EOType::ObjectiveVector >
{};
#endif #endif

View file

@ -49,8 +49,8 @@
* Elitist replacement strategy that consists in keeping the N best individuals. * Elitist replacement strategy that consists in keeping the N best individuals.
*/ */
template < class MOEOT > class moeoElitistReplacement:public moeoReplacement < MOEOT > template < class MOEOT > class moeoElitistReplacement:public moeoReplacement < MOEOT >
{ {
public: public:
/** /**
* Full constructor. * Full constructor.
@ -116,7 +116,7 @@ public:
} }
protected: protected:
/** the fitness assignment strategy */ /** the fitness assignment strategy */
moeoFitnessAssignment < MOEOT > & fitnessAssignment; moeoFitnessAssignment < MOEOT > & fitnessAssignment;
@ -148,8 +148,9 @@ protected:
private: private:
/** the comparator */ /** the comparator */
moeoComparator < MOEOT > & comp; moeoComparator < MOEOT > & comp;
} comparator; }
comparator;
}; };
#endif /*MOEOELITISTREPLACEMENT_H_ */ #endif /*MOEOELITISTREPLACEMENT_H_ */

View file

@ -49,8 +49,8 @@
* and by updating the fitness and diversity values after each deletion. * and by updating the fitness and diversity values after each deletion.
*/ */
template < class MOEOT > class moeoEnvironmentalReplacement:public moeoReplacement < MOEOT > template < class MOEOT > class moeoEnvironmentalReplacement:public moeoReplacement < MOEOT >
{ {
public: public:
/** The type for objective vector */ /** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -132,7 +132,7 @@ public:
} }
protected: protected:
/** the fitness assignment strategy */ /** the fitness assignment strategy */
moeoFitnessAssignment < MOEOT > & fitnessAssignment; moeoFitnessAssignment < MOEOT > & fitnessAssignment;
@ -164,8 +164,9 @@ protected:
private: private:
/** the comparator */ /** the comparator */
moeoComparator < MOEOT > & comp; moeoComparator < MOEOT > & comp;
} comparator; }
comparator;
}; };
#endif /*MOEOENVIRONMENTALREPLACEMENT_H_ */ #endif /*MOEOENVIRONMENTALREPLACEMENT_H_ */

View file

@ -46,8 +46,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoGenerationalReplacement : public moeoReplacement < MOEOT >, public eoGenerationalReplacement < MOEOT > class moeoGenerationalReplacement : public moeoReplacement < MOEOT >, public eoGenerationalReplacement < MOEOT >
{ {
public: public:
/** /**
* Swaps _parents and _offspring * Swaps _parents and _offspring
@ -59,6 +59,6 @@ public:
eoGenerationalReplacement < MOEOT >::operator ()(_parents, _offspring); eoGenerationalReplacement < MOEOT >::operator ()(_parents, _offspring);
} }
}; };
#endif /*MOEOGENERATIONALREPLACEMENT_H_*/ #endif /*MOEOGENERATIONALREPLACEMENT_H_*/

View file

@ -44,6 +44,7 @@
* Replacement strategy for multi-objective optimization. * Replacement strategy for multi-objective optimization.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoReplacement : public eoReplacement < MOEOT > {}; class moeoReplacement : public eoReplacement < MOEOT >
{};
#endif /*MOEOREPLACEMENT_H_*/ #endif /*MOEOREPLACEMENT_H_*/

View file

@ -47,8 +47,8 @@
* Selection strategy that selects ONE individual by deterministic tournament. * Selection strategy that selects ONE individual by deterministic tournament.
*/ */
template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne < MOEOT > template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne < MOEOT >
{ {
public: public:
/** /**
* Full Ctor. * Full Ctor.
@ -94,7 +94,7 @@ public:
} }
protected: protected:
/** the comparator (used to compare 2 individuals) */ /** the comparator (used to compare 2 individuals) */
moeoComparator < MOEOT > & comparator; moeoComparator < MOEOT > & comparator;
@ -103,6 +103,6 @@ protected:
/** the number of individuals in the tournament */ /** the number of individuals in the tournament */
unsigned int tSize; unsigned int tSize;
}; };
#endif /*MOEODETTOURNAMENTSELECT_H_ */ #endif /*MOEODETTOURNAMENTSELECT_H_ */

View file

@ -46,13 +46,14 @@
* Selection strategy that selects only one element randomly from a whole population. * Selection strategy that selects only one element randomly from a whole population.
*/ */
template < class MOEOT > class moeoRandomSelect:public moeoSelectOne < MOEOT >, public eoRandomSelect <MOEOT > template < class MOEOT > class moeoRandomSelect:public moeoSelectOne < MOEOT >, public eoRandomSelect <MOEOT >
{ {
public: public:
/** /**
* Ctor. * Ctor.
*/ */
moeoRandomSelect(){} moeoRandomSelect()
{}
/** /**
@ -63,6 +64,6 @@ public:
return eoRandomSelect < MOEOT >::operator ()(_pop); return eoRandomSelect < MOEOT >::operator ()(_pop);
} }
}; };
#endif /*MOEORANDOMSELECT_H_ */ #endif /*MOEORANDOMSELECT_H_ */

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoRouletteSelect:public moeoSelectOne < MOEOT > class moeoRouletteSelect:public moeoSelectOne < MOEOT >
{ {
public: public:
/** /**
* Ctor. * Ctor.
@ -77,11 +77,11 @@ public:
} }
protected: protected:
/** size */ /** size */
double & tSize; double & tSize;
}; };
#endif /*MOEOROULETTESELECT_H_ */ #endif /*MOEOROULETTESELECT_H_ */

View file

@ -49,8 +49,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoSelectFromPopAndArch : public moeoSelectOne < MOEOT > class moeoSelectFromPopAndArch : public moeoSelectOne < MOEOT >
{ {
public: public:
/** /**
* Ctor * Ctor
@ -99,7 +99,7 @@ public:
} }
private: private:
/** The population's selection operator */ /** The population's selection operator */
moeoSelectOne < MOEOT > & popSelectOne; moeoSelectOne < MOEOT > & popSelectOne;
@ -112,6 +112,6 @@ private:
/** A random selection operator (used as default for archSelectOne) */ /** A random selection operator (used as default for archSelectOne) */
moeoRandomSelect < MOEOT > randomSelectOne; moeoRandomSelect < MOEOT > randomSelectOne;
}; };
#endif /*MOEOSELECTONEFROMPOPANDARCH_H_*/ #endif /*MOEOSELECTONEFROMPOPANDARCH_H_*/

View file

@ -44,6 +44,7 @@
* Selection strategy for multi-objective optimization that selects only one element from a whole population. * Selection strategy for multi-objective optimization that selects only one element from a whole population.
*/ */
template < class MOEOT > template < class MOEOT >
class moeoSelectOne : public eoSelectOne < MOEOT > {}; class moeoSelectOne : public eoSelectOne < MOEOT >
{};
#endif /*MOEOSELECTONE_H_*/ #endif /*MOEOSELECTONE_H_*/

View file

@ -47,8 +47,8 @@
* Selection strategy that selects ONE individual by stochastic tournament. * Selection strategy that selects ONE individual by stochastic tournament.
*/ */
template < class MOEOT > class moeoStochTournamentSelect:public moeoSelectOne <MOEOT> template < class MOEOT > class moeoStochTournamentSelect:public moeoSelectOne <MOEOT>
{ {
public: public:
/** /**
* Full Ctor * Full Ctor
@ -102,7 +102,7 @@ public:
} }
protected: protected:
/** the comparator (used to compare 2 individuals) */ /** the comparator (used to compare 2 individuals) */
moeoComparator < MOEOT > & comparator; moeoComparator < MOEOT > & comparator;
@ -111,6 +111,6 @@ protected:
/** the tournament rate */ /** the tournament rate */
double tRate; double tRate;
}; };
#endif /*MOEOSTOCHTOURNAMENTSELECT_H_ */ #endif /*MOEOSTOCHTOURNAMENTSELECT_H_ */

View file

@ -51,8 +51,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoArchiveObjectiveVectorSavingUpdater : public eoUpdater class moeoArchiveObjectiveVectorSavingUpdater : public eoUpdater
{ {
public: public:
/** /**
* Ctor * Ctor
@ -69,7 +69,8 @@ public:
/** /**
* Saves the fitness of the archive's members into the file * Saves the fitness of the archive's members into the file
*/ */
void operator()() { void operator()()
{
char buff[MAX_BUFFER_SIZE]; char buff[MAX_BUFFER_SIZE];
if (count) if (count)
{ {
@ -101,7 +102,7 @@ public:
} }
private: private:
/** local archive */ /** local archive */
moeoArchive<MOEOT> & arch; moeoArchive<MOEOT> & arch;
@ -114,6 +115,6 @@ private:
/** own ID */ /** own ID */
int id; int id;
}; };
#endif /*MOEOARCHIVEOBJECTIVEVECTORSAVINGUPDATER_H_*/ #endif /*MOEOARCHIVEOBJECTIVEVECTORSAVINGUPDATER_H_*/

View file

@ -47,8 +47,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoArchiveUpdater : public eoUpdater class moeoArchiveUpdater : public eoUpdater
{ {
public: public:
/** /**
* Ctor * Ctor
@ -62,18 +62,19 @@ public:
/** /**
* Updates the archive with newly found non-dominated solutions contained in the main population * Updates the archive with newly found non-dominated solutions contained in the main population
*/ */
void operator()() { void operator()()
{
arch.update(pop); arch.update(pop);
} }
private: private:
/** the archive of non-dominated solutions */ /** the archive of non-dominated solutions */
moeoArchive < MOEOT > & arch; moeoArchive < MOEOT > & arch;
/** the main population */ /** the main population */
const eoPop < MOEOT > & pop; const eoPop < MOEOT > & pop;
}; };
#endif /*MOEOARCHIVEUPDATER_H_*/ #endif /*MOEOARCHIVEUPDATER_H_*/

View file

@ -51,8 +51,8 @@
*/ */
template < class MOEOT > template < class MOEOT >
class moeoBinaryMetricSavingUpdater : public eoUpdater class moeoBinaryMetricSavingUpdater : public eoUpdater
{ {
public: public:
/** The objective vector type of a solution */ /** The objective vector type of a solution */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
@ -72,12 +72,16 @@ public:
/** /**
* Saves the metric's value for the current generation * Saves the metric's value for the current generation
*/ */
void operator()() { void operator()()
if (pop.size()) { {
if (firstGen) { if (pop.size())
{
if (firstGen)
{
firstGen = false; firstGen = false;
} }
else { else
{
// creation of the two Pareto sets // creation of the two Pareto sets
std::vector < ObjectiveVector > from; std::vector < ObjectiveVector > from;
std::vector < ObjectiveVector > to; std::vector < ObjectiveVector > to;
@ -95,7 +99,7 @@ public:
} }
private: private:
/** binary metric comparing two Pareto sets */ /** binary metric comparing two Pareto sets */
moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > & metric; moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > & metric;
@ -110,6 +114,6 @@ private:
/** counter */ /** counter */
unsigned int counter; unsigned int counter;
}; };
#endif /*MOEOBINARYMETRICSAVINGUPDATER_H_*/ #endif /*MOEOBINARYMETRICSAVINGUPDATER_H_*/

View file

@ -46,8 +46,8 @@
*/ */
template < class MOEOT, class ObjectiveVector = typename MOEOT::ObjectiveVector > template < class MOEOT, class ObjectiveVector = typename MOEOT::ObjectiveVector >
class moeoConvertPopToObjectiveVectors : public eoUF < const eoPop < MOEOT >, const std::vector < ObjectiveVector > > class moeoConvertPopToObjectiveVectors : public eoUF < const eoPop < MOEOT >, const std::vector < ObjectiveVector > >
{ {
public: public:
/** /**
* Returns a vector of the objective vectors from the population _pop * Returns a vector of the objective vectors from the population _pop
@ -64,6 +64,6 @@ public:
return result; return result;
} }
}; };
#endif /*MOEOPOPTOOBJECTIVEVECTORS_H_*/ #endif /*MOEOPOPTOOBJECTIVEVECTORS_H_*/

View file

@ -44,8 +44,8 @@ using namespace std;
// the moeoObjectiveVectorTraits : minimizing 2 objectives // the moeoObjectiveVectorTraits : minimizing 2 objectives
class Sch1ObjectiveVectorTraits : public moeoObjectiveVectorTraits class Sch1ObjectiveVectorTraits : public moeoObjectiveVectorTraits
{ {
public: public:
static bool minimizing (int i) static bool minimizing (int i)
{ {
return true; return true;
@ -58,7 +58,7 @@ public:
{ {
return 2; return 2;
} }
}; };
// objective vector of real values // objective vector of real values
@ -67,16 +67,17 @@ typedef moeoRealObjectiveVector < Sch1ObjectiveVectorTraits > Sch1ObjectiveVecto
// multi-objective evolving object for the Sch1 problem // multi-objective evolving object for the Sch1 problem
class Sch1 : public moeoRealVector < Sch1ObjectiveVector, double, double > class Sch1 : public moeoRealVector < Sch1ObjectiveVector, double, double >
{ {
public: public:
Sch1() : moeoRealVector < Sch1ObjectiveVector, double, double > (1) {} Sch1() : moeoRealVector < Sch1ObjectiveVector, double, double > (1)
}; {}
};
// evaluation of objective functions // evaluation of objective functions
class Sch1Eval : public moeoEvalFunc < Sch1 > class Sch1Eval : public moeoEvalFunc < Sch1 >
{ {
public: public:
void operator () (Sch1 & _sch1) void operator () (Sch1 & _sch1)
{ {
if (_sch1.invalidObjectiveVector()) if (_sch1.invalidObjectiveVector())
@ -88,7 +89,7 @@ public:
_sch1.objectiveVector(objVec); _sch1.objectiveVector(objVec);
} }
} }
}; };
// main // main

View file

@ -38,6 +38,6 @@
#include <FlowShop.h> #include <FlowShop.h>
std::string FlowShop::className() const std::string FlowShop::className() const
{ {
return "FlowShop"; return "FlowShop";
} }

View file

@ -45,14 +45,14 @@
* Structure of the genotype for the flow-shop scheduling problem: a vector of unsigned int int. * Structure of the genotype for the flow-shop scheduling problem: a vector of unsigned int int.
*/ */
class FlowShop: public moeoVector < FlowShopObjectiveVector , double , double , unsigned int > class FlowShop: public moeoVector < FlowShopObjectiveVector , double , double , unsigned int >
{ {
public: public:
/** /**
* class name * class name
*/ */
std::string className() const; std::string className() const;
}; };
#endif /*FLOWSHOP_H_*/ #endif /*FLOWSHOP_H_*/

View file

@ -69,21 +69,24 @@ const std::vector<unsigned int> FlowShopBenchmarkParser::getD()
void FlowShopBenchmarkParser::printOn(std::ostream & _os) const void FlowShopBenchmarkParser::printOn(std::ostream & _os) const
{ {
_os << "M=" << M << " N=" << N << std::endl; _os << "M=" << M << " N=" << N << std::endl;
_os << "*** processing times" << std::endl; _os << "*** processing times" << std::endl;
for (unsigned int i=0; i<M; i++) { for (unsigned int i=0; i<M; i++)
for (unsigned int j=0; j<N; j++) { {
for (unsigned int j=0; j<N; j++)
{
_os << p[i][j] << " "; _os << p[i][j] << " ";
} }
_os << std::endl; _os << std::endl;
} }
_os << "*** due-dates" << std::endl; _os << "*** due-dates" << std::endl;
for (unsigned int j=0; j<N; j++) { for (unsigned int j=0; j<N; j++)
{
_os << d[j] << " "; _os << d[j] << " ";
} }
_os << std::endl << std::endl; _os << std::endl << std::endl;
} }
void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName) void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
@ -106,7 +109,8 @@ void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
p = std::vector< std::vector<unsigned int> > (M,N); p = std::vector< std::vector<unsigned int> > (M,N);
d = std::vector<unsigned int> (N); d = std::vector<unsigned int> (N);
// for each job... // for each job...
for (unsigned int j=0 ; j<N ; j++) { for (unsigned int j=0 ; j<N ; j++)
{
// index of the job (<=> j) // index of the job (<=> j)
getline(inputFile, buffer, '\n'); getline(inputFile, buffer, '\n');
// due-date of the job j // due-date of the job j
@ -115,7 +119,8 @@ void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
// processing times of the job j on each machine // processing times of the job j on each machine
getline(inputFile, buffer, '\n'); getline(inputFile, buffer, '\n');
start = buffer.find_first_not_of(" "); start = buffer.find_first_not_of(" ");
for (unsigned int i=0 ; i<M ; i++) { for (unsigned int i=0 ; i<M ; i++)
{
end = buffer.find_first_of(" ", start); end = buffer.find_first_of(" ", start);
p[i][j] = atoi(buffer.substr(start, end-start).data()); p[i][j] = atoi(buffer.substr(start, end-start).data());
start = buffer.find_first_not_of(" ", end); start = buffer.find_first_not_of(" ", end);

View file

@ -46,8 +46,8 @@
* Class to handle parameters of a flow-shop instance from a benchmark file * Class to handle parameters of a flow-shop instance from a benchmark file
*/ */
class FlowShopBenchmarkParser class FlowShopBenchmarkParser
{ {
public: public:
/** /**
* Ctor * Ctor
@ -86,7 +86,7 @@ public:
void printOn(std::ostream & _os) const; void printOn(std::ostream & _os) const;
private: private:
/** number of machines */ /** number of machines */
unsigned int M; unsigned int M;
@ -104,6 +104,6 @@ private:
*/ */
void init(const std::string _benchmarkFileName); void init(const std::string _benchmarkFileName);
}; };
#endif /*FLOWSHOPBENCHMARKPARSER_H_*/ #endif /*FLOWSHOPBENCHMARKPARSER_H_*/

View file

@ -75,7 +75,8 @@ double FlowShopEval::tardiness(const FlowShop & _flowshop)
} }
std::vector< std::vector<unsigned int> > FlowShopEval::completionTime(const FlowShop & _flowshop) { std::vector< std::vector<unsigned int> > FlowShopEval::completionTime(const FlowShop & _flowshop)
{
std::vector< std::vector<unsigned int> > C(M,N); std::vector< std::vector<unsigned int> > C(M,N);
C[0][_flowshop[0]] = p[0][_flowshop[0]]; C[0][_flowshop[0]] = p[0][_flowshop[0]];
for (unsigned int j=1; j<N; j++) for (unsigned int j=1; j<N; j++)

View file

@ -46,8 +46,8 @@
* Evaluation of the objective vector a (multi-objective) FlowShop object * Evaluation of the objective vector a (multi-objective) FlowShop object
*/ */
class FlowShopEval : public moeoEvalFunc<FlowShop> class FlowShopEval : public moeoEvalFunc<FlowShop>
{ {
public: public:
/** /**
* Ctor * Ctor
@ -66,7 +66,7 @@ public:
void operator()(FlowShop & _flowshop); void operator()(FlowShop & _flowshop);
private: private:
/** number of machines */ /** number of machines */
unsigned int M; unsigned int M;
@ -99,6 +99,6 @@ private:
*/ */
std::vector< std::vector<unsigned int> > completionTime (const FlowShop & _flowshop); std::vector< std::vector<unsigned int> > completionTime (const FlowShop & _flowshop);
}; };
#endif /*FLOWSHOPEVAL_H_*/ #endif /*FLOWSHOPEVAL_H_*/

View file

@ -45,8 +45,8 @@
* Initialization of a random genotype built by the default constructor of the FlowShop class * Initialization of a random genotype built by the default constructor of the FlowShop class
*/ */
class FlowShopInit : public eoInit<FlowShop> class FlowShopInit : public eoInit<FlowShop>
{ {
public: public:
/** /**
* Ctor * Ctor
@ -62,11 +62,11 @@ public:
void operator()(FlowShop & _flowshop); void operator()(FlowShop & _flowshop);
private: private:
/** the number of jobs (size of a scheduling vector) */ /** the number of jobs (size of a scheduling vector) */
unsigned int N; unsigned int N;
}; };
#endif /*FLOWSHOPINIT_H_*/ #endif /*FLOWSHOPINIT_H_*/

View file

@ -44,8 +44,8 @@
* Definition of the objective vector traits for multi-objective flow-shop problems * Definition of the objective vector traits for multi-objective flow-shop problems
*/ */
class FlowShopObjectiveVectorTraits : public moeoObjectiveVectorTraits class FlowShopObjectiveVectorTraits : public moeoObjectiveVectorTraits
{ {
public: public:
/** /**
* Returns true if the _ith objective have to be minimzed * Returns true if the _ith objective have to be minimzed
@ -66,6 +66,6 @@ public:
*/ */
static unsigned int nObjectives (); static unsigned int nObjectives ();
}; };
#endif /*FLOWSHOPOBJECTIVEVECTORTRAITS_H_*/ #endif /*FLOWSHOPOBJECTIVEVECTORTRAITS_H_*/

View file

@ -39,9 +39,9 @@
std::string FlowShopOpCrossoverQuad::className() const std::string FlowShopOpCrossoverQuad::className() const
{ {
return "FlowShopOpCrossoverQuad"; return "FlowShopOpCrossoverQuad";
} }
bool FlowShopOpCrossoverQuad::operator()(FlowShop & _flowshop1, FlowShop & _flowshop2) bool FlowShopOpCrossoverQuad::operator()(FlowShop & _flowshop1, FlowShop & _flowshop2)
@ -53,7 +53,8 @@ bool FlowShopOpCrossoverQuad::operator()(FlowShop & _flowshop1, FlowShop & _flow
{ {
point1 = rng.random(std::min(_flowshop1.size(), _flowshop2.size())); point1 = rng.random(std::min(_flowshop1.size(), _flowshop2.size()));
point2 = rng.random(std::min(_flowshop1.size(), _flowshop2.size())); point2 = rng.random(std::min(_flowshop1.size(), _flowshop2.size()));
} while (fabs((double) point1-point2) <= 2); }
while (fabs((double) point1-point2) <= 2);
// computation of the offspring // computation of the offspring
FlowShop offspring1 = generateOffspring(_flowshop1, _flowshop2, point1, point2); FlowShop offspring1 = generateOffspring(_flowshop1, _flowshop2, point1, point2);
FlowShop offspring2 = generateOffspring(_flowshop2, _flowshop1, point1, point2); FlowShop offspring2 = generateOffspring(_flowshop2, _flowshop1, point1, point2);

View file

@ -45,8 +45,8 @@
* Quadratic crossover operator for flow-shop (modify the both genotypes) * Quadratic crossover operator for flow-shop (modify the both genotypes)
*/ */
class FlowShopOpCrossoverQuad : public eoQuadOp < FlowShop > class FlowShopOpCrossoverQuad : public eoQuadOp < FlowShop >
{ {
public: public:
/** /**
* the class name (used to display statistics) * the class name (used to display statistics)
@ -62,7 +62,7 @@ public:
bool operator()(FlowShop & _flowshop1, FlowShop & _flowshop2); bool operator()(FlowShop & _flowshop1, FlowShop & _flowshop2);
private: private:
/** /**
* generation of an offspring by a 2 points crossover * generation of an offspring by a 2 points crossover
@ -73,6 +73,6 @@ private:
*/ */
FlowShop generateOffspring(const FlowShop & _parent1, const FlowShop & _parent2, unsigned int _point1, unsigned int _point2); FlowShop generateOffspring(const FlowShop & _parent1, const FlowShop & _parent2, unsigned int _point1, unsigned int _point2);
}; };
#endif /*FLOWSHOPOPCROSSOVERQUAD_H_*/ #endif /*FLOWSHOPOPCROSSOVERQUAD_H_*/

View file

@ -39,9 +39,9 @@
std::string FlowShopOpMutationExchange::className() const std::string FlowShopOpMutationExchange::className() const
{ {
return "FlowShopOpMutationExchange"; return "FlowShopOpMutationExchange";
} }
bool FlowShopOpMutationExchange::operator()(FlowShop & _flowshop) bool FlowShopOpMutationExchange::operator()(FlowShop & _flowshop)
@ -54,7 +54,8 @@ bool FlowShopOpMutationExchange::operator()(FlowShop & _flowshop)
{ {
point1 = rng.random(result.size()); point1 = rng.random(result.size());
point2 = rng.random(result.size()); point2 = rng.random(result.size());
} while (point1 == point2); }
while (point1 == point2);
// swap // swap
std::swap (result[point1], result[point2]); std::swap (result[point1], result[point2]);
// update (if necessary) // update (if necessary)

View file

@ -45,8 +45,8 @@
* Exchange mutation operator for the flow-shop * Exchange mutation operator for the flow-shop
*/ */
class FlowShopOpMutationExchange : public eoMonOp<FlowShop> class FlowShopOpMutationExchange : public eoMonOp<FlowShop>
{ {
public: public:
/** /**
* the class name (used to display statistics) * the class name (used to display statistics)
@ -60,6 +60,6 @@ public:
*/ */
bool operator()(FlowShop & _flowshop); bool operator()(FlowShop & _flowshop);
}; };
#endif /*FLOWSHOPOPMUTATIONEXCHANGE_H_*/ #endif /*FLOWSHOPOPMUTATIONEXCHANGE_H_*/

View file

@ -39,9 +39,9 @@
std::string FlowShopOpMutationShift::className() const std::string FlowShopOpMutationShift::className() const
{ {
return "FlowShopOpMutationShift"; return "FlowShopOpMutationShift";
} }
bool FlowShopOpMutationShift::operator()(FlowShop & _flowshop) bool FlowShopOpMutationShift::operator()(FlowShop & _flowshop)
@ -56,7 +56,8 @@ bool FlowShopOpMutationShift::operator()(FlowShop & _flowshop)
{ {
point1 = rng.random(result.size()); point1 = rng.random(result.size());
point2 = rng.random(result.size()); point2 = rng.random(result.size());
} while (point1 == point2); }
while (point1 == point2);
// direction // direction
if (point1 < point2) if (point1 < point2)
direction = 1; direction = 1;

View file

@ -45,8 +45,8 @@
* Shift mutation operator for flow-shop * Shift mutation operator for flow-shop
*/ */
class FlowShopOpMutationShift : public eoMonOp < FlowShop > class FlowShopOpMutationShift : public eoMonOp < FlowShop >
{ {
public: public:
/** /**
* the class name (used to display statistics) * the class name (used to display statistics)
@ -60,6 +60,6 @@ public:
*/ */
bool operator()(FlowShop & _flowshop); bool operator()(FlowShop & _flowshop);
}; };
#endif /*FLOWSHOPOPMUTATIONSHIFT_H_*/ #endif /*FLOWSHOPOPMUTATIONSHIFT_H_*/

View file

@ -55,7 +55,8 @@ eoEvalFuncCounter<FlowShop> & do_make_eval(eoParser& _parser, eoState& _state)
{ {
// benchmark file name // benchmark file name
std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value(); std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value();
if (benchmarkFileName == "") { if (benchmarkFileName == "")
{
std::string stmp = "*** Missing name of the benchmark file\n"; std::string stmp = "*** Missing name of the benchmark file\n";
stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n"; stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks"; stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";

View file

@ -53,7 +53,8 @@ eoInit<FlowShop> & do_make_genotype(eoParser& _parser, eoState& _state)
{ {
// benchmark file name // benchmark file name
std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks/)", 'B',"Representation", true).value(); std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks/)", 'B',"Representation", true).value();
if (benchmarkFileName == "") { if (benchmarkFileName == "")
{
std::string stmp = "*** Missing name of the benchmark file\n"; std::string stmp = "*** Missing name of the benchmark file\n";
stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n"; stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks"; stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";