tree modifications
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@512 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
0d2b55437a
commit
61c0424eed
47 changed files with 395 additions and 458 deletions
|
|
@ -1,47 +0,0 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003-2006
|
||||
|
||||
/* LICENCE TEXT
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
TwoOpt TwoOpt :: operator ! () const
|
||||
{
|
||||
TwoOpt move = * this ;
|
||||
std :: swap (move.first, move.second) ;
|
||||
|
||||
return move ;
|
||||
}
|
||||
|
||||
void TwoOpt :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
std :: vector <unsigned int> seq_cities ;
|
||||
|
||||
for (unsigned int i = second ; i > first ; i --)
|
||||
{
|
||||
seq_cities.push_back (__route [i]) ;
|
||||
}
|
||||
|
||||
unsigned int j = 0 ;
|
||||
for (unsigned int i = first + 1 ; i < second + 1 ; i ++)
|
||||
{
|
||||
__route [i] = seq_cities [j ++] ;
|
||||
}
|
||||
}
|
||||
|
||||
void TwoOpt :: readFrom (std :: istream & __is)
|
||||
{
|
||||
__is >> first >> second ;
|
||||
}
|
||||
|
||||
void TwoOpt :: printOn (std :: ostream & __os) const
|
||||
{
|
||||
__os << first << ' ' << second ;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue