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 <moComparator.h>
|
||||
#include <moCoolingSchedule.h>
|
||||
#include <moExponentialCoolingSchedule.h>
|
||||
#include <moFirstImprSelect.h>
|
||||
#include <moFitComparator.h>
|
||||
#include <moFitSolContinue.h>
|
||||
#include <moGenSolContinue.h>
|
||||
#include <moGeometricCoolingSchedule.h>
|
||||
#include <moHC.h>
|
||||
#include <moHCMoveLoopExpl.h>
|
||||
#include <moILS.h>
|
||||
|
|
|
|||
|
|
@ -39,68 +39,75 @@
|
|||
|
||||
//! Description of an explorer
|
||||
/*!
|
||||
Only a description...See moMoveLoopExpl.
|
||||
This class allows to use any mutation object as a neighborhood.
|
||||
*/
|
||||
template < class EOT >
|
||||
class moExpl : public eoBF < const EOT &, EOT &, bool >
|
||||
{
|
||||
public:
|
||||
unsigned int i;
|
||||
|
||||
//Neighborhoods vector
|
||||
std::vector< eoMonOp<EOT>* > explore;
|
||||
|
||||
//! Generic constructor
|
||||
public:
|
||||
|
||||
//! Generic constructor
|
||||
/*!
|
||||
Generic constructor using a eoMonOp
|
||||
|
||||
\param _expl Algorithme or mutation.
|
||||
\param _explorer Algorithme or mutation.
|
||||
|
||||
*/
|
||||
moExpl(eoMonOp<EOT> & expl){
|
||||
i=0;
|
||||
explore.resize(0);
|
||||
add(expl);
|
||||
}
|
||||
|
||||
//! Generic constructor
|
||||
/*!
|
||||
Generic constructor using a eoMonOp
|
||||
|
||||
\param _expl Algorithme or mutation.
|
||||
|
||||
*/
|
||||
|
||||
//! Procedure which launches the moExpl.
|
||||
moExpl(eoMonOp<EOT> & _explorer): index(0)
|
||||
{
|
||||
explorers.clear();
|
||||
addExplorer(_explorer);
|
||||
}
|
||||
|
||||
//! Procedure which launches the moExpl.
|
||||
/*!
|
||||
The exploration starts from an old solution and provides a new solution.
|
||||
|
||||
|
||||
\param _old_solution The current solution.
|
||||
\param _new_solution The new solution (result of the procedure).
|
||||
*/
|
||||
|
||||
bool operator ()(const EOT & _old, EOT & _new){
|
||||
_new=(EOT)_old;
|
||||
return (*explore[i])(_new);
|
||||
}
|
||||
//add an algorithm or mutation to neighborhoods vector
|
||||
void add(eoMonOp<EOT> & expl){
|
||||
explore.push_back(&expl);
|
||||
}
|
||||
//setIndice make sur that the initial indice (_i) is not bigger than the explorer size.
|
||||
void setIndice(unsigned int _i){
|
||||
if( _i >= explore.size() ){
|
||||
std::cout << "[" << _i << "]" << std::endl;
|
||||
throw std::runtime_error("[moExpl.h]: bad index "+_i);
|
||||
}
|
||||
i=_i;
|
||||
}
|
||||
bool operator ()(const EOT & _old, EOT & _new)
|
||||
{
|
||||
_new=(EOT)_old;
|
||||
return (*explorers[index])(_new);
|
||||
}
|
||||
|
||||
//! Add an algorithm or mutation to neighborhoods vector
|
||||
void addExplorer(eoMonOp<EOT> & _new_explorer)
|
||||
{
|
||||
explorers.push_back(&_new_explorer);
|
||||
}
|
||||
|
||||
//! Procedure which modified the current explorer to use.
|
||||
/*!
|
||||
\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 size(){
|
||||
return explore.size();
|
||||
}
|
||||
unsigned int index;
|
||||
|
||||
//!Neighborhoods vector
|
||||
std::vector< eoMonOp<EOT>* > explorers;
|
||||
};
|
||||
|
||||
#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
|
||||
#define _moSA_h
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <moAlgo.h>
|
||||
#include <moRandMove.h>
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
#ifndef _moTA_h
|
||||
#define _moTA_h
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <moAlgo.h>
|
||||
#include <moRandMove.h>
|
||||
|
|
@ -45,9 +43,9 @@
|
|||
#include <moCoolingSchedule.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 >
|
||||
class moTA:public moAlgo < typename M::EOType >
|
||||
|
|
@ -63,20 +61,20 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
|
||||
//! 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 _incremental_evaluation The (generally) efficient evaluation function
|
||||
\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 _full_evaluation The full evaluation function.
|
||||
*/
|
||||
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):
|
||||
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)
|
||||
{}
|
||||
|
||||
|
|
@ -91,7 +89,7 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
{
|
||||
Fitness incremental_fitness, delta_fit;
|
||||
EOT best_solution;
|
||||
double threeshold;
|
||||
double threshold;
|
||||
M move;
|
||||
|
||||
if (_solution.invalid())
|
||||
|
|
@ -99,7 +97,7 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
full_evaluation (_solution);
|
||||
}
|
||||
|
||||
threeshold = initial_threeshold;
|
||||
threshold = initial_threshold;
|
||||
|
||||
best_solution = _solution;
|
||||
|
||||
|
|
@ -115,7 +113,7 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
|
||||
delta_fit = incremental_fitness - _solution.fitness ();
|
||||
|
||||
if ( threeshold > delta_fit)
|
||||
if ( threshold > delta_fit)
|
||||
|
||||
{
|
||||
move(_solution);
|
||||
|
|
@ -131,7 +129,7 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
}
|
||||
while ( continu (_solution));
|
||||
}
|
||||
while ( cooling_schedule (threeshold) );
|
||||
while ( cooling_schedule (threshold) );
|
||||
|
||||
_solution = best_solution;
|
||||
|
||||
|
|
@ -146,11 +144,11 @@ class moTA:public moAlgo < typename M::EOType >
|
|||
//! A (generally) efficient evaluation function.
|
||||
moMoveIncrEval < M > & incremental_evaluation;
|
||||
|
||||
//! Stopping criterion before threeshold update
|
||||
//! Stopping criterion before threshold update
|
||||
moSolContinue < EOT > & continu;
|
||||
|
||||
//! Initial temperature
|
||||
double initial_threeshold;
|
||||
double initial_threshold;
|
||||
|
||||
//! The cooling schedule
|
||||
moCoolingSchedule & cooling_schedule;
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@
|
|||
#ifndef _moVNS_h
|
||||
#define _moVNS_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eo>
|
||||
#include <mo>
|
||||
#include <moAlgo.h>
|
||||
|
||||
//! Variable Neighbors Search (VNS)
|
||||
/*!
|
||||
|
|
@ -48,70 +46,86 @@
|
|||
template < class EOT>
|
||||
class moVNS : public moAlgo < EOT>
|
||||
{
|
||||
//! Alias for the fitness.
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
//! Alias for the fitness.
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
//! Generic constructor
|
||||
//! Generic constructor
|
||||
/*!
|
||||
Generic constructor using a moExpl
|
||||
|
||||
\param _explorer Vector of Neighborhoods.
|
||||
\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.
|
||||
|
||||
\param _solution a current solution to improve.
|
||||
\return true.
|
||||
*/
|
||||
bool operator()(EOT & _solution)
|
||||
{
|
||||
bool change;
|
||||
unsigned int i;
|
||||
|
||||
bool operator()(EOT & _solution) {
|
||||
bool change=false;
|
||||
int i = 0;
|
||||
EOT solution_prime, solution_second;
|
||||
EOT solution_initial=_solution;
|
||||
|
||||
EOT solution_initial=_solution;
|
||||
EOT solution_prime, solution_second;
|
||||
change=false;
|
||||
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()) {
|
||||
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) {
|
||||
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;
|
||||
//!The full evaluation function
|
||||
eoEvalFunc<EOT> & full_evaluation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,31 +31,31 @@ LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MO_BINARY_DIR}/lib)
|
|||
######################################################################################
|
||||
|
||||
SET (TEST_LIST t-moBestImprSelect
|
||||
t-moExponentialCoolingSchedule
|
||||
t-moFirstImprSelect
|
||||
t-moFitComparator
|
||||
t-moFitSolContinue
|
||||
t-moGenSolContinue
|
||||
t-moHC
|
||||
t-moHC_2
|
||||
t-moHCMoveLoopExpl
|
||||
t-moILS
|
||||
t-moILS_HC
|
||||
t-moILS_TS
|
||||
t-moILS_SA
|
||||
t-moImprBestFitAspirCrit
|
||||
t-moItRandNextMove
|
||||
t-moFirstImprSelect
|
||||
t-moFitComparator
|
||||
t-moFitSolContinue
|
||||
t-moGenSolContinue
|
||||
t-moGeometricCoolingSchedule
|
||||
t-moHC
|
||||
t-moHC_2
|
||||
t-moHCMoveLoopExpl
|
||||
t-moILS
|
||||
t-moILS_HC
|
||||
t-moILS_TS
|
||||
t-moILS_SA
|
||||
t-moImprBestFitAspirCrit
|
||||
t-moItRandNextMove
|
||||
t-moLinearCoolingSchedule
|
||||
t-moLSCheckPoint
|
||||
t-moNoAspirCrit
|
||||
t-moNoFitImprSolContinue
|
||||
t-moRandImprSelect
|
||||
t-moSA
|
||||
t-moSimpleMoveTabuList
|
||||
t-moSimpleSolutionTabuList
|
||||
t-moLSCheckPoint
|
||||
t-moNoAspirCrit
|
||||
t-moNoFitImprSolContinue
|
||||
t-moRandImprSelect
|
||||
t-moSA
|
||||
t-moSimpleMoveTabuList
|
||||
t-moSimpleSolutionTabuList
|
||||
t-moSteadyFitSolContinue
|
||||
t-moTS
|
||||
t-moTS_2
|
||||
t-moTS
|
||||
t-moTS_2
|
||||
t-moTSMoveLoopExpl
|
||||
t-moTA
|
||||
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()
|
||||
{
|
||||
std::string test_result;
|
||||
int return_value;
|
||||
|
||||
//solution solution;
|
||||
Route so ;
|
||||
|
|
@ -120,7 +119,7 @@ main()
|
|||
Voisinage sol1;
|
||||
Voisinage sol2;
|
||||
Explorer explorer(sol1);
|
||||
explorer.add(sol2);
|
||||
explorer.addExplorer(sol2);
|
||||
solutionEval eval;
|
||||
|
||||
moVNS<Route> vns(explorer, eval);
|
||||
|
|
@ -135,7 +134,7 @@ main()
|
|||
|
||||
cout << "OK" << endl;
|
||||
|
||||
return EXIT_SUCCESS; //return_value;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ main (int _argc, char* _argv [])
|
|||
{
|
||||
std::string instancePath, value;
|
||||
unsigned int seed, maxIterations;
|
||||
double threshold, exponentialRatio, linearRatio, initialTemperature;
|
||||
double threshold, geometricRatio, linearRatio, initialTemperature;
|
||||
|
||||
eoParser parser(_argc, _argv);
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ main (int _argc, char* _argv [])
|
|||
maxIterations=atoi( (parser.getParamWithLongName("maxIter")->getValue()).c_str() );
|
||||
initialTemperature=atof( (parser.getParamWithLongName("initialTemp")->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() );
|
||||
value=parser.getParamWithLongName("coolSchedType")->getValue();
|
||||
|
||||
|
|
@ -83,9 +83,9 @@ main (int _argc, char* _argv [])
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
@ -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.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(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);
|
||||
|
||||
if (_parser.userNeedsHelp())
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ main (int _argc, char* _argv [])
|
|||
//-----------neighbor vector--------------------------
|
||||
|
||||
moExpl<Route> explorer(perturbation);
|
||||
explorer.add(hill_climbing);
|
||||
explorer.add(perturbation);
|
||||
explorer.addExplorer(hill_climbing);
|
||||
explorer.addExplorer(perturbation);
|
||||
|
||||
//------------VNS application--------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue