Debut des travaux sur ILS
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1724 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cb67604723
commit
856830e4ed
15 changed files with 804 additions and 43 deletions
44
trunk/paradiseo-mo/src/acceptCrit/moAcceptanceCriterion.h
Normal file
44
trunk/paradiseo-mo/src/acceptCrit/moAcceptanceCriterion.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
<moAcceptanceCriterion.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 _moAcceptanceCriterion_h
|
||||
#define _moAcceptanceCriterion_h
|
||||
|
||||
#include <eoFunctor.h>
|
||||
#include <memory/moMemory.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Acceptance criteria
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moAcceptanceCriterion : public eoBF<typename Neighbor::EOT&, typename Neighbor::EOT&, bool>, virtual public moMemory<Neighbor>{
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
57
trunk/paradiseo-mo/src/acceptCrit/moAlwaysAcceptCrit.h
Normal file
57
trunk/paradiseo-mo/src/acceptCrit/moAlwaysAcceptCrit.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
<moAlwaysAcceptCrit.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 _moAlwaysAcceptCrit_h
|
||||
#define _moAlwaysAcceptCrit_h
|
||||
|
||||
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
|
||||
/**
|
||||
* Acceptance Criterion for extreme diversification : always accept new solution
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moAlwaysAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor>{
|
||||
|
||||
public:
|
||||
typedef typename Neighor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Always accept the new solution
|
||||
* @param _sol1 the previous solution
|
||||
* @param _sol2 the new solution after local search
|
||||
* @return always true
|
||||
*/
|
||||
bool operator()(EOT& _sol1, EOT& _sol2){
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
34
trunk/paradiseo-mo/src/acceptCrit/moBetterAcceptCrit.h
Normal file
34
trunk/paradiseo-mo/src/acceptCrit/moBetterAcceptCrit.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
<moBetterAcceptCrit.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 _moBetterAcceptCrit_h
|
||||
#define _moBetterAcceptCrit_h
|
||||
|
||||
|
||||
#endif
|
||||
169
trunk/paradiseo-mo/src/explorer/moILSexplorer.h
Normal file
169
trunk/paradiseo-mo/src/explorer/moILSexplorer.h
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
<moILSexplorer.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 _moILSexplorer_h
|
||||
#define _moILSexplorer_h
|
||||
|
||||
#include <explorer/moNeighborhoodExplorer.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <algo/moLocalSearch.h>
|
||||
#include <perturb/moPerturbation.h>
|
||||
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||
|
||||
/**
|
||||
* Explorer for an Iterated Local Search
|
||||
*/
|
||||
template< class NHE >
|
||||
class moILSexplorer : public moNeighborhoodExplorer<typename NHE::Neighborhood>
|
||||
{
|
||||
public:
|
||||
typedef typename NHE::Neighborhood Neighborhood ;
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighborhood::Neighbor Neighbor ;
|
||||
|
||||
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
|
||||
using moNeighborhoodExplorer<Neighborhood>::eval;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _ls a local search
|
||||
* @param _perturb a perturbation operator
|
||||
* @param _acceptCrit a acceptance criteria
|
||||
*/
|
||||
moILSexplorer(moLocalSearch<NHE>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit){
|
||||
firstIteration=true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moILSexplorer(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Init perturbation and acceptance criteria
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void initParam(EOT & _solution){
|
||||
firstIteration=true;
|
||||
perturb.init(_solution);
|
||||
acceptCrit.init(_solution);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update perturbation and acceptance criteria
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void updateParam(EOT & _solution){
|
||||
if((*this).isMoved()){
|
||||
perturb.add(_solution,emptyNeighbor);
|
||||
acceptCrit.add(_solution,emptyNeighbor);
|
||||
}
|
||||
perturb.update(_solution, emptyNeighbor);
|
||||
acceptCrit.update(_solution, emptyNeighbor);
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
*/
|
||||
virtual void terminate(EOT & _solution){};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
* @param _solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution){
|
||||
//copy the solution to perform new local search
|
||||
current=_solution;
|
||||
|
||||
//perturb solution exept at the first iteration
|
||||
if(!firstIteration)
|
||||
perturb(current);
|
||||
else
|
||||
firstIteration=false;
|
||||
|
||||
//apply the local search on the copy
|
||||
ls(current);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Always continue
|
||||
* @param _solution the solution
|
||||
* @return always true
|
||||
*/
|
||||
virtual bool isContinue(EOT & _solution) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* move the solution with the best neighbor
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
_solution=current;
|
||||
};
|
||||
|
||||
/**
|
||||
* accept test if an ameliorated neighbor was be found
|
||||
* @param _solution the solution
|
||||
* @return true if acceptance criteria is verified
|
||||
*/
|
||||
virtual bool accept(EOT & _solution) {
|
||||
return acceptCrit(_solution, current);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moILSexplorer";
|
||||
}
|
||||
|
||||
private:
|
||||
//Usefull to use the momory of tabuSearch
|
||||
Neighbor emptyNeighbor;
|
||||
EOT current;
|
||||
moLocalSearch<NHE>& ls;
|
||||
moPerturbation<Neighbor> & perturb;
|
||||
moAcceptanceCriterion<Neighbor>& acceptCrit;
|
||||
|
||||
bool firstIteration;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -2,36 +2,17 @@
|
|||
#define _moDummyDiversification_h
|
||||
|
||||
#include <memory/moDiversification.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
|
||||
/**
|
||||
* Dummy diversification strategy
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moDummyDiversification : public moDiversification<Neighbor>
|
||||
class moDummyDiversification : public moDiversification<Neighbor>, public moDummyMemory<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Init : NOTHIING TO DO
|
||||
*/
|
||||
void init(EOT & _sol) {}
|
||||
|
||||
/**
|
||||
* Add : NOTHIING TO DO
|
||||
*/
|
||||
void add(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* Update : NOTHIING TO DO
|
||||
*/
|
||||
void update(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* ClearMemory : NOTHIING TO DO
|
||||
*/
|
||||
void clearMemory() {}
|
||||
|
||||
/**
|
||||
* @return always false
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,36 +2,17 @@
|
|||
#define _moDummyIntensification_h
|
||||
|
||||
#include <memory/moIntensification.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
|
||||
/**
|
||||
* Dummy intensification strategy
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moDummyIntensification : public moIntensification<Neighbor>
|
||||
class moDummyIntensification : public moIntensification<Neighbor>, public moDummyMemory<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Init : NOTHIING TO DO
|
||||
*/
|
||||
void init(EOT & _sol) {}
|
||||
|
||||
/**
|
||||
* Add : NOTHIING TO DO
|
||||
*/
|
||||
void add(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* Update : NOTHIING TO DO
|
||||
*/
|
||||
void update(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* ClearMemory : NOTHIING TO DO
|
||||
*/
|
||||
void clearMemory() {}
|
||||
|
||||
/**
|
||||
* @return always false
|
||||
*/
|
||||
|
|
|
|||
67
trunk/paradiseo-mo/src/memory/moDummyMemory.h
Normal file
67
trunk/paradiseo-mo/src/memory/moDummyMemory.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
<moDummyMemory.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 _moDummyMemory_h
|
||||
#define _moDummyMemory_h
|
||||
|
||||
#include <memory/moMemory.h>
|
||||
|
||||
/**
|
||||
* Dummy memory to make an empty memory
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moDummyMemory : virtual public moMemory<Neighbor>{
|
||||
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Init : NOTHIING TO DO
|
||||
*/
|
||||
void init(EOT & _sol) {}
|
||||
|
||||
/**
|
||||
* Add : NOTHIING TO DO
|
||||
*/
|
||||
void add(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* Update : NOTHIING TO DO
|
||||
*/
|
||||
void update(EOT & _sol, Neighbor & _neighbor) {}
|
||||
|
||||
/**
|
||||
* ClearMemory : NOTHIING TO DO
|
||||
*/
|
||||
void clearMemory() {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -72,10 +72,12 @@
|
|||
#include <explorer/moSimpleHCexplorer.h>
|
||||
#include <explorer/moSimpleHCneutralExplorer.h>
|
||||
#include <explorer/moTSExplorer.h>
|
||||
#include <explorer/moILSexplorer.h>
|
||||
|
||||
#include <memory/moAspiration.h>
|
||||
#include <memory/moBestImprAspiration.h>
|
||||
#include <memory/moDiversification.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
#include <memory/moDummyDiversification.h>
|
||||
#include <memory/moDummyIntensification.h>
|
||||
#include <memory/moIntensification.h>
|
||||
|
|
@ -94,6 +96,13 @@
|
|||
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||
#include <neighborhood/moRndWithReplNeighborhood.h>
|
||||
|
||||
#include <perturb/moPerturbation.h>
|
||||
#include <perturb/moMonOpPerturb.h>
|
||||
|
||||
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||
|
||||
|
||||
//#include <old/moMove.h>
|
||||
//#include <old/moMoveIncrEval.h>
|
||||
//#include <old/moMoveInit.h>
|
||||
|
|
|
|||
65
trunk/paradiseo-mo/src/perturb/moMonOpPerturb.h
Normal file
65
trunk/paradiseo-mo/src/perturb/moMonOpPerturb.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<moMonOpPerturb.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 _moMonOpPerturb_h
|
||||
#define _moMonOpPerturb_h
|
||||
|
||||
#include <eoOp.h>
|
||||
#include <perturb/moPerturbation.h>
|
||||
|
||||
/**
|
||||
* Perturbation operator using only a eoMonOp
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moMonOpPerturb : public moPerturbation<Neighbor>, public moDummyMemory<Neighbor> {
|
||||
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _monOp an eoMonOp (pertubation operator)
|
||||
*/
|
||||
moMonOpPerturb(eoMonOp<EOT>& _monOp):monOp(_monOp){}
|
||||
|
||||
/**
|
||||
* Apply monOp on the solution
|
||||
* @param _solution to perturb
|
||||
* @return value of monOp
|
||||
*/
|
||||
bool operator()(EOT& _solution){
|
||||
return monOp(_solution);
|
||||
}
|
||||
|
||||
private:
|
||||
/** monOp */
|
||||
eoMonOp<EOT>& monOp;
|
||||
};
|
||||
|
||||
#endif
|
||||
34
trunk/paradiseo-mo/src/perturb/moNeighborhoodPerturb.h
Normal file
34
trunk/paradiseo-mo/src/perturb/moNeighborhoodPerturb.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
<moNeighborhoodPerturb.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 _moNeighborhoodPerturb_h
|
||||
#define _moNeighborhoodPerturb_h
|
||||
|
||||
|
||||
#endif
|
||||
43
trunk/paradiseo-mo/src/perturb/moPertubation.h
Normal file
43
trunk/paradiseo-mo/src/perturb/moPertubation.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
<moPertubation.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 _moPertubation_h
|
||||
#define _moPertubation_h
|
||||
|
||||
#include <eoOp.h>
|
||||
#include <memory/moMemory.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Perturbation operator
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moPerturbation : public eoMonOp<typename Neighbor::EOT>, virtual public moMemory<Neighbor> {
|
||||
};
|
||||
|
||||
#endif
|
||||
34
trunk/paradiseo-mo/src/perturb/moRestartPerturb.h
Normal file
34
trunk/paradiseo-mo/src/perturb/moRestartPerturb.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
<moRestartPerturb.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 _moRestartPerturb_h
|
||||
#define _moRestartPerturb_h
|
||||
|
||||
|
||||
#endif
|
||||
43
trunk/paradiseo-mo/test/t-moILSexplorer.cpp
Normal file
43
trunk/paradiseo-mo/test/t-moILSexplorer.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
<t-moILSexplorer.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
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moILSexplorer] => START" << std::endl;
|
||||
|
||||
|
||||
std::cout << "[t-moILSexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -13,6 +13,7 @@ ADD_EXECUTABLE(testMetropolisHasting testMetropolisHasting.cpp)
|
|||
#ADD_EXECUTABLE(testWithMove testWithMove.cpp)
|
||||
ADD_EXECUTABLE(testSimpleTS testSimpleTS.cpp)
|
||||
ADD_EXECUTABLE(testRandomNeutralWalk testRandomNeutralWalk.cpp)
|
||||
ADD_EXECUTABLE(testILS testILS.cpp)
|
||||
|
||||
TARGET_LINK_LIBRARIES(testSimpleHC eoutils ga eo)
|
||||
TARGET_LINK_LIBRARIES(testFirstImpr eoutils ga eo)
|
||||
|
|
@ -22,6 +23,7 @@ TARGET_LINK_LIBRARIES(testHCneutral eoutils ga eo)
|
|||
TARGET_LINK_LIBRARIES(testMetropolisHasting eoutils ga eo)
|
||||
#TARGET_LINK_LIBRARIES(testWithMove eoutils ga eo)
|
||||
TARGET_LINK_LIBRARIES(testSimpleTS eoutils ga eo)
|
||||
TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo)
|
||||
TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo)
|
||||
TARGET_LINK_LIBRARIES(testILS eoutils ga eo)
|
||||
|
||||
|
||||
198
trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp
Normal file
198
trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
/** testILS.cpp
|
||||
*
|
||||
* SV - 12/01/10
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// 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;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// fitness function
|
||||
#include <funcOneMax.h>
|
||||
#include <eoInt.h>
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
#include <oneMaxBitNeighbor.h>
|
||||
|
||||
#include <eval/moFullEvalByModif.h>
|
||||
#include <eval/moFullEvalByCopy.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <algo/moLocalSearch.h>
|
||||
#include <explorer/moSimpleHCexplorer.h>
|
||||
#include <explorer/moILSexplorer.h>
|
||||
|
||||
// REPRESENTATION
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef eoBit<unsigned> Indi;
|
||||
typedef moBitNeighbor<unsigned int> Neighbor ; // incremental evaluation
|
||||
typedef moOrderNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
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();
|
||||
|
||||
// description of genotype
|
||||
eoValueParam<unsigned int> vecSizeParam(8, "vecSize", "Genotype size", 'V');
|
||||
parser.processParam( vecSizeParam, "Representation" );
|
||||
unsigned vecSize = vecSizeParam.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" );
|
||||
|
||||
// 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 aways get the same result, NOT a random run
|
||||
rng.reseed(seed);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* Eval fitness function
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
FuncOneMax<Indi> eval(vecSize);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* Initilisation of the solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
// a Indi random initializer
|
||||
eoUniformGenerator<bool> uGen;
|
||||
eoInitFixedLength<Indi> random(vecSize, uGen);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* evaluation of a neighbor solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
moFullEvalByModif<Neighbor> fulleval(eval);
|
||||
|
||||
//An eval by copy can be used instead of the eval by modif
|
||||
//moFullEvalByCopy<Neighbor> fulleval(eval);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* Comparator of neighbors
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
moNeighborComparator<Neighbor> comparator;
|
||||
moSolNeighborComparator<Neighbor> solComparator;
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* the neighborhood of a solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
Neighborhood neighborhood(vecSize);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* a neighborhood explorer solution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
moSimpleHCexplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator);
|
||||
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* the local search algorithm
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
moTrueContinuator<Neighborhood> continuator;//always continue
|
||||
|
||||
moLocalSearch< moSimpleHCexplorer<Neighborhood> > localSearch(explorer, continuator, eval);
|
||||
|
||||
/* =========================================================
|
||||
*
|
||||
* execute the local search from random sollution
|
||||
*
|
||||
* ========================================================= */
|
||||
|
||||
Indi solution;
|
||||
|
||||
random(solution);
|
||||
|
||||
//Can be eval here, else it will be done at the beginning of the localSearch
|
||||
//eval(solution);
|
||||
|
||||
std::cout << "initial: " << solution << std::endl ;
|
||||
|
||||
localSearch(solution);
|
||||
|
||||
std::cout << "final: " << solution << 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue