00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00018 unsigned int v1 = __route [__move.first], v1_next = __route [__move.first + 1] ;
00019
00020
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 }