diff --git a/trunk/paradiseo-mo/src/comparator/moComparator.h b/trunk/paradiseo-mo/src/comparator/moComparator.h new file mode 100644 index 000000000..153e39422 --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moComparator.h @@ -0,0 +1,60 @@ +/* + + 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 _moComparator_h +#define _moComparator_h + +#include +#include + + +/** + * Comparator of two types + */ +template< class T1, class T2 > +class moComparator : public eoBF +{ +public: + + /** + * @param _ref1 a reference on a variable of type T1 + * @param _ref2 a reference on a variable of type T2 + * @return true if _ref1 and _ref2 are equals + */ + virtual bool equals(const T1& _ref1, const T2& _ref2) = 0; + +}; + +#endif + diff --git a/trunk/paradiseo-mo/src/comparator/moEqualNeighborComparator.h b/trunk/paradiseo-mo/src/comparator/moEqualNeighborComparator.h new file mode 100644 index 000000000..6ea148df0 --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moEqualNeighborComparator.h @@ -0,0 +1,69 @@ +/* + + 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 _moEqualNeighborComparator_h +#define _moEqualNeighborComparator_h + +#include +#include + +/** + * Comparator of two neighbors : a neighbor is better if the fitness is higher or equal + */ +template< class Neighbor > +class moEqualNeighborComparator : public moNeighborComparator +{ +public: + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is better or equal than neighbor1 + */ + virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() <= _neighbor2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEqualNeighborComparator"; + } +}; + + +#endif diff --git a/trunk/paradiseo-mo/src/comparator/moEqualSolNeighborComparator.h b/trunk/paradiseo-mo/src/comparator/moEqualSolNeighborComparator.h new file mode 100644 index 000000000..6f706dc73 --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moEqualSolNeighborComparator.h @@ -0,0 +1,74 @@ +/* + + 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 _moEqualSolNeighborComparator_h +#define _moEqualSolNeighborComparator_h + +#include +#include + +#include +#include + + +/** + * Comparator of a solution and its neighbor : a neighbor is better if the fitness is higher or equal + */ +template< class Neighbor > +class moEqualSolNeighborComparator : public moSolNeighborComparator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Compare two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is better or equal than sol + */ + virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() <= _neighbor.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEqualSolNeighborComparator"; + } +}; + + +#endif diff --git a/trunk/paradiseo-mo/src/comparator/moNeighborComparator.h b/trunk/paradiseo-mo/src/comparator/moNeighborComparator.h new file mode 100644 index 000000000..869adbb5c --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moNeighborComparator.h @@ -0,0 +1,79 @@ +/* + + 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 _moNeighborComparator_h +#define _moNeighborComparator_h + +#include +#include + +/** + * Comparator of two neighbors + */ +template< class Neighbor > +class moNeighborComparator : public moComparator +{ +public: + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is better than neighbor1 + */ + virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() < _neighbor2.fitness()); + } + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is equal to neighbor1 + */ + virtual bool equals(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() == _neighbor2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moNeighborComparator"; + } +}; + + +#endif diff --git a/trunk/paradiseo-mo/src/comparator/moSolComparator.h b/trunk/paradiseo-mo/src/comparator/moSolComparator.h new file mode 100644 index 000000000..d7f30c2f8 --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moSolComparator.h @@ -0,0 +1,72 @@ +/* + +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 _moSolComparator_h +#define _moSolComparator_h + +#include + +/** + * Comparator of two solutions + */ +template< class EOT > +class moSolComparator : public moComparator +{ +public: + + /** + * Compare two solutions + * @param _sol1 the first solution + * @param _sol2 the second solution + * @return true if the solution2 is better than solution1 + */ + virtual bool operator()(const EOT& _sol1, const EOT& _sol2) { + return (_sol1.fitness() < _sol2.fitness()); + } + + /** + * Test the equality between two solutions + * @param _sol1 the first solution + * @param _sol2 the second solution + * @return true if the solution2 is equal to solution1 + */ + virtual bool equals(const EOT& _sol1, const EOT& _sol2) { + return (_sol1.fitness() == _sol2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSolComparator"; + } +}; + +#endif diff --git a/trunk/paradiseo-mo/src/comparator/moSolNeighborComparator.h b/trunk/paradiseo-mo/src/comparator/moSolNeighborComparator.h new file mode 100644 index 000000000..2275a6494 --- /dev/null +++ b/trunk/paradiseo-mo/src/comparator/moSolNeighborComparator.h @@ -0,0 +1,84 @@ +/* + + 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 _moSolNeighborComparator_h +#define _moSolNeighborComparator_h + +#include +#include + +#include +#include + + +/** + * Comparator of a solution and its neighbor + */ +template< class Neighbor > +class moSolNeighborComparator : public moComparator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Compare two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is better than sol + */ + virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() < _neighbor.fitness()); + } + + /** + * Test the equality between two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is equal to the solution + */ + virtual bool equals(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() == _neighbor.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSolNeighborComparator"; + } +}; + + +#endif