Migration from SVN
This commit is contained in:
parent
d7d6c3a217
commit
8cd56f37db
29069 changed files with 0 additions and 4096888 deletions
80
moeo/src/comparator/moeoAggregativeComparator.h
Normal file
80
moeo/src/comparator/moeoAggregativeComparator.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* <moeoAggregativeComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOAGGREGATIVECOMPARATOR_H_
|
||||
#define MOEOAGGREGATIVECOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions according to their fitness and diversity values, each according to its aggregative value.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoAggregativeComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _weightFitness the weight for fitness
|
||||
* @param _weightDiversity the weight for diversity
|
||||
*/
|
||||
moeoAggregativeComparator(double _weightFitness = 1.0, double _weightDiversity = 1.0) : weightFitness(_weightFitness), weightDiversity(_weightDiversity)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if _moeo1 < _moeo2 according to the aggregation of their fitness and diversity values
|
||||
* @param _moeo1 the first solution
|
||||
* @param _moeo2 the second solution
|
||||
*/
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
return ( weightFitness * _moeo1.fitness() + weightDiversity * _moeo1.diversity() ) < ( weightFitness * _moeo2.fitness() + weightDiversity * _moeo2.diversity() );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the weight for fitness */
|
||||
double weightFitness;
|
||||
/** the weight for diversity */
|
||||
double weightDiversity;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOAGGREGATIVECOMPARATOR_H_*/
|
||||
50
moeo/src/comparator/moeoComparator.h
Normal file
50
moeo/src/comparator/moeoComparator.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <moeoComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOCOMPARATOR_H_
|
||||
#define MOEOCOMPARATOR_H_
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoComparator : public eoBF < const MOEOT &, const MOEOT &, const bool >
|
||||
{};
|
||||
|
||||
#endif /*MOEOCOMPARATOR_H_*/
|
||||
70
moeo/src/comparator/moeoDiversityThenFitnessComparator.h
Normal file
70
moeo/src/comparator/moeoDiversityThenFitnessComparator.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* <moeoDiversityThenFitnessComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEODIVERSITYTHENFITNESSCOMPARATOR_H_
|
||||
#define MOEODIVERSITYTHENFITNESSCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions according to their diversity values, then according to their fitness values.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _moeo1 < _moeo2 according to their diversity values, then according to their fitness values
|
||||
* @param _moeo1 the first solution
|
||||
* @param _moeo2 the second solution
|
||||
*/
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
if (_moeo1.diversity() == _moeo2.diversity())
|
||||
{
|
||||
return _moeo1.fitness() < _moeo2.fitness();
|
||||
}
|
||||
else
|
||||
{
|
||||
return _moeo1.diversity() < _moeo2.diversity();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEODIVERSITYTHENFITNESSCOMPARATOR_H_*/
|
||||
94
moeo/src/comparator/moeoEpsilonObjectiveVectorComparator.h
Normal file
94
moeo/src/comparator/moeoEpsilonObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* <moeoEpsilonObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOEPSILONOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOEPSILONOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* This functor class allows to compare 2 objective vectors according to epsilon dominance.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoEpsilonObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _epsilon the epsilon value
|
||||
*/
|
||||
moeoEpsilonObjectiveVectorComparator(double _epsilon) : epsilon(_epsilon)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 is epsilon-dominated by _objectiveVector2
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||
{
|
||||
// _objectiveVector1[i] == _objectiveVector2[i] ?
|
||||
if ( fabs((_objectiveVector1[i]/ epsilon) - _objectiveVector2[i]) > ObjectiveVector::Traits::tolerance() )
|
||||
{
|
||||
if (ObjectiveVector::minimizing(i))
|
||||
{
|
||||
if ((_objectiveVector1[i] / epsilon) <= _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
else if (ObjectiveVector::maximizing(i))
|
||||
{
|
||||
if ((_objectiveVector1[i] / epsilon) >= _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
/** the reference point */
|
||||
double epsilon;
|
||||
};
|
||||
|
||||
#endif /*MOEOEPSILONOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
64
moeo/src/comparator/moeoFitnessComparator.h
Executable file
64
moeo/src/comparator/moeoFitnessComparator.h
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* <moeoFitnessComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
* François Legillon
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOFITNESSCOMPARATOR_H_
|
||||
#define MOEOFITNESSCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions according to their fitness values
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoFitnessComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _moeo1 < _moeo2 according to their fitness values
|
||||
* @param _moeo1 the first solution
|
||||
* @param _moeo2 the second solution
|
||||
*/
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
return _moeo1.fitness() < _moeo2.fitness();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOFITNESSCOMPARATOR_H_*/
|
||||
70
moeo/src/comparator/moeoFitnessThenDiversityComparator.h
Normal file
70
moeo/src/comparator/moeoFitnessThenDiversityComparator.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* <moeoFitnessThenDiversityComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_
|
||||
#define MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions according to their fitness values, then according to their diversity values.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _moeo1 < _moeo2 according to their fitness values, then according to their diversity values
|
||||
* @param _moeo1 the first solution
|
||||
* @param _moeo2 the second solution
|
||||
*/
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
if (_moeo1.fitness() == _moeo2.fitness())
|
||||
{
|
||||
return _moeo1.diversity() < _moeo2.diversity();
|
||||
}
|
||||
else
|
||||
{
|
||||
return _moeo1.fitness() < _moeo2.fitness();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_*/
|
||||
127
moeo/src/comparator/moeoGDominanceObjectiveVectorComparator.h
Normal file
127
moeo/src/comparator/moeoGDominanceObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* <moeoGDominanceObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOGDOMINANCEOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOGDOMINANCEOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* This functor class allows to compare 2 objective vectors according to g-dominance.
|
||||
* The concept of g-dominance as been introduced in:
|
||||
* J. Molina, L. V. Santana, A. G. Hernandez-Diaz, C. A. Coello Coello, R. Caballero,
|
||||
* "g-dominance: Reference point based dominance" (2007)
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoGDominanceObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _ref the reference point
|
||||
*/
|
||||
moeoGDominanceObjectiveVectorComparator(ObjectiveVector & _ref) : ref(_ref)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 is g-dominated by _objectiveVector2.
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
unsigned int flag1 = flag(_objectiveVector1);
|
||||
unsigned int flag2 = flag(_objectiveVector2);
|
||||
if (flag2==0)
|
||||
{
|
||||
// cannot dominate
|
||||
return false;
|
||||
}
|
||||
else if ( (flag2==1) && (flag1==0) )
|
||||
{
|
||||
// is dominated
|
||||
return true;
|
||||
}
|
||||
else // (flag1==1) && (flag2==1)
|
||||
{
|
||||
// both are on the good region, so let's use the classical Pareto dominance
|
||||
return paretoComparator(_objectiveVector1, _objectiveVector2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the reference point */
|
||||
ObjectiveVector & ref;
|
||||
/** Pareto comparator */
|
||||
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the flag of _objectiveVector according to the reference point
|
||||
* @param _objectiveVector the first objective vector
|
||||
*/
|
||||
unsigned int flag(const ObjectiveVector & _objectiveVector)
|
||||
{
|
||||
unsigned int result=1;
|
||||
for (unsigned int i=0; i<ref.nObjectives(); i++)
|
||||
{
|
||||
if (_objectiveVector[i] > ref[i])
|
||||
{
|
||||
result=0;
|
||||
}
|
||||
}
|
||||
if (result==0)
|
||||
{
|
||||
result=1;
|
||||
for (unsigned int i=0; i<ref.nObjectives(); i++)
|
||||
{
|
||||
if (_objectiveVector[i] < ref[i])
|
||||
{
|
||||
result=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOGDOMINANCEOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
77
moeo/src/comparator/moeoObjectiveObjectiveVectorComparator.h
Normal file
77
moeo/src/comparator/moeoObjectiveObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* <moeoObjectiveObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two objective vectors according to their first objective value, then their second, and so on.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoObjectiveObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 < _objectiveVector2 on the first objective, then on the second, and so on
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||
{
|
||||
if ( fabs(_objectiveVector1[i] - _objectiveVector2[i]) > ObjectiveVector::Traits::tolerance() )
|
||||
{
|
||||
if (_objectiveVector1[i] < _objectiveVector2[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOOBJECTIVEOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
52
moeo/src/comparator/moeoObjectiveVectorComparator.h
Normal file
52
moeo/src/comparator/moeoObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* <moeoObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <eoFunctor.h>
|
||||
|
||||
/**
|
||||
* Abstract class allowing to compare 2 objective vectors.
|
||||
* The template argument ObjectiveVector have to be a moeoObjectiveVector.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoObjectiveVectorComparator : public eoBF < const ObjectiveVector &, const ObjectiveVector &, const bool >
|
||||
{};
|
||||
|
||||
#endif /*MOEOOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
82
moeo/src/comparator/moeoOneObjectiveComparator.h
Normal file
82
moeo/src/comparator/moeoOneObjectiveComparator.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* <moeoOneObjectiveComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOONEOBJECTIVECOMPARATOR_H_
|
||||
#define MOEOONEOBJECTIVECOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
|
||||
/**
|
||||
* Functor allowing to compare two solutions according to one objective.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoOneObjectiveComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _obj the index of objective
|
||||
*/
|
||||
moeoOneObjectiveComparator(unsigned int _obj) : obj(_obj)
|
||||
{
|
||||
if (obj > MOEOT::ObjectiveVector::nObjectives())
|
||||
{
|
||||
throw std::runtime_error("Problem with the index of objective in moeoOneObjectiveComparator");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if _moeo1 < _moeo2 on the obj objective
|
||||
* @param _moeo1 the first solution
|
||||
* @param _moeo2 the second solution
|
||||
*/
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
return _moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj];
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the index of objective */
|
||||
unsigned int obj;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOONEOBJECTIVECOMPARATOR_H_*/
|
||||
95
moeo/src/comparator/moeoParetoObjectiveVectorComparator.h
Normal file
95
moeo/src/comparator/moeoParetoObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* <moeoParetoObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOPARETOOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOPARETOOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* This functor class allows to compare 2 objective vectors according to Pareto dominance.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoParetoObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 is dominated by _objectiveVector2
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
bool dom = false;
|
||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||
{
|
||||
// first, we have to check if the 2 objective values are not equal for the ith objective
|
||||
if ( fabs(_objectiveVector1[i] - _objectiveVector2[i]) > ObjectiveVector::Traits::tolerance() )
|
||||
{
|
||||
// if the ith objective have to be minimized...
|
||||
if (ObjectiveVector::minimizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] > _objectiveVector2[i])
|
||||
{
|
||||
dom = true; //_objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; //_objectiveVector2 cannot dominate _objectiveVector1
|
||||
}
|
||||
}
|
||||
// if the ith objective have to be maximized...
|
||||
else if (ObjectiveVector::maximizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] < _objectiveVector2[i])
|
||||
{
|
||||
dom = true; //_objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; //_objectiveVector2 cannot dominate _objectiveVector1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOPARETOOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
59
moeo/src/comparator/moeoPtrComparator.h
Normal file
59
moeo/src/comparator/moeoPtrComparator.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Waldo Cancino *
|
||||
* wcancino@icmc.usp.br *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MOEOPTRCOMPARATOR_H_
|
||||
#define MOEOPTRCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoComparator.h>
|
||||
/**
|
||||
* Functor allowing to compare two solutions.referenced by pointers.
|
||||
* Several MOEO related stuff have to sort populations according some criterion
|
||||
* Instead to do this, we used a vector whose elements are pointers to true individuals
|
||||
*/
|
||||
|
||||
template < class MOEOT >
|
||||
class moeoPtrComparator : public eoBF < const MOEOT *, const MOEOT *, const bool >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor with a comparator
|
||||
* @param _cmp comparator to be employed
|
||||
|
||||
*/
|
||||
moeoPtrComparator( moeoComparator<MOEOT> & _cmp) : cmp(_cmp) {}
|
||||
|
||||
/** compare two const individuals */
|
||||
const bool operator() (const MOEOT *ptr1, const MOEOT *ptr2)
|
||||
{
|
||||
return cmp(*ptr1, *ptr2);
|
||||
}
|
||||
|
||||
/** compare two non const individuals */
|
||||
const bool operator() (MOEOT *ptr1, MOEOT *ptr2)
|
||||
{
|
||||
return cmp(*ptr1, *ptr2);
|
||||
}
|
||||
|
||||
private:
|
||||
moeoComparator<MOEOT> &cmp;
|
||||
};
|
||||
|
||||
#endif /*MOEOPTRCOMPARATOR_H_*/
|
||||
85
moeo/src/comparator/moeoStrictObjectiveVectorComparator.h
Normal file
85
moeo/src/comparator/moeoStrictObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* <moeoStrictObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOSTRICTOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOSTRICTOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* This functor class allows to compare 2 objective vectors according to strict dominance.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoStrictObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 is strictly dominated by _objectiveVector2
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||
{
|
||||
// _objectiveVector1[i] == _objectiveVector2[i] ?
|
||||
if ( fabs(_objectiveVector1[i] - _objectiveVector2[i]) < ObjectiveVector::Traits::tolerance() )
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not STRICTLY better than _objectiveVector2[i]
|
||||
}
|
||||
else if (ObjectiveVector::minimizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] < _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
else if (ObjectiveVector::maximizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] > _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOSTRICTOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
84
moeo/src/comparator/moeoWeakObjectiveVectorComparator.h
Normal file
84
moeo/src/comparator/moeoWeakObjectiveVectorComparator.h
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* <moeoWeakObjectiveVectorComparator.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOWEAKOBJECTIVEVECTORCOMPARATOR_H_
|
||||
#define MOEOWEAKOBJECTIVEVECTORCOMPARATOR_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
|
||||
/**
|
||||
* This functor class allows to compare 2 objective vectors according to weak dominance.
|
||||
*/
|
||||
template < class ObjectiveVector >
|
||||
class moeoWeakObjectiveVectorComparator : public moeoObjectiveVectorComparator < ObjectiveVector >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns true if _objectiveVector1 is weakly dominated by _objectiveVector2
|
||||
* @param _objectiveVector1 the first objective vector
|
||||
* @param _objectiveVector2 the second objective vector
|
||||
*/
|
||||
const bool operator()(const ObjectiveVector & _objectiveVector1, const ObjectiveVector & _objectiveVector2)
|
||||
{
|
||||
for (unsigned int i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||
{
|
||||
// _objectiveVector1[i] == _objectiveVector2[i] ?
|
||||
if ( fabs(_objectiveVector1[i] - _objectiveVector2[i]) > ObjectiveVector::Traits::tolerance() )
|
||||
{
|
||||
if (ObjectiveVector::minimizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] < _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
else if (ObjectiveVector::maximizing(i))
|
||||
{
|
||||
if (_objectiveVector1[i] > _objectiveVector2[i])
|
||||
{
|
||||
return false; // _objectiveVector1[i] is not better than _objectiveVector2[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOWEAKOBJECTIVEVECTORCOMPARATOR_H_*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue