diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/explorer/moVNSexplorer.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/explorer/moVNSexplorer.h deleted file mode 100644 index 1887d1fe0..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/explorer/moVNSexplorer.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moVNSexplorer_h -#define _moVNSexplorer_h - -#include -#include -#include - -/** - * Explorer for Variiable Neighborhood Search - */ -template< class EOT > -class moVNSexplorer : public moNeighborhoodExplorer< moNeighborhood< moNeighbor > > -{ -public: - typedef typename EOT::Fitness Fitness ; - typedef moNeighbor Neighbor ; - typedef moNeighborhood Neighborhood ; - - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; - - /** - * Constructor - * @param _neighborhood the neighborhood - * @param _eval the evaluation function - * @param _neighborComparator a neighbor comparator - * @param _solNeighborComparator solution vs neighbor comparator - */ - moVNSexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { - } - - /** - * Destructor - */ - ~moVNSexplorer() { - } - - /** - * initParam: NOTHING TO DO - */ - virtual void initParam(EOT & solution) {}; - - /** - * updateParam: NOTHING TO DO - */ - virtual void updateParam(EOT & solution) {}; - - /** - * terminate: NOTHING TO DO - */ - virtual void terminate(EOT & solution) {}; - - /** - * Explore the neighborhood of a solution - * @param _solution - */ - virtual void operator()(EOT & _solution) { - }; - - /** - * continue if a move is accepted - * @param _solution the solution - * @return true if an ameliorated neighbor was be found - */ - virtual bool isContinue(EOT & _solution) { - return isAccept ; - }; - - /** - * move the solution with the best neighbor - * @param _solution the solution to move - */ - virtual void move(EOT & _solution) { - //move the solution - (*best).move(_solution); - //update its fitness - _solution.fitness((*best).fitness()); - }; - - /** - * accept test if an amelirated neighbor was be found - * @param _solution the solution - * @return true if the best neighbor ameliorate the fitness - */ - virtual bool accept(EOT & _solution) { - }; - - /** - * Return the class id. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moVNSexplorer"; - } - -private: - // comparator betwenn solution and neighbor or between neighbors - moNeighborComparator& neighborComparator; - moSolNeighborComparator& solNeighborComparator; - -}; - - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/mo.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/mo.h index 0bcc07789..6cb50c0c5 100755 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/mo.h +++ b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/mo.h @@ -148,8 +148,6 @@ #include #include -#include -#include #include #include #include diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moBackwardVariableNeighborhood.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moBackwardVariableNeighborhood.h deleted file mode 100644 index 397246ea4..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moBackwardVariableNeighborhood.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moBackwardVariableNeighborhood_h -#define _moBackwardVariableNeighborhood_h - -#include - -/** - * A variable Neighborhood Search (VNS) in the Backward manner - */ -template< class EOT > -class moBackwardVariableNeighborhood : public moVariableNeighborhood -{ -public: - typedef moNeighbor Neighbor; - - using moVariableNeighborhood::currentNH; - using moVariableNeighborhood::neighborhoodVector; - - /** - * Construction of at least one neighborhood - * @param _firstNH first neighborhood in the vector - */ - moBackwardVariableNeighborhood(moNeighborhood& _firstNH) : moVariableNeighborhood(_firstNH) { } - - /** - * Return the class id. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moBackwardVariableNeighborhood"; - } - - /** - * test if there is still some neighborhood to explore - * @return true if there is some neighborhood to explore - */ - virtual bool contNeighborhood() { - return (currentNH > 0); - } - - /** - * put the current neighborhood on the last one - */ - virtual void initNeighborhood() { - currentNH = neighborhoodVector.size() - 1; - } - - /** - * put the current neighborhood on the next one - */ - virtual void nextNeighborhood() { - currentNH--; - } - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moForwardVariableNeighborhood.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moForwardVariableNeighborhood.h deleted file mode 100644 index 449999208..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moForwardVariableNeighborhood.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moForwardVariableNeighborhood_h -#define _moForwardVariableNeighborhood_h - -#include - -/** - * A variable Neighborhood Search (VNS) in the forward manner - */ -template< class EOT > -class moForwardVariableNeighborhood : public moVariableNeighborhood -{ -public: - - typedef moNeighbor Neighbor; - - using moVariableNeighborhood::currentNH; - using moVariableNeighborhood::neighborhoodVector; - - /** - * Construction of at least one neighborhood - * @param _firstNH first neighborhood in the vector - */ - moForwardVariableNeighborhood(moNeighborhood& _firstNH) : moVariableNeighborhood(_firstNH) { } - - /** - * Return the class id. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moForwardVariableNeighborhood"; - } - - /** - * test if there is still some neighborhood to explore - * @return true if there is some neighborhood to explore - */ - virtual bool contNeighborhood() { - return (currentNH < neighborhoodVector.size() - 1); - } - - /** - * put the current neighborhood on the first one - */ - virtual void initNeighborhood() { - currentNH = 0; - } - - /** - * put the current neighborhood on the next one - */ - virtual void nextNeighborhood() { - currentNH++; - } - -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moRndVariableNeighborhood.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moRndVariableNeighborhood.h deleted file mode 100644 index 8b7421a1e..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moRndVariableNeighborhood.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moRndVariableNeighborhood_h -#define _moRndVariableNeighborhood_h - -#include -#include - -/** - * A variable Neighborhood Search (VNS) in the random manner - */ -template< class EOT, class Fitness > -class moRndVariableNeighborhood : public moVariableNeighborhood -{ -public: - typedef moNeighbor Neighbor; - - using moVariableNeighborhood::currentNH; - using moVariableNeighborhood::neighborhoodVector; - - /** - * Construction of at least one neighborhood - * @param _firstNH first neighborhood in the vector - */ - moRndVariableNeighborhood(moNeighborhood& _firstNH) : moVariableNeighborhood(_firstNH) { - indexVector.push_back(0); - } - - /** - * to add a neighborhood in the vector - * @param _nh the neighborhood to add at the end of the vector of neighborhood - */ - virtual void add(moNeighborhood& _nh) { - neighborhoodVector.push_back(_nh); - indexVector.push_back(indexVector.size()); - } - - - /** - * Return the class id. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moRndVariableNeighborhood"; - } - - /** - * test if there is still some neighborhood to explore - * @return true if there is some neighborhood to explore - */ - virtual bool contNeighborhood() { - return (index < neighborhoodVector.size() - 1); - } - - /** - * put the current neighborhood on the first one - */ - virtual void initNeighborhood() { - std::random_shuffle(indexVector.begin(), indexVector.end()); - index = 0; - currentNH = indexVector[index]; - } - - /** - * put the current neighborhood on the next one - */ - virtual void nextNeighborhood() { - index++; - currentNH = indexVector[index]; - } - -private: - unsigned int index; - std::vector indexVector; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moVariableNeighborhood.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moVariableNeighborhood.h deleted file mode 100644 index ac07af8b0..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/neighborhood/moVariableNeighborhood.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moVariableNeighborhood_h -#define _moVariableNeighborhood_h - -#include -#include -#include -#include - -/** - * A vector of neighborhood for the Variable Neighborhood Search (VNS) - */ -template< class EOT > -class moVariableNeighborhood : public moNeighborhood > -{ -public: - - typedef moNeighbor Neighbor; - /** - * Construction of at least one neighborhood - * @param _firstNH first neighborhood in the vector - */ - moVariableNeighborhood(moNeighborhood& _firstNH) { - neighborhoodVector.push_back(&_firstNH); - // the current neighborhood - currentNH = 0; - } - - /** - * @return if the current neighborhood is random - */ - virtual bool isRandom() { - return neighborhoodVector[currentNH]->isRandom(); - } - - /** - * Test if a solution has a Neighbor in the current neighborhood - * @param _solution the related solution - * @return if _solution has a Neighbor in the current neighborhood - */ - virtual bool hasNeighbor(EOT & _solution) { - return neighborhoodVector[currentNH]->hasNeighbor(_solution); - } - - /** - * Initialization of the current neighborhood - * @param _solution the solution to explore - * @param _current the first neighbor in the current neighborhood - */ - virtual void init(EOT & _solution, Neighbor & _current) { - neighborhoodVector[currentNH]->init(_solution, _current); - } - - /** - * Give the next neighbor in the current neighborhood - * @param _solution the solution to explore - * @param _current the next neighbor in the current neighborhood - */ - virtual void next(EOT & _solution, Neighbor & _current) { - neighborhoodVector[currentNH]->next(_solution, _current); - } - - /** - * Test if there is again a neighbor in the current neighborhood - * @param _solution the solution to explore - * @return if there is still a neighbor not explored in the current neighborhood - */ - virtual bool cont(EOT & _solution) { - return neighborhoodVector[currentNH]->cont(_solution); - } - - /** - * Return the class id. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moVariableNeighborhood"; - } - - /** - * to add a neighborhood in the vector - * @param _nh the neighborhood to add at the end of the vector of neighborhood - */ - virtual void add(moNeighborhood& _nh) { - neighborhoodVector.push_back(&_nh); - } - - /** - * test if there is still some neighborhood to explore - * @return true if there is some neighborhood to explore - */ - virtual bool contNeighborhood() = 0; - - /** - * put the current neighborhood on the first one - */ - virtual void initNeighborhood() = 0; - - /** - * put the current neighborhood on the next one - */ - virtual void nextNeighborhood() = 0; - -protected: - // the vector of neighborhoods - std::vector* > neighborhoodVector; - // the index of the current neighborhood - unsigned int currentNH; - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopBitNeighbor.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopBitNeighbor.h deleted file mode 100644 index 028aedd25..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopBitNeighbor.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moPopBitNeighbor_h -#define _moPopBitNeighbor_h - -#include -#include -#include -#include -#include - -/** - * Neighbor related to a vector of Bit - */ -template< class Fitness > -class moPopBitNeighbor : public moIndexNeighbor< moPopSol > > -{ -public: - typedef moPopSol > EOT ; - typedef eoBit SUBEOT; - - using moIndexNeighbor::fitness; - using moIndexNeighbor::key; - - /** - * move the solution - * @param _solution the solution to move - */ - virtual void move(EOT & _solution) { - if(_solution[0].size()>0){ - unsigned size=_solution[0].size(); - unsigned s = key/size; - unsigned b = key%size; - _solution[s][b] = !_solution[s][b]; - _solution[s].fitness(subfit); - _solution.invalidate(); - } - } - - void setSubFit(Fitness _subfit){ - subfit=_subfit; - } - - /** - * return the class name - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moPopBitNeighbor"; - } - - /** - * Read object.\ - * Calls base class, just in case that one had something to do. - * The read and print methods should be compatible and have the same format. - * In principle, format is "plain": they just print a number - * @param _is a std::istream. - * @throw runtime_std::exception If a valid object can't be read. - */ - virtual void readFrom(std::istream& _is) { - std::string fitness_str; - int pos = _is.tellg(); - _is >> fitness_str; - if (fitness_str == "INVALID") { - throw std::runtime_error("invalid fitness"); - } - else { - Fitness repFit ; - _is.seekg(pos); - _is >> repFit; - _is >> key; - fitness(repFit); - } - } - - /** - * Write object. Called printOn since it prints the object _on_ a stream. - * @param _os A std::ostream. - */ - virtual void printOn(std::ostream& _os) const { - _os << fitness() << ' ' << key << std::endl; - } - -private: - Fitness subfit; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopSol.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopSol.h deleted file mode 100644 index adb70a859..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/bitString/moPopSol.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moPopSol_h -#define _moPopSol_h - -#include -#include - -template -class moPopSol : public EO, public std::vector{ -public: - typedef typename EO::Fitness Fitness; - using EO::invalidate; - - virtual void printOn(std::ostream& _os) const - { - _os << (*this).size() << " " << (*this).fitness() << '\n'; - for(unsigned int i=0; i<(*this).size(); i++) - _os << (*this).operator[](i) << std::endl; - } - -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/eval/moPopBitEval.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/eval/moPopBitEval.h deleted file mode 100644 index fcc4b13b7..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/src/problems/eval/moPopBitEval.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Sébastien Verel, Arnaud Liefooghe, Jérémie 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 -*/ - -#ifndef moPopBitEval_H -#define moPopBitEval_H - -#include -#include - -/** - * Abstract class for the evaluation - */ -template -class moPopBitEval : public moEval -{ -public: - typedef typename Neighbor::EOT EOT; - typedef typename Neighbor::SUBEOT SUBEOT; - - typedef typename EOT::Fitness Fitness; - - moPopBitEval(eoEvalFunc& _eval, unsigned int _p):eval(_eval), p(_p){ - - } - - void operator()(EOT& _sol, Neighbor& _n){ - if(_sol[0].size()>0){ - unsigned int size=_sol[0].size(); - unsigned int s=_n.index()/size; - unsigned int b=_n.index()%size; - subfit=_sol[s].fitness(); - _sol[s][b]=!_sol[s][b]; - _sol[s].invalidate(); - eval(_sol[s]); - double fit=0; - for (unsigned int i = 0; i < _sol.size(); i++){ - fit+=pow((double) _sol[i].fitness(), (int) p); - } - fit=pow((double) fit, (double)1/p); - _n.setSubFit(_sol[s].fitness()); - _n.fitness(fit); - _sol[s][b]=!_sol[s][b]; - _sol[s].fitness(subfit); - } - } - -private: - eoEvalFunc & eval; - unsigned int p; - Fitness subfit; - -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/CMakeLists.txt b/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/CMakeLists.txt index bbf9bfcaf..5b622393e 100644 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/CMakeLists.txt +++ b/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/CMakeLists.txt @@ -395,7 +395,6 @@ ADD_SUBDIRECTORY(Lesson4) ADD_SUBDIRECTORY(Lesson5) ADD_SUBDIRECTORY(Lesson6) ADD_SUBDIRECTORY(Lesson7) -ADD_SUBDIRECTORY(Lesson8) IF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") ADD_COMMANDS_NEWMO() diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/CMakeLists.txt b/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/CMakeLists.txt deleted file mode 100644 index 982173989..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src - ${MO_SRC_DIR}/src - ${PROBLEMS_SRC_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src) - -LINK_DIRECTORIES(${EO_BIN_DIR}/lib) - -ADD_EXECUTABLE(testPopLS testPopLS.cpp) - -TARGET_LINK_LIBRARIES(testPopLS eoutils ga eo) diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/moPopFitContinuator.h b/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/moPopFitContinuator.h deleted file mode 100644 index 0e1874d7b..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/moPopFitContinuator.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _moPopFitContinuator_h -#define _moPopFitContinuator_h - -#include - -/** - * Termination condition until a running time is reached. - */ -template < class Neighbor > -class moPopFitContinuator: public moContinuator -{ -public: - - typedef typename Neighbor::EOT EOT; - typedef typename EOT::Fitness Fitness; - - /** - * Constructor - * @param _fit fitness to reach - * @param _verbose verbose mode true/false -> on/off - */ - moPopFitContinuator(Fitness _fit, bool _verbose=true): fit(_fit), verbose(_verbose) {} - - - /** - * Returns false when the running time is reached. - * @param _sol the current solution - */ - virtual bool operator() (EOT& _sol) - { - unsigned int i=0; - bool res=true; - while (res && i<_sol.size()){ - res= (_sol[i].fitness() < fit); - i++; - } - if (!res && verbose) - std::cout << "STOP in moPopFitContinuator: Reached maximum fitness [" << fit << "]" << std::endl; - return res; - } - - /** - * reset the start time - * @param _solution a solution - */ - virtual void init(EOT & _solution) {} - - - /** - * Class name - */ - virtual std::string className(void) const - { - return "moPopFitContinuator"; - } - - -private: - - Fitness fit; - /** verbose mode */ - bool verbose; - -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/testPopLS.cpp b/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/testPopLS.cpp deleted file mode 100644 index b026f86c7..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-mo/tutorial/Lesson8/testPopLS.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 -*/ - -// standard includes -#define HAVE_SSTREAM - -#include // runtime_error -#include // cout -#include // ostrstream, istrstream -#include -#include - -// the general include for eo -#include -#include - -using namespace std; - -//----------------------------------------------------------------------------- -//Representation and initializer -#include -#include -#include -#include -#include - -// fitness function -#include -#include - -//Neighbors and Neighborhoods -#include -#include - -//Algorithm and its components -#include -#include - -//comparator -#include - -//continuators -#include -#include -#include -#include -#include - -#include "moPopFitContinuator.h" - -#include - - -//----------------------------------------------------------------------------- -// Define types of the representation solution, different neighbors and neighborhoods -//----------------------------------------------------------------------------- -typedef moPopSol > Solution; //Permutation (Queen's problem representation) - -typedef moPopBitNeighbor Neighbor; //shift Neighbor -typedef moRndWithReplNeighborhood Neighborhood; //rnd shift Neighborhood (Indexed) - - -class popInit: public eoInit{ - -public: - - popInit( eoInitFixedLength > & _rnd, unsigned int _popSize):rnd(_rnd), popSize(_popSize){} - - void operator()(Solution & _sol){ - - - - eoBit tmp; - - for(unsigned int i=0; i >& rnd; - unsigned int popSize; - -}; - -void main_function(int argc, char **argv) -{ - /* ========================================================= - * - * Parameters - * - * ========================================================= */ - - // First define a parser from the command-line arguments - eoParser parser(argc, argv); - - // For each parameter, define Parameter, read it through the parser, - // and assign the value to the variable - - eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); - parser.processParam( seedParam ); - unsigned seed = seedParam.value(); - - // the number of steps of the random walk - eoValueParam stepParam(100, "nbStep", "Number of steps of the random walk", 'n'); - parser.processParam( stepParam, "Representation" ); - unsigned nbStep = stepParam.value(); - - // description of genotype - eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); - parser.processParam( vecSizeParam, "Representation" ); - unsigned vecSize = vecSizeParam.value(); - - // description of genotype - eoValueParam popSizeParam(10, "popSize", "population size", 'P'); - parser.processParam( popSizeParam, "Representation" ); - unsigned popSize = popSizeParam.value(); - - // the name of the "status" file where all actual parameter values will be saved - string str_status = parser.ProgramName() + ".status"; // default value - eoValueParam statusParam(str_status.c_str(), "status", "Status file"); - parser.processParam( statusParam, "Persistence" ); - - // the name of the output file - string str_out = "out.dat"; // default value - eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); - parser.processParam(outParam, "Persistence" ); - - // description of genotype - eoValueParam pparam(10, "p", "p", 'p'); - parser.processParam( pparam, "Representation" ); - unsigned p = pparam.value(); - - // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED - // i.e. in case you need parameters somewhere else, postpone these - if (parser.userNeedsHelp()) { - parser.printHelp(cout); - exit(1); - } - if (statusParam.value() != "") { - ofstream os(statusParam.value().c_str()); - os << parser;// and you can use that file as parameter file - } - - /* ========================================================= - * - * Random seed - * - * ========================================================= */ - - //reproducible random seed: if you don't change SEED above, - // you'll always get the same result, NOT a random run - rng.reseed(seed); - - - /* ========================================================= - * - * Eval fitness function - * - * ========================================================= */ - - oneMaxEval< eoBit > eval; - oneMaxPopEval< eoBit > popEval(eval, p); - - - /* ========================================================= - * - * Initilisation of the solution - * - * ========================================================= */ - - eoUniformGenerator uGen; - eoInitFixedLength > rnd(vecSize, uGen); - - popInit random(rnd, popSize); - - - - - /* ========================================================= - * - * evaluation of a neighbor solution - * - * ========================================================= */ - - moPopBitEval evalNeighbor(eval,p); - -// Neighbor n; -// -// n.index(3); -// moEval(sol, n); -// n.move(sol); -// popEval(sol); -// sol.printOn(std::cout); -// std::cout << "fit neighor: " << n.fitness() << std::endl; - - - - - /* ========================================================= - * - * the neighborhood of a solution - * - * ========================================================= */ - - Neighborhood neighborhood(vecSize*popSize); - - moPopFitContinuator cont(vecSize); - - /* ========================================================= - * - * the local search algorithm - * - * ========================================================= */ - - //moSimpleHC ls(neighborhood, popEval, evalNeighbor, cont); - - /* ========================================================= - * - * execute the local search from random solution - * - * ========================================================= */ - -// ls(sol); -// -// std::cout << "final solution:" << std::endl; -// sol.printOn(std::cout); -// std::cout << std::endl; - - - - - /* ========================================================= - * - * The sampling of the search space - * - * ========================================================= */ - - // sampling object : - // - random initialization - // - neighborhood to compute the next step - // - fitness function - // - neighbor evaluation - // - number of steps of the walk - moAutocorrelationSampling sampling(random, neighborhood, popEval, evalNeighbor, nbStep); - - /* ========================================================= - * - * execute the sampling - * - * ========================================================= */ - - sampling(); - - /* ========================================================= - * - * export the sampling - * - * ========================================================= */ - - // to export the statistics into file - sampling.fileExport(str_out); - - // to get the values of statistics - // so, you can compute some statistics in c++ from the data - const std::vector & fitnessValues = sampling.getValues(0); - - std::cout << "First values:" << std::endl; - std::cout << "Fitness " << fitnessValues[0] << std::endl; - - std::cout << "Last values:" << std::endl; - std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; - - // more basic statistics on the distribution: - moStatistics statistics; - - vector rho, phi; - - statistics.autocorrelation(fitnessValues, 20, rho, phi); - - for (unsigned s = 0; s < rho.size(); s++) - std::cout << s << " " << "rho=" << rho[s] << ", phi=" << phi[s] << std::endl; - -// Queen solution1, solution2; -// -// init(solution1); -// -// fullEval(solution1); -// -// std::cout << "#########################################" << std::endl; -// std::cout << "initial solution1: " << solution1 << std::endl ; -// -// localSearch1(solution1); -// -// std::cout << "final solution1: " << solution1 << std::endl ; -// std::cout << "#########################################" << std::endl; - - - /* ========================================================= - * - * the cooling schedule of the process - * - * ========================================================= */ - - // initial temp, factor of decrease, number of steps without decrease, final temp. - - - /* ========================================================= - * - * Comparator of neighbors - * - * ========================================================= */ - - - - /* ========================================================= - * - * Example of Checkpointing - * - * ========================================================= */ - -// moTrueContinuator continuator;//always continue -// moCheckpoint checkpoint(continuator); -// moFitnessStat fitStat; -// checkpoint.add(fitStat); -// eoFileMonitor monitor("fitness.out", ""); -// moCounterMonitorSaver countMon(100, monitor); -// checkpoint.add(countMon); -// monitor.add(fitStat); -// -// moSA localSearch2(rndShiftNH, fullEval, shiftEval, coolingSchedule, solComparator, checkpoint); -// -// init(solution2); -// -// fullEval(solution2); -// -// std::cout << "#########################################" << std::endl; -// std::cout << "initial solution2: " << solution2 << std::endl ; -// -// localSearch2(solution2); -// -// std::cout << "final solution2: " << solution2 << std::endl ; -// std::cout << "#########################################" << std::endl; -} - -// A main that catches the exceptions - -int main(int argc, char **argv) -{ - try { - main_function(argc, argv); - } - catch (exception& e) { - cout << "Exception: " << e.what() << '\n'; - } - return 1; -} - diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/moeo b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/moeo index 3e5db4142..6667d9bb5 100644 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/moeo +++ b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/moeo @@ -152,43 +152,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoHC.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoHC.h deleted file mode 100644 index 8c922b1b3..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoHC.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 __moeoHC_h -#define __moeoHC_h -#include -#include -#include -#include -#include -//! Hill Climbing (HC) -/*! - Class which describes the algorithm for a hill climbing. - Adapts the moHC for a multi-objective problem using a moeoSingleObjectivization. - M is for Move - */ -template -class moeoHC : public moeoSolAlgo < typename M::EOType > -{ - - public: - typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - - //! Full constructor. - /*! - All the boxes are given in order the HC to use a moHCMoveLoopExpl. - - \param _move_initializer a move initialiser. - \param _next_move_generator a neighborhood explorer. - \param _incremental_evaluation a (generally) efficient evaluation function. - \param _move_selection a move selector. - \param _singler a singleObjectivizer to translate objectiveVectors into fitness - */ - moeoHC (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, - moMoveIncrEval < M,ObjectiveVector > & _incremental_evaluation, moMoveSelect < M > & _move_selection, moeoSingleObjectivization < MOEOT > & _singler) : - incrEval((new moeoIncrEvalSingleObjectivizer(_singler,_incremental_evaluation))), - moveLoop(new moeoHCMoveLoopExpl(_move_initializer,_next_move_generator,*(incrEval),_move_selection)), - algo(*(moveLoop), (_singler)) - {} - //! Function which launches the HC - /*! - The HC has to improve a current solution. - As the moSA and the mo TS, it can be used for HYBRIDATION in an evolutionnary algorithm. - - \param _solution a current solution to improve. - \return true. - */ - - bool operator()(MOEOT &_solution){ - if (_solution.invalidObjectiveVector()) { - (*incrEval)(_solution); - }else{ - } - return algo(_solution); - } - - private: - moeoIncrEvalSingleObjectivizer *incrEval; - moeoHCMoveLoopExpl *moveLoop; - //! the actual algo - moHC algo; - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoILS.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoILS.h deleted file mode 100644 index 37b9ea8f7..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoILS.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 _moeoILS_h -#define _moeoILS_h - -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - -//! Iterated Local Search (ILS) -/*! - Class which describes the algorithm for a iterated local search. - Adapts the moILS for a multi-objective problem using a moeoSingleObjectivization. - M is for Move - */ - -template < class M > -class moeoILS:public moeoSolAlgo < typename M::EOType > -{ - - public: - typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - //! Generic constructor - /*! - Generic constructor using a moAlgo - - \param _algorithm The solution based heuristic to use. - \param _continue The stopping criterion. - \param _acceptance_criterion The acceptance criterion. - \param _perturbation The pertubation generator. - \param _full_evaluation The evaluation function. - */ - moeoILS (moeoSolAlgo & _algorithm, moSolContinue & _continue, moComparator & _acceptance_criterion, - eoMonOp & _perturbation, moeoSingleObjectivization & _full_evaluation): - algo(_algorithm,_continue,_acceptance_criterion,_perturbation,_full_evaluation) - {} - //! Constructor for using a moHC - /*! - \param _move_initializer The move initialisation (for the moHC). - \param _next_move_generator The move generator (for the moHC). - \param _incremental_evaluation The partial evaluation function (for the moHC). - \param _singler a singleObjectivizer to translate objectiveVectors into fitness - \param _move_selection The move selection strategy (for the moHC). - \param _continue The stopping criterion. - \param _acceptance_criterion The acceptance criterion. - \param _perturbation The pertubation generator. - */ - moeoILS (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, - moMoveIncrEval < M,ObjectiveVector > & _incremental_evaluation, moeoSingleObjectivization &_singler,moMoveSelect < M > & _move_selection, - moSolContinue & _continue, moComparator & _acceptance_criterion, - eoMonOp & _perturbation): - subAlgo(new moeoHC(_move_initializer,_next_move_generator,_incremental_evaluation,_move_selection,_singler)), - algo(*subAlgo,_continue,_acceptance_criterion,_perturbation,_singler) - {} - //! Constructor for using a moTS for the moAlgo - /*! - \param _move_initializer The move initialisation (for the moTS). - \param _next_move_generator The move generator (for the moTS). - \param _incremental_evaluation The partial evaluation function (for the moTS). - \param _singler a singleObjectivizer to translate objectiveVectors into fitness - \param _tabu_list The tabu list (for the moTS !!!!). - \param _aspiration_criterion The aspiration criterion (for the moTS). - \param _moTS_continue The stopping criterion (for the moTS). - \param _continue The stopping criterion. - \param _acceptance_criterion The acceptance criterion. - \param _perturbation The pertubation generator. - */ - - moeoILS (moMoveInit & _move_initializer, moNextMove & _next_move_generator,moMoveIncrEval & _incremental_evaluation, moeoSingleObjectivization &_singler, moTabuList & _tabu_list,moAspirCrit & _aspiration_criterion, moSolContinue & _moTS_continue,moSolContinue & _continue, moComparator & _acceptance_criterion, eoMonOp & _perturbation): - subAlgo(new moeoTS(_move_initializer,_next_move_generator,_incremental_evaluation,_tabu_list,_aspiration_criterion,_moTS_continue,_singler)), - algo((*subAlgo),_continue,_acceptance_criterion,_perturbation,_singler) - {} - //! Constructor for using a moSA for the moAlgo - /*! - \param _random_move_generator The random move generator (for the moSA). - \param _incremental_evaluation The partial evaluation function (for the moSA). - \param _singler a singleObjectivizer to translate objectiveVectors into fitness - \param _moSA_continue The stopping criterion (for the moSA). - \param _initial_temperature The initial temperature (for the moSA). - \param _cooling_schedule The cooling schedule (for the moSA). - \param _continue The stopping criterion. - \param _acceptance_criterion The acceptance criterion. - \param _perturbation The pertubation generator. - */ - moeoILS (moRandMove & _random_move_generator, moMoveIncrEval & _incremental_evaluation,moeoSingleObjectivization &_singler, moSolContinue & _moSA_continue,double _initial_temperature, moCoolingSchedule & _cooling_schedule, moSolContinue & _continue,moComparator & _acceptance_criterion, eoMonOp & _perturbation): - subAlgo(new moeoSA(_random_move_generator, _incremental_evaluation, _moSA_continue, _initial_temperature,_cooling_schedule, _singler)), - algo(*subAlgo,_continue, _acceptance_criterion, _perturbation, _singler) - {} - - - - //! Function which launches the ILS - /*! - The ILS has to improve a current solution. - - \param _solution a current solution to improve. - \return true. - */ - bool operator()(MOEOT &_solution){ -// std::cout<<"moeoILS"< *subAlgo; - //! the actual algo - moILS algo; - - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSA.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSA.h deleted file mode 100644 index 9b1615a2f..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSA.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 __moeoSA_h -#define __moeoSA_h - -#include -#include -#include -#include -#include -#include -//! Simulated annealing (SA) -/*! - Generic algorithm that describes a Simulated Annealing algorithm. - Adapts the moSA for a multi-objective problem using a moeoSingleObjectivization. - M is for Move - */ - -template < class M > -class moeoSA:public moeoSolAlgo < typename M::EOType > -{ - - public: - - typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - moeoSA (moRandMove < M > & _random_move_generator, moMoveIncrEval < M,ObjectiveVector > & _incremental_evaluation, - moSolContinue < MOEOT > & _continue, double _initial_temperature, moCoolingSchedule & _cooling_schedule, - moeoSingleObjectivization &_singler): - incrEval(_singler,_incremental_evaluation), - algo(_random_move_generator,incrEval,_continue,_initial_temperature,_cooling_schedule, _singler) - {} - /*! - Algorithm of the SA - As a moHC, it can be used for HYBRIDATION in an evolutionary algorithm. - - \param _solution a solution to improve. - \return TRUE. - */ - bool operator()(MOEOT &_solution){ - return algo(_solution); - } - - private: - moeoIncrEvalSingleObjectivizer incrEval; - //! the actual algo - moSA algo; - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSolAlgo.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSolAlgo.h deleted file mode 100755 index 4bdafc583..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoSolAlgo.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* Arnaud Liefooghe -* Jérémie Humeau -* 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 MOEOSOLALGO_H_ -#define MOEOSOLALGO_H_ - -#include -#include -#include - -/** - * Abstract class for Solution based multi-objective evolutionary algorithms. - */ -template < class MOEOT > -class moeoSolAlgo : public moAlgo, public moeoAlgo -{ -}; - -#endif /*MOEOSOLALGO_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoTS.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoTS.h deleted file mode 100644 index 4eadcb289..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoTS.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 __moeoTS_h -#define __moeoTS_h - -#include -#include -#include -#include -#include -//! Tabu Search (TS) -/*! - Generic algorithm that describes a tabu search. - Adapts the moTS for a multi-objective problem using a moeoSingleObjectivization. - M is for Move - */ - -template < class M > -class moeoTS:public moeoSolAlgo < typename M::EOType > -{ - - public: - typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - - //! Full constructor. - /*! - All the boxes are given in order the TS to use a moTSMoveLoopExpl. - - \param _move_initializer a move initialiser. - \param _next_move_generator a neighborhood explorer. - \param _incremental_evaluation a (generally) efficient evaluation function. - \param _tabu_list The tabu list. - \param _aspiration_criterion An aspiration criterion. - \param _continue The stopping criterion. - \param _singler a singleObjectivizer to translate objectiveVectors into fitness - */ - moeoTS (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, - moMoveIncrEval < M, typename MOEOT::ObjectiveVector > & _incremental_evaluation, moTabuList < M > & _tabu_list, - moAspirCrit < M > & _aspiration_criterion, moSolContinue < MOEOT > & _continue, - moeoSingleObjectivization &_singler): - incrEval(_singler,_incremental_evaluation), - moveLoop(_move_initializer,_next_move_generator,incrEval,_tabu_list,_aspiration_criterion), - algo(moveLoop,_continue,_singler) - {} - - //! Function which launchs the Tabu Search - /*! - Algorithm of the tabu search. - As a moSA or a moHC, it can be used for HYBRIDATION in an evolutionary algorithm. - For security a lock (pthread_mutex_t) is closed during the algorithm. - - \param _solution a solution to improve. - \return TRUE. - */ - bool operator()(MOEOT &_solution){ - return algo(_solution); - } - - private: - moeoIncrEvalSingleObjectivizer incrEval; - moeoTSMoveLoopExpl moveLoop; - //! the actual algo - moTS algo; - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVFAS.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVFAS.h deleted file mode 100644 index 507063322..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVFAS.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 _moeoVFAS_h -#define _moeoVFAS_h - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -//! Variable fitness assignment search (vfas) -/*! - Search using multiple fitness assignment to search solution to a multi objective problem - */ - -template < class M > -class moeoVFAS:public moeoPopAlgo < typename M::EOType > -{ - - public: - typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - /** - * constructor using a moAlgo and a vector of weight - * take a base vector of weight, and modify it to relaunch the algo with a diferent fitness - * use a selectOne to determine which moeot should be the base for the algo launch - * use a eoPop to keep result from each iteration - * @param _algorithm The solution based heuristic to use. It should at least use the fitness value at some point. - * @param _continue The stopping criterion. - * @param _select a selector to choose on which moeot we use the algorithm - * @param _weights a vector containing the base weights, which will be changed at each iteration. - * @param _eval The evaluation function. - * @param _wstrat the strategy to change weights (should be constructed with the same weights as the fitness) - */ - moeoVFAS (moeoSolAlgo & _algorithm, eoContinue & _continue,moeoSelectOne &_select, - std::vector &_weights, eoEvalFunc< MOEOT > &_eval , moeoVariableWeightStrategy &_wstrat ): - algo(_algorithm),cont(_continue), select(_select), weights(_weights),eval(_eval),refPoint(defaultRefPoint), wstrat(_wstrat), rstrat(defaultRstrat) - {} - - /** - * constructor using a moAlgo an ObjectiveVector and a vector of weight - * take a base vector of weight, and modify it to relaunch the algo with a diferent fitness - * use a selectOne to determine which moeot should be the base for the algo launch - * use a eoPop to keep result from each iteration - * @param _algorithm The solution based heuristic to use. It should at least use the fitness value at some point. - * @param _continue The stopping criterion. - * @param _select a selector to choose on which moeot we use the algorithm - * @param _weights a vector containing the base weights, which will be changed at each iteration. - * @param _refPoint a reference point changed at each iteration - * @param _eval The evaluation function. - * @param _wstrat the strategy to change weights (should be constructed with the same weights as the fitness) - * @param _rstrat the strategy to change the reference point - */ - moeoVFAS (moeoSolAlgo & _algorithm, eoContinue & _continue,moeoSelectOne &_select, - std::vector &_weights, ObjectiveVector &_refPoint, eoEvalFunc< MOEOT > &_eval , moeoVariableWeightStrategy &_wstrat , moeoVariableRefPointStrategy& _rstrat): - algo(_algorithm),cont(_continue), select(_select), weights(_weights),eval(_eval),refPoint(_refPoint),wstrat(_wstrat), rstrat(_rstrat) - {} - - /** - * constructor without the weights - * @param _algorithm The solution based heuristic to use. It should at least use the fitness value at some point. - * @param _continue The stopping criterion. - * @param _select a selector to choose on which moeot we use the algorithm - * @param _eval The evaluation function. - * @param _wstrat the strategy to change weights (should be constructed with the same weights as the fitness) - */ - moeoVFAS (moeoSolAlgo & _algorithm, eoContinue & _continue,moeoSelectOne &_select, - eoEvalFunc< MOEOT > &_eval, moeoVariableWeightStrategy &_wstrat): - algo(_algorithm),cont(_continue), select(_select), weights(defaultWeights), eval(_eval), refPoint(defaultRefPoint), wstrat(defaultWstrat), rstrat(defaultRstrat) - { - weights.resize(MOEOT::ObjectiveVector::nObjectives(),1.0/MOEOT::ObjectiveVector::nObjectives()); - } - /** - * launch the algorithm - * @param _pop the initial population on which algo will be launched - **/ - virtual void operator()(eoPop &_pop){ - uniform_generator rngGen(0.0,1.0); - for (unsigned int i=0;i<_pop.size();i++){ - if (_pop[i].invalidObjectiveVector()) - eval(_pop[i]); - } - moeoObjectiveVectorNormalizer norm(_pop); - moeoAggregationFitnessAssignment fitness(weights,eval); - bool res=false; - fitness(_pop); - MOEOT moeot(select(_pop)); - wstrat(weights,moeot); - rstrat(refPoint,moeot); - - do { - norm.update_by_pop(_pop); - fitness(_pop); - moeot=(select(_pop)); - res=algo(moeot)||res; - _pop.push_back(moeot); - std::cout< &algo; - eoContinue &cont; - moeoSelectOne &select; - std::vector &weights; - std::vector defaultWeights; - eoEvalFunc &eval; - ObjectiveVector &refPoint; - ObjectiveVector defaultRefPoint; - moeoVariableWeightStrategy &wstrat; - moeoVariableRefPointStrategy &rstrat; - moeoDummyRefPointStrategy defaultRstrat; - moeoDummyWeightStrategy defaultWstrat; - - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVNS.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVNS.h deleted file mode 100644 index 3d3668174..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/algo/moeoVNS.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - 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 _moeoVNS_h -#define _moeoVNS_h - -#include -#include -#include -#include -#include -#include -//! Variable Neighbors Search (VNS) -/*! - Class which describes the algorithm for a Variable Neighbors Search. - Adapts the moVNS for a multi-objective problem using a moeoSingleObjectivization. - M is for Move - */ - -template < class MOEOT > -class moeoVNS:public moeoSolAlgo < MOEOT > -{ - - public: -// typedef typename M::EOType MOEOT; - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - //! Generic constructor - /*! - Generic constructor using a moExpl - - \param _explorer Vector of Neighborhoods. - \param _full_evaluation The singleObjectivization containing a full eval. - */ - moeoVNS(moExpl< MOEOT> & _explorer, moeoSingleObjectivization < MOEOT> & _full_evaluation): algo(_explorer,_full_evaluation) {} - - //! Function which launches the VNS - /*! - The VNS has to improve a current solution. - - \param _solution a current solution to improve. - \return true. - */ - bool operator()(MOEOT &_solution){ - return algo(_solution); - } - - private: - //! the actual algo - moVNS algo; - -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoArchiveIndex.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoArchiveIndex.h deleted file mode 100755 index 809530d6e..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoArchiveIndex.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef MOEOARCHIVEINDEX_H_ -#define MOEOARCHIVEINDEX_H_ - -#include -#include - -/** - * Inteface for Archive Indexes - */ -template < class MOEOT > -class moeoArchiveIndex -{ - - public: - //type of MOEOT Objective vector - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - /**type for a modification that will have to be applied to the archive - * each item concern one ObjectiveVector, designated by itemObjective - **/ - struct modif{ - public: - //Objective vector of the concerned item - ObjectiveVector itemObjective; - //oldIdx is the index of the item in the vector before the modification (in the archive itself, not in the index) - int oldIdx; - //newIdx is the new index of the item in the vector after the modification (in the archive itself, not in the index) - //-1 if deletion has to occur - int newIdx; - /** - * ctor for a deletion - * @param _obj the objectiveVector of the concerned entry - * @param _oldIdx the current index of the concerned entry in the vector (before deletion) - */ - modif(ObjectiveVector& _obj, int _oldIdx):itemObjective(_obj),oldIdx(_oldIdx),newIdx(-1){} - /** - * ctor for a move - * @param _obj the objectiveVector of the concerned entry - * @param _oldIdx the current index of the concerned entry in the vector (before moving) - * @param _newIdx the index of the concerned entry in the vector after moving - **/ - modif(ObjectiveVector& _obj, int _oldIdx,int _newIdx):itemObjective(_obj),oldIdx(_oldIdx),newIdx(_newIdx){} - }; - - /** - * principal method for the index, add a moeot to the index - * @param _moeot the MOEOT we try to insert - * @param _insert should we really insert the moeot, or just check if we have to - * @return a pair, the first is a boolean indicating if the insertion can occur, the second a vector of modification - **/ - virtual std::pair > operator()(const MOEOT& _moeot, bool _insert=true)=0; - - /* - * method for adding a population of moeot to the the index - * @param _pop the population of MOEOT we try to insert - * @param _insert should we really insert the moeot, or just check if we have to - * @return a pair, the first is how many moeot can be inserted, the second a vector of modification that would have to occur to insert - */ -// virtual std::pair > operator()(const eoPop& _pop, bool _insert=true)=0; - - /** - * when updates will be necessary to keep indexes of archive and index synced, the archive will launch this method - * @param _update the update to do, see modif documentation - * @return false if no problem occured - */ - virtual bool update( modif& _update)=0; - - /** - * creates a modif that move the item ObjectiveVector placed at idx oldIdx in the archive to newIdx, or delete it if newIdx=-1 - * @param _obj the objectiveVector we want to move - * @param _oldIdx the index of the item we want to move in the vector - * @param _newIdx the new index for the item, -1 if we want it deleted - **/ - static modif make_modif(ObjectiveVector &_obj,int _oldIdx,int _newIdx=-1){ - modif res(_obj,_oldIdx,_newIdx); - return res; - } - - - -}; - -#endif /*MOEOARCHIVEINDEX_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoIndexedArchive.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoIndexedArchive.h deleted file mode 100755 index 3e2c574dc..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoIndexedArchive.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MOEOINDEXEDARCHIVE_H_ -#define MOEOINDEXEDARCHIVE_H_ - -#include -#include -#include - -/** - * Archive used for 2 dimension vectors which remove pareto dominated values - * Use an moeoArchiveIndex - */ -template < class MOEOT > -class moeoIndexedArchive : public moeoArchive < MOEOT > -{ - - public: - - - using eoPop < MOEOT > :: size; - using eoPop < MOEOT > :: operator[]; - using eoPop < MOEOT > :: pop_back; - - /** - * The type of an objective vector for a solution - */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - /** - * Default ctor. - * The moeoObjectiveVectorComparator used to compare solutions is based on Pareto dominance - */ - moeoIndexedArchive(moeoArchiveIndex& _index) : index(_index) {} - - - /** - * Updates the archive with a given individual _moeo - * @param _moeo the given individual - */ - bool operator()(const MOEOT & _moeo){ - std::pair::modif> > res=index(_moeo); - if (!(res.first)){ - return false; - } - else{ - for (unsigned int i=0;i & _pop) - { - bool res=false; - for (unsigned int i=0;i<_pop.size();i++){ - res=operator()(_pop[i])||res; - } - return res; - } - - - - protected: - /** - * apply a modification - * @param _modif the modification to apply - **/ - void apply_modif(typename moeoArchiveIndex::modif &_modif){ - if (_modif.newIdx==-1){ - int oldIdx=size()-1; - (*this)[_modif.oldIdx]=(*this)[size()-1]; - ObjectiveVector obj=(*this)[_modif.oldIdx].objectiveVector(); - typename moeoArchiveIndex::modif upd(obj,oldIdx,_modif.oldIdx); - index.update(upd); - pop_back(); - } - } - - //not used yet... - void apply_modif(std::vector::modif> &_modifs){ - unsigned int num_to_delete=0; - for (unsigned int i=0;i<_modifs.size();i++){ - if (_modifs[i].newIdx==-1){ - num_to_delete++; - int oldIdx=size()-1; - (*this)[_modifs[i].oldIdx]=(*this)[size()-1]; - ObjectiveVector obj=(*this)[_modifs[i].oldIdx].objectiveVector(); - typename moeoArchiveIndex::modif upd(obj,oldIdx,_modifs[i].oldIdx); - index.update(upd); - } - } - for (unsigned int i=0;i &index; - - - -}; - -#endif /*MOEOINDEXEDARCHIVE_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTree.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTree.h deleted file mode 100755 index b06a248d4..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTree.h +++ /dev/null @@ -1,527 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (C) OPAC Team, LIFL, 2002-2007 -* -* Arnaud Liefooghe -* Jérémie 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 -* -*/ -//----------------------------------------------------------------------------- - -#ifndef MOEOQUADTREE_H_ -#define MOEOQUADTREE_H_ - -#include -#include -template < class ObjectiveVector > -class QuadTreeNode{ -public: - - - QuadTreeNode(ObjectiveVector& _objVec):objVec(_objVec),subTree(){} - - QuadTreeNode(const QuadTreeNode& _source):objVec(_source.objVec),subTree(_source.subTree){} - - QuadTreeNode& operator=(const QuadTreeNode& _src){ - (*this).objVec=_src.objVec; - (*this).subTree=subTree; - (*this).inserted=_src.is_inserted(); - if(inserted) (*this).index=_src.get_index(); - return *this; - } - - ObjectiveVector& getVec(){ - return objVec; - } - - /** - * @param _kSuccesor the k_successor of _child regarding this Node - * @param _child the child to link at the index _kSuccessor - * @return true if _child is inserted, false if there is already a child for this index - */ - bool setChild(unsigned int _kSuccesor, QuadTreeNode* _child){ - bool res = false; - if((*this).subTree[_kSuccesor] == NULL){ - res=true; - (*this).subTree[_kSuccesor]= _child; - } - return res; - } - - - - - std::map*>& getSubTree(){ - return (*this).subTree; - } - - void set_index(int idx){ - inserted=true; - index=idx; - } - unsigned int get_index(){ - if (!inserted) std::cerr<<"moeoQuadTree getting index of a non-inserted node"<*> subTree; - unsigned int index; - bool inserted; -}; - - - -template < class MOEOT > -class moeoQuadTree : public moeoArchiveIndex { - - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename std::map*>::iterator QuadTreeIterator; - typedef typename moeoArchiveIndex::modif modif; -public: - moeoQuadTree():root(NULL),current_size(0){ - bound=pow(2,ObjectiveVector::nObjectives())-1; - comparator=new moeoParetoObjectiveVectorComparator(); - } - - ~moeoQuadTree(){ - delete(comparator); - } - - /** - * insert a _moeot in the index if it can be inserted - * @param @_moeot the individual ton insert - * @param _insert not used, should be changed... - */ - std::pair > operator()(const MOEOT& _moeot, bool _insert=true){ - std::pair > res; - insert(_moeot.objectiveVector(),res); - if (res.first){ - current_size=current_size+1-res.second.size(); - } - return res; - }; - - /** - * apply the modif - * @param _update the modif to apply (move only) - * @return false if no problem occured - **/ - bool update( modif& _update){ - QuadTreeNode* node=find_node(_update.itemObjective,getRoot()); - if (node==NULL) return true; - node->set_index(_update.newIdx); - return false; - } - - /** - * @paramm _obj the Objective Vector to insert into the tree. - * @return true if it is inserted - */ - void insert(ObjectiveVector _obj, std::pair > &res){ - //create a new node - QuadTreeNode* tmp = new QuadTreeNode(_obj); - //if the tree is empty, we have a new root! - if(isEmpty()){ - root=tmp; - tmp->set_index(0); - res.first=true; - } - //else try to insert the new node in the tree - else{ - res.first = insert_aux(tmp, root, NULL, 0, res.second); - if(res.first) tmp->set_index(size()-1); - } - } - - /** - * @param _newnode the node to insert - * @param _tmproot the temporary root - * @param _parent the parent of _tmproot - * @param _succ the index of _parent where the _tmproot is linked - * @return true if the _newnode is inserted - */ - bool insert_aux(QuadTreeNode* _newnode, QuadTreeNode* _tmproot, QuadTreeNode* _parent, unsigned int _succ, std::vector &modifs){ - bool res=false; - bool dominated=false; - - unsigned int succ=k_succ(_newnode->getVec(), _tmproot->getVec()); - if(succ==bound){ - //_newnode is dominated by _tmproot - delete(_newnode); - } - else if(succ==0){ - //_newnode dominates _tmproot - replace(_newnode, _tmproot, _parent, _succ, modifs); - res=true; - } - else{ - //dominance test1 (test if _newnode is dominated by the childs of _tmproot) - if(!(_tmproot->getSubTree().empty())){ - QuadTreeIterator it=_tmproot->getSubTree().begin(); - while(!dominated && (it != _tmproot->getSubTree().end())){ - if((*it).second != NULL){ - if( ((*it).first < succ) && (((succ ^ bound) & ((*it).first ^ bound)) == (succ ^ bound)) ){ - dominated = test1(_newnode, (*it).second); - } - } - it++; - } - } - if(dominated){ - //_newnode is dominated by a node of the subtree - delete(_newnode); - } - else{ - //dominance test2 (test if _newnode dominates the childs of _tmproot) - QuadTreeIterator it=_tmproot->getSubTree().begin(); - while(it != _tmproot->getSubTree().end()){ - if((*it).second != NULL){ - if( (succ < (*it).first) && ((succ & (*it).first) == succ)){ - test2(_newnode, (*it).second, _tmproot, (*it).first, modifs); - } - } - it++; - } - - //insertion - if(_tmproot->setChild(succ, _newnode)){ - //the child is inserted - res=true; - } - else{ - //else if the child is not inserted, insert it in the subtree - res=insert_aux(_newnode, _tmproot->getSubTree()[succ], _tmproot, succ , modifs); - } - } - } - return res; - } - - /* - * @param _objVec1 - * @param _objVec2 - * @return the k-successor of _objVec1 with respect to _objVec2 - */ - unsigned int k_succ(const ObjectiveVector& _objVec1, const ObjectiveVector& _objVec2){ - unsigned int res=0; - if(!(*comparator)(_objVec2, _objVec1)){ - for(unsigned int i=0; i < ObjectiveVector::nObjectives(); i++){ - if( (ObjectiveVector::minimizing(i) && ((_objVec1[i] - _objVec2[i]) >= (-1.0 * 1e-6 ))) || - (ObjectiveVector::maximizing(i) && ((_objVec1[i] - _objVec2[i]) <= 1e-6 ))){ - res+=pow(2,ObjectiveVector::nObjectives()-i-1); - } - } - } - return res; - } - - /* - * replace the root by a new one - * @param _newnode thee new root - * @param _tmproot the old root - * @param _parent the parent of _tmproot - * @param _succ the index of _parent where the _tmproot is linked - */ - void replace(QuadTreeNode* _newnode, QuadTreeNode* _tmproot, QuadTreeNode* _parent, unsigned int _succ, std::vector & res){ - if(!(_tmproot->getSubTree().empty())){ - //reconsider each son of the old root - QuadTreeIterator it; - for(it=(_tmproot->getSubTree()).begin(); it != (_tmproot->getSubTree()).end(); it++){ - if((*it).second!=NULL){ - reconsider(_newnode, (*it).second, res); - } - } - } - //replace the old root by the new one - if(_parent==NULL){ - root=_newnode; - } - else{ - _parent->getSubTree()[_succ]=_newnode; - } - //kill the old root - modif new_modif(_tmproot->getVec(),_tmproot->get_index()); - res.push_back(new_modif); - delete(_tmproot); - } - - /** - * @param _newroot the new root - * @param _child a node to reconsider regarding tthe _newroot - */ - void reconsider(QuadTreeNode* _newroot, QuadTreeNode* _child, std::vector & res){ - unsigned int succ; - //reconsider all child of _child - if(!(_child->getSubTree().empty())){ - QuadTreeIterator it; - for(it=(_child->getSubTree()).begin(); it != (_child->getSubTree()).end(); it++){ - if((*it).second != NULL){ - QuadTreeNode* tmp=(*it).second; - _child->getSubTree()[(*it).first]=NULL; - reconsider(_newroot, tmp, res ); - } - } - } - succ=k_succ(_child->getVec(),_newroot->getVec()); - //if _child is dominated by the newroot, delete it - if(succ==bound){ - modif new_modif(_child->getVec(),_child->get_index()); - res.push_back(new_modif); - delete(_child); - } - //else reinsert it in the tree rooted at _newroot - else if(_newroot->getSubTree()[succ] != NULL){ - reinsert(_newroot->getSubTree()[succ],_child); - } - else{ - _newroot->setChild(succ, _child); - } - } - - /** - * reinsert _node2 into _node1 - * @param _node1 first node - * @param _node2 second node - */ - void reinsert(QuadTreeNode* _node1, QuadTreeNode* _node2){ - //first resinsert all child of the second node into node1 - if(_node1 != _node2){ - unsigned int succ; - if(!(_node2->getSubTree().empty())){ - QuadTreeIterator it; - for(it=(_node2->getSubTree()).begin(); it != (_node2->getSubTree()).end(); it++){ - if((*it).second != NULL){ - QuadTreeNode* tmp=(*it).second; - _node2->getSubTree()[(*it).first]=NULL; - reinsert(_node1, tmp); - } - } - } - //insert node2 into node1 - succ=k_succ(_node2->getVec(),_node1->getVec()); - if(_node1->getSubTree()[succ] != NULL){ - reinsert(_node1->getSubTree()[succ],_node2); - } - else{ - _node1->setChild(succ, _node2); - } - } - } - - /** - * remove a node - * @param _node the node to remove - * @param _parent its parent - * @param _succ the index of _parent where the _node is linked - */ - void remove(QuadTreeNode* _node, QuadTreeNode* _parent, unsigned int _succ, std::vector & res){ - unsigned int k=1; - QuadTreeNode* tmp=NULL; - _parent->getSubTree()[_succ]=NULL; - while((k < (bound -1)) && _node->getSubTree()[k]==NULL){ - k++; - } - if(_node->getSubTree()[k]!=NULL){ - tmp =_node->getSubTree()[k]; - _parent->setChild(_succ, tmp); - } - k++; - while(k < (bound -1)){ - if(_node->getSubTree()[k]!=NULL){ - reinsert(tmp ,_node->getSubTree()[k]); - } - k++; - } - modif new_modif(_node->getVec(),_node->get_index()); - res.push_back(new_modif); - delete(_node); - } - - /** - * test if _node1 is dominated by _node2 (and recursivly by its childs) - * @param _node1 first node - * @param _node2 second node - */ - bool test1(QuadTreeNode* _node1, QuadTreeNode* _node2){ - bool res = false; - unsigned int succ; - succ=k_succ(_node1->getVec(), _node2->getVec()); - if(succ==bound){ - res=true; - } - else{ - QuadTreeIterator it=_node2->getSubTree().begin(); - while(!res && (it != _node2->getSubTree().end())){ - if((*it).second!=NULL){ - if( ((succ ^ bound) & ((*it).first ^ bound)) == (succ^bound)){ - res = res || test1(_node1, (*it).second); - } - } - it++; - } - } - return res; - } - - /** - * test if _node1 dominates _node2 (and recursivly its childs) - * @param _node1 first node - * @param _node2 second node - */ - void test2(QuadTreeNode* _node1, QuadTreeNode* _node2, QuadTreeNode* _parent, unsigned int _succ, std::vector & res){ - - unsigned int succ; - succ=k_succ(_node1->getVec(), _node2->getVec()); - if(succ==0){ - remove(_node2, _parent, _succ, res); - if(_parent->getSubTree()[_succ]!=NULL) - test2(_node1, _parent->getSubTree()[_succ], _parent, _succ, res); - } - else{ - QuadTreeIterator it=_node2->getSubTree().begin(); - while(it != _node2->getSubTree().end()){ - if((*it).second!=NULL){ - if( (succ & (*it).first) == succ){ - test2(_node1, (*it).second, _node2, (*it).first, res); - } - } - it++; - } - } - } - - //************* A REVOIR ************ - void printTree(){ - QuadTreeIterator it; - if(!isEmpty()){ - std::cout << "root: " << root->getVec() << " -> "; - if(!(root->getSubTree().empty())){ - for(it=(root->getSubTree()).begin(); it != (root->getSubTree()).end(); it++){ - if((*it).second!=NULL) - std::cout << (*it).second->getVec() << " ; "; - } - std::cout << std::endl; - for(it=(root->getSubTree()).begin(); it != (root->getSubTree()).end(); it++){ - if((*it).second!=NULL){ - printChild((*it).second, (*it).first); - std::cout << std::endl; - } - } - } - } - } - - void printChild(QuadTreeNode* _child, unsigned int _key){ - QuadTreeIterator it; - std::cout << "[" << _key << " : " << _child->getVec() << "] -> "; - if(!(_child->getSubTree().empty())){ - for(it=(_child->getSubTree()).begin(); it != (_child->getSubTree()).end(); it++){ - if((*it).second!=NULL) - std::cout << (*it).second->getVec() << " ; "; - } - std::cout << std::endl; - for(it=(_child->getSubTree()).begin(); it != (_child->getSubTree()).end(); it++){ - if((*it).second!=NULL){ - printChild((*it).second, (*it).first); - std::cout << std::endl; - } - } - } - } - //*********************************** - - /** - * @return if the tree is empty or not - */ - bool isEmpty(){ - return root==NULL; - } - - /** - * @return a pointer on the root of the tree - */ - QuadTreeNode* getRoot(){ - return root; - } - - /** - * the number of individual currently indexed - * @return the tree size - */ - unsigned int size(){ - return current_size; - } - - -private: - - /** - * to find a node from his objectiveVector - * @param _obj the objective to find - * @param current the node in which we are looking (to be able to recurse) - * @return the node with obj as objectiveVector, or null if it's not found - */ - QuadTreeNode* find_node(ObjectiveVector &_obj, QuadTreeNode* current){ - if (current->getVec()==_obj) return current; - else{ - int succ=k_succ(current->getVec(),_obj); - if(current->getSubTree()[succ]!=NULL) - return find_node(_obj,current->getSubTree()[succ]); - else{ - return NULL; - } - - } - - } - - //pointer on the root of the tree - QuadTreeNode* root; - - //size max of an index - unsigned int bound; - - //Pareto comparator - moeoParetoObjectiveVectorComparator* comparator; - - //current tree size - int current_size; - -}; - - - -#endif /*MOEOQUADTREE_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTreeArchive.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTreeArchive.h deleted file mode 100644 index 9f95224bb..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuadTreeArchive.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -* -* 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 -* -*/ -//----------------------------------------------------------------------------- -// moeoEpsilonHyperboxArchive.h -//----------------------------------------------------------------------------- - -#ifndef MOEOQUADTREEARCHIVE_H_ -#define MOEOQUADTREEARCHIVE_H_ - -#include - - -/** - * This class represents an epsilon hyperbox archive. - */ -template < class MOEOT > -class moeoQuadTreeArchive : public moeoArchive < MOEOT > -{ -public: - - using moeoArchive < MOEOT > :: size; - using moeoArchive < MOEOT > :: resize; - using moeoArchive < MOEOT > :: operator[]; - using moeoArchive < MOEOT > :: back; - using moeoArchive < MOEOT > :: pop_back; - using moeoArchive < MOEOT > :: push_back; - using moeoArchive < MOEOT > :: begin; - using moeoArchive < MOEOT > :: end; - using moeoArchive < MOEOT > :: replace; - - - /** - * The type of an objective vector for a solution - */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - - moeoQuadTreeArchive() : moeoArchive < MOEOT >(){} - - /** - * Updates the archive with a given individual _moeo - * @param _moeo the given individual - * @return if the _moeo is added to the archive - */ - bool operator()(const MOEOT & _moeo){ - return false; - } - - - /** - * Updates the archive with a given population _pop - * @param _pop the given population - * @return if at least one _pop[i] is added to the archive - */ - bool operator()(const eoPop < MOEOT > & _pop){ - bool res, tmp = false; - for(unsigned int i=0; i<_pop.size(); i++){ - tmp = (*this)(_pop[i]); - res = res || tmp; - } - return res; - } - - - - -}; - -#endif /*MOEOQUADTREEARCHIVE_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h deleted file mode 100755 index a40add6ae..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef MOEOQUICKUNBOUNDEDARCHIVEINDEX_H_ -#define MOEOQUICKUNBOUNDEDARCHIVEINDEX_H_ - -#include -#include -#include -#include -#include -#include - -/** - * Archive used for 2 dimension vectors which remove pareto dominated values - * the index is ordered following the first objective - */ -template < class MOEOT > -class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT > -{ - - public: - - - - /** - * The type of an objective vector for a solution - */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename moeoArchiveIndex::modif modif; -// typedef typename moeoArchiveIndex < MOEOT> :: s_update s_update; - - /** - * Default ctor. Pareto !!!! - * The moeoObjectiveVectorComparator used to compare solutions is based on Pareto dominance - */ - moeoQuickUnboundedArchiveIndex() : index() {} - - /** - * Ctor - * @param _comparator the moeoObjectiveVectorComparator used to compare solutions - */ - //moeoQuickUnboundedArchive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator) : moeoArchive < MOEOT >(_comparator),index() {} - - /**struct for an entry of the index - * obj is the objective vector of the vector[indice] - */ - struct entree{ - entree(ObjectiveVector _obj, int _indice):obj(_obj),indice(_indice){} - bool operator == (const entree a){ - return obj==a.obj; - } - ObjectiveVector obj; - int indice; - }; - /** - * equivalent to "number one element should be on top of number two element" in the list by looking to the first obj - */ - struct CompareByFirst - : std::binary_function< bool, entree, entree > { - bool operator ()( - const entree& elem1, - const entree& elem2 - ) const { - if (ObjectiveVector::minimizing(0)){ - return elem1.obj[0] > elem2.obj[0]; - } - else{ - return elem1.obj[0] < elem2.obj[0]; - } - } - }cbf; - /** - * equivalent to "number one element should be on top of number two element" in the list by looking to the 2nd obj - */ - struct CompareByLast - : std::binary_function< bool, entree, entree > { - bool operator ()( - const entree& elem1, - const entree& elem2 - ) const { - if (ObjectiveVector::minimizing(1)){ - return elem1.obj[1] < elem2.obj[1]; - } - else{ - return elem1.obj[1] > elem2.obj[1]; - } - } - }cbl; - - - struct CompareByLast2 - : std::binary_function< bool, MOEOT, MOEOT > { - bool operator ()( - const MOEOT& elem1, - const MOEOT& elem2 - ) const { - if (ObjectiveVector::minimizing(1)){ - return elem1.objectiveVector()[1] < elem2.objectiveVector()[1]; - } - else{ - return elem1.objectiveVector()[1] > elem2.objectiveVector()[1]; - } - } - }cbl2; - /** - * type for the index - */ - typedef typename std::set MOEOTIndex; - /** - * iterator from the index - */ - typedef typename std::set::iterator MOEOTIndexIte; - /** - * iterator for gcc stop being annoying - */ - typedef typename std::set::iterator set_ite; - - - - /** - updates the index following a modif - @param _update the modification to apply - @return false - */ - bool update(modif& _update){ - entree oldEnt(_update.itemObjective,_update.oldIdx); - entree newEnt(_update.itemObjective,_update.newIdx); - index.erase(oldEnt); - index.insert(newEnt); - return false; - } - -/* - std::pair > operator()(const eoPop& _pop, bool _insert=true){ - std::cout<<"OH, HI, je fais quelque chose"< > res; - res.first=false; - std::vector tmp; - for (unsigned int i=0;i<_pop.size();i++){ - std::cout<<"once va être créé"< > once=operator()(_pop[i],_insert); - if (once.first){ - std::cout<<"once vrai taille "< > operator()(const MOEOT& _moeo, bool _insert=true){ - return insert(_moeo,_insert); - } - /** - * inserts a _moeo in the index - * @param _moeo the MOEOT to insert - * @param _insert if _insert is false we only ask the index, and dont modify it - * @return a pair composed by a boolean indicating if the moeot can be inserted, and a list of modif to do so - */ - virtual std::pair > insert(const MOEOT& _moeo, bool _insert=true){ -// std::cout<<"entree dans l'algo avec "<<_moeo.objectiveVector()< > res; - std::vector to_er; - res.first=false; - if (index.empty()){ - std::cout<<"empty donc ok"< comparator; - - - -}; - -#endif /*MOEOQUICKUNBOUNDEDARCHIVE_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAchievementScalarizingFunctionDistance.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAchievementScalarizingFunctionDistance.h deleted file mode 100644 index 192feae33..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAchievementScalarizingFunctionDistance.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2007 - * - * Jeremie Humeau - * 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 MOEOASFADIST_H_ -#define MOEOASFADIST_H_ - -#include - -/** - Achievment scalarizing function aproach to calculate a distance - */ -template < class MOEOT> -class moeoAchievementScalarizingFunctionDistance : public moeoObjSpaceDistance< MOEOT > -{ - public: - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - - /** - constructor with a normalizer - @param _rho - @param _weight the weight to apply to each dimension - @param _normalizer the normalizer - */ - moeoAchievementScalarizingFunctionDistance(unsigned int _rho, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer): normalizer(_normalizer), weight(_weight), rho(_rho){} - - /** - constructor without a normalizer - @param _rho - @param _weight the weight to apply to each dimension - */ - moeoAchievementScalarizingFunctionDistance(unsigned int _rho, const ObjectiveVector& _weight): normalizer(defaultNormalizer), weight(_weight), rho(_rho){} - - /** - fonction which calculate the distance - @param _obj the point to evaluate - @param _reference the reference to calculate the distance from - @return the fitness conrresponding to the distance - */ - const Fitness operator()(const ObjectiveVector& _reference, const ObjectiveVector& _obj){ - unsigned int dim=_obj.size(); - ObjectiveVector tmp1(_reference); - ObjectiveVector tmp2(_obj); - Fitness max=iteration(tmp2,tmp1,0,_obj.minimizing(0)); - Fitness res=max; - for (unsigned i=0;i defaultNormalizer; - moeoObjectiveVectorNormalizer &normalizer; - const ObjectiveVector &weight; - double rho; - - Fitness iteration(const ObjectiveVector &obj, const ObjectiveVector& reference, int dim, bool mini){ - ObjectiveVector obj_norm=normalizer(obj); - ObjectiveVector ref_norm=normalizer(reference); - Fitness res; - if (mini){ - res=(obj_norm[dim]-ref_norm[dim]); - }else{ - res=(ref_norm[dim]-obj_norm[dim]); - } - res=weight[dim]*res; - return res; - } -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedAchievementScalarizingFunctionDistance.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedAchievementScalarizingFunctionDistance.h deleted file mode 100644 index 62120071a..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedAchievementScalarizingFunctionDistance.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2007 - * - * Jeremie Humeau - * Arnaud Liefooghe - * Legillon François - * - * 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 MOEOASFAORDIST_H_ -#define MOEOASFAORDIST_H_ - - -#include -#include -#include - -/** - Order representing Achievment scalarizing function aproach to calculate a metric - */ -template < class MOEOT> -class moeoAugmentedAchievementScalarizingFunctionDistance : public moeoObjSpaceDistance< MOEOT > -{ - public: - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - /** - constructor with a normalizer - @param _rho - @param _weight the weight to apply to each dimansion - @param _normalizer the normalizer - */ - moeoAugmentedAchievementScalarizingFunctionDistance(unsigned int _rho,const ObjectiveVector &_weight,moeoObjectiveVectorNormalizer &_normalizer): normalizer(_normalizer),weight(_weight),rho(_rho) - {} - /** - constructor without a normalizer - @param _rho - @param _weight the weight to apply to each dimansion - */ - moeoAugmentedAchievementScalarizingFunctionDistance(unsigned int _rho,const ObjectiveVector &_weight): normalizer(defaultNormalizer),weight(_weight),rho(_rho) - {} - - - /** - fonction which apply the metric to calculate a fitness - @param _reference the reference point to calculate the distance - @param _obj the point to evaluate - @return the fitness conrresponding to the distance - */ - const Fitness operator()(const ObjectiveVector &_reference,const ObjectiveVector &_obj){ - unsigned int dim=_obj.size(); - Fitness res=0; - Fitness max=iteration(_obj,_reference,0,_obj.minimizing(0)); - for (unsigned i=0;i defaultNormalizer; - moeoObjectiveVectorNormalizer &normalizer; - const ObjectiveVector &weight; - double rho; - Fitness iteration(const ObjectiveVector &obj,const ObjectiveVector &reference,int dim,bool mini){ - ObjectiveVector obj_norm=normalizer(obj); - ObjectiveVector ref_norm=normalizer(reference); - Fitness res; - if (mini){ - res=obj_norm[dim]-ref_norm[dim]; - }else{ - - res=ref_norm[dim]-obj_norm[dim]; - } - res=weight[dim]*res; - return res; - } -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedWeightedChebychevDistance.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedWeightedChebychevDistance.h deleted file mode 100644 index 098b3c817..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoAugmentedWeightedChebychevDistance.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2007 - * - * François Legillon - * Jeremie Humeau - * 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 MOEOCHEBYCHEVORDIST_H_ -#define MOEOCHEBYCHEVORDIST_H_ - -#include - -/** - order representing chebychev distance - */ -template < class MOEOT> -class moeoAugmentedWeightedChebychevDistance : public moeoObjSpaceDistance < MOEOT > -{ - public: - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - - /** - constructor with a normalizer - @param _rho - @param _weight the weight to apply to each dimension - @param _normalizer the normalizer - */ - moeoAugmentedWeightedChebychevDistance(unsigned int _rho, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer): normalizer(_normalizer), weight(_weight), rho(_rho){} - - /** - constructor with a dummy normalizer - @param _rho - @param _weight the weight to apply to each dimension - */ - moeoAugmentedWeightedChebychevDistance(unsigned int _rho, const ObjectiveVector& _weight): normalizer(defaultNormalizer), weight(_weight), rho(_rho){} - - /** - fonction which calculate a fitness - @param _reference the reference to calculate the distance from - @param _obj the point to evaluate - @return the fitness conrresponding to the distance - */ - const Fitness operator()(const ObjectiveVector& _reference, const ObjectiveVector& _obj){ - unsigned int dim=_obj.size(); - Fitness res=iteration(_obj,_reference,0); - Fitness max=res*weight[0]; - for (unsigned i=1;imax) - max=tmp*weight[i]; - res+=tmp; - } - res=res*rho+max; - return res; - } - - private: - moeoObjectiveVectorNormalizer &normalizer; - moeoObjectiveVectorNormalizer defaultNormalizer; - const ObjectiveVector &weight; - double rho; - - Fitness iteration(const ObjectiveVector &obj,const ObjectiveVector &reference,int dim){ - ObjectiveVector obj_norm=normalizer(obj); - ObjectiveVector ref_norm=normalizer(reference); - Fitness res=abs(obj_norm[dim]-ref_norm[dim]); - return res; - } -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoWeightedChebychevDistance.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoWeightedChebychevDistance.h deleted file mode 100644 index c25c86987..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/distance/moeoWeightedChebychevDistance.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2007 - * - * Jeremie Humeau - * 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 MOEOCHEBYCHEVDIST_H_ -#define MOEOCHEBYCHEVDIST_H_ - - -#include -#include -#include -/** - * weighted chebychev distance - */ -template < class MOEOT> -class moeoWeightedChebychevDistance : public moeoObjSpaceDistance < MOEOT > -{ - public: - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - - /** - * constructor with a normalizer - * @param _rho - * @param _weight the weight to apply to each dimansion - * @param _normalizer the normalizer - */ - moeoWeightedChebychevDistance(unsigned int _rho, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer): normalizer(_normalizer), weight(_weight), rho(_rho){} - - /** - * constructor with a normalizer - * @param _rho - * @param _weight the weight to apply to each dimansion - */ - moeoWeightedChebychevDistance(unsigned int _rho, const ObjectiveVector& _weight): normalizer(defaultNormalizer), weight(_weight), rho(_rho){} - - /** - * fonction which apply the metric to calculate a fitness - * @param _obj the point to evaluate - * @param _reference the reference to calculate the distance from - * @return the fitness conrresponding to the distance - */ - const Fitness operator()(const ObjectiveVector& _reference, const ObjectiveVector& _obj){ - unsigned int dim=_obj.size(); - Fitness res=0; - ObjectiveVector obj_norm=normalizer(_obj); - ObjectiveVector ref_norm=normalizer(_reference); - for (unsigned i=0;i &normalizer; - moeoObjectiveVectorNormalizer defaultNormalizer; - const ObjectiveVector &weight; - double rho; - - Fitness iteration(const ObjectiveVector &obj,const ObjectiveVector &reference,int dim){ - Fitness res=abs(obj[dim]-reference[dim]); - res=weight[dim]*pow(res,rho); - res=pow(res,1/rho); - return res; - } -}; -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h deleted file mode 100755 index 79f1b8003..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - - 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 __moeoHCLoopExpl_h -#define __moeoHCLoopExpl_h - -#include -#include -#include -#include -#include -#include -#include -/** - move explorer for multiobjectives solutions - */ -template < class M > -class moeoHCMoveLoopExpl:public moMoveLoopExpl < M > -{ - //! Alias for the type. - typedef typename M::EOType EOT; - - //! Alias for the fitness. - typedef typename M::EOType::Fitness Fitness; - - typedef typename M::EOType::ObjectiveVector ObjectiveVector; - - public: - - //! Constructor. - /*! - All the boxes have to be specified. - - \param _move_initializer The move initialiser. - \param _next_move_generator The neighbourhood explorer. - \param _incremental_evaluation (generally) Efficient evaluation function. - \param _move_selection The move selector. - */ - moeoHCMoveLoopExpl (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, - moeoIncrEvalSingleObjectivizer < EOT,M > & _incremental_evaluation, moMoveSelect < M > & _move_selection) : - move_initializer (_move_initializer), next_move_generator (_next_move_generator), - incremental_evaluation (_incremental_evaluation), move_selection (_move_selection) - {} - - //! Procedure which launches the explorer. - /*! - The exploration starts from an old solution and provides a new solution. - - \param _old_solution The current solution. - \param _new_solution The new solution (result of the procedure). - */ - void operator () (const EOT & _old_solution, EOT & _new_solution) - { - M move, best_move; - Fitness best_fitness; - bool has_next_move, selection_update_is_ok; - - if( _old_solution.invalid() ) - { - throw std::runtime_error("[moHCMoveLoopExpl.h]: The current solution has not been evaluated."); - } - - /* - The two following lines are added to avoid compilation warning. - <=> current best move fitness is the current fitness. - <=> move and best move are empty for the moment. - */ - best_fitness=_old_solution.fitness(); - move=best_move; - //At the begining, the new sol is equivalent to the old one. - _new_solution=(EOT)_old_solution; - - // Restarting the exploration of the neighbourhood - move_initializer(move, _old_solution); - - move_selection.init(_old_solution.fitness ()); - - do - { - selection_update_is_ok = move_selection.update (move, incremental_evaluation(move, _old_solution) ); - has_next_move = next_move_generator (move, _old_solution); - } - while ( selection_update_is_ok && has_next_move); - //The selecter gives the value of the best move and the corresponding best fitness. - move_selection (best_move, best_fitness); - - /*std::cout<<"bonjour moeoloopexpl"< & move_initializer; - - //! Neighborhood explorer. - moNextMove < M > & next_move_generator; - - //! (generally) Efficient evaluation. - moeoIncrEvalSingleObjectivizer < EOT,M > & incremental_evaluation; - - //! Move selector. - moMoveSelect < M > & move_selection; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h deleted file mode 100755 index 0f51d2a96..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 - (C) OPAC Team, LIFL, 2002-2008 - - Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr) - - 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 _moeoTSMoveLoopExpl_h -#define _moeoTSMoveLoopExpl_h -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -template -class moeoTSMoveLoopExpl:public moMoveLoopExpl < M > -{ - //!Alias for the type - typedef typename M::EOType EOT; - - //!Alias for the fitness - typedef typename M::EOType::Fitness Fitness; - - public: - - //!Constructor - /*! - \param _move_initializer The move initializer. - \param _next_move_generator The neighbourhood explorer. - \param _incremental_evaluation A (generally) efficient evaluation. - \param _tabu_list The tabu list. - \param _aspiration_criterion An aspiration criterion. - */ - moeoTSMoveLoopExpl (moMoveInit < M > & _move_initializer, moNextMove < M > & _next_move_generator, moeoIncrEvalSingleObjectivizer < EOT, M > & _incremental_evaluation, moTabuList < M > & _tabu_list, moAspirCrit < M > & _aspiration_criterion): - move_initializer(_move_initializer), - next_move_generator(_next_move_generator), - incremental_evaluation(_incremental_evaluation), - tabu_list(_tabu_list), - aspiration_criterion(_aspiration_criterion) - { - tabu_list.init (); - aspiration_criterion.init (); - } - //!Procedure which lauches the exploration - /*! - The exploration continues while the chosen move is not in the tabu list - or the aspiration criterion is true. If these 2 conditions are not true, the - exploration stops if the move selector update function returns false. - - \param _old_solution the initial solution - \param _new_solution the new solution - */ - void operator () (const EOT & _old_solution, EOT & _new_solution) - { - M move, best_move; - Fitness fitness, best_move_fitness; - - bool move_is_tabu, aspiration_criterion_is_verified, selection_update_is_ok, has_next_move; - - if( _old_solution.invalidFitness() || _old_solution.invalid() ) - { - throw std::runtime_error("[moTSMoveLoopExpl.h]: The current solution has not been evaluated."); - } - - //At the begining, the new solution is equivalent to the old one. - _new_solution=(EOT)_old_solution; - // EOT mem(_old_solution); - - - // Restarting the exploration of of the neighborhood ! - move_initializer (move, _old_solution); - - move_selection.init( _old_solution.fitness() ); - - selection_update_is_ok=true; -// std::cout<<"moeoTS lets go"< & move_initializer; - - //! Neighborhood explorer - moNextMove < M > & next_move_generator; - - //! Efficient evaluation - moeoIncrEvalSingleObjectivizer < EOT,M > & incremental_evaluation; - - //! Move selector - moBestImprSelect < M > move_selection; - - //! Tabu list - moTabuList < M > & tabu_list; - - //! Aspiration criterion - moAspirCrit < M > & aspiration_criterion; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h deleted file mode 100644 index b77355bb1..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -* -* 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 MOEOACHIEVEMENTFITNESSASSIGNMENT_H_ -#define MOEOACHIEVEMENTFITNESSASSIGNMENT_H_ - -#include -#include -#include - -/** - * Fitness assignment sheme based on the achievement scalarizing function propozed by Wiersbicki (1980). - */ -template < class MOEOT > -class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MOEOT > - { - public: - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - - /** - * Default ctor - * @param _reference reference point vector - * @param _lambdas weighted coefficients vector - * @param _spn arbitrary small positive number (0 < _spn << 1) - */ - moeoAchievementFitnessAssignment(ObjectiveVector & _reference, std::vector < double > & _lambdas, double _spn=0.0001) : reference(_reference), lambdas(_lambdas), spn(_spn) - { - // consistency check - if ((spn < 0.0) || (spn > 1.0)) - { - std::cout << "Warning, the arbitrary small positive number should be > 0 and <<1, adjusted to 0.0001\n"; - spn = 0.0001; - } - } - - - /** - * Ctor with default values for lambdas (1/nObjectives) - * @param _reference reference point vector - * @param _spn arbitrary small positive number (0 < _spn << 1) - */ - moeoAchievementFitnessAssignment(ObjectiveVector & _reference, double _spn=0.0001) : reference(_reference), spn(_spn) - { - // compute the default values for lambdas - lambdas = std::vector < double > (ObjectiveVector::nObjectives()); - for (unsigned int i=0 ; i 1.0)) - { - std::cout << "Warning, the arbitrary small positive number should be > 0 and <<1, adjusted to 0.0001\n"; - spn = 0.0001; - } - } - - - /** - * Sets the fitness values for every solution contained in the population _pop - * @param _pop the population - */ - virtual void operator()(eoPop < MOEOT > & _pop) - { - for (unsigned int i=0; i<_pop.size() ; i++) - { - compute(_pop[i]); - } - } - - - /** - * Updates the fitness values of the whole population _pop by taking the deletion of the objective vector _objVec into account (nothing to do). - * @param _pop the population - * @param _objVec the objective vector - */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) - { - // nothing to do ;-) - } - - - /** - * Sets the reference point - * @param _reference the new reference point - */ - void setReference(const ObjectiveVector & _reference) - { - reference = _reference; - } - - - private: - - /** the reference point */ - ObjectiveVector reference; - /** the weighted coefficients vector */ - std::vector < double > lambdas; - /** an arbitrary small positive number (0 < _spn << 1) */ - double spn; - - - /** - * Returns a big value (regarded as infinite) - */ - double inf() const - { - return std::numeric_limits::max(); - } - - - /** - * Computes the fitness value for a solution - * @param _moeo the solution - */ - void compute(MOEOT & _moeo) - { - unsigned int nobj = MOEOT::ObjectiveVector::nObjectives(); - double temp; - double min = inf(); - double sum = 0; - for (unsigned int obj=0; obj - * 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 - * - */ -//----------------------------------------------------------------------------- -// moeoScalarizationFunctionMetricFitnessAssignment.h -//----------------------------------------------------------------------------- -#ifndef MOEOASFAFITNESSASSIGNMENT_H_ -#define MOEOASFAFITNESSASSIGNMENT_H_ - -#include -#include -#include -#include -#include - -/* - * Fitness assignment scheme which use a metric - */ -template < class MOEOT> -class moeoAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSingleObjectivization < MOEOT > -{ - public: - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - typedef typename ObjectiveVector::Type Type; - - /** - * ctor with normalizer - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - */ - moeoAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer) : normalizer(_normalizer), eval(defaultEval), distance(_rho, _weight), metric( distance, _reference, defaultNormalizer){} - - /** - * ctor with an evaluing fonction, applied if give moeot is invalid - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, ObjectiveVector& _reference, const ObjectiveVector& _weight, eoEvalFunc& _eval): normalizer(defaultNormalizer), eval(_eval), distance(_rho, _weight), metric( distance, _reference, defaultNormalizer){} - - /** - * ctor with an evaluing fonction, applied if give moeot is invalid, and a noramlizer, applied to ObjectiveVectors - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer, eoEvalFunc& _eval) : normalizer(_normalizer), eval(_eval), distance(_rho, _weight), metric(distance, _reference, _normalizer){} - - /** - default constructor - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight) : normalizer(defaultNormalizer), eval(defaultEval), distance(_rho, _weight), metric(distance, _reference, defaultNormalizer){} - - /** - * Sets the fitness values for a moeot - * @param _mo the MOEOT - */ - void operator()(MOEOT & _mo){ - if (_mo.invalidObjectiveVector()) - eval(_mo); - _mo.fitness(operator()(_mo.objectiveVector())); - } - - /** - return the fitness of a valid objectiveVector - @param _mo the objectiveVector - @return the fitness value of _mo - */ - typename MOEOT::Fitness operator()(const typename MOEOT::ObjectiveVector& _mo){ - return -metric(_mo); - } - - /** - * Sets the fitness values for every solution contained in the populing _pop (and in the archive) - * @param _pop the populing - */ - void operator()(eoPop < MOEOT > & _pop) - { - for (unsigned int k=0; k < _pop.size(); k++) - operator()(_pop[k]); - } - - /** - * @param _pop the populing - * @param _objVec the objective vector - */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} - - private: - - class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ - } - } defaultEval; - - moeoObjectiveVectorNormalizer &normalizer; - moeoObjectiveVectorNormalizer defaultNormalizer; - eoEvalFunc &eval; - moeoAchievementScalarizingFunctionDistance distance; - moeoDistanceMetric metric; - - -}; - -#endif /*moeoAugmentedScalarizingFunctionMetricFitnessASSIGNMENT_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h deleted file mode 100644 index b0a1499bd..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// moeoAugmentedScalarizingFunctionMetricFitnessAssignment.h -//----------------------------------------------------------------------------- -#ifndef MOEOAUGASFAFITNESSASSIGNMENT_H_ -#define MOEOAUGASFAFITNESSASSIGNMENT_H_ - -#include -#include -#include -#include -#include -#include -#include - -/* - * Fitness assignment scheme which use a metric - */ -template < class MOEOT> -class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSingleObjectivization < MOEOT > -{ - public: - - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - typedef typename ObjectiveVector::Type Type; - - - /** - * ctor with normalizer - * @param _normalizer the normalizer to apply to objectiveVectors - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho,const ObjectiveVector &_reference,const ObjectiveVector &_weight,moeoObjectiveVectorNormalizer &_normalizer) : normalizer(_normalizer),eval(defaultEval), distance(_rho,_weight), metric(distance,_reference,normalizer) - {} - /** - * ctor with an evaluing fonction, applied if give moeot is invalid - * @param _eval a evalFunc to regenerate the objectiveVector if needed - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector &_reference,const ObjectiveVector &_weight,eoEvalFunc &_eval) : normalizer(defaultNormalizer), eval(_eval), distance(_rho,_weight), metric(distance,_reference,normalizer) - {} - /** - * ctor with an evaluing fonction, applied if give moeot is invalid, and a noramlizer, applied to ObjectiveVectors - * @param _eval a evalFunc to regenerate the objectiveVector if needed - * @param _normalizer the normalizer to apply to objectiveVectors - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector &_reference,const ObjectiveVector &_weight,moeoObjectiveVectorNormalizer &_normalizer,eoEvalFunc &_eval) :normalizer(_normalizer),eval(_eval), distance(_rho,_weight), metric(distance,_reference,normalizer) - {} - /** - default constructor - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector &_reference,const ObjectiveVector &_weight) : normalizer(defaultNormalizer), eval(defaultEval), distance(_rho,_weight), metric(distance,_reference,normalizer) - {} - - /** - * Sets the fitness values for a moeot - * @param _mo the MOEOT - */ - void operator()(MOEOT & _mo){ - if (_mo.invalidObjectiveVector()) eval(_mo); - _mo.fitness(operator()(_mo.objectiveVector())); - - } - - /** - return the fitness of a valid objectiveVector - @param _mo the objectiveVector - @return the fitness value of _mo - */ - typename MOEOT::Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){ - return -metric(_mo); - } - - - /** - * Sets the fitness values for every solution contained in the populing _pop (and in the archive) - * @param _pop the populing - */ - void operator()(eoPop < MOEOT > & _pop) - { - unsigned int pop_size= _pop.size(); - for (unsigned int k=0; k & _pop, ObjectiveVector & _objVec) - { - } - - - private: - - class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ - } - } defaultEval; - - moeoObjectiveVectorNormalizer defaultNormalizer; - moeoObjectiveVectorNormalizer &normalizer; - eoEvalFunc &eval; - moeoAugmentedAchievementScalarizingFunctionDistance distance; - moeoDistanceMetric metric; - -}; - -#endif /*moeoAugmentedScalarizingFunctionMetricFitnessASSIGNMENT_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h deleted file mode 100644 index 356ac2144..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// moeoAugmentedWeightedChebychevMetricFitnessAssignment.h -//----------------------------------------------------------------------------- -#ifndef MOEOAUGCHEVMETRICFITNESSASSIGNMENT_H_ -#define MOEOAUGCHEVMETRICFITNESSASSIGNMENT_H_ - -#include -#include -#include - -/* - * Fitness assignment scheme which use a metric - */ -template < class MOEOT> -class moeoAugmentedWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectivization < MOEOT > -{ - public: - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - typedef typename ObjectiveVector::Type Type; - - /** - * ctor with normalizer - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - */ - moeoAugmentedWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer) : normalizer(_normalizer), eval(defaultEval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - * ctor with an evaluation fonction, applied if give moeot is invalid - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoAugmentedWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, eoEvalFunc& _eval) : normalizer(defaultNormalizer), eval(_eval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - * ctor with an evaluation fonction, applied if give moeot is invalid, and a noramlizer, applied to ObjectiveVectors - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoAugmentedWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer, eoEvalFunc& _eval) : normalizer(_normalizer), eval(_eval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - default constructor - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoAugmentedWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight) : normalizer(defaultNormalizer), eval(defaultEval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - * Sets the fitness values for a moeot - * @param _mo the MOEOT - */ - void operator()(MOEOT & _mo){ - if (_mo.invalidObjectiveVector()) - eval(_mo); - _mo.fitness(operator()(_mo.objectiveVector())); - } - - /** - return the fitness of a valid objectiveVector - @param _mo the objectiveVector - @return the fitness value of _mo - */ - typename MOEOT::Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){ - return -metric(_mo); - } - - /** - * 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]); - } - - /** - * @param _pop the population - * @param _objVec the objective vector - */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} - - private: - - class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ - } - } defaultEval; - - moeoObjectiveVectorNormalizer defaultNormalizer; - moeoObjectiveVectorNormalizer &normalizer; - eoEvalFunc &eval; - moeoAugmentedWeightedChebychevDistance distance; - moeoDistanceMetric metric; - - -}; - -#endif /*moeoAugmentedWeightedChebychevMetricFitnessASSIGNMENT_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoIncrEvalSingleObjectivizer.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoIncrEvalSingleObjectivizer.h deleted file mode 100644 index d316e6cc3..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoIncrEvalSingleObjectivizer.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -* -* 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 MOEOINCREVALSINGLEOBJECTIVIZER_H_ -#define MOEOINCREVALSINGLEOBJECTIVIZER_H_ - -#include -#include -#include -#include -#include -#include - -/** - * Class to adapt mo algorithms (moTS moVNC...) for multiobjectives - * This class play a moMoveIncrEval but can be used with multi objectives - * Use a Singleobjectivizer to set the fitness value according to each dimension - */ -template < class MOEOT , class Move > -class moeoIncrEvalSingleObjectivizer : public moeoSingleObjectivization, public moMoveIncrEval < Move, typename MOEOT::Fitness> - { - public: - - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - - moeoIncrEvalSingleObjectivizer (){} - /** - Constructor - @param _singler a singleObjectivizer to calculte the fitness from the objectiveVector - @param _incr incremental evaluation of moeots - */ - moeoIncrEvalSingleObjectivizer ( moeoSingleObjectivization &_singler, moMoveIncrEval &_incr): - singler(_singler), incr(_incr) - {} - /** - * herited from moeoFitnessAssignment, calculate fitness for all population - * @param _pop the population - */ - virtual void operator () (eoPop < MOEOT > & _pop){ - singler(_pop); - }; - - /** - herited from eoEvalFunc, calculate fitness for a moeot - @param _moeot - */ - virtual void operator() (MOEOT & _moeot){ - singler(_moeot); - }; - - /** - calculate fitness from an objectiveVector - @param _moeot a valid ObejctiveVector - @return the fitness value for the objectiveVector - */ - virtual typename MOEOT::Fitness operator() (const typename MOEOT::ObjectiveVector & _moeot){ - return singler(_moeot); - }; - /** - evaluates incrementally the fitness for a moeo - @param _mov a movement to virtually apply to _moeo - @param _moeo the base solution - @return the fitness of _moeo with _move applied - */ - virtual typename MOEOT::Fitness operator() ( const Move &_mov, const MOEOT &_moeo ){ - return singler(incr_obj(_mov,_moeo)); - } - - /** - evaluates incrementally the objectiveVector for a moeo - @param _mov a movement to virtually apply to _moeo - @param _moeo the base solution - @return the objectiveVector of _moeo with _move applied - */ - virtual ObjectiveVector incr_obj ( const Move &_mov, const MOEOT &_moeo ){ - return incr(_mov,_moeo); - } - /** dummy method**/ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} - private: - moeoSingleObjectivization &singler; - moMoveIncrEval &incr; - }; - -#endif /*MOEOINCREVALSINGLEOBJECTIVIZER_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoMetricFitnessAssignment.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoMetricFitnessAssignment.h deleted file mode 100644 index f5c3e5549..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoMetricFitnessAssignment.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// moeoMetrucFitnessAssignment.h -//----------------------------------------------------------------------------- -#ifndef MOEOMETRICFITNESSASSIGNMENT_H_ -#define MOEOMETRICFITNESSASSIGNMENT_H_ - -#include -#include -#include -#include -#include -#include - -/* - * Fitness assignment scheme which use a metric - */ -template < class MOEOT> -class moeoMetricFitnessAssignment : public moeoSingleObjectivization < MOEOT > -{ - public: - - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - typedef typename ObjectiveVector::Type Type; - - - /** - * Default ctor - * @param _metric a metric function to calculate fitness - * @param _negate true if fitness should be maxed - */ - moeoMetricFitnessAssignment(moeoUnaryMetric &_metric, bool _negate=true) : metric(_metric),eval(defaultEval),negate(_negate) - {} - /** - * ctor with an evaluation fonction, applied if give moeot is invalid - * @param _eval a evalFunc to regenerate the objectiveVector if needed - * @param _metric a metric function to calculate fitness - * @param _negate true if fitness should be maxed - */ - moeoMetricFitnessAssignment(moeoUnaryMetric &_metric,eoEvalFunc &_eval, bool _negate=false) : metric(_metric),eval(_eval),negate(_negate) - {} - - /** - * Sets the fitness values for a moeot - * @param _mo the MOEOT - */ - void operator()(MOEOT & _mo){ - if (_mo.invalidObjectiveVector()) eval(_mo); - _mo.fitness(operator()(_mo.objectiveVector())); - - } - - /** - return the fitness of a valid objectiveVector - @param _mo the objectiveVector - @return the fitness value of _mo - */ - typename MOEOT::Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){ - if (negate) - return 1/metric(_mo); - else return metric(_mo); - } - - - /** - * 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 pop_size= _pop.size(); - for (unsigned int k=0; k & _pop, ObjectiveVector & _objVec) - { - //std::cout << "WARNING : updateByDeleting not implemented in moeoAssignmentFitnessAssignment" << std::endl; - } - - - private: - - moeoUnaryMetric &metric; - eoEvalFunc &eval; - bool negate; - class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ - } - } defaultEval; - -}; - -#endif /*MOEOMETRICFITNESSASSIGNMENT_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h deleted file mode 100644 index 382d4e2ef..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * - * 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 - * - */ -//----------------------------------------------------------------------------- -// moeoWeightedChebychevMetricFitnessAssignment.h -//----------------------------------------------------------------------------- -#ifndef MOEOCHEVMETRICFITNESSASSIGNMENT_H_ -#define MOEOCHEVMETRICFITNESSASSIGNMENT_H_ - -#include -#include -#include -#include -#include -#include -#include - -/* - * Fitness assignment scheme which use a metric - */ -template < class MOEOT> -class moeoWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectivization < MOEOT > -{ - public: - - /** the objective vector type of the solutions */ - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - typedef typename MOEOT::Fitness Fitness; - typedef typename ObjectiveVector::Type Type; - - /** - * ctor with normalizer - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - */ - moeoWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer) : normalizer(_normalizer), eval(defaultEval), distance(_rho, _weight), metric(distance, _reference, _normalizer){} - - /** - * ctor with an evaluation fonction, applied if give moeot is invalid - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, eoEvalFunc& _eval) : normalizer(defaultNormalizer), eval(_eval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - * ctor with an evaluation fonction, applied if give moeot is invalid, and a noramlizer, applied to ObjectiveVectors - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - * @param _normalizer the normalizer to apply to objectiveVectors - * @param _eval a evalFunc to regenerate the objectiveVector if needed - */ - moeoWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight, moeoObjectiveVectorNormalizer& _normalizer, eoEvalFunc& _eval) : normalizer(_normalizer), eval(_eval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - default constructor - * @param _rho - * @param _reference the reference point - * @param _weight the weights applied to the objectives - */ - moeoWeightedChebychevMetricFitnessAssignment(unsigned int _rho, const ObjectiveVector& _reference, const ObjectiveVector& _weight) : normalizer(defaultNormalizer), eval(defaultEval), distance(_rho, _weight), metric(distance, _reference, normalizer){} - - /** - * Sets the fitness values for a moeot - * @param _mo the MOEOT - */ - void operator()(MOEOT & _mo){ - if (_mo.invalidObjectiveVector()) - eval(_mo); - _mo.fitness(operator()(_mo.objectiveVector())); - } - - /** - return the fitness of a valid objectiveVector - @param _mo the objectiveVector - @return the fitness value of _mo - */ - typename MOEOT::Fitness operator()(const typename MOEOT::ObjectiveVector & _mo){ - return -metric(_mo); - } - - /** - * 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]); - } - - /** - * @param _pop the population - * @param _objVec the objective vector - */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} - - private: - - class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ - } - } defaultEval; - - moeoObjectiveVectorNormalizer defaultNormalizer; - moeoObjectiveVectorNormalizer& normalizer; - eoEvalFunc &eval; - moeoWeightedChebychevDistance distance; - moeoDistanceMetric metric; -}; - -#endif /*moeoWeightedChebychevMetricFitnessASSIGNMENT_H_*/ diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAnytimeWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAnytimeWeightStrategy.h deleted file mode 100755 index 83ee36883..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAnytimeWeightStrategy.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOANYTIMEWEIGHTSTRAT_H_ -#define MOEOANYTIMEWEIGHTSTRAT_H_ -#include -#include -#include -#include - -/** - * Change all weights according to a pattern ressembling to a "double strategy" 2 to 1 then 1 to 2. - * Can only be applied to 2 objectives vector problem - */ -template -class moeoAnytimeWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - */ - moeoAnytimeWeightStrategy():random(default_random),depth(0){} - - /** - * constructor with a given random generator, for algorithms wanting to keep the same generator for some reason - * @param _random an uniform random generator - */ - moeoAnytimeWeightStrategy(UF_random_generator &_random):random(_random), depth(0){} - - /** - * - * @param _weights the weights to change - * @param _moeot not used - */ - void operator()(std::vector& _weights, const MOEOT& _moeot){ - if (depth<2){ - if (depth==0) toTest.push_back(0.5); - _weights[0]=depth; - _weights[1]=1-_weights[0]; - depth++; - old1=0; - old2=1; - return; - } - if (!toTest.empty()){ - _weights[0]=toTest.front(); - _weights[1]=1-_weights[0]; - toTest.erase(toTest.begin()); - toTest.push_back((_weights[0]+old1)/2); - toTest.push_back((_weights[0]+old2)/2); - old2=old1; - old1=_weights[0]; - }else{ - std::cout<<"Error: Strange occurence in moeoAnytimeWeightStrategy "< &random; - UF_random_generator default_random; - int depth; - std::list toTest; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAugmentedQexploreWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAugmentedQexploreWeightStrategy.h deleted file mode 100755 index 0db3f34b0..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoAugmentedQexploreWeightStrategy.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOAUGMENTEDQEXPLWEIGHTSTRAT_H_ -#define MOEOAUGMENTEDQEXPLWEIGHTSTRAT_H_ -#include -#include -#include -#include - -/** - * Change all weights according to a pattern ressembling to a "double strategy" 2 to 1 then 1 to 2. - * Can only be applied to 2 objectives vector problem - */ -template -class moeoAugmentedQexploreWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - */ - moeoAugmentedQexploreWeightStrategy():depth(0),num(0),reset(true){ - nums.resize(1,0); - } - /** - * - * @param _weights the weights to change - * @param moeot a moeot, not used - */ - void operator()(std::vector &_weights,const MOEOT &moeot){ - int dim=moeot.objectiveVector().size(); - bool res=false; - int max=dim-1; - if (depth==0) do_reset(); - while (!res) { - res=translate(dim,_weights); - next_num(dim); - if (nums[0]>max){ - do_reset(); - } - } - } - - private: - - void next_num(int dim){ - int max=dim-1; - int idx=nums.size()-1; - if (depth==0){ - do_reset(); - }else{ - idx=nums.size()-1; - while(idx>0 && nums[idx]==max) idx--; - int to_assign=nums[idx]+1; - for (unsigned int i=idx;i &_weights){ - _weights.clear(); - _weights.resize(dim,0); - for (unsigned int i=0;i1 && _weights[nums[i]]==depth) { - return false; - } - } - - bool accept_pow=false; - bool accept_prim=false; - for (unsigned int i=0;i<_weights.size();i++){ - if (accept_pow || (_weights[i]!=1 && !is2pow(_weights[i]))) { - accept_pow=true; - } - if (accept_prim || (coprim(_weights[i],depth))) - accept_prim=true; - - _weights[i]=(_weights[i]+0.0)/(0.0+depth); - } - return accept_prim && accept_pow; - } - - void do_reset(){ - if (depth==0) depth=1; - else depth=depth*2; - nums.resize(depth); - for (unsigned int i=0;i nums; - int depth,num; - bool reset; - -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDichoWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDichoWeightStrategy.h deleted file mode 100644 index cacfa3273..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDichoWeightStrategy.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * - * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 - * (C) OPAC Team, LIFL, 2002-2007 - * - * Fran<-61><-89>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 MOEODICHOWEIGHTSTRAT_H_ -#define MOEODICHOWEIGHTSTRAT_H_ -#include -#include -#include -#include - -/** - * Change all weights according to a pattern ressembling to a "double strategy" 2 to 1 then 1 to 2. - * Can only be applied to 2 objectives vector problem - */ -template -class moeoDichoWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - */ - moeoDichoWeightStrategy():random(default_random),num(0){} - - /** - * constructor with a given random generator, for algorithms wanting to keep the same generator for some reason - * @param _random an uniform random generator - */ - moeoDichoWeightStrategy(UF_random_generator &_random):random(_random),num(0){} - - /** - * - * @param _weights the weights to change - * @param moeot a moeot, will be kept in an archive in order to calculate weights later - */ - void operator()(std::vector &_weights,const MOEOT &moeot){ - std::vector res; - ObjectiveVector tmp; - _weights.resize(moeot.objectiveVector().size()); - if (arch.size()<2){ - //archive too small, we generate starting weights to populate it - //if no better solution is provided, we will toggle between (0,1) and (1,0) - arch(moeot); - if (num==0){ - _weights[0]=0; - _weights[1]=1; - num++; - }else{ - _weights[1]=0; - _weights[0]=1; - num=0; - std::sort(arch.begin(),arch.end(),cmpParetoSort()); - it=arch.begin(); - } - return; - }else{ - if (it!=arch.end()){ - tmp=(*it).objectiveVector(); - it++; - if (it==arch.end()){ - //we were at the last elements, recurse to update the archive - operator()(_weights,moeot); - return; - } - toAdd.push_back(moeot); - res=normal(tmp,(*it).objectiveVector()); - _weights[0]=res[0]; - _weights[1]=res[1]; - }else{ - //we only add new elements to the archive once we have done an entire cycle on it, - //to prevent iterator breaking - //then we reset the iterator, and we recurse to start over - arch(toAdd); - toAdd.clear(); - std::sort(arch.begin(),arch.end(),cmpParetoSort()); - it=arch.begin(); - operator()(_weights,moeot); - return; - } - } - - } - - - - private: - typedef typename MOEOT::ObjectiveVector ObjectiveVector; - - std::vector normal(const ObjectiveVector &_obj1, const ObjectiveVector &_obj2){ - std::vector res; - double sum=0; - for (unsigned int i=0;i<_obj1.size();i++){ - if (_obj1[i]>_obj2[i]) - res.push_back(_obj1[i]-_obj2[i]); - else - res.push_back(_obj2[i]-_obj1[i]); - sum+=res[i]; - } - for (unsigned int i=0;i<_obj1.size();i++) res[i]=res[i]/sum; - return res; - } - struct cmpParetoSort - { - //since we apply it to a 2dimension pareto front, we can sort every objectiveVector - // following either objective without problem - bool operator()(const MOEOT & a,const MOEOT & b) const - { - return b.objectiveVector()[0] &random; - UF_random_generator default_random; - int num; - moeoUnboundedArchive arch; - eoPop toAdd; - typename eoPop::iterator it; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyRefPointStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyRefPointStrategy.h deleted file mode 100755 index bd3142cd2..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyRefPointStrategy.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEODUMMYREFPOINT_H_ -#define MOEODUMMYREFPOINT_H_ - -/** - * dummy class for variable reference point strategies. do nothing - */ -template -class moeoDummyRefPointStrategy : public moeoVariableRefPointStrategy - { - public: - virtual void operator()(typename MOEOT::ObjectiveVector &_obj, const MOEOT &_moeo ){} - }; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyWeightStrategy.h deleted file mode 100755 index 5aefd2872..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoDummyWeightStrategy.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEODUMMYWEIGHTSTRAT_H_ -#define MOEODUMMYWEIGHTSTRAT_H_ -#include - -/** - * Dummy variable weight strategy. Fill the weight with equal values - */ -template -class moeoDummyWeightStrategy: public moeoVariableWeightStrategy - { - public: - /** - * main function - * @param _weights the weights to change - * @param _moeot not used - */ - void operator()(std::vector &_weights,const MOEOT &_moeot){ - for (unsigned int i=0;i<_weights.size();i++){ - _weights[i]=(1.0/_weights.size()); - } - } - }; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeBothDirectionWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeBothDirectionWeightStrategy.h deleted file mode 100755 index a67489b28..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeBothDirectionWeightStrategy.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOFTBDWSWEIGHTSTRAT_H_ -#define MOEOFTBDWSWEIGHTSTRAT_H_ -#include -#include -#include -#include - -/** - * Change all weights according to a "double strategy" pattern 2 to 1 then 1 to 2. - */ -template -class moeoFixedTimeBothDirectionWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - * @param _step how much we want the weight to change every iteration - */ - moeoFixedTimeBothDirectionWeightStrategy(double _step):step(_step),current(0),direction(false){} - /** - * - * @param _weights the weights to change - * @param moeot a moeot, not used - */ - void operator()(std::vector &_weights,const MOEOT &moeot){ - double res; - if (current==1){ - res=1; - current=0; - direction=!direction; - }else res=current; - if (current+step>1){ - current=1; - }else current+=step; - if (direction){ - _weights[0]=res; - _weights[1]=1-res; - }else{ - _weights[0]=1-res; - _weights[1]=res; - } - } - - private: - double step; - double current; - bool direction; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeOneDirectionWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeOneDirectionWeightStrategy.h deleted file mode 100755 index 60d615a60..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoFixedTimeOneDirectionWeightStrategy.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOFTODWSWEIGHTSTRAT_H_ -#define MOEOFTODWSWEIGHTSTRAT_H_ -#include -#include -#include -#include - -/** - * Change all weights according to a simple strategy by adding a step every generation - */ -template -class moeoFixedTimeOneDirectionWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - * @param _step how much we want the weight to change every iteration - */ - moeoFixedTimeOneDirectionWeightStrategy(double _step):step(_step),current(0){} - /** - * - * @param _weights the weights to change - * @param moeot a moeot, not used - */ - void operator()(std::vector &_weights,const MOEOT &moeot){ - double res; - if (current==1){ - res=1; - current=0; - }else res=current; - if (current+step>1){ - current=1; - }else current+=step; - _weights[0]=res; - _weights[1]=1-res; - } - - private: - double step; - double current; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoQexploreWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoQexploreWeightStrategy.h deleted file mode 100755 index b79e8bfde..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoQexploreWeightStrategy.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOQEXPLWEIGHTSTRAT_H_ -#define MOEOQEXPLWEIGHTSTRAT_H_ -#include -#include -#include -#include -//#include -/** - * Change all weights according to a pattern ressembling to a "double strategy" 2 to 1 then 1 to 2. - * Can only be applied to 2 objectives vector problem - */ -template -class moeoQexploreWeightStrategy: public moeoVariableWeightStrategy -{ - public: - /** - * default constructor - */ - moeoQexploreWeightStrategy():random(default_random),depth(0),num(0){} - - /** - * constructor with a given random generator, for algorithms wanting to keep the same generator for some reason - * @param _random an uniform random generator - */ - moeoQexploreWeightStrategy(UF_random_generator &_random):random(_random),depth(0),num(0){} - /** - * - * @param _weights the weights to change - * @param moeot a moeot, not used - */ - void operator()(std::vector &_weights,const MOEOT &moeot){ - if (depth==0){ - if (num==0){ - num++; - _weights[0]=0; - _weights[1]=1; - }else{ - num=1; - depth=1; - _weights[0]=1; - _weights[1]=0; - } - }else{ - while (num=depth){ - depth++; - num=1; - } - _weights[0]=(num+0.0)/depth; - _weights[1]=1-(num+0.0)/depth; - num++; - } - } - - - private: - - bool coprim(int a, int b){ - if (b==0){ - return a==1; - }else { - return coprim(b,a%b); - } - } - - void next_num(){ - - } - UF_random_generator &random; - UF_random_generator default_random; - int depth,num,idx; - std::list toTest; -}; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoRandWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoRandWeightStrategy.h deleted file mode 100755 index 582cf27f7..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoRandWeightStrategy.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEORANDWEIGHTSTRAT_H_ -#define MOEORANDWEIGHTSTRAT_H_ -#include - -/** - * Change all weights randomly. - */ -template -class moeoRandWeightStrategy: public moeoVariableWeightStrategy - { - public: - /** - * default constructor - */ - moeoRandWeightStrategy():random(default_random){} - - /** - * constructor with a given random generator, for algorithms wanting to keep the same generator for some reason - * @param _random an uniform random generator - */ - moeoRandWeightStrategy(UF_random_generator &_random):random(_random){} - - /** - * main function, fill the weight randomly - * @param _weights the weights to change - * @param _moeot not used - */ - void operator()(std::vector &_weights,const MOEOT &_moeot){ - double sum=0; - for (unsigned int i=0;i<_weights.size();i++){ - double rnd=random(100000); - sum+=rnd; - _weights[i]=rnd; - } - //we divide by the sum in order to keep the weight sum equal to 1 - for (unsigned int i=0;i<_weights.size();i++){ - _weights[i]=_weights[i]/sum; - } - } - - private: - UF_random_generator &random; - UF_random_generator default_random; - }; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableRefPointStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableRefPointStrategy.h deleted file mode 100755 index 1eb355d54..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableRefPointStrategy.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOVARREFPOINT_H_ -#define MOEOVARREFPOINT_H_ - -/** - * Abstract class for strategies for changing reference point, in a fitness assignment that use it. - */ -template -class moeoVariableRefPointStrategy - { - public: - virtual void operator()(typename MOEOT::ObjectiveVector &_obj,const MOEOT &_moeo )=0; - }; - -#endif diff --git a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableWeightStrategy.h b/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableWeightStrategy.h deleted file mode 100755 index f6a2147b3..000000000 --- a/tags/paradiseo-1.3-beta2/paradiseo-moeo/src/scalarStuffs/weighting/moeoVariableWeightStrategy.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* -* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007 -* (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 MOEOVARWEIGHT_H_ -#define MOEOVARWEIGHT_H_ - -/** - * Abstract class for strategies for changing weight, in a aggregative fitness assignment. - */ -template -class moeoVariableWeightStrategy - { - public: - virtual void operator()(std::vector &_weights,const MOEOT &_moeo )=0; - }; - -#endif diff --git a/tags/paradiseo-1.3-beta2/problems/eval/oneMaxPopEval.h b/tags/paradiseo-1.3-beta2/problems/eval/oneMaxPopEval.h deleted file mode 100644 index ecd475ee6..000000000 --- a/tags/paradiseo-1.3-beta2/problems/eval/oneMaxPopEval.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - -Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can ue, -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". - -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 _oneMaxPopEval_h -#define _oneMaxPopEval_h - -#include -#include -#include - -template< class EOT > -class oneMaxPopEval : public eoEvalFunc< moPopSol > -{ -public: - - oneMaxPopEval(oneMaxEval& _eval, unsigned int _p): eval(_eval), p(_p){} - /** - * Count the number of 1 in a bitString - * @param _sol the solution to evaluate - */ - void operator() (moPopSol& _sol) { - double fit=0; - for (unsigned int i = 0; i < _sol.size(); i++){ - if(_sol[i].invalid()) - eval(_sol[i]); - fit+=pow((double) _sol[i].fitness(), (int) p); - } - fit=pow((double) fit, (double)1/p); - _sol.fitness(fit); - } - -private: - oneMaxEval& eval; - unsigned int p; -}; - -#endif