New config of Paradiseo with Cmake 2.6
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1347 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
aa8109322c
commit
712e8d6cfa
84 changed files with 1468 additions and 739 deletions
|
|
@ -129,7 +129,7 @@ public:
|
|||
/**
|
||||
* Ctor with a crossover, a mutation and their corresponding rates.
|
||||
* @param _continuator stopping criteria
|
||||
* @param _eval evaluation function
|
||||
popEval * @param _eval evaluation function
|
||||
* @param _op general operator
|
||||
* @param _archive archive
|
||||
* @param _k the k-ieme distance used to fixe diversity
|
||||
|
|
@ -241,14 +241,16 @@ class eoDummyTransform : public eoTransform<MOEOT>
|
|||
eoPopLoopEval < MOEOT > loopEval;
|
||||
/** evaluation function used to evaluate the whole population */
|
||||
eoPopEvalFunc < MOEOT > & popEval;
|
||||
/**archive*/
|
||||
moeoArchive < MOEOT >& archive;
|
||||
/** selectMany */
|
||||
eoSelectMany <MOEOT> selectMany;
|
||||
/** select Transform*/
|
||||
eoSelectTransform <MOEOT> selectTransform;
|
||||
/** binary tournament selection */
|
||||
moeoSelectFromPopAndArch < MOEOT > select;
|
||||
/**SelectOne*/
|
||||
moeoDetTournamentSelect < MOEOT > defaultSelect;
|
||||
/** binary tournament selection */
|
||||
moeoSelectFromPopAndArch < MOEOT > select;
|
||||
/** fitness assignment used in NSGA-II */
|
||||
moeoDominanceCountRankingFitnessAssignment < MOEOT > fitnessAssignment;
|
||||
/** diversity assignment used in NSGA-II */
|
||||
|
|
@ -267,8 +269,7 @@ class eoDummyTransform : public eoTransform<MOEOT>
|
|||
eoBreed < MOEOT > & breed;
|
||||
/**distance*/
|
||||
moeoEuclideanDistance < MOEOT > dist;
|
||||
/**archive*/
|
||||
moeoArchive < MOEOT >& archive;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -141,12 +141,12 @@ public:
|
|||
*/
|
||||
void operator()(const eoPop < MOEOT > & _pop)
|
||||
{
|
||||
unsigned int i=0;
|
||||
unsigned int i;
|
||||
unsigned int foo=0;
|
||||
|
||||
//Creation of the vector that contains minimal pop's informations
|
||||
std::vector<struct refpop> copy_pop(_pop.size());
|
||||
for (i;i<_pop.size(); i++)
|
||||
for (i=0;i<_pop.size(); i++)
|
||||
{
|
||||
copy_pop[i].index=i;
|
||||
copy_pop[i].fitness=_pop[i].fitness();
|
||||
|
|
@ -250,7 +250,7 @@ public:
|
|||
for (l=0; l<matrice.size(); l++)
|
||||
{
|
||||
it=matrice[l].begin();
|
||||
while ((*it).first != tmp2)
|
||||
while ((unsigned int)(*it).first != tmp2)
|
||||
it++;
|
||||
matrice[l].erase(it);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ class moeoParetoObjectiveVectorComparator : public moeoObjectiveVectorComparator
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,13 +49,11 @@
|
|||
#include <utils/eoState.h>
|
||||
#include <metric/moeoContributionMetric.h>
|
||||
#include <metric/moeoEntropyMetric.h>
|
||||
#include <metric/moeoHyperVolumeDifferenceMetric.h>
|
||||
#include <metric/moeoVecVsVecMultiplicativeEpsilonBinaryMetric.h>
|
||||
#include <metric/moeoVecVsVecAdditiveEpsilonBinaryMetric.h>
|
||||
#include <utils/moeoArchiveUpdater.h>
|
||||
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <utils/moeoBinaryMetricSavingUpdater.h>
|
||||
|
||||
|
||||
bool testDirRes(std::string _dirName, bool _erase);
|
||||
|
||||
/**
|
||||
|
|
@ -197,57 +195,6 @@ eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState &
|
|||
_state.storeFunctor(entropy_updater);
|
||||
checkpoint.add(*entropy_updater);
|
||||
}
|
||||
|
||||
// store the hyperVolume of the non-dominated solutions
|
||||
bool hyp = _parser.getORcreateParam(false, "hyperVolume", "Store the hyperVolume of the archive at each gen.", '\0', "Output").value();
|
||||
if (hyp)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\hyperVolume";
|
||||
#else
|
||||
std::string stmp = dirName + "/hyperVolume";
|
||||
#endif
|
||||
moeoHyperVolumeDifferenceMetric < ObjectiveVector > * hyperVolume = new moeoHyperVolumeDifferenceMetric < ObjectiveVector >(true, 1.1);
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * hyperVolume_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*hyperVolume, _archive, stmp);
|
||||
_state.storeFunctor(hyperVolume_updater);
|
||||
checkpoint.add(*hyperVolume_updater);
|
||||
}
|
||||
|
||||
// store the Multiplicative Epsilon of the non-dominated solutions
|
||||
bool multeps = _parser.getORcreateParam(false, "multEpsilon", "Store the Multiplicative Epsilon of the archive at each gen.", '\0', "Output").value();
|
||||
if (multeps)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\multepsilon";
|
||||
#else
|
||||
std::string stmp = dirName + "/multepsilon";
|
||||
#endif
|
||||
moeoVecVsVecMultiplicativeEpsilonBinaryMetric < ObjectiveVector > * multepsilon = new moeoVecVsVecMultiplicativeEpsilonBinaryMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * multepsilon_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*multepsilon, _archive, stmp);
|
||||
_state.storeFunctor(multepsilon_updater);
|
||||
checkpoint.add(*multepsilon_updater);
|
||||
}
|
||||
|
||||
// store the Additive Epsilon of the non-dominated solutions
|
||||
bool addeps = _parser.getORcreateParam(false, "addEpsilon", "Store the Additive Epsilon of the archive at each gen.", '\0', "Output").value();
|
||||
if (addeps)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\addepsilon";
|
||||
#else
|
||||
std::string stmp = dirName + "/addepsilon";
|
||||
#endif
|
||||
moeoVecVsVecAdditiveEpsilonBinaryMetric < ObjectiveVector > * addepsilon = new moeoVecVsVecAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * addepsilon_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*addepsilon, _archive, stmp);
|
||||
_state.storeFunctor(addepsilon_updater);
|
||||
checkpoint.add(*addepsilon_updater);
|
||||
}
|
||||
|
||||
// and that's it for the (control and) output
|
||||
return checkpoint;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@
|
|||
#include <diversity/moeoDummyDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontCrowdingDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
|
||||
#include <diversity/moeoNearestNeighborDiversityAssignment.h>
|
||||
#include <fitness/moeoDummyFitnessAssignment.h>
|
||||
#include <fitness/moeoExpBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <fitness/moeoDominanceDepthFitnessAssignment.h>
|
||||
|
|
@ -95,7 +94,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
|
||||
/* the fitness assignment strategy */
|
||||
std::string & fitnessParam = _parser.createParam(std::string("DomDepth"), "fitness",
|
||||
"Fitness assignment scheme: Dummy, DomDepth, DomCount, DomRank, DomCountRanking or IndicatorBased", 'F',
|
||||
"Fitness assignment scheme: Dummy, DomDepth or IndicatorBased", 'F',
|
||||
"Evolution Engine").value();
|
||||
std::string & indicatorParam = _parser.createParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i',
|
||||
|
|
@ -113,18 +112,6 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
{
|
||||
fitnessAssignment = new moeoDominanceDepthFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("DomCount"))
|
||||
{
|
||||
fitnessAssignment = new moeoDominanceCountFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("DomRank"))
|
||||
{
|
||||
fitnessAssignment = new moeoDominanceRankFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("DomCountRanking"))
|
||||
{
|
||||
fitnessAssignment = new moeoDominanceCountRankingFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
|
|
@ -154,7 +141,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
|
||||
/* the diversity assignment strategy */
|
||||
eoValueParam<eoParamParamType> & diversityParam = _parser.createParam(eoParamParamType("Dummy"), "diversity",
|
||||
"Diversity assignment scheme: Dummy, Sharing(nicheSize), NearestNeighbor(k) or Crowding", 'D', "Evolution Engine");
|
||||
"Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine");
|
||||
eoParamParamType & diversityParamValue = diversityParam.value();
|
||||
moeoDiversityAssignment < MOEOT > * diversityAssignment;
|
||||
if (diversityParamValue.first == std::string("Dummy"))
|
||||
|
|
@ -176,21 +163,6 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF
|
|||
}
|
||||
diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize);
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("NearestNeighbor"))
|
||||
{
|
||||
unsigned int k;
|
||||
if (!diversityParamValue.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no k-th distance for Sharing, using 1" << std::endl;
|
||||
k = 1;
|
||||
diversityParamValue.second.push_back(std::string("1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
k = atoi(diversityParamValue.second[0].c_str());
|
||||
}
|
||||
diversityAssignment = new moeoNearestNeighborDiversityAssignment < MOEOT> (k);
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("Crowding"))
|
||||
{
|
||||
diversityAssignment = new moeoFrontByFrontCrowdingDiversityAssignment < MOEOT> ();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
* Default ctor
|
||||
* @param _nocopy boolean to move away copies
|
||||
*/
|
||||
moeoDominanceCountRankingFitnessAssignment(bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy)
|
||||
moeoDominanceCountRankingFitnessAssignment(bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public:
|
|||
* @param _archive the archive used
|
||||
* @param _nocopy boolean to move away copies
|
||||
*/
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), matrix(_nocopy)
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), matrix(_nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
* @param _comparator the functor used to compare objective vectors
|
||||
* @param _nocopy boolean to move away copies
|
||||
*/
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy)
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public:
|
|||
* @param _archive the archive used
|
||||
* @param _nocopy boolean to move away copies
|
||||
*/
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy)
|
||||
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class moeoDominanceDepthFitnessAssignment : public moeoDominanceBasedFitnessAssi
|
|||
// assign fitness values
|
||||
unsigned int rank = 1;
|
||||
_pop[_pop.size()-1].fitness(rank);
|
||||
for (int i=((int)_pop.size())-2; i>=0; i--)
|
||||
for (int i=_pop.size()-2; i>=0; i--)
|
||||
{
|
||||
if (_pop[i].objectiveVector() != _pop[i+1].objectiveVector())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public:
|
|||
* @param _start a start value used to determine the fitness (default _start = 1.0)
|
||||
* @param _nocopy boolean to penalize clone individuals (default = false)
|
||||
*/
|
||||
moeoDominanceRankFitnessAssignment(double _start=1.0, bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy)
|
||||
moeoDominanceRankFitnessAssignment(double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public:
|
|||
* @param _start a start value used to determine the fitness (default _start = 1.0)
|
||||
* @param _nocopy boolean to penalize clone individuals (default = false)
|
||||
*/
|
||||
moeoDominanceRankFitnessAssignment(moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy)
|
||||
moeoDominanceRankFitnessAssignment(moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
* @param _start a start value used to determine the fitness (default _start = 1.0)
|
||||
* @param _nocopy boolean to penalize clone individuals (default = false)
|
||||
*/
|
||||
moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, double _start=1.0, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy)
|
||||
moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
* @param _start a start value used to determine the fitness (default _start = 1.0)
|
||||
* @param _nocopy boolean to penalize clone individuals (default = false)
|
||||
*/
|
||||
moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=false) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy)
|
||||
moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -135,8 +135,7 @@ class moeoHyperVolumeDifferenceMetric : public moeoVectorVsVectorBinaryMetric <
|
|||
*/
|
||||
void setup(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2){
|
||||
if(_set1.size() < 1 || _set2.size() < 1)
|
||||
std::cout << "Warning!!! In moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0" << std::endl;
|
||||
//throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0");
|
||||
throw("Error in moeoHyperVolumeUnaryMetric::setup -> argument1: vector<ObjectiveVector> size must be greater than 0");
|
||||
else{
|
||||
double min, max;
|
||||
unsigned int nbObj=ObjectiveVector::Traits::nObjectives();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ template < class ObjectiveVector >
|
|||
class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , double >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/**
|
||||
* Constructor with a coefficient (rho)
|
||||
* @param _normalize allow to normalize data (default true)
|
||||
|
|
@ -63,7 +63,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
bounds[i] = eoRealInterval(0,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor with a reference point
|
||||
* @param _normalize allow to normalize data (default true)
|
||||
|
|
@ -77,22 +77,22 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
bounds[i] = eoRealInterval(0,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor with a reference point
|
||||
* @param _normalize allow to normalize data (default true)
|
||||
* @param _ref_point the reference point
|
||||
*/
|
||||
moeoHyperVolumeMetric(ObjectiveVector& _ref_point=NULL, std::vector < eoRealInterval >& _bounds=NULL): normalize(false), rho(0.0), ref_point(_ref_point), bounds(_bounds){}
|
||||
|
||||
moeoHyperVolumeMetric(ObjectiveVector& _ref_point=NULL, std::vector < eoRealInterval >& _bounds=NULL): normalize(false), rho(0.0), ref_point(_ref_point), bounds(_bounds){}
|
||||
|
||||
/**
|
||||
* calculates and returns the HyperVolume value of a pareto front
|
||||
* @param _set the vector contains all objective Vector of pareto front
|
||||
* @param _set the vector contains all objective Vector of pareto front
|
||||
*/
|
||||
double operator()(const std::vector < ObjectiveVector > & _set)
|
||||
{
|
||||
std::vector < std::vector<double> > front;
|
||||
|
||||
|
||||
//determine the reference point if a coefficient is passed in paremeter
|
||||
if(rho >= 1.0){
|
||||
//determine bounds
|
||||
|
|
@ -112,7 +112,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
ref_point[i]= bounds[i].maximum() * (1-rho);
|
||||
}
|
||||
}
|
||||
//if no normalization, reinit bounds to O..1 for
|
||||
//if no normalization, reinit bounds to O..1 for
|
||||
if(!normalize)
|
||||
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||
bounds[i] = eoRealInterval(0,1);
|
||||
|
|
@ -132,10 +132,10 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return calc_hypervolume(front, front.size(),ObjectiveVector::Traits::nObjectives());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getter on bounds
|
||||
* @return bounds
|
||||
|
|
@ -143,7 +143,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
std::vector < eoRealInterval > getBounds(){
|
||||
return bounds;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* method caclulate bounds for the normalization
|
||||
* @param _set the vector of objective vectors
|
||||
|
|
@ -166,7 +166,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* method calculate if a point dominates another one regarding the x first objective
|
||||
* @param _point1 a vector of distances
|
||||
|
|
@ -178,18 +178,18 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
unsigned int i;
|
||||
bool better_in_any_objective = false;
|
||||
bool worse_in_any_objective = false;
|
||||
|
||||
|
||||
for(i=0; i < _no_objectives && !worse_in_any_objective; i++){
|
||||
if(_point1[i] > _point2[i])
|
||||
better_in_any_objective = true;
|
||||
else if(_point1[i] < _point2[i])
|
||||
worse_in_any_objective = true;
|
||||
}
|
||||
}
|
||||
//_point1 dominates _point2 if it is better than _point2 on a objective and if it is never worse in any other objectives
|
||||
return(!worse_in_any_objective && better_in_any_objective);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* swap two elements of a vector
|
||||
* @param _front the vector
|
||||
|
|
@ -197,18 +197,13 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
* @param _j index of the second element to swap
|
||||
*/
|
||||
void swap(std::vector< std::vector<double> >& _front, unsigned int _i, unsigned int _j){
|
||||
std::vector<double> _tmp;
|
||||
_tmp= _front[_i];
|
||||
_front.push_back(_front[_i]);
|
||||
_front[_i]= _front[_j];
|
||||
_front[_j]=_tmp;
|
||||
|
||||
//other way which don't work on windows
|
||||
//_front.push_back(_front[_i]);
|
||||
//front.back();
|
||||
//_front.pop_back();
|
||||
_front[_j]=_front.back();
|
||||
_front.pop_back();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* collect all nondominated points regarding the first '_no_objectives' objectives (dominated points are stored at the end of _front)
|
||||
* @param _front the front
|
||||
|
|
@ -218,7 +213,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
*/
|
||||
unsigned int filter_nondominated_set( std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _no_objectives){
|
||||
unsigned int i,j,n;
|
||||
|
||||
|
||||
n=_no_points;
|
||||
i=0;
|
||||
while(i < n){
|
||||
|
|
@ -243,7 +238,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param _front the front
|
||||
* @param _no_points the number of points of the front to consider (index 0 to _no_points are considered)
|
||||
|
|
@ -253,20 +248,20 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
double surface_unchanged_to(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _objective){
|
||||
unsigned int i;
|
||||
double min, value;
|
||||
|
||||
|
||||
if(_no_points < 1)
|
||||
throw("Error in moeoHyperVolumeUnaryMetric::surface_unchanged_to -> argument2: _no_points must be greater than 0");
|
||||
min = _front[0][_objective];
|
||||
|
||||
|
||||
for(i=1; i < _no_points; i++){
|
||||
value = _front[i][_objective];
|
||||
if(value < min)
|
||||
min = value;
|
||||
min = value;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* remove all points having a value <= 'threshold' regarding the dimension 'objective', only points of index 0 to _no_points are considered.
|
||||
* points removed are swap at the end of the front.
|
||||
|
|
@ -278,7 +273,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
*/
|
||||
unsigned int reduce_nondominated_set(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _objective, double _threshold){
|
||||
unsigned int i,n ;
|
||||
|
||||
|
||||
n=_no_points;
|
||||
for(i=0; i < n ; i++)
|
||||
if(_front[i][_objective] <= _threshold){
|
||||
|
|
@ -286,35 +281,35 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
swap(_front, i, n);
|
||||
i--; //ATTENTION I had this to reconsider the point copied to index i (it can be useless verify algorythimic in calc_hypervolume)
|
||||
}
|
||||
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* calculate hypervolume of the front (data are redrafted before)
|
||||
* @param _front the front
|
||||
* @param _no_points the number of points of the front to consider (index 0 to _no_points are considered)
|
||||
* @param _no_objectives the number of objective to consider
|
||||
* @return the hypervolume of the front
|
||||
* @return the hypervolume of the front
|
||||
*/
|
||||
double calc_hypervolume(std::vector < std::vector< double > >& _front, unsigned int _no_points, unsigned int _no_objectives){
|
||||
unsigned int n;
|
||||
double volume, distance;
|
||||
|
||||
|
||||
volume=0;
|
||||
distance=0;
|
||||
n=_no_points;
|
||||
while(n > 0){
|
||||
unsigned int no_nondominated_points;
|
||||
double temp_vol, temp_dist;
|
||||
|
||||
|
||||
//get back the index of non dominated points of the front regarding the first "_nb_objectives - 1" objectives
|
||||
//So one dimension is not determinante for the dominance
|
||||
//So one dimension is not determinante for the dominance
|
||||
no_nondominated_points = filter_nondominated_set(_front, n, _no_objectives - 1);
|
||||
|
||||
|
||||
temp_vol=0;
|
||||
|
||||
|
||||
//if there are less than 3 objectifs take the fisrt objectif of the first point of front to begin computation of hypervolume
|
||||
if(_no_objectives < 3){
|
||||
if(_no_objectives < 1)
|
||||
|
|
@ -324,7 +319,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
//else if there at least 3 objectives, a recursive computation of hypervolume starts with _no_objectives -1 on the filter_nondominated_set calculating previously.
|
||||
else
|
||||
temp_vol= calc_hypervolume(_front, no_nondominated_points, _no_objectives - 1);
|
||||
|
||||
|
||||
//search the next minimum distance on the dimension _no_objectives -1
|
||||
temp_dist = surface_unchanged_to(_front, n, _no_objectives - 1);
|
||||
//calculate the area
|
||||
|
|
@ -332,27 +327,24 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d
|
|||
//change distance to have the good lenght on next step
|
||||
distance= temp_dist;
|
||||
//remove all points <= distance on dimension _no_objectives
|
||||
n=reduce_nondominated_set(_front, n , _no_objectives - 1, distance);
|
||||
n=reduce_nondominated_set(_front, n , _no_objectives - 1, distance);
|
||||
}
|
||||
return volume;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/*boolean indicates if data must be normalized or not*/
|
||||
bool normalize;
|
||||
|
||||
|
||||
double rho;
|
||||
|
||||
|
||||
ObjectiveVector ref_point;
|
||||
|
||||
|
||||
/*vectors contains bounds for normalization*/
|
||||
std::vector < eoRealInterval > bounds;
|
||||
|
||||
|
||||
|
||||
ObjectiveVector ref_point;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@
|
|||
#include <algo/moeoNSGAII.h>
|
||||
#include <algo/moeoSEEA.h>
|
||||
#include <algo/moeoSPEA2.h>
|
||||
#include <algo/moeoMOGA.h>
|
||||
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <archive/moeoUnboundedArchive.h>
|
||||
|
|
@ -111,7 +110,6 @@
|
|||
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
|
||||
#include <fitness/moeoScalarFitnessAssignment.h>
|
||||
#include <fitness/moeoUnaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <fitness/moeoAggregativeFitnessAssignment.h>
|
||||
|
||||
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
||||
#include <metric/moeoContributionMetric.h>
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ public:
|
|||
* Default constructor with paretoComparator
|
||||
* @param _nocopy boolean allow to consider copy and doublons as bad element whose were dominated by all other MOEOT
|
||||
*/
|
||||
moeoDominanceMatrix(bool _nocopy=false):std::vector < std::vector<bool> >(), nocopy(_nocopy), comparator(paretoComparator) {}
|
||||
moeoDominanceMatrix(bool _nocopy=false):std::vector < std::vector<bool> >(),comparator(paretoComparator), nocopy(_nocopy) {}
|
||||
|
||||
/**
|
||||
* Constructor which allow to choose the comparator
|
||||
* @param _nocopy boolean allow to consider copy and doublons as bad element whose were dominated by all other MOEOT
|
||||
* @param _comparator the comparator you want to use for the comparaison of two MOEOT
|
||||
*/
|
||||
moeoDominanceMatrix(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true):std::vector < std::vector<bool> >(), nocopy(_nocopy) , comparator(_comparator) {}
|
||||
moeoDominanceMatrix(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true):std::vector < std::vector<bool> >(),comparator(_comparator), nocopy(_nocopy) {}
|
||||
|
||||
/**
|
||||
* Filling up the Dominance Matrix on one population
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue