Des modif...
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1359 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
b75d71e073
commit
c4655544c4
11 changed files with 165 additions and 307 deletions
|
|
@ -41,11 +41,11 @@
|
||||||
#include <moBestImprSelect.h>
|
#include <moBestImprSelect.h>
|
||||||
#include <moComparator.h>
|
#include <moComparator.h>
|
||||||
#include <moCoolingSchedule.h>
|
#include <moCoolingSchedule.h>
|
||||||
#include <moExponentialCoolingSchedule.h>
|
|
||||||
#include <moFirstImprSelect.h>
|
#include <moFirstImprSelect.h>
|
||||||
#include <moFitComparator.h>
|
#include <moFitComparator.h>
|
||||||
#include <moFitSolContinue.h>
|
#include <moFitSolContinue.h>
|
||||||
#include <moGenSolContinue.h>
|
#include <moGenSolContinue.h>
|
||||||
|
#include <moGeometricCoolingSchedule.h>
|
||||||
#include <moHC.h>
|
#include <moHC.h>
|
||||||
#include <moHCMoveLoopExpl.h>
|
#include <moHCMoveLoopExpl.h>
|
||||||
#include <moILS.h>
|
#include <moILS.h>
|
||||||
|
|
|
||||||
|
|
@ -39,68 +39,75 @@
|
||||||
|
|
||||||
//! Description of an explorer
|
//! Description of an explorer
|
||||||
/*!
|
/*!
|
||||||
Only a description...See moMoveLoopExpl.
|
This class allows to use any mutation object as a neighborhood.
|
||||||
*/
|
*/
|
||||||
template < class EOT >
|
template < class EOT >
|
||||||
class moExpl : public eoBF < const EOT &, EOT &, bool >
|
class moExpl : public eoBF < const EOT &, EOT &, bool >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unsigned int i;
|
|
||||||
|
//! Generic constructor
|
||||||
//Neighborhoods vector
|
|
||||||
std::vector< eoMonOp<EOT>* > explore;
|
|
||||||
|
|
||||||
//! Generic constructor
|
|
||||||
/*!
|
/*!
|
||||||
Generic constructor using a eoMonOp
|
Generic constructor using a eoMonOp
|
||||||
|
|
||||||
\param _expl Algorithme or mutation.
|
\param _explorer Algorithme or mutation.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moExpl(eoMonOp<EOT> & expl){
|
moExpl(eoMonOp<EOT> & _explorer): index(0)
|
||||||
i=0;
|
{
|
||||||
explore.resize(0);
|
explorers.clear();
|
||||||
add(expl);
|
addExplorer(_explorer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Generic constructor
|
//! Procedure which launches the moExpl.
|
||||||
/*!
|
|
||||||
Generic constructor using a eoMonOp
|
|
||||||
|
|
||||||
\param _expl Algorithme or mutation.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Procedure which launches the moExpl.
|
|
||||||
/*!
|
/*!
|
||||||
The exploration starts from an old solution and provides a new solution.
|
The exploration starts from an old solution and provides a new solution.
|
||||||
|
|
||||||
\param _old_solution The current solution.
|
\param _old_solution The current solution.
|
||||||
\param _new_solution The new solution (result of the procedure).
|
\param _new_solution The new solution (result of the procedure).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool operator ()(const EOT & _old, EOT & _new){
|
bool operator ()(const EOT & _old, EOT & _new)
|
||||||
_new=(EOT)_old;
|
{
|
||||||
return (*explore[i])(_new);
|
_new=(EOT)_old;
|
||||||
}
|
return (*explorers[index])(_new);
|
||||||
//add an algorithm or mutation to neighborhoods vector
|
}
|
||||||
void add(eoMonOp<EOT> & expl){
|
|
||||||
explore.push_back(&expl);
|
//! Add an algorithm or mutation to neighborhoods vector
|
||||||
}
|
void addExplorer(eoMonOp<EOT> & _new_explorer)
|
||||||
//setIndice make sur that the initial indice (_i) is not bigger than the explorer size.
|
{
|
||||||
void setIndice(unsigned int _i){
|
explorers.push_back(&_new_explorer);
|
||||||
if( _i >= explore.size() ){
|
}
|
||||||
std::cout << "[" << _i << "]" << std::endl;
|
|
||||||
throw std::runtime_error("[moExpl.h]: bad index "+_i);
|
//! Procedure which modified the current explorer to use.
|
||||||
}
|
/*!
|
||||||
i=_i;
|
\param _index Index of the explorer to use.
|
||||||
}
|
*/
|
||||||
|
void setCurrentExplorer(unsigned int _index)
|
||||||
|
{
|
||||||
|
if( _index >= explorers.size() )
|
||||||
|
{
|
||||||
|
std::cout << "[" << _index << "]" << std::endl;
|
||||||
|
throw std::runtime_error("[moExpl.h]: bad index "+_index);
|
||||||
|
}
|
||||||
|
index=_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Function which returns the number of explorers already saved.
|
||||||
|
/*!
|
||||||
|
\return The number of explorers contained in the moExpl.
|
||||||
|
*/
|
||||||
|
unsigned int getExplorerNumber()
|
||||||
|
{
|
||||||
|
return explorers.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
private :
|
||||||
|
|
||||||
//return the size of the class
|
unsigned int index;
|
||||||
unsigned int size(){
|
|
||||||
return explore.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//!Neighborhoods vector
|
||||||
|
std::vector< eoMonOp<EOT>* > explorers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
<moExponentialCoolingSchedule.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)
|
|
||||||
|
|
||||||
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 _moExponentialCoolingSchedule_h
|
|
||||||
#define _moExponentialCoolingSchedule_h
|
|
||||||
|
|
||||||
#include <moCoolingSchedule.h>
|
|
||||||
|
|
||||||
//! One of the possible moCoolingSchedule
|
|
||||||
/*!
|
|
||||||
An other very simple cooling schedule, the temperature decrease according to a ratio while
|
|
||||||
the temperature is greater than a given threshold.
|
|
||||||
*/
|
|
||||||
class moExponentialCoolingSchedule: public moCoolingSchedule
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Simple constructor
|
|
||||||
/*!
|
|
||||||
\param _threshold the threshold.
|
|
||||||
\param _ratio the ratio used to descrease the temperature.
|
|
||||||
*/
|
|
||||||
moExponentialCoolingSchedule (double _threshold, double _ratio):threshold (_threshold), ratio (_ratio)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! Function which proceeds to the cooling.
|
|
||||||
/*!
|
|
||||||
It decreases the temperature and indicates if it is greater than the threshold.
|
|
||||||
|
|
||||||
\param _temperature the current temperature.
|
|
||||||
\return if the new temperature (current temperature * ratio) is greater than the threshold.
|
|
||||||
*/
|
|
||||||
bool operator() (double & _temperature)
|
|
||||||
{
|
|
||||||
return (_temperature *= ratio) > threshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//! The temperature threhold.
|
|
||||||
double threshold;
|
|
||||||
|
|
||||||
//! The decreasing factor of the temperature.
|
|
||||||
double ratio;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
#ifndef _moSA_h
|
#ifndef _moSA_h
|
||||||
#define _moSA_h
|
#define _moSA_h
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <eoEvalFunc.h>
|
#include <eoEvalFunc.h>
|
||||||
#include <moAlgo.h>
|
#include <moAlgo.h>
|
||||||
#include <moRandMove.h>
|
#include <moRandMove.h>
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@
|
||||||
#ifndef _moTA_h
|
#ifndef _moTA_h
|
||||||
#define _moTA_h
|
#define _moTA_h
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <eoEvalFunc.h>
|
#include <eoEvalFunc.h>
|
||||||
#include <moAlgo.h>
|
#include <moAlgo.h>
|
||||||
#include <moRandMove.h>
|
#include <moRandMove.h>
|
||||||
|
|
@ -45,9 +43,9 @@
|
||||||
#include <moCoolingSchedule.h>
|
#include <moCoolingSchedule.h>
|
||||||
#include <moSolContinue.h>
|
#include <moSolContinue.h>
|
||||||
|
|
||||||
//! Threeshol Accepting (TA)
|
//! Threshold Accepting (TA)
|
||||||
/*!
|
/*!
|
||||||
Class that describes a Threeshol Accepting algorithm.
|
Class that describes a Threshold Accepting algorithm.
|
||||||
*/
|
*/
|
||||||
template < class M >
|
template < class M >
|
||||||
class moTA:public moAlgo < typename M::EOType >
|
class moTA:public moAlgo < typename M::EOType >
|
||||||
|
|
@ -63,20 +61,20 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
|
|
||||||
//! TA constructor
|
//! TA constructor
|
||||||
/*!
|
/*!
|
||||||
All the boxes used by a SA need to be given.
|
All the boxes used by a TA need to be given. It is equivalent to a SA object.
|
||||||
|
|
||||||
\param _random_move_generator The move generator (generally randomly).
|
\param _random_move_generator The move generator (generally randomly).
|
||||||
\param _incremental_evaluation The (generally) efficient evaluation function
|
\param _incremental_evaluation The (generally) efficient evaluation function
|
||||||
\param _continue The stopping criterion.
|
\param _continue The stopping criterion.
|
||||||
\param _initial_threeshold The initial threeshold.
|
\param _initial_threshold The initial threshold.
|
||||||
\param _cooling_schedule The cooling schedule, describes how the temperature is modified.
|
\param _cooling_schedule The cooling schedule, describes how the temperature is modified.
|
||||||
\param _full_evaluation The full evaluation function.
|
\param _full_evaluation The full evaluation function.
|
||||||
*/
|
*/
|
||||||
moTA (moRandMove < M > & _random_move_generator, moMoveIncrEval < M > & _incremental_evaluation,
|
moTA (moRandMove < M > & _random_move_generator, moMoveIncrEval < M > & _incremental_evaluation,
|
||||||
moSolContinue < EOT > & _continue, double _initial_threeshold, moCoolingSchedule & _cooling_schedule,
|
moSolContinue < EOT > & _continue, double _initial_threshold, moCoolingSchedule & _cooling_schedule,
|
||||||
eoEvalFunc < EOT > & _full_evaluation):
|
eoEvalFunc < EOT > & _full_evaluation):
|
||||||
random_move_generator(_random_move_generator), incremental_evaluation(_incremental_evaluation),
|
random_move_generator(_random_move_generator), incremental_evaluation(_incremental_evaluation),
|
||||||
continu(_continue), initial_threeshold(_initial_threeshold),
|
continu(_continue), initial_threshold(_initial_threshold),
|
||||||
cooling_schedule(_cooling_schedule), full_evaluation(_full_evaluation)
|
cooling_schedule(_cooling_schedule), full_evaluation(_full_evaluation)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
@ -91,7 +89,7 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
{
|
{
|
||||||
Fitness incremental_fitness, delta_fit;
|
Fitness incremental_fitness, delta_fit;
|
||||||
EOT best_solution;
|
EOT best_solution;
|
||||||
double threeshold;
|
double threshold;
|
||||||
M move;
|
M move;
|
||||||
|
|
||||||
if (_solution.invalid())
|
if (_solution.invalid())
|
||||||
|
|
@ -99,7 +97,7 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
full_evaluation (_solution);
|
full_evaluation (_solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
threeshold = initial_threeshold;
|
threshold = initial_threshold;
|
||||||
|
|
||||||
best_solution = _solution;
|
best_solution = _solution;
|
||||||
|
|
||||||
|
|
@ -115,7 +113,7 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
|
|
||||||
delta_fit = incremental_fitness - _solution.fitness ();
|
delta_fit = incremental_fitness - _solution.fitness ();
|
||||||
|
|
||||||
if ( threeshold > delta_fit)
|
if ( threshold > delta_fit)
|
||||||
|
|
||||||
{
|
{
|
||||||
move(_solution);
|
move(_solution);
|
||||||
|
|
@ -131,7 +129,7 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
}
|
}
|
||||||
while ( continu (_solution));
|
while ( continu (_solution));
|
||||||
}
|
}
|
||||||
while ( cooling_schedule (threeshold) );
|
while ( cooling_schedule (threshold) );
|
||||||
|
|
||||||
_solution = best_solution;
|
_solution = best_solution;
|
||||||
|
|
||||||
|
|
@ -146,11 +144,11 @@ class moTA:public moAlgo < typename M::EOType >
|
||||||
//! A (generally) efficient evaluation function.
|
//! A (generally) efficient evaluation function.
|
||||||
moMoveIncrEval < M > & incremental_evaluation;
|
moMoveIncrEval < M > & incremental_evaluation;
|
||||||
|
|
||||||
//! Stopping criterion before threeshold update
|
//! Stopping criterion before threshold update
|
||||||
moSolContinue < EOT > & continu;
|
moSolContinue < EOT > & continu;
|
||||||
|
|
||||||
//! Initial temperature
|
//! Initial temperature
|
||||||
double initial_threeshold;
|
double initial_threshold;
|
||||||
|
|
||||||
//! The cooling schedule
|
//! The cooling schedule
|
||||||
moCoolingSchedule & cooling_schedule;
|
moCoolingSchedule & cooling_schedule;
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@
|
||||||
#ifndef _moVNS_h
|
#ifndef _moVNS_h
|
||||||
#define _moVNS_h
|
#define _moVNS_h
|
||||||
|
|
||||||
#include <eoEvalFunc.h>
|
#include <moAlgo.h>
|
||||||
#include <eo>
|
|
||||||
#include <mo>
|
|
||||||
|
|
||||||
//! Variable Neighbors Search (VNS)
|
//! Variable Neighbors Search (VNS)
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -48,70 +46,86 @@
|
||||||
template < class EOT>
|
template < class EOT>
|
||||||
class moVNS : public moAlgo < EOT>
|
class moVNS : public moAlgo < EOT>
|
||||||
{
|
{
|
||||||
//! Alias for the fitness.
|
//! Alias for the fitness.
|
||||||
typedef typename EOT::Fitness Fitness;
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Generic constructor
|
//! Generic constructor
|
||||||
/*!
|
/*!
|
||||||
Generic constructor using a moExpl
|
Generic constructor using a moExpl
|
||||||
|
|
||||||
\param _explorer Vector of Neighborhoods.
|
\param _explorer Vector of Neighborhoods.
|
||||||
\param _full_evaluation The evaluation function.
|
\param _full_evaluation The evaluation function.
|
||||||
*/
|
*/
|
||||||
|
moVNS(moExpl< EOT> & _explorer, eoEvalFunc < EOT> & _full_evaluation): explorer(_explorer), full_evaluation(_full_evaluation) {}
|
||||||
moVNS(moExpl< EOT> & _explorer, eoEvalFunc < EOT> & _full_evaluation): explorer(_explorer), full_evaluation(_full_evaluation) {}
|
|
||||||
|
|
||||||
|
|
||||||
//! Function which launches the VNS
|
//! Function which launches the VNS
|
||||||
/*!
|
/*!
|
||||||
The VNS has to improve a current solution.
|
The VNS has to improve a current solution.
|
||||||
|
|
||||||
\param _solution a current solution to improve.
|
\param _solution a current solution to improve.
|
||||||
\return true.
|
\return true.
|
||||||
*/
|
*/
|
||||||
|
bool operator()(EOT & _solution)
|
||||||
|
{
|
||||||
|
bool change;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
bool operator()(EOT & _solution) {
|
EOT solution_prime, solution_second;
|
||||||
bool change=false;
|
EOT solution_initial=_solution;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
EOT solution_initial=_solution;
|
change=false;
|
||||||
EOT solution_prime, solution_second;
|
i=0;
|
||||||
|
explorer.setCurrentExplorer(i);
|
||||||
|
|
||||||
|
while( i<explorer.getExplorerNumber() )
|
||||||
|
{
|
||||||
|
solution_prime=solution_initial;
|
||||||
|
if(solution_prime.invalid())
|
||||||
|
{
|
||||||
|
full_evaluation(solution_prime);
|
||||||
|
}
|
||||||
|
|
||||||
|
explorer(solution_prime, solution_second);
|
||||||
|
|
||||||
|
if( solution_second.invalid() )
|
||||||
|
{
|
||||||
|
full_evaluation(solution_second);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( solution_second > solution_initial )
|
||||||
|
{
|
||||||
|
solution_initial=solution_second;
|
||||||
|
change=true;
|
||||||
|
if(i!= 0)
|
||||||
|
{
|
||||||
|
i=0;
|
||||||
|
explorer.setCurrentExplorer(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if( i<explorer.getExplorerNumber() )
|
||||||
|
{
|
||||||
|
explorer.setCurrentExplorer(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_solution=solution_initial;
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
explorer.setIndice(i);
|
private:
|
||||||
|
|
||||||
|
//!Neighborhoods vector
|
||||||
|
moExpl<EOT> & explorer;
|
||||||
|
|
||||||
while(i<explorer.size()) {
|
//!The full evaluation function
|
||||||
solution_prime=solution_initial;
|
eoEvalFunc<EOT> & full_evaluation;
|
||||||
if(solution_prime.invalid())
|
|
||||||
full_evaluation(solution_prime);
|
|
||||||
explorer(solution_prime, solution_second);
|
|
||||||
if(solution_second.invalid())
|
|
||||||
full_evaluation(solution_second);
|
|
||||||
if(solution_second > solution_initial) {
|
|
||||||
solution_initial=solution_second;
|
|
||||||
change=true;
|
|
||||||
if(i!= 0) {
|
|
||||||
explorer.setIndice(0);
|
|
||||||
i=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
if(i<explorer.size())
|
|
||||||
explorer.setIndice(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_solution=solution_initial;
|
|
||||||
return change;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//Neighborhoods vector
|
|
||||||
moExpl<EOT> & explorer;
|
|
||||||
//The full evaluation function
|
|
||||||
eoEvalFunc<EOT> & full_evaluation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,31 +31,31 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MO_BINARY_DIR}/lib)
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
SET (TEST_LIST t-moBestImprSelect
|
SET (TEST_LIST t-moBestImprSelect
|
||||||
t-moExponentialCoolingSchedule
|
t-moFirstImprSelect
|
||||||
t-moFirstImprSelect
|
t-moFitComparator
|
||||||
t-moFitComparator
|
t-moFitSolContinue
|
||||||
t-moFitSolContinue
|
t-moGenSolContinue
|
||||||
t-moGenSolContinue
|
t-moGeometricCoolingSchedule
|
||||||
t-moHC
|
t-moHC
|
||||||
t-moHC_2
|
t-moHC_2
|
||||||
t-moHCMoveLoopExpl
|
t-moHCMoveLoopExpl
|
||||||
t-moILS
|
t-moILS
|
||||||
t-moILS_HC
|
t-moILS_HC
|
||||||
t-moILS_TS
|
t-moILS_TS
|
||||||
t-moILS_SA
|
t-moILS_SA
|
||||||
t-moImprBestFitAspirCrit
|
t-moImprBestFitAspirCrit
|
||||||
t-moItRandNextMove
|
t-moItRandNextMove
|
||||||
t-moLinearCoolingSchedule
|
t-moLinearCoolingSchedule
|
||||||
t-moLSCheckPoint
|
t-moLSCheckPoint
|
||||||
t-moNoAspirCrit
|
t-moNoAspirCrit
|
||||||
t-moNoFitImprSolContinue
|
t-moNoFitImprSolContinue
|
||||||
t-moRandImprSelect
|
t-moRandImprSelect
|
||||||
t-moSA
|
t-moSA
|
||||||
t-moSimpleMoveTabuList
|
t-moSimpleMoveTabuList
|
||||||
t-moSimpleSolutionTabuList
|
t-moSimpleSolutionTabuList
|
||||||
t-moSteadyFitSolContinue
|
t-moSteadyFitSolContinue
|
||||||
t-moTS
|
t-moTS
|
||||||
t-moTS_2
|
t-moTS_2
|
||||||
t-moTSMoveLoopExpl
|
t-moTSMoveLoopExpl
|
||||||
t-moTA
|
t-moTA
|
||||||
t-moVNS
|
t-moVNS
|
||||||
|
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
* <t-moExponentialCoolingSchedule.cpp>
|
|
||||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
|
||||||
* (C) OPAC Team, LIFL, 2002-2008
|
|
||||||
*
|
|
||||||
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
|
|
||||||
*
|
|
||||||
* This software is governed by the CeCILL license under French law and
|
|
||||||
* abiding by the rules of distribution of free software. You can use,
|
|
||||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
|
||||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
|
||||||
* "http://www.cecill.info".
|
|
||||||
*
|
|
||||||
* As a counterpart to the access to the source code and rights to copy,
|
|
||||||
* modify and redistribute granted by the license, users are provided only
|
|
||||||
* with a limited warranty and the software's author, the holder of the
|
|
||||||
* economic rights, and the successive licensors have only limited liability.
|
|
||||||
*
|
|
||||||
* In this respect, the user's attention is drawn to the risks associated
|
|
||||||
* with loading, using, modifying and/or developing or reproducing the
|
|
||||||
* software by the user in light of its specific status of free software,
|
|
||||||
* that may mean that it is complicated to manipulate, and that also
|
|
||||||
* therefore means that it is reserved for developers and experienced
|
|
||||||
* professionals having in-depth computer knowledge. Users are therefore
|
|
||||||
* encouraged to load and test the software's suitability as regards their
|
|
||||||
* requirements in conditions enabling the security of their systems and/or
|
|
||||||
* data to be ensured and, more generally, to use and operate it in the
|
|
||||||
* same conditions as regards security.
|
|
||||||
* The fact that you are presently reading this means that you have had
|
|
||||||
* knowledge of the CeCILL license and that you accept its terms.
|
|
||||||
*
|
|
||||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
|
||||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// t-moExponentialCoolingSchedule.cpp
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <eo> // EO
|
|
||||||
#include <mo> // MO
|
|
||||||
|
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
int return_value;
|
|
||||||
std::string test_result;
|
|
||||||
|
|
||||||
unsigned int i;
|
|
||||||
double temperature;
|
|
||||||
|
|
||||||
moExponentialCoolingSchedule coolingSchedule( 4.0, 0.5 );
|
|
||||||
|
|
||||||
temperature=10.0;
|
|
||||||
|
|
||||||
cout << "[ moExponentialCoolingSchedule ] ==> ";
|
|
||||||
|
|
||||||
i=0;
|
|
||||||
while( coolingSchedule(temperature) )
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
test_result=((i!=1)?"KO":"OK");
|
|
||||||
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
|
|
||||||
|
|
||||||
cout << test_result << endl;
|
|
||||||
return return_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
@ -112,7 +112,6 @@ int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
std::string test_result;
|
std::string test_result;
|
||||||
int return_value;
|
|
||||||
|
|
||||||
//solution solution;
|
//solution solution;
|
||||||
Route so ;
|
Route so ;
|
||||||
|
|
@ -120,7 +119,7 @@ main()
|
||||||
Voisinage sol1;
|
Voisinage sol1;
|
||||||
Voisinage sol2;
|
Voisinage sol2;
|
||||||
Explorer explorer(sol1);
|
Explorer explorer(sol1);
|
||||||
explorer.add(sol2);
|
explorer.addExplorer(sol2);
|
||||||
solutionEval eval;
|
solutionEval eval;
|
||||||
|
|
||||||
moVNS<Route> vns(explorer, eval);
|
moVNS<Route> vns(explorer, eval);
|
||||||
|
|
@ -135,7 +134,7 @@ main()
|
||||||
|
|
||||||
cout << "OK" << endl;
|
cout << "OK" << endl;
|
||||||
|
|
||||||
return EXIT_SUCCESS; //return_value;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ main (int _argc, char* _argv [])
|
||||||
{
|
{
|
||||||
std::string instancePath, value;
|
std::string instancePath, value;
|
||||||
unsigned int seed, maxIterations;
|
unsigned int seed, maxIterations;
|
||||||
double threshold, exponentialRatio, linearRatio, initialTemperature;
|
double threshold, geometricRatio, linearRatio, initialTemperature;
|
||||||
|
|
||||||
eoParser parser(_argc, _argv);
|
eoParser parser(_argc, _argv);
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ main (int _argc, char* _argv [])
|
||||||
maxIterations=atoi( (parser.getParamWithLongName("maxIter")->getValue()).c_str() );
|
maxIterations=atoi( (parser.getParamWithLongName("maxIter")->getValue()).c_str() );
|
||||||
initialTemperature=atof( (parser.getParamWithLongName("initialTemp")->getValue()).c_str() );
|
initialTemperature=atof( (parser.getParamWithLongName("initialTemp")->getValue()).c_str() );
|
||||||
threshold=atof( (parser.getParamWithLongName("threshold")->getValue()).c_str() );
|
threshold=atof( (parser.getParamWithLongName("threshold")->getValue()).c_str() );
|
||||||
exponentialRatio=atof( (parser.getParamWithLongName("expoRatio")->getValue()).c_str() );
|
geometricRatio=atof( (parser.getParamWithLongName("geometricRatio")->getValue()).c_str() );
|
||||||
linearRatio=atof( (parser.getParamWithLongName("lineaRatio")->getValue()).c_str() );
|
linearRatio=atof( (parser.getParamWithLongName("lineaRatio")->getValue()).c_str() );
|
||||||
value=parser.getParamWithLongName("coolSchedType")->getValue();
|
value=parser.getParamWithLongName("coolSchedType")->getValue();
|
||||||
|
|
||||||
|
|
@ -83,9 +83,9 @@ main (int _argc, char* _argv [])
|
||||||
|
|
||||||
moCoolingSchedule* coolingSchedule;
|
moCoolingSchedule* coolingSchedule;
|
||||||
|
|
||||||
if(value.compare("Expo")==0)
|
if(value.compare("Geometric")==0)
|
||||||
{
|
{
|
||||||
coolingSchedule=new moExponentialCoolingSchedule(threshold, exponentialRatio);
|
coolingSchedule=new moGeometricCoolingSchedule(threshold, geometricRatio);
|
||||||
}
|
}
|
||||||
else if (value.compare("Linear")==0)
|
else if (value.compare("Linear")==0)
|
||||||
{
|
{
|
||||||
|
|
@ -125,11 +125,11 @@ manage_configuration_file(eoParser & _parser)
|
||||||
|
|
||||||
_parser.getORcreateParam((double)0.1, "threshold", "Minimum temperature allowed.", 0, "Configuration", false);
|
_parser.getORcreateParam((double)0.1, "threshold", "Minimum temperature allowed.", 0, "Configuration", false);
|
||||||
|
|
||||||
_parser.getORcreateParam((double)0.98, "expoRatio", "Ratio used if exponential cooling schedule is chosen.", 0, "Configuration", false);
|
_parser.getORcreateParam((double)0.98, "geometricRatio", "Ratio used if exponential cooling schedule is chosen.", 0, "Configuration", false);
|
||||||
|
|
||||||
_parser.getORcreateParam((double)0.5, "lineaRatio", "Ratio used if linear cooling schedule is chosen.", 0, "Configuration", false);
|
_parser.getORcreateParam((double)0.5, "lineaRatio", "Ratio used if linear cooling schedule is chosen.", 0, "Configuration", false);
|
||||||
|
|
||||||
_parser.getORcreateParam(std::string("Expo"), "coolSchedType", "Type the cooling schedule: 'Expo' or 'Linear'.",
|
_parser.getORcreateParam(std::string("Geometric"), "coolSchedType", "Type the cooling schedule: 'Geometric' or 'Linear'.",
|
||||||
0, "Configuration", false);
|
0, "Configuration", false);
|
||||||
|
|
||||||
if (_parser.userNeedsHelp())
|
if (_parser.userNeedsHelp())
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ main (int _argc, char* _argv [])
|
||||||
//-----------neighbor vector--------------------------
|
//-----------neighbor vector--------------------------
|
||||||
|
|
||||||
moExpl<Route> explorer(perturbation);
|
moExpl<Route> explorer(perturbation);
|
||||||
explorer.add(hill_climbing);
|
explorer.addExplorer(hill_climbing);
|
||||||
explorer.add(perturbation);
|
explorer.addExplorer(perturbation);
|
||||||
|
|
||||||
//------------VNS application--------------------------
|
//------------VNS application--------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue