New style for MO
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@787 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
47298125ec
commit
7161febf9c
80 changed files with 2014 additions and 2038 deletions
|
|
@ -44,8 +44,6 @@
|
||||||
moHC, moTS and moSA are 3 examples of algorithm of the paradiseo-mo library.
|
moHC, moTS and moSA are 3 examples of algorithm of the paradiseo-mo library.
|
||||||
*/
|
*/
|
||||||
template < class EOT > class moAlgo:public eoMonOp < EOT >
|
template < class EOT > class moAlgo:public eoMonOp < EOT >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@
|
||||||
*/
|
*/
|
||||||
template<class EOT>
|
template<class EOT>
|
||||||
class moComparator: public eoBF<const EOT&, const EOT&, bool>
|
class moComparator: public eoBF<const EOT&, const EOT&, bool>
|
||||||
{
|
{};
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@
|
||||||
See moExponentialCoolingSchedule or moLinearCoolingSchedule for example.
|
See moExponentialCoolingSchedule or moLinearCoolingSchedule for example.
|
||||||
*/
|
*/
|
||||||
class moCoolingSchedule:public eoUF < double &, bool >
|
class moCoolingSchedule:public eoUF < double &, bool >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,7 @@ public:
|
||||||
\param __maxNumGen the maximum number of generation.
|
\param __maxNumGen the maximum number of generation.
|
||||||
*/
|
*/
|
||||||
moGenSolContinue (unsigned int __maxNumGen):maxNumGen (__maxNumGen), numGen (0)
|
moGenSolContinue (unsigned int __maxNumGen):maxNumGen (__maxNumGen), numGen (0)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Function that activates the stop criterion.
|
//! Function that activates the stop criterion.
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,7 @@ public:
|
||||||
moHC (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moMoveSelect < M > &__move_select, eoEvalFunc < EOT > &__full_eval):move_expl (*new moHCMoveLoopExpl < M >
|
moHC (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moMoveSelect < M > &__move_select, eoEvalFunc < EOT > &__full_eval):move_expl (*new moHCMoveLoopExpl < M >
|
||||||
(__move_init, __next_move, __incr_eval, __move_select)),
|
(__move_init, __next_move, __incr_eval, __move_select)),
|
||||||
full_eval (__full_eval)
|
full_eval (__full_eval)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Light constructor.
|
//! Light constructor.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -91,9 +89,7 @@ moHC (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEv
|
||||||
moHC (moMoveExpl < M > &__move_expl, eoEvalFunc < EOT > &__full_eval):move_expl (__move_expl),
|
moHC (moMoveExpl < M > &__move_expl, eoEvalFunc < EOT > &__full_eval):move_expl (__move_expl),
|
||||||
full_eval
|
full_eval
|
||||||
(__full_eval)
|
(__full_eval)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Function which launches the HC
|
//! Function which launches the HC
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,7 @@ moHCMoveLoopExpl (moMoveInit < M > &__move_init, moNextMove < M > &__next_move,
|
||||||
move_init (__move_init),
|
move_init (__move_init),
|
||||||
next_move (__next_move),
|
next_move (__next_move),
|
||||||
incr_eval (__incr_eval), move_select (__move_select)
|
incr_eval (__incr_eval), move_select (__move_select)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Procedure which launches the explorer.
|
//! Procedure which launches the explorer.
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,7 @@ public:
|
||||||
moItRandNextMove (moRandMove < M > &__rand_move,
|
moItRandNextMove (moRandMove < M > &__rand_move,
|
||||||
unsigned int __max_iter):rand_move (__rand_move),
|
unsigned int __max_iter):rand_move (__rand_move),
|
||||||
max_iter (__max_iter), num_iter (0)
|
max_iter (__max_iter), num_iter (0)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Generation of a new move
|
//! Generation of a new move
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@ template < class M > class moMoveExpl:public eoBF < const typename
|
||||||
M::EOType &,
|
M::EOType &,
|
||||||
typename
|
typename
|
||||||
M::EOType &, void >
|
M::EOType &, void >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ template < class M > class moMoveIncrEval:public eoBF < const M &, const typenam
|
||||||
M::EOType &,
|
M::EOType &,
|
||||||
typename
|
typename
|
||||||
M::EOType::Fitness >
|
M::EOType::Fitness >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@
|
||||||
*/
|
*/
|
||||||
template < class M > class moMoveInit:public eoBF < M &, const typename
|
template < class M > class moMoveInit:public eoBF < M &, const typename
|
||||||
M::EOType &, void >
|
M::EOType &, void >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,6 @@
|
||||||
Only a description... moHCMoveLoopExpl and moTSMoveLoopExpl are exemples of class that are a moMoveLoopExpl.
|
Only a description... moHCMoveLoopExpl and moTSMoveLoopExpl are exemples of class that are a moMoveLoopExpl.
|
||||||
*/
|
*/
|
||||||
template < class M > class moMoveLoopExpl:public moMoveExpl < M >
|
template < class M > class moMoveLoopExpl:public moMoveExpl < M >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,7 @@
|
||||||
This class is used as an exception that can be thrown if a solution selector has completly failed.
|
This class is used as an exception that can be thrown if a solution selector has completly failed.
|
||||||
*/
|
*/
|
||||||
class EmptySelection
|
class EmptySelection
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Class that describes a move selector (moMove).
|
//! Class that describes a move selector (moMove).
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@
|
||||||
template < class M > class moNextMove:public eoBF < M &, const typename
|
template < class M > class moNextMove:public eoBF < M &, const typename
|
||||||
M::EOType &,
|
M::EOType &,
|
||||||
bool >
|
bool >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,7 @@ template < class M > class moNoAspirCrit:public moAspirCrit < M >
|
||||||
Nothing...
|
Nothing...
|
||||||
*/
|
*/
|
||||||
void init ()
|
void init ()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,6 @@
|
||||||
Only a description... An object that herits from this class needs to be designed in order to use a moSA.
|
Only a description... An object that herits from this class needs to be designed in order to use a moSA.
|
||||||
*/
|
*/
|
||||||
template < class M > class moRandMove:public eoUF < M &, void >
|
template < class M > class moRandMove:public eoUF < M &, void >
|
||||||
{
|
{};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,7 @@ public:
|
||||||
init_temp (__init_temp),
|
init_temp (__init_temp),
|
||||||
cool_sched (__cool_sched),
|
cool_sched (__cool_sched),
|
||||||
full_eval (__full_eval)
|
full_eval (__full_eval)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! function that launches the SA algorithm.
|
//! function that launches the SA algorithm.
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
int
|
int
|
||||||
main (int __argc, char * __argv [])
|
main (int __argc, char * __argv [])
|
||||||
{
|
{
|
||||||
if (__argc != 2) {
|
if (__argc != 2)
|
||||||
|
{
|
||||||
|
|
||||||
std :: cerr << "Usage : ./hill_climbing [instance]" << std :: endl ;
|
std :: cerr << "Usage : ./hill_climbing [instance]" << std :: endl ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@
|
||||||
|
|
||||||
#include "city_swap.h"
|
#include "city_swap.h"
|
||||||
|
|
||||||
bool CitySwap :: operator () (Route & __route) {
|
bool CitySwap :: operator () (Route & __route)
|
||||||
|
{
|
||||||
|
|
||||||
std :: swap (__route [rng.random (__route.size ())],
|
std :: swap (__route [rng.random (__route.size ())],
|
||||||
__route [rng.random (__route.size ())]) ;
|
__route [rng.random (__route.size ())]) ;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@
|
||||||
|
|
||||||
/** Its swaps two vertices
|
/** Its swaps two vertices
|
||||||
randomly choosen */
|
randomly choosen */
|
||||||
class CitySwap : public eoMonOp <Route> {
|
class CitySwap : public eoMonOp <Route>
|
||||||
|
{
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,8 @@ EdgeXover :: add_vertex (unsigned int __vertex, Route & __child)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __child) {
|
EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __child)
|
||||||
|
{
|
||||||
|
|
||||||
build_map (__par1, __par2) ;
|
build_map (__par1, __par2) ;
|
||||||
|
|
||||||
|
|
@ -100,7 +101,8 @@ EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __child)
|
||||||
|
|
||||||
add_vertex (cur_vertex, __child) ;
|
add_vertex (cur_vertex, __child) ;
|
||||||
|
|
||||||
for (unsigned int i = 1 ; i < len ; i ++) {
|
for (unsigned int i = 1 ; i < len ; i ++)
|
||||||
|
{
|
||||||
|
|
||||||
unsigned int len_min_entry = MAXINT ;
|
unsigned int len_min_entry = MAXINT ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
|
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
|
||||||
namespace Graph {
|
namespace Graph
|
||||||
|
{
|
||||||
|
|
||||||
static std :: vector <std :: pair <double, double> > vectCoord ; // Coordinates
|
static std :: vector <std :: pair <double, double> > vectCoord ; // Coordinates
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@
|
||||||
#include "part_route_eval.h"
|
#include "part_route_eval.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
|
|
||||||
PartRouteEval :: PartRouteEval (float __from, float __to) : from (__from), to (__to) {}
|
PartRouteEval :: PartRouteEval (float __from, float __to) : from (__from), to (__to)
|
||||||
|
{}
|
||||||
|
|
||||||
void PartRouteEval :: operator () (Route & __route)
|
void PartRouteEval :: operator () (Route & __route)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
||||||
/** Partial Mapped Crossover */
|
/** Partial Mapped Crossover */
|
||||||
class PartialMappedXover : public eoQuadOp <Route> {
|
class PartialMappedXover : public eoQuadOp <Route>
|
||||||
|
{
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue