00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <mo.h>
00013
00014 #include <graph.h>
00015 #include <route.h>
00016 #include <route_eval.h>
00017 #include <route_init.h>
00018
00019 #include <two_opt.h>
00020 #include <two_opt_init.h>
00021 #include <two_opt_next.h>
00022 #include <two_opt_incr_eval.h>
00023
00024 #include <city_swap.h>
00025
00026 int
00027 main (int __argc, char * __argv [])
00028 {
00029 if (__argc != 2)
00030 {
00031 std :: cerr << "Usage : ./iterated_local_search [instance]" << std :: endl ;
00032 return 1 ;
00033 }
00034
00035 Graph :: load (__argv [1]) ;
00036
00037 Route route ;
00038
00039 RouteInit init ;
00040 init (route) ;
00041
00042 RouteEval full_eval ;
00043 full_eval (route) ;
00044
00045 std :: cout << "[From] " << route << std :: endl ;
00046
00047 TwoOptInit two_opt_init ;
00048
00049 TwoOptNext two_opt_next ;
00050
00051 TwoOptIncrEval two_opt_incr_eval ;
00052
00053 moBestImprSelect <TwoOpt> two_opt_select ;
00054
00055 moGenSolContinue <Route> cont (1000) ;
00056
00057 moFitComparator<Route> comparator;
00058
00059 CitySwap perturbation;
00060
00061 moILS<TwoOpt> iterated_local_search (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select,
00062 cont, comparator, perturbation, full_eval) ;
00063 iterated_local_search(route) ;
00064
00065 std :: cout << "[To] " << route << std :: endl ;
00066
00067 return 0 ;
00068 }
00069