removed pthread management
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@471 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
98d3391ccb
commit
aaddd2483d
1 changed files with 3 additions and 39 deletions
|
|
@ -21,7 +21,6 @@
|
|||
#include "moMoveExpl.h"
|
||||
#include "moTSMoveLoopExpl.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
//! Tabu Search (TS)
|
||||
/*!
|
||||
|
|
@ -59,16 +58,7 @@ public:
|
|||
moTS (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEval < M > &__incr_eval, moTabuList < M > &__tabu_list, moAspirCrit < M > &__aspir_crit, moSolContinue < EOT > &__cont, eoEvalFunc < EOT > &__full_eval):move_expl (*new moTSMoveLoopExpl < M >
|
||||
(__move_init, __next_move, __incr_eval, __tabu_list,
|
||||
__aspir_crit)), cont (__cont), full_eval (__full_eval)
|
||||
{
|
||||
|
||||
if (first_time)
|
||||
{
|
||||
|
||||
pthread_mutex_init (&mutex, 0);
|
||||
|
||||
first_time = false;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
//! Constructor with less parameters
|
||||
/*!
|
||||
|
|
@ -81,16 +71,7 @@ moTS (moMoveInit < M > &__move_init, moNextMove < M > &__next_move, moMoveIncrEv
|
|||
moTS (moMoveExpl < M > &__move_expl, moSolContinue < EOT > &__cont, eoEvalFunc < EOT > &__full_eval):move_expl (__move_expl),
|
||||
cont (__cont),
|
||||
full_eval (__full_eval)
|
||||
{
|
||||
|
||||
if (first_time)
|
||||
{
|
||||
|
||||
pthread_mutex_init (&mutex, 0);
|
||||
|
||||
first_time = false;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
//! Function which launchs the Tabu Search
|
||||
/*!
|
||||
|
|
@ -103,9 +84,6 @@ moTS (moMoveExpl < M > &__move_expl, moSolContinue < EOT > &__cont, eoEvalFunc <
|
|||
*/
|
||||
bool operator ()(EOT & __sol)
|
||||
{
|
||||
|
||||
pthread_mutex_lock (&mutex);
|
||||
|
||||
if (__sol.invalid ())
|
||||
{
|
||||
full_eval (__sol);
|
||||
|
|
@ -147,20 +125,12 @@ moTS (moMoveExpl < M > &__move_expl, moSolContinue < EOT > &__cont, eoEvalFunc <
|
|||
while (cont (__sol));
|
||||
|
||||
__sol = best_sol;
|
||||
|
||||
pthread_mutex_unlock (&mutex);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Boolean allowing to initialise the ptread_mutex_t in the constructor
|
||||
static bool first_time;
|
||||
|
||||
//! The lock
|
||||
static pthread_mutex_t mutex;
|
||||
|
||||
//! Neighborhood explorer
|
||||
moMoveExpl < M > &move_expl;
|
||||
|
||||
|
|
@ -171,10 +141,4 @@ private:
|
|||
eoEvalFunc < EOT > &full_eval;
|
||||
};
|
||||
|
||||
//! declaration of the mutex variable
|
||||
template < class EOT > pthread_mutex_t moTS < EOT >::mutex;
|
||||
|
||||
//! by default, first_time must have the value true
|
||||
template < class EOT > bool moTS < EOT >::first_time = true;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue