Nettoyage pour la release
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1875 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
18922d3435
commit
499ee542f0
51 changed files with 0 additions and 5970 deletions
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
<moVNSexplorer.h>
|
||||
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 <explorer/moNeighborhoodExplorer.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
/**
|
||||
* Explorer for Variiable Neighborhood Search
|
||||
*/
|
||||
template< class EOT >
|
||||
class moVNSexplorer : public moNeighborhoodExplorer< moNeighborhood< moNeighbor<EOT, typename EOT::Fitness> > >
|
||||
{
|
||||
public:
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
typedef moNeighbor<EOT, Fitness> Neighbor ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
|
||||
using moNeighborhoodExplorer<Neighborhood>::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<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_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<Neighbor>& neighborComparator;
|
||||
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -148,8 +148,6 @@
|
|||
#include <perturb/moSolInit.h>
|
||||
|
||||
#include <problems/bitString/moBitNeighbor.h>
|
||||
#include <problems/bitString/moPopBitNeighbor.h>
|
||||
#include <problems/bitString/moPopSol.h>
|
||||
#include <problems/eval/moMaxSATincrEval.h>
|
||||
#include <problems/eval/moOneMaxIncrEval.h>
|
||||
#include <problems/eval/moRoyalRoadIncrEval.h>
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
<moBackwardVariableNeighborhood.h>
|
||||
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 <neighborhood/moVariableNeighborhood.h>
|
||||
|
||||
/**
|
||||
* A variable Neighborhood Search (VNS) in the Backward manner
|
||||
*/
|
||||
template< class EOT >
|
||||
class moBackwardVariableNeighborhood : public moVariableNeighborhood<EOT>
|
||||
{
|
||||
public:
|
||||
typedef moNeighbor<EOT> Neighbor;
|
||||
|
||||
using moVariableNeighborhood<EOT>::currentNH;
|
||||
using moVariableNeighborhood<EOT>::neighborhoodVector;
|
||||
|
||||
/**
|
||||
* Construction of at least one neighborhood
|
||||
* @param _firstNH first neighborhood in the vector
|
||||
*/
|
||||
moBackwardVariableNeighborhood(moNeighborhood<Neighbor>& _firstNH) : moVariableNeighborhood<EOT>(_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
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
<moForwardVariableNeighborhood.h>
|
||||
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 <neighborhood/moVariableNeighborhood.h>
|
||||
|
||||
/**
|
||||
* A variable Neighborhood Search (VNS) in the forward manner
|
||||
*/
|
||||
template< class EOT >
|
||||
class moForwardVariableNeighborhood : public moVariableNeighborhood<EOT>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef moNeighbor<EOT> Neighbor;
|
||||
|
||||
using moVariableNeighborhood<EOT>::currentNH;
|
||||
using moVariableNeighborhood<EOT>::neighborhoodVector;
|
||||
|
||||
/**
|
||||
* Construction of at least one neighborhood
|
||||
* @param _firstNH first neighborhood in the vector
|
||||
*/
|
||||
moForwardVariableNeighborhood(moNeighborhood<Neighbor>& _firstNH) : moVariableNeighborhood<EOT>(_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
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
<moRndVariableNeighborhood.h>
|
||||
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 <neighborhood/moVariableNeighborhood.h>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
* A variable Neighborhood Search (VNS) in the random manner
|
||||
*/
|
||||
template< class EOT, class Fitness >
|
||||
class moRndVariableNeighborhood : public moVariableNeighborhood<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
typedef moNeighbor<EOT, Fitness> Neighbor;
|
||||
|
||||
using moVariableNeighborhood<EOT, Fitness>::currentNH;
|
||||
using moVariableNeighborhood<EOT, Fitness>::neighborhoodVector;
|
||||
|
||||
/**
|
||||
* Construction of at least one neighborhood
|
||||
* @param _firstNH first neighborhood in the vector
|
||||
*/
|
||||
moRndVariableNeighborhood(moNeighborhood<Neighbor>& _firstNH) : moVariableNeighborhood<EOT, Fitness>(_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<Neighbor>& _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<unsigned int> indexVector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
<moVariableNeighborhood.h>
|
||||
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 <neighborhood/moNeighborhood.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* A vector of neighborhood for the Variable Neighborhood Search (VNS)
|
||||
*/
|
||||
template< class EOT >
|
||||
class moVariableNeighborhood : public moNeighborhood<moNeighbor<EOT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef moNeighbor<EOT> Neighbor;
|
||||
/**
|
||||
* Construction of at least one neighborhood
|
||||
* @param _firstNH first neighborhood in the vector
|
||||
*/
|
||||
moVariableNeighborhood(moNeighborhood<Neighbor>& _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<Neighbor>& _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<moNeighborhood<Neighbor>* > neighborhoodVector;
|
||||
// the index of the current neighborhood
|
||||
unsigned int currentNH;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
<moPopBitNeighbor.h>
|
||||
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 <eoPop.h>
|
||||
#include <ga/eoBit.h>
|
||||
#include <problems/bitString/moPopSol.h>
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
|
||||
/**
|
||||
* Neighbor related to a vector of Bit
|
||||
*/
|
||||
template< class Fitness >
|
||||
class moPopBitNeighbor : public moIndexNeighbor< moPopSol<eoBit<Fitness> > >
|
||||
{
|
||||
public:
|
||||
typedef moPopSol<eoBit<Fitness> > EOT ;
|
||||
typedef eoBit<Fitness> SUBEOT;
|
||||
|
||||
using moIndexNeighbor<EOT>::fitness;
|
||||
using moIndexNeighbor<EOT>::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
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
<moPopSol.h>
|
||||
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 <EO.h>
|
||||
#include <eoPop.h>
|
||||
|
||||
template <class EOT>
|
||||
class moPopSol : public EO<double>, public std::vector<EOT>{
|
||||
public:
|
||||
typedef typename EO<double>::Fitness Fitness;
|
||||
using EO<double>::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
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
<moPopBitEval.h>
|
||||
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 <eoFunctor.h>
|
||||
#include <eval/moEval.h>
|
||||
|
||||
/**
|
||||
* Abstract class for the evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moPopBitEval : public moEval<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename Neighbor::SUBEOT SUBEOT;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
moPopBitEval(eoEvalFunc<SUBEOT>& _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<SUBEOT> & eval;
|
||||
unsigned int p;
|
||||
Fitness subfit;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
<moPopFitContinuator.h>
|
||||
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 <continuator/moContinuator.h>
|
||||
|
||||
/**
|
||||
* Termination condition until a running time is reached.
|
||||
*/
|
||||
template < class Neighbor >
|
||||
class moPopFitContinuator: public moContinuator<Neighbor>
|
||||
{
|
||||
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
|
||||
|
|
@ -1,385 +0,0 @@
|
|||
/*
|
||||
<testPopLS.cpp>
|
||||
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 <stdexcept> // runtime_error
|
||||
#include <iostream> // cout
|
||||
#include <sstream> // ostrstream, istrstream
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
|
||||
// the general include for eo
|
||||
#include <eo>
|
||||
#include <ga.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//Representation and initializer
|
||||
#include <eoInt.h>
|
||||
#include <eoInit.h>
|
||||
#include <eoScalarFitness.h>
|
||||
#include <ga/eoBit.h>
|
||||
#include <eoPop.h>
|
||||
|
||||
// fitness function
|
||||
#include <eval/oneMaxPopEval.h>
|
||||
#include <problems/eval/moPopBitEval.h>
|
||||
|
||||
//Neighbors and Neighborhoods
|
||||
#include <problems/bitString/moPopBitNeighbor.h>
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
|
||||
//Algorithm and its components
|
||||
#include <coolingSchedule/moCoolingSchedule.h>
|
||||
#include <algo/moSimpleHC.h>
|
||||
|
||||
//comparator
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
//continuators
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <continuator/moCheckpoint.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <utils/eoFileMonitor.h>
|
||||
#include <continuator/moCounterMonitorSaver.h>
|
||||
|
||||
#include "moPopFitContinuator.h"
|
||||
|
||||
#include <mo>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Define types of the representation solution, different neighbors and neighborhoods
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef moPopSol<eoBit<double> > Solution; //Permutation (Queen's problem representation)
|
||||
|
||||
typedef moPopBitNeighbor<double> Neighbor; //shift Neighbor
|
||||
typedef moRndWithReplNeighborhood<Neighbor> Neighborhood; //rnd shift Neighborhood (Indexed)
|
||||
|
||||
|
||||
class popInit: public eoInit<Solution>{
|
||||
|
||||
public:
|
||||
|
||||
popInit( eoInitFixedLength<eoBit<double> > & _rnd, unsigned int _popSize):rnd(_rnd), popSize(_popSize){}
|
||||
|
||||
void operator()(Solution & _sol){
|
||||
|
||||
|
||||
|
||||
eoBit<double> tmp;
|
||||
|
||||
for(unsigned int i=0; i<popSize; i++){
|
||||
rnd(tmp);
|
||||
_sol.push_back(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
eoInitFixedLength<eoBit<double> >& 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<uint32_t> seedParam(time(0), "seed", "Random number seed", 'S');
|
||||
parser.processParam( seedParam );
|
||||
unsigned seed = seedParam.value();
|
||||
|
||||
// the number of steps of the random walk
|
||||
eoValueParam<unsigned int> stepParam(100, "nbStep", "Number of steps of the random walk", 'n');
|
||||
parser.processParam( stepParam, "Representation" );
|
||||
unsigned nbStep = stepParam.value();
|
||||
|
||||
// description of genotype
|
||||
eoValueParam<unsigned int> vecSizeParam(8, "vecSize", "Genotype size", 'V');
|
||||
parser.processParam( vecSizeParam, "Representation" );
|
||||
unsigned vecSize = vecSizeParam.value();
|
||||
|
||||
// description of genotype
|
||||
eoValueParam<unsigned int> 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<string> 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<string> outParam(str_out.c_str(), "out", "Output file of the sampling", 'o');
|
||||
parser.processParam(outParam, "Persistence" );
|
||||
|
||||
// description of genotype
|
||||
eoValueParam<unsigned int> 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<double> > eval;
|
||||
oneMaxPopEval< eoBit<double> > popEval(eval, p);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* Initilisation of the solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
eoUniformGenerator<bool> uGen;
|
||||
eoInitFixedLength<eoBit<double> > rnd(vecSize, uGen);
|
||||
|
||||
popInit random(rnd, popSize);
|
||||
|
||||
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* evaluation of a neighbor solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
moPopBitEval<Neighbor> 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<Neighbor> cont(vecSize);
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* the local search algorithm
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
//moSimpleHC<Neighbor> 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<Neighbor> 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<double> & 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<double> 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<shiftNeighbor> continuator;//always continue
|
||||
// moCheckpoint<shiftNeighbor> checkpoint(continuator);
|
||||
// moFitnessStat<Queen> fitStat;
|
||||
// checkpoint.add(fitStat);
|
||||
// eoFileMonitor monitor("fitness.out", "");
|
||||
// moCounterMonitorSaver countMon(100, monitor);
|
||||
// checkpoint.add(countMon);
|
||||
// monitor.add(fitStat);
|
||||
//
|
||||
// moSA<shiftNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
@ -152,43 +152,6 @@
|
|||
#include <replacement/moeoGenerationalReplacement.h>
|
||||
#include <replacement/moeoReplacement.h>
|
||||
|
||||
#include <scalarStuffs/algo/moeoHC.h>
|
||||
#include <scalarStuffs/algo/moeoILS.h>
|
||||
#include <scalarStuffs/algo/moeoSA.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <scalarStuffs/algo/moeoTS.h>
|
||||
#include <scalarStuffs/algo/moeoVFAS.h>
|
||||
#include <scalarStuffs/algo/moeoVNS.h>
|
||||
#include <scalarStuffs/archive/moeoArchiveIndex.h>
|
||||
#include <scalarStuffs/archive/moeoIndexedArchive.h>
|
||||
#include <scalarStuffs/archive/moeoQuadTree.h>
|
||||
#include <scalarStuffs/archive/moeoQuadTreeArchive.h>
|
||||
#include <scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h>
|
||||
#include <scalarStuffs/distance/moeoAchievementScalarizingFunctionDistance.h>
|
||||
#include <scalarStuffs/distance/moeoAugmentedAchievementScalarizingFunctionDistance.h>
|
||||
#include <scalarStuffs/distance/moeoAugmentedWeightedChebychevDistance.h>
|
||||
#include <scalarStuffs/distance/moeoWeightedChebychevDistance.h>
|
||||
#include <scalarStuffs/explorer/moeoHCMoveLoopExpl.h>
|
||||
#include <scalarStuffs/explorer/moeoTSMoveLoopExpl.h>
|
||||
#include <scalarStuffs/fitness/moeoAchievementFitnessAssignment.h>
|
||||
#include <scalarStuffs/fitness/moeoAchievementScalarizingFunctionMetricFitnessAssignment.h>
|
||||
#include <scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h>
|
||||
#include <scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h>
|
||||
#include <scalarStuffs/fitness/moeoIncrEvalSingleObjectivizer.h>
|
||||
#include <scalarStuffs/fitness/moeoMetricFitnessAssignment.h>
|
||||
#include <scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h>
|
||||
#include <scalarStuffs/weighting/moeoAnytimeWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoAugmentedQexploreWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoDichoWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoDummyRefPointStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoDummyWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoFixedTimeBothDirectionWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoFixedTimeOneDirectionWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoQexploreWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoRandWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoVariableRefPointStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoVariableWeightStrategy.h>
|
||||
|
||||
#include <selection/moeoDetArchiveSelect.h>
|
||||
#include <selection/moeoDetTournamentSelect.h>
|
||||
#include <selection/moeoExhaustiveUnvisitedSelect.h>
|
||||
|
|
|
|||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
<moeoHC.h>
|
||||
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 <scalarStuffs/explorer/moeoHCMoveLoopExpl.h>
|
||||
#include <fitness/moeoSingleObjectivization.h>
|
||||
#include <scalarStuffs/fitness/moeoIncrEvalSingleObjectivizer.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <moHC.h>
|
||||
//! 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 M>
|
||||
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<MOEOT,M>(_singler,_incremental_evaluation))),
|
||||
moveLoop(new moeoHCMoveLoopExpl<M>(_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<MOEOT,M> *incrEval;
|
||||
moeoHCMoveLoopExpl<M> *moveLoop;
|
||||
//! the actual algo
|
||||
moHC<M> algo;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
<moeoILS.h>
|
||||
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 <moComparator.h>
|
||||
#include <moILS.h>
|
||||
|
||||
|
||||
#include <scalarStuffs/algo/moeoHC.h>
|
||||
#include <scalarStuffs/algo/moeoTS.h>
|
||||
#include <scalarStuffs/algo/moeoSA.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <moHCMoveLoopExpl.h>
|
||||
#include <fitness/moeoSingleObjectivization.h>
|
||||
#include <scalarStuffs/explorer/moeoHCMoveLoopExpl.h>
|
||||
|
||||
//! 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<MOEOT> & _algorithm, moSolContinue <MOEOT> & _continue, moComparator<MOEOT> & _acceptance_criterion,
|
||||
eoMonOp<MOEOT> & _perturbation, moeoSingleObjectivization<MOEOT> & _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<MOEOT> &_singler,moMoveSelect < M > & _move_selection,
|
||||
moSolContinue <MOEOT> & _continue, moComparator<MOEOT> & _acceptance_criterion,
|
||||
eoMonOp<MOEOT> & _perturbation):
|
||||
subAlgo(new moeoHC<M>(_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 <M> & _move_initializer, moNextMove <M> & _next_move_generator,moMoveIncrEval <M,ObjectiveVector> & _incremental_evaluation, moeoSingleObjectivization<MOEOT> &_singler, moTabuList <M> & _tabu_list,moAspirCrit <M> & _aspiration_criterion, moSolContinue <MOEOT> & _moTS_continue,moSolContinue <MOEOT> & _continue, moComparator<MOEOT> & _acceptance_criterion, eoMonOp<MOEOT> & _perturbation):
|
||||
subAlgo(new moeoTS<M>(_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<M> & _random_move_generator, moMoveIncrEval <M,ObjectiveVector> & _incremental_evaluation,moeoSingleObjectivization<MOEOT> &_singler, moSolContinue <MOEOT> & _moSA_continue,double _initial_temperature, moCoolingSchedule & _cooling_schedule, moSolContinue <MOEOT> & _continue,moComparator<MOEOT> & _acceptance_criterion, eoMonOp<MOEOT> & _perturbation):
|
||||
subAlgo(new moeoSA<M>(_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"<<std::endl;
|
||||
return algo(_solution);
|
||||
}
|
||||
|
||||
private:
|
||||
moeoSolAlgo<MOEOT> *subAlgo;
|
||||
//! the actual algo
|
||||
moILS<M> algo;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
<moeoSA.h>
|
||||
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 <eoEvalFunc.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <moTSMoveLoopExpl.h>
|
||||
#include <fitness/moeoSingleObjectivization.h>
|
||||
#include <scalarStuffs/explorer/moeoTSMoveLoopExpl.h>
|
||||
#include <moSA.h>
|
||||
//! 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<MOEOT> &_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<MOEOT,M> incrEval;
|
||||
//! the actual algo
|
||||
moSA<M> algo;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* <moeoSolAlgo.h>
|
||||
* 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 <eoAlgo.h>
|
||||
#include <algo/moeoAlgo.h>
|
||||
#include <moAlgo.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Solution based multi-objective evolutionary algorithms.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoSolAlgo : public moAlgo<MOEOT>, public moeoAlgo
|
||||
{
|
||||
};
|
||||
|
||||
#endif /*MOEOSOLALGO_H_*/
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
<moeoTS.h>
|
||||
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 <moTS.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <fitness/moeoSingleObjectivization.h>
|
||||
#include <scalarStuffs/explorer/moeoTSMoveLoopExpl.h>
|
||||
//! 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<MOEOT> &_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<MOEOT,M> incrEval;
|
||||
moeoTSMoveLoopExpl<M> moveLoop;
|
||||
//! the actual algo
|
||||
moTS<M> algo;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
/*
|
||||
<moeoVFAS.h>
|
||||
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 <moComparator.h>
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <scalarStuffs/algo/moeoSolAlgo.h>
|
||||
#include <fitness/moeoSingleObjectivization.h>
|
||||
#include <fitness/moeoAggregationFitnessAssignment.h>
|
||||
#include <scalarStuffs/explorer/moeoHCMoveLoopExpl.h>
|
||||
#include <scalarStuffs/weighting/moeoVariableWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoVariableRefPointStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoDummyWeightStrategy.h>
|
||||
#include <scalarStuffs/weighting/moeoDummyRefPointStrategy.h>
|
||||
//! 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<MOEOT> & _algorithm, eoContinue <MOEOT> & _continue,moeoSelectOne<MOEOT> &_select,
|
||||
std::vector<double> &_weights, eoEvalFunc< MOEOT > &_eval , moeoVariableWeightStrategy<MOEOT> &_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<MOEOT> & _algorithm, eoContinue <MOEOT> & _continue,moeoSelectOne<MOEOT> &_select,
|
||||
std::vector<double> &_weights, ObjectiveVector &_refPoint, eoEvalFunc< MOEOT > &_eval , moeoVariableWeightStrategy<MOEOT> &_wstrat , moeoVariableRefPointStrategy<MOEOT>& _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<MOEOT> & _algorithm, eoContinue <MOEOT> & _continue,moeoSelectOne<MOEOT> &_select,
|
||||
eoEvalFunc< MOEOT > &_eval, moeoVariableWeightStrategy<MOEOT> &_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<MOEOT> &_pop){
|
||||
uniform_generator<double> rngGen(0.0,1.0);
|
||||
for (unsigned int i=0;i<_pop.size();i++){
|
||||
if (_pop[i].invalidObjectiveVector())
|
||||
eval(_pop[i]);
|
||||
}
|
||||
moeoObjectiveVectorNormalizer<MOEOT> norm(_pop);
|
||||
moeoAggregationFitnessAssignment<MOEOT> 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<<moeot.objectiveVector()<<std::endl;
|
||||
wstrat(weights,moeot);
|
||||
rstrat(refPoint,moeot);
|
||||
}while(cont(_pop));
|
||||
}
|
||||
|
||||
private:
|
||||
moeoSolAlgo<MOEOT> &algo;
|
||||
eoContinue<MOEOT> &cont;
|
||||
moeoSelectOne<MOEOT> &select;
|
||||
std::vector<double> &weights;
|
||||
std::vector<double> defaultWeights;
|
||||
eoEvalFunc<MOEOT> &eval;
|
||||
ObjectiveVector &refPoint;
|
||||
ObjectiveVector defaultRefPoint;
|
||||
moeoVariableWeightStrategy<MOEOT> &wstrat;
|
||||
moeoVariableRefPointStrategy<MOEOT> &rstrat;
|
||||
moeoDummyRefPointStrategy<MOEOT> defaultRstrat;
|
||||
moeoDummyWeightStrategy<MOEOT> defaultWstrat;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue