- Main Page
- Namespaces
- Classes
- Files

- Search for |

# two_opt_incr_eval.cpp

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 // "TwoOptIncrEval.cpp"
    00004
    00005 // (c) OPAC Team, LIFL, 2003-2006
    00006
    00007 /* LICENCE TEXT
    00008
    00009    Contact: paradiseo-help@lists.gforge.inria.fr
    00010 */
    00011
    00012 #include "two_opt_incr_eval.h"
    00013 #include "graph.h"
    00014
    00015 float TwoOptIncrEval :: operator () (const TwoOpt & __move, const Route & __route)
    00016 {
    00017   // From
    00018   unsigned int v1 = __route [__move.first], v1_next = __route [__move.first + 1] ;
    00019
    00020   // To
    00021   unsigned int v2 = __route [__move.second], v2_next = __route [__move.second + 1] ;
    00022
    00023   return __route.fitness ()
    00024     - Graph :: distance (v1, v2)
    00025     - Graph :: distance (v1_next, v2_next)
    00026     + Graph :: distance (v1, v1_next)
    00027     + Graph :: distance (v2, v2_next)  ;
    00028 }