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
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <moHCMoveLoopExpl.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -46,88 +46,86 @@
|
|||
|
||||
//! Iterative explorer used by a moHC.
|
||||
template < class M > class moHCMoveLoopExpl:public moMoveLoopExpl < M >
|
||||
{
|
||||
|
||||
//! Alias for the type.
|
||||
typedef typename M::EOType EOT;
|
||||
|
||||
//! Alias for the fitness.
|
||||
typedef typename M::EOType::Fitness Fitness;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor.
|
||||
/*!
|
||||
All the boxes have to be specified.
|
||||
|
||||
\param __move_init the move initialiser.
|
||||
\param __next_move the neighborhood explorer.
|
||||
\param __incr_eval (generally) efficient evaluation function.
|
||||
\param __move_select the move selector.
|
||||
*/
|
||||
moHCMoveLoopExpl (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moMoveSelect < M > &__move_select):
|
||||
|
||||
move_init (__move_init),
|
||||
next_move (__next_move),
|
||||
incr_eval (__incr_eval), move_select (__move_select)
|
||||
{
|
||||
|
||||
}
|
||||
//! Alias for the type.
|
||||
typedef typename M::EOType EOT;
|
||||
|
||||
//! Procedure which launches the explorer.
|
||||
/*!
|
||||
The exploration starts from an old solution and provides a new solution.
|
||||
//! Alias for the fitness.
|
||||
typedef typename M::EOType::Fitness Fitness;
|
||||
|
||||
\param __old_sol the current solution.
|
||||
\param __new_sol the new_sol (result of the procedure).
|
||||
*/
|
||||
void operator () (const EOT & __old_sol, EOT & __new_sol)
|
||||
{
|
||||
public:
|
||||
|
||||
M move;
|
||||
//! Constructor.
|
||||
/*!
|
||||
All the boxes have to be specified.
|
||||
|
||||
//
|
||||
move_init (move, __old_sol); /* Restarting the exploration of
|
||||
of the neighborhood ! */
|
||||
\param __move_init the move initialiser.
|
||||
\param __next_move the neighborhood explorer.
|
||||
\param __incr_eval (generally) efficient evaluation function.
|
||||
\param __move_select the move selector.
|
||||
*/
|
||||
moHCMoveLoopExpl (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moMoveSelect < M > &__move_select):
|
||||
|
||||
move_select.init (__old_sol.fitness ());
|
||||
move_init (__move_init),
|
||||
next_move (__next_move),
|
||||
incr_eval (__incr_eval), move_select (__move_select)
|
||||
{}
|
||||
|
||||
while (move_select.update (move, incr_eval (move, __old_sol))
|
||||
&& next_move (move, __old_sol));
|
||||
//! Procedure which launches the explorer.
|
||||
/*!
|
||||
The exploration starts from an old solution and provides a new solution.
|
||||
|
||||
try
|
||||
\param __old_sol the current solution.
|
||||
\param __new_sol the new_sol (result of the procedure).
|
||||
*/
|
||||
void operator () (const EOT & __old_sol, EOT & __new_sol)
|
||||
{
|
||||
|
||||
M best_move;
|
||||
M move;
|
||||
|
||||
Fitness best_move_fit;
|
||||
//
|
||||
move_init (move, __old_sol); /* Restarting the exploration of
|
||||
of the neighborhood ! */
|
||||
|
||||
move_select (best_move, best_move_fit);
|
||||
__new_sol.fitness (best_move_fit);
|
||||
best_move (__new_sol);
|
||||
move_select.init (__old_sol.fitness ());
|
||||
|
||||
while (move_select.update (move, incr_eval (move, __old_sol))
|
||||
&& next_move (move, __old_sol));
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
M best_move;
|
||||
|
||||
Fitness best_move_fit;
|
||||
|
||||
move_select (best_move, best_move_fit);
|
||||
__new_sol.fitness (best_move_fit);
|
||||
best_move (__new_sol);
|
||||
|
||||
}
|
||||
catch (EmptySelection & __ex)
|
||||
{
|
||||
|
||||
// ?
|
||||
}
|
||||
}
|
||||
catch (EmptySelection & __ex)
|
||||
{
|
||||
|
||||
// ?
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
//! Move initialiser.
|
||||
moMoveInit < M > &move_init;
|
||||
|
||||
//! Move initialiser.
|
||||
moMoveInit < M > &move_init;
|
||||
//! Neighborhood explorer.
|
||||
moNextMove < M > &next_move;
|
||||
|
||||
//! Neighborhood explorer.
|
||||
moNextMove < M > &next_move;
|
||||
//! (generally) Efficient evaluation.
|
||||
moMoveIncrEval < M > &incr_eval;
|
||||
|
||||
//! (generally) Efficient evaluation.
|
||||
moMoveIncrEval < M > &incr_eval;
|
||||
//! Move selector.
|
||||
moMoveSelect < M > &move_select;
|
||||
|
||||
//! Move selector.
|
||||
moMoveSelect < M > &move_select;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue