Tests have been included and src code has been updated to avoid compilation warnings

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@937 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jboisson 2008-02-13 10:38:33 +00:00
commit acc73239fb
37 changed files with 2531 additions and 47 deletions

View file

@ -36,8 +36,10 @@
#include "two_opt_init.h"
void TwoOptInit :: operator () (TwoOpt & __move, const Route & __route)
void TwoOptInit :: operator () (TwoOpt & _move, const Route & _route)
{
__move.first = 0 ;
__move.second = 2 ;
Route route=_route;
_move.first = 0 ;
_move.second = 2 ;
}

View file

@ -47,7 +47,7 @@ class TwoOptInit : public moMoveInit <TwoOpt>
public :
void operator () (TwoOpt & __move, const Route & __route) ;
void operator () (TwoOpt & _move, const Route & _route) ;
} ;

View file

@ -37,19 +37,21 @@
#include "two_opt_next.h"
#include "graph.h"
bool TwoOptNext :: operator () (TwoOpt & __move, const Route & __route)
bool TwoOptNext :: operator () (TwoOpt & _move, const Route & _route)
{
if (__move.first == Graph :: size () - 4 && __move.second == __move.first + 2)
Route route=_route;
if (_move.first == Graph :: size () - 4 && _move.second == _move.first + 2)
{
return false ;
}
else
{
__move.second ++ ;
if (__move.second == Graph :: size () - 1)
_move.second ++ ;
if (_move.second == Graph :: size () - 1)
{
__move.first ++ ;
__move.second = __move.first + 2 ;
_move.first ++ ;
_move.second = _move.first + 2 ;
}
return true ;

View file

@ -46,7 +46,7 @@ class TwoOptNext : public moNextMove <TwoOpt>
public :
bool operator () (TwoOpt & __move, const Route & __route) ;
bool operator () (TwoOpt & _move, const Route & _route) ;
} ;

View file

@ -39,7 +39,8 @@
#define TABU_LENGTH 10
void TwoOptTabuList :: init ()
void
TwoOptTabuList :: init ()
{
// Size (eventually)
tabu_span.resize (Graph :: size ()) ;
@ -58,23 +59,32 @@ void TwoOptTabuList :: init ()
}
}
bool TwoOptTabuList :: operator () (const TwoOpt & __move, const Route & __sol)
bool
TwoOptTabuList :: operator () (const TwoOpt & _move, const Route & _route)
{
return tabu_span [__move.first] [__move.second] > 0 ;
Route route=_route;
return tabu_span [_move.first] [_move.second] > 0 ;
}
void TwoOptTabuList :: add (const TwoOpt & __move, const Route & __sol)
void
TwoOptTabuList :: add (const TwoOpt & _move, const Route & _route)
{
tabu_span [__move.first] [__move.second] = tabu_span [__move.second] [__move.first] = TABU_LENGTH ;
Route route=_route;
tabu_span [_move.first] [_move.second] = tabu_span [_move.second] [_move.first] = TABU_LENGTH ;
}
void TwoOptTabuList :: update ()
void
TwoOptTabuList :: update ()
{
for (unsigned int i = 0 ; i < tabu_span.size () ; i ++)
unsigned int i,j;
for (i = 0 ; i < tabu_span.size () ; i ++)
{
for (unsigned int j = 0 ; j < tabu_span [i].size () ; j ++)
for (j = 0 ; j < tabu_span [i].size () ; j ++)
{
if (tabu_span [i] [j] > 0)
if ( tabu_span [i] [j] > 0 )
{
tabu_span [i] [j] -- ;
}

View file

@ -46,9 +46,9 @@ class TwoOptTabuList : public moTabuList <TwoOpt>
{
public :
bool operator () (const TwoOpt & __move, const Route & __sol) ;
bool operator () (const TwoOpt & _move, const Route & _route) ;
void add (const TwoOpt & __move, const Route & __sol) ;
void add (const TwoOpt & _move, const Route & _route) ;
void update () ;