Migration from SVN

This commit is contained in:
quemy 2012-08-30 11:30:11 +02:00
commit 8cd56f37db
29069 changed files with 0 additions and 4096888 deletions

View file

@ -0,0 +1,129 @@
/*
* <moeoAggregationFitnessAssignment.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* 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
*
*/
//-----------------------------------------------------------------------------
// moeoAggregationFitnessAssignment.h
//-----------------------------------------------------------------------------
#ifndef MOEOAGGREGATIONFITNESSASSIGNMENT_H_
#define MOEOAGGREGATIONFITNESSASSIGNMENT_H_
#include <eoPop.h>
#include <eoEvalFunc.h>
#include <fitness/moeoSingleObjectivization.h>
/*
* Fitness assignment scheme which use weight for each objective
*/
template < class MOEOT >
class moeoAggregationFitnessAssignment : public moeoSingleObjectivization < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
typedef typename MOEOT::Fitness Fitness;
/**
* Default ctor
* @param _weight vectors contains all weights.
* @param _eval a eval function, to revalidate the objectiveVector if needed
*/
moeoAggregationFitnessAssignment(std::vector<double> & _weight,eoEvalFunc<MOEOT> &_eval) : weight(_weight),eval(_eval){}
/**
* Ctor with a dummy evaluation function
* @param _weight vectors contains all weights.
*/
moeoAggregationFitnessAssignment(std::vector<double> & _weight) : weight(_weight),eval(defaultEval){}
/**
* Sets the fitness values for _moeot
* @param _moeot the MOEOT
*/
virtual void operator()(MOEOT & _moeot){
if (_moeot.invalidObjectiveVector())
eval(_moeot);
_moeot.fitness(operator()(_moeot.objectiveVector()));
}
/**
* function which calculate the fitness from an objectiveVector (which has troi be valid.)
* @param _mo an valid objectiveVector
* @return the fitness value of _mo
*/
virtual Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){
unsigned int dim=_mo.nObjectives();
Fitness res=0;
if (dim>weight.size()){
std::cout<<"moeoAggregationFitnessAssignmentFitness: Error -> given weight dimension is smaller than MOEOTs"<<std::endl;
return res;
}
for(unsigned int l=0; l<dim; l++){
if (_mo.minimizing(l))
res-=(_mo[l]) * weight[l];
else
res+=(_mo[l]) * weight[l];
}
return res;
}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _pop the population
*/
virtual void operator()(eoPop < MOEOT > & _pop){
for (unsigned int k=0; k < _pop.size(); k++)
operator()(_pop[k]);
}
/**
* Warning: no yet implemented: Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){}
private:
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){}
}defaultEval;
//the vector of weight
std::vector<double>& weight;
eoEvalFunc<MOEOT>& eval;
};
#endif /*MOEOAGGREGATIONFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,65 @@
/*
* <moeoBinaryIndicatorBasedFitnessAssignment.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 MOEOBINARYINDICATORBASEDFITNESSASSIGNMENT_H_
#define MOEOBINARYINDICATORBASEDFITNESSASSIGNMENT_H_
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
/**
* moeoIndicatorBasedFitnessAssignment for binary indicators.
*/
template < class MOEOT >
class moeoBinaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT >
{
public:
/** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Updates the fitness values of the whole population _pop by taking the new objective vector _objVec into account
* and returns the fitness value of _objVec.
* @param _pop the population
* @param _objVec the objective vector
*/
virtual double updateByAdding(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0;
};
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,171 @@
/*
* <moeoConstraintFitnessAssignment.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* 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
*
*/
//-----------------------------------------------------------------------------
// moeoConstraintFitnessAssignment.h
//-----------------------------------------------------------------------------
#ifndef MOEOCONSTRAINTFITNESSASSIGNMENT_H_
#define MOEOCONSTRAINTFITNESSASSIGNMENT_H_
#include <eoPop.h>
#include <fitness/moeoSingleObjectivization.h>
#include <utils/moeoObjectiveVectorNormalizer.h>
/*
* Fitness assignment scheme which give a penalty if MOEOT does not respect constraints
*/
template < class MOEOT >
class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/** the fitness type of the solutions */
typedef typename MOEOT::Fitness Fitness;
/** the type of the solutions */
typedef typename ObjectiveVector::Type Type;
/**
* Default ctor
* @param _weight vectors contains all weights to apply for not respecting the contraint in each dimension.
* @param _constraint vector containing the constraints, normalizer is applied to it
* @param _to_optimize dimension in which we ignore the constraint
* @param _normalizer normalizer to apply to each objective
*/
moeoConstraintFitnessAssignment(std::vector<double> & _weight, ObjectiveVector &_constraint, int _to_optimize, moeoObjectiveVectorNormalizer<MOEOT> &_normalizer, eoEvalFunc<MOEOT> &_eval) : weight(_weight),constraint(_constraint),to_optimize(_to_optimize),normalizer(_normalizer),eval(_eval),to_eval(true){}
/**
* Ctor with a dummy eval
* @param _weight vectors contains all weights to apply for not respecting the contraint in each dimension.
* @param _constraint vector containing the constraints, normalizer is applied to it
* @param _to_optimize dimension in which we ignore the constraint
* @param _normalizer normalizer to apply to each objective
*/
moeoConstraintFitnessAssignment(std::vector<double> & _weight, ObjectiveVector &_constraint, int _to_optimize, moeoObjectiveVectorNormalizer<MOEOT> &_normalizer) : weight(_weight), constraint(_constraint), to_optimize(_to_optimize), normalizer(_normalizer), eval(defaultEval), to_eval(false){}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _mo the MOEOT
*/
void operator()(MOEOT & _mo){
if (to_eval && _mo.invalidObjectiveVector())
eval(_mo);
_mo.fitness(operator()(_mo.objectiveVector()));
}
/**
* Calculate a fitness from a valid objectiveVector
* @param _mo a valid objectiveVector
* @return the fitness of _mo
*/
Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){
unsigned int dim=_mo.nObjectives();
Fitness res=0;
if (dim>weight.size()){
std::cout<<"moeoAggregationFitnessAssignmentFitness: ouch, given weight dimension is smaller than MOEOTs"<<std::endl;
}
else{
for(unsigned int l=0; l<dim; l++){
if ((int)l==to_optimize)
if (_mo.minimizing(l))
res-=(normalizer(_mo)[l]) * weight[l];
else
res+=(normalizer(_mo)[l]) * weight[l];
else{
if(_mo.minimizing(l)){
if (normalizer(_mo)[l]>normalizer(constraint)[l])
res-=(normalizer(_mo)[l]-normalizer(constraint)[l])*weight[l];
}
else{
if (normalizer(_mo)[l]<normalizer(constraint)[l])
//negative so we add it instead of removing it
res+=(normalizer(_mo)[l]-normalizer(constraint)[l])*weight[l];
}
}
}
}
return res;
}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
for(unsigned int k=0; k<_pop.size(); k++)
operator()(_pop[k]);
}
/**
* Warning: no yet implemented: Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
//std::cout << "WARNING : updateByDeleting not implemented in moeoAssignmentFitnessAssignment" << std::endl;
}
private:
//dummy evaluation function
class DummyEval: public eoEvalFunc<MOEOT>{
void operator()(MOEOT &moeo){
}
} defaultEval;
//the vector of weight
std::vector<double> weight;
//the vector of constraints
ObjectiveVector constraint;
//index of the objective to optimize
int to_optimize;
//the normalizer
moeoObjectiveVectorNormalizer<MOEOT>& normalizer;
//the evaluation function
eoEvalFunc<MOEOT> &eval;
//true if the evaluation has to be done
bool to_eval;
};
#endif /*MOEOAGGREGATIONFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,50 @@
/*
* <moeoCriterionBasedFitnessAssignment.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 MOEOCRITERIONBASEDFITNESSASSIGNMENT_H_
#define MOEOCRITERIONBASEDFITNESSASSIGNMENT_H_
#include <fitness/moeoFitnessAssignment.h>
/**
* moeoCriterionBasedFitnessAssignment is a moeoFitnessAssignment for criterion-based strategies.
*/
template < class MOEOT >
class moeoCriterionBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOCRITERIONBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,50 @@
/*
* <moeoDominanceBasedFitnessAssignment.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 MOEODOMINANCEBASEDFITNESSASSIGNMENT_H_
#define MOEODOMINANCEBASEDFITNESSASSIGNMENT_H_
#include <fitness/moeoFitnessAssignment.h>
/**
* moeoDominanceBasedFitnessAssignment is a moeoFitnessAssignment for dominance-based strategies.
*/
template < class MOEOT >
class moeoDominanceBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEODOMINANCEBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,143 @@
/*
* <moeoDominanceCountFitnessAssignment.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie Humeau
*
* 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
*
*/
//-----------------------------------------------------------------------------
// moeoDominanceCountFitnessAssignment.h
//-----------------------------------------------------------------------------
#ifndef MOEODOMINANCECOUNTFITNESSASSIGNMENT_H_
#define MOEODOMINANCECOUNTFITNESSASSIGNMENT_H_
#include <vector>
#include <eoPop.h>
#include <archive/moeoArchive.h>
#include <archive/moeoUnboundedArchive.h>
#include <comparator/moeoObjectiveVectorComparator.h>
#include <comparator/moeoParetoObjectiveVectorComparator.h>
#include <fitness/moeoDominanceBasedFitnessAssignment.h>
#include <utils/moeoDominanceMatrix.h>
/**
* Fitness assignment sheme that computes how many solutions does each solution dominate.
*/
template < class MOEOT >
class moeoDominanceCountFitnessAssignment : public moeoDominanceBasedFitnessAssignment < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Default ctor
* @param _nocopy boolean to move away clone individuals (default = false)
*/
moeoDominanceCountFitnessAssignment(bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own archive
* @param _archive an archive to be included in the fitness assignment process
* @param _nocopy boolean to penalize clone individuals (default = false)
*/
moeoDominanceCountFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @param _nocopy boolean to penalize clone individuals (default = false)
*/
moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy)
{}
/**
* Ctor where you can choose your own archive and your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @param _archive an archive to be included in the fitness assignment process
* @param _nocopy boolean to penalize clone individuals (default = false)
*/
moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy)
{}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
unsigned int j= _pop.size();
unsigned int i= archive.size();
matrix(archive,_pop);
for (unsigned int k=0; k<i; k++)
archive[k].fitness(matrix.count(k));
for (unsigned int k=i; k<i+j; k++)
_pop[k-i].fitness(matrix.count(k));
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountFitnessAssignment" << std::endl;
}
private:
/** Functor to compare two objective vectors */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
/** Functor to compare two objective vectors according to Pareto dominance relation */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
/** Archive to be included in the fitness assignment process */
moeoArchive < MOEOT > & archive;
/** Default archive */
moeoUnboundedArchive < MOEOT > defaultArchive;
/** Dominance Matrix */
moeoDominanceMatrix < MOEOT > matrix;
};
#endif /*MOEODOMINANCECOUNTFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,162 @@
/*
* <moeoDominanceCountRankingFitnessAssignment.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie Humeau
*
* 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
*
*/
//-----------------------------------------------------------------------------
// moeoDominanceCountRankingFitnessAssignment.h
//-----------------------------------------------------------------------------
#ifndef MOEODOMINANCECOUNTRANKINGFITNESSASSIGNMENT_H_
#define MOEODOMINANCECOUNTRANKINGFITNESSASSIGNMENT_H_
#include <vector>
#include <eoPop.h>
#include <archive/moeoArchive.h>
#include <archive/moeoUnboundedArchive.h>
#include <comparator/moeoObjectiveVectorComparator.h>
#include <comparator/moeoParetoObjectiveVectorComparator.h>
#include <fitness/moeoDominanceBasedFitnessAssignment.h>
#include <utils/moeoDominanceMatrix.h>
/**
* Fitness assignment sheme that sum-up the ranks of all solutions dominated by each solution.
* This strategy is used, for instance, in SPEA2.
* E. Zitzler, M. Laumanns, and L. Thiele. SPEA2: Improving the Strength Pareto Evolutionary Algorithm. Technical Report 103,
* Computer Engineering and Networks Laboratory (TIK), ETH Zurich, Zurich, Switzerland, 2001.
*/
template < class MOEOT >
class moeoDominanceCountRankingFitnessAssignment : public moeoDominanceBasedFitnessAssignment < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Default ctor
* @param _nocopy boolean to move away copies
*/
moeoDominanceCountRankingFitnessAssignment(bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own archive
* @param _archive the archive used
* @param _nocopy boolean to move away copies
*/
moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @param _nocopy boolean to move away copies
*/
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy)
{}
/**
* Ctor where you can choose your own archive and your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @param _archive the archive used
* @param _nocopy boolean to move away copies
*/
moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy)
{}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
unsigned int i= _pop.size();
unsigned int j= archive.size();
matrix(archive,_pop);
for (unsigned int k=0; k<j; k++)
archive[k].fitness(countRanking(k));
for (unsigned int k=j; k<i+j; k++)
_pop[k-j].fitness(countRanking(k));
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountRankingFitnessAssignment" << std::endl;
}
private:
/** Functor to compare two objective vectors */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
/** Functor to compare two objective vectors according to Pareto dominance relation */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
/** Archive to be included in the fitness assignment process */
moeoArchive < MOEOT > & archive;
/** Default archive */
moeoUnboundedArchive < MOEOT > defaultArchive;
/** Dominance Matrix */
moeoDominanceMatrix <MOEOT> matrix;
/**
* @param _i index of the column
*/
double countRanking(unsigned int _i)
{
double res=0;
for (unsigned int k=0; k<matrix.size(); k++)
{
if (matrix[k][_i])
res+=matrix.count(k);
}
return -res;
}
};
#endif /*MOEODOMINANCECOUNTRANKINGFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,265 @@
/*
* <moeoDominanceDepthFitnessAssignment.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 MOEODOMINANCEDEPTHFITNESSASSIGNMENT_H_
#define MOEODOMINANCEDEPTHFITNESSASSIGNMENT_H_
#include <vector>
#include <eoPop.h>
#include <comparator/moeoObjectiveObjectiveVectorComparator.h>
#include <comparator/moeoObjectiveVectorComparator.h>
#include <comparator/moeoParetoObjectiveVectorComparator.h>
#include <fitness/moeoDominanceBasedFitnessAssignment.h>
/**
* Fitness assignment sheme based on Pareto-dominance count proposed in:
* N. Srinivas, K. Deb, "Multiobjective Optimization Using Nondominated Sorting in Genetic Algorithms", Evolutionary Computation vol. 2, no. 3, pp. 221-248 (1994)
* and in:
* K. Deb, A. Pratap, S. Agarwal, T. Meyarivan, "A Fast and Elitist Multi-Objective Genetic Algorithm: NSGA-II", IEEE Transactions on Evolutionary Computation, vol. 6, no. 2 (2002).
* This strategy is, for instance, used in NSGA and NSGA-II.
*/
template < class MOEOT >
class moeoDominanceDepthFitnessAssignment : public moeoDominanceBasedFitnessAssignment < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Default ctor
*/
moeoDominanceDepthFitnessAssignment() : comparator(paretoComparator)
{}
/**
* Ctor where you can choose your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
*/
moeoDominanceDepthFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator) : comparator(_comparator)
{}
/**
* Sets the fitness values for every solution contained in the population _pop
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
// number of objectives for the problem under consideration
unsigned int nObjectives = MOEOT::ObjectiveVector::nObjectives();
if (nObjectives == 1)
{
// one objective
oneObjective(_pop);
}
else if (nObjectives == 2)
{
// two objectives (the two objectives function is still to implement)
mObjectives(_pop);
}
else if (nObjectives > 2)
{
// more than two objectives
mObjectives(_pop);
}
else
{
// problem with the number of objectives
throw std::runtime_error("Problem with the number of objectives in moeoDominanceDepthFitnessAssignment");
}
// a higher fitness is better, so the values need to be inverted
double max = _pop[0].fitness();
for (unsigned int i=1 ; i<_pop.size() ; i++)
{
max = std::max(max, _pop[i].fitness());
}
for (unsigned int i=0 ; i<_pop.size() ; i++)
{
_pop[i].fitness(max - _pop[i].fitness());
}
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
for (unsigned int i=0; i<_pop.size(); i++)
{
// if _pop[i] is dominated by _objVec
if ( comparator(_pop[i].objectiveVector(), _objVec) )
{
_pop[i].fitness(_pop[i].fitness()+1);
}
}
}
private:
/** Functor to compare two objective vectors */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
/** Functor to compare two objective vectors according to Pareto dominance relation */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
/** Functor allowing to compare two solutions according to their first objective value, then their second, and so on. */
class ObjectiveComparator : public moeoComparator < MOEOT >
{
public:
/**
* Returns true if _moeo1 < _moeo2 on the first objective, then on the second, and so on
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
return cmp(_moeo1.objectiveVector(), _moeo2.objectiveVector());
}
private:
/** the corresponding comparator for objective vectors */
moeoObjectiveObjectiveVectorComparator < ObjectiveVector > cmp;
}
objComparator;
/**
* Sets the fitness values for mono-objective problems
* @param _pop the population
*/
void oneObjective (eoPop < MOEOT > & _pop)
{
// sorts the population in the ascending order
std::sort(_pop.begin(), _pop.end(), objComparator);
// assign fitness values
unsigned int rank = 1;
_pop[_pop.size()-1].fitness(rank);
for (int i=_pop.size()-2; i>=0; i--)
{
if (_pop[i].objectiveVector() != _pop[i+1].objectiveVector())
{
rank++;
}
_pop[i].fitness(rank);
}
}
/**
* Sets the fitness values for bi-objective problems with a complexity of O(n log n), where n stands for the population size
* @param _pop the population
*/
void twoObjectives (eoPop < MOEOT > & _pop)
{
//... TO DO !
}
/**
* Sets the fitness values for problems with more than two objectives with a complexity of O(n² log n), where n stands for the population size
* @param _pop the population
*/
void mObjectives (eoPop < MOEOT > & _pop)
{
// S[i] = indexes of the individuals dominated by _pop[i]
std::vector < std::vector<unsigned int> > S(_pop.size());
// n[i] = number of individuals that dominate the individual _pop[i]
std::vector < unsigned int > n(_pop.size(), 0);
// fronts: F[i] = indexes of the individuals contained in the ith front
std::vector < std::vector<unsigned int> > F(_pop.size()+2);
// used to store the number of the first front
F[1].reserve(_pop.size());
for (unsigned int p=0; p<_pop.size(); p++)
{
for (unsigned int q=0; q<_pop.size(); q++)
{
// if q is dominated by p
if ( comparator(_pop[q].objectiveVector(), _pop[p].objectiveVector()) )
{
// add q to the set of solutions dominated by p
S[p].push_back(q);
}
// if p is dominated by q
else if ( comparator(_pop[p].objectiveVector(), _pop[q].objectiveVector()) )
{
// increment the domination counter of p
n[p]++;
}
}
// if no individual dominates p
if (n[p] == 0)
{
// p belongs to the first front
_pop[p].fitness(1);
F[1].push_back(p);
}
}
// front counter
unsigned int counter=1;
unsigned int p,q;
while (! F[counter].empty())
{
// used to store the number of the next front
F[counter+1].reserve(_pop.size());
for (unsigned int i=0; i<F[counter].size(); i++)
{
p = F[counter][i];
for (unsigned int j=0; j<S[p].size(); j++)
{
q = S[p][j];
n[q]--;
// if no individual dominates q anymore
if (n[q] == 0)
{
// q belongs to the next front
_pop[q].fitness(counter+1);
F[counter+1].push_back(q);
}
}
}
counter++;
}
}
} ;
#endif /*MOEODOMINANCEDEPTHFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,149 @@
/*
* <moeoDominanceRankFitnessAssignment.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie Humeau
*
* 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
*
*/
//-----------------------------------------------------------------------------
// moeoDominanceRankFitnessAssignment.cpp
//-----------------------------------------------------------------------------
#ifndef MOEODOMINANCERANKFITNESSASSIGNEMENT_H_
#define MOEODOMINANCERANKFITNESSASSIGNEMENT_H_
#include <vector>
#include <eoPop.h>
#include <archive/moeoArchive.h>
#include <archive/moeoUnboundedArchive.h>
#include <comparator/moeoObjectiveVectorComparator.h>
#include <comparator/moeoParetoObjectiveVectorComparator.h>
#include <fitness/moeoDominanceBasedFitnessAssignment.h>
#include <utils/moeoDominanceMatrix.h>
/**
* Fitness assignment sheme that computes how many solutions each solution is dominated by.
*/
template < class MOEOT >
class moeoDominanceRankFitnessAssignment : public moeoDominanceBasedFitnessAssignment < MOEOT >
{
public:
/** the objective vector type of the solutions */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Default ctor
* @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=true) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own archive
* @param _archive an archive to be included in the fitness assignment process
* @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=true) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy)
{}
/**
* Ctor where you can choose your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @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=true) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy)
{}
/**
* Ctor where you can choose your own archive and your own way to compare objective vectors
* @param _comparator the functor used to compare objective vectors
* @param _archive an archive to be included in the fitness assignment process
* @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=true) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy)
{}
/**
* Sets the fitness values for every solution contained in the population _pop (and in the archive)
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
unsigned int i= archive.size();
unsigned int j= _pop.size();
matrix(archive, _pop);
for (unsigned int k=0; k<i; k++)
archive[k].fitness(-(matrix.rank(k)+start));
for (unsigned int k=i; k<i+j; k++)
_pop[k-i].fitness(-(matrix.rank(k)+start));
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceRankFitnessAssignment" << std::endl;
}
private:
/** Functor to compare two objective vectors */
moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
/** Functor to compare two objective vectors according to Pareto dominance relation */
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
/** Archive to be included in the fitness assignment process */
moeoArchive < MOEOT > & archive;
/** Default archive */
moeoUnboundedArchive < MOEOT > defaultArchive;
/** Start value */
double start;
/** Dominance Matrix */
moeoDominanceMatrix < MOEOT > matrix;
};
#endif /*MOEODOMINANCERANKFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,84 @@
/*
* <moeoDummyFitnessAssignment.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 MOEODUMMYFITNESSASSIGNMENT_H_
#define MOEODUMMYFITNESSASSIGNMENT_H_
#include <fitness/moeoFitnessAssignment.h>
/**
* moeoDummyFitnessAssignment is a moeoFitnessAssignment that gives the value '0' as the individual's fitness for a whole population if it is invalid.
*/
template < class MOEOT >
class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{
public:
/** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Sets the fitness to '0' for every individuals of the population _pop if it is invalid
* @param _pop the population
*/
void operator () (eoPop < MOEOT > & _pop)
{
for (unsigned int idx = 0; idx<_pop.size (); idx++)
{
if (_pop[idx].invalidFitness())
{
// set the diversity to 0
_pop[idx].fitness(0.0);
}
}
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
// nothing to do... ;-)
}
};
#endif /*MOEODUMMYFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,227 @@
/*
* <moeoExpBinaryIndicatorBasedFitnessAssignment.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 MOEOEXPBINARYINDICATORBASEDFITNESSASSIGNMENT_H_
#define MOEOEXPBINARYINDICATORBASEDFITNESSASSIGNMENT_H_
#include <math.h>
#include <vector>
#include <eoPop.h>
#include <fitness/moeoBinaryIndicatorBasedFitnessAssignment.h>
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
#include <utils/moeoConvertPopToObjectiveVectors.h>
/**
* Fitness assignment sheme based on an indicator proposed in:
* E. Zitzler, S. Künzli, "Indicator-Based Selection in Multiobjective Search", Proc. 8th International Conference on Parallel Problem Solving from Nature (PPSN VIII), pp. 832-842, Birmingham, UK (2004).
* This strategy is, for instance, used in IBEA.
*/
template < class MOEOT >
class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorBasedFitnessAssignment < MOEOT >
{
public:
/** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Ctor.
* @param _metric the quality indicator
* @param _kappa the scaling factor
*/
moeoExpBinaryIndicatorBasedFitnessAssignment(moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric, const double _kappa = 0.05) : metric(_metric), kappa(_kappa)
{}
/**
* Sets the fitness values for every solution contained in the population _pop
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
// 1 - setting of the bounds
setup(_pop);
// 2 - computing every indicator values
computeValues(_pop);
// 3 - setting fitnesses
setFitnesses(_pop);
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
std::vector < double > v;
v.resize(_pop.size());
for (unsigned int i=0; i<_pop.size(); i++)
{
v[i] = metric(_objVec, _pop[i].objectiveVector());
}
for (unsigned int i=0; i<_pop.size(); i++)
{
_pop[i].fitness( _pop[i].fitness() + exp(-v[i]/kappa) );
}
}
/**
* Updates the fitness values of the whole population _pop by taking the adding of the objective vector _objVec into account
* and returns the fitness value of _objVec.
* @param _pop the population
* @param _objVec the objective vector
*/
double updateByAdding(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
std::vector < double > v;
// update every fitness values to take the new individual into account
v.resize(_pop.size());
for (unsigned int i=0; i<_pop.size(); i++)
{
v[i] = metric(_objVec, _pop[i].objectiveVector());
}
for (unsigned int i=0; i<_pop.size(); i++)
{
_pop[i].fitness( _pop[i].fitness() - exp(-v[i]/kappa) );
}
// compute the fitness of the new individual
v.clear();
v.resize(_pop.size());
for (unsigned int i=0; i<_pop.size(); i++)
{
v[i] = metric(_pop[i].objectiveVector(), _objVec);
}
double result = 0;
for (unsigned int i=0; i<v.size(); i++)
{
result -= exp(-v[i]/kappa);
}
return result;
}
protected:
/** the quality indicator */
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & metric;
/** the scaling factor */
double kappa;
/** the computed indicator values */
std::vector < std::vector<double> > values;
/**
* Sets the bounds for every objective using the min and the max value for every objective vector of _pop
* @param _pop the population
*/
void setup(const eoPop < MOEOT > & _pop)
{
double min, max;
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
{
min = _pop[0].objectiveVector()[i];
max = _pop[0].objectiveVector()[i];
for (unsigned int j=1; j<_pop.size(); j++)
{
min = std::min(min, _pop[j].objectiveVector()[i]);
max = std::max(max, _pop[j].objectiveVector()[i]);
}
// setting of the bounds for the objective i
metric.setup(min, max, i);
}
}
/**
* Compute every indicator value in values (values[i] = I(_v[i], _o))
* @param _pop the population
*/
void computeValues(const eoPop < MOEOT > & _pop)
{
values.clear();
values.resize(_pop.size());
for (unsigned int i=0; i<_pop.size(); i++)
{
values[i].resize(_pop.size());
for (unsigned int j=0; j<_pop.size(); j++)
{
if (i != j)
{
values[i][j] = metric(_pop[i].objectiveVector(), _pop[j].objectiveVector());
}
}
}
}
/**
* Sets the fitness value of the whple population
* @param _pop the population
*/
void setFitnesses(eoPop < MOEOT > & _pop)
{
for (unsigned int i=0; i<_pop.size(); i++)
{
_pop[i].fitness(computeFitness(i));
}
}
/**
* Returns the fitness value of the _idx th individual of the population
* @param _idx the index
*/
double computeFitness(const unsigned int _idx)
{
double result = 0;
for (unsigned int i=0; i<values.size(); i++)
{
if (i != _idx)
{
result -= exp(-values[i][_idx]/kappa);
}
}
return result;
}
};
#endif /*MOEOEXPBINARYINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,76 @@
/*
* <moeoFitnessAssignment.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 MOEOFITNESSASSIGNMENT_H_
#define MOEOFITNESSASSIGNMENT_H_
#include <eoFunctor.h>
#include <eoPop.h>
/**
* Functor that sets the fitness values of a whole population.
*/
template < class MOEOT >
class moeoFitnessAssignment : public eoUF < eoPop < MOEOT > &, void >
{
public:
/** The type for objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
virtual void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) = 0;
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the individual _moeo into account.
* @param _pop the population
* @param _moeo the individual
*/
void updateByDeleting(eoPop < MOEOT > & _pop, MOEOT & _moeo)
{
updateByDeleting(_pop, _moeo.objectiveVector());
}
};
#endif /*MOEOFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,50 @@
/*
* <moeoIndicatorBasedFitnessAssignment.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 MOEOINDICATORBASEDFITNESSASSIGNMENT_H_
#define MOEOINDICATORBASEDFITNESSASSIGNMENT_H_
#include <fitness/moeoFitnessAssignment.h>
/**
* moeoIndicatorBasedFitnessAssignment is a moeoFitnessAssignment for Indicator-based strategies.
*/
template < class MOEOT >
class moeoIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,134 @@
/*
* <moeoReferencePointIndicatorBasedFitnessAssignment.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 MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_
#define MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_
#include <math.h>
#include <eoPop.h>
#include <fitness/moeoFitnessAssignment.h>
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
/**
* Fitness assignment sheme based a Reference Point and a Quality Indicator.
*/
template < class MOEOT >
class moeoReferencePointIndicatorBasedFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{
public:
/** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
/**
* Ctor
* @param _refPoint the reference point
* @param _metric the quality indicator
*/
moeoReferencePointIndicatorBasedFitnessAssignment (ObjectiveVector & _refPoint, moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & _metric) :
refPoint(_refPoint), metric(_metric)
{}
/**
* Sets the fitness values for every solution contained in the population _pop
* @param _pop the population
*/
void operator()(eoPop < MOEOT > & _pop)
{
// 1 - setting of the bounds
setup(_pop);
// 2 - setting fitnesses
setFitnesses(_pop);
}
/**
* Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account.
* @param _pop the population
* @param _objVec the objective vector
*/
void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec)
{
// nothing to do ;-)
}
protected:
/** the reference point */
ObjectiveVector & refPoint;
/** the quality indicator */
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > & metric;
/**
* Sets the bounds for every objective using the min and the max value for every objective vector of _pop (and the reference point)
* @param _pop the population
*/
void setup(const eoPop < MOEOT > & _pop)
{
double min, max;
for (unsigned int i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
{
min = refPoint[i];
max = refPoint[i];
for (unsigned int j=0; j<_pop.size(); j++)
{
min = std::min(min, _pop[j].objectiveVector()[i]);
max = std::max(max, _pop[j].objectiveVector()[i]);
}
// setting of the bounds for the objective i
metric.setup(min, max, i);
}
}
/**
* Sets the fitness of every individual contained in the population _pop
* @param _pop the population
*/
void setFitnesses(eoPop < MOEOT > & _pop)
{
for (unsigned int i=0; i<_pop.size(); i++)
{
_pop[i].fitness(- metric(_pop[i].objectiveVector(), refPoint) );
}
}
};
#endif /*MOEOREFERENCEPOINTINDICATORBASEDFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,50 @@
/*
* <moeoScalarFitnessAssignment.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 MOEOSCALARFITNESSASSIGNMENT_H_
#define MOEOSCALARFITNESSASSIGNMENT_H_
#include <fitness/moeoFitnessAssignment.h>
/**
* moeoScalarFitnessAssignment is a moeoFitnessAssignment for scalar strategies.
*/
template < class MOEOT >
class moeoScalarFitnessAssignment : public moeoFitnessAssignment < MOEOT >
{};
#endif /*MOEOSCALARFITNESSASSIGNMENT_H_*/

View file

@ -0,0 +1,67 @@
/*
* <moeoSingleObjectivization.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2009
* (C) OPAC Team, LIFL, 2002-2007
*
* 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 MOEOSINGLEOBJECTIVIZATION_H_
#define MOEOSINGLEOBJECTIVIZATION_H_
#include <fitness/moeoFitnessAssignment.h>
#include <eoEvalFunc.h>
/**
* Class to adapt multiobjective problems to single objective algorithms
*/
template < class MOEOT >
class moeoSingleObjectivization : public moeoFitnessAssignment < MOEOT > , public eoEvalFunc < MOEOT >
{
public:
/**
* herited from moeoFitnessAssignment
* @param _pop the population
*/
virtual void operator () (eoPop < MOEOT > & _pop)=0;
/**
herited from eoEvalFunc
@param _moeot
*/
virtual void operator() (MOEOT & _moeot)=0;
virtual typename MOEOT::Fitness operator() (const typename MOEOT::ObjectiveVector & _obj)=0;
};
#endif /*MOEOSINGLEOBJECTIVIZATION_H_*/

View file

@ -0,0 +1,50 @@
/*
* <moeoUnaryIndicatorBasedFitnessAssignment.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 MOEOUNARYINDICATORBASEDFITNESSASSIGNMENT_H_
#define MOEOUNARYINDICATORBASEDFITNESSASSIGNMENT_H_
#include <fitness/moeoIndicatorBasedFitnessAssignment.h>
/**
* moeoIndicatorBasedFitnessAssignment for unary indicators.
*/
template < class MOEOT >
class moeoUnaryIndicatorBasedFitnessAssignment : public moeoIndicatorBasedFitnessAssignment < MOEOT >
{};
#endif /*MOEOINDICATORBASEDFITNESSASSIGNMENT_H_*/