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 #include <two_opt_tabu_list.h>
00024 #include <two_opt_rand.h>
00025
00026 #include <city_swap.h>
00027
00028 int
00029 main (int __argc, char * __argv [])
00030 {
00031 if (__argc != 2)
00032 {
00033 std :: cerr << "Usage : ./iterated_local_search [instance]" << std :: endl ;
00034 return 1 ;
00035 }
00036
00037 Graph :: load (__argv [1]) ;
00038
00039 Route route ;
00040
00041 RouteInit init ;
00042 init (route) ;
00043
00044 RouteEval full_eval ;
00045 full_eval (route) ;
00046
00047 std :: cout << "[From] " << route << std :: endl ;
00048
00049
00050
00051
00052 TwoOptInit two_opt_init ;
00053
00054 TwoOptNext two_opt_next ;
00055
00056 TwoOptIncrEval two_opt_incr_eval ;
00057
00058 moBestImprSelect <TwoOpt> two_opt_select ;
00059
00060
00061
00062 moGenSolContinue <Route> cont (1000) ;
00063
00064 moFitComparator<Route> comparator;
00065
00066 CitySwap perturbation;
00067
00068
00069
00070
00071
00072 moGenSolContinue <Route> ts_cont (100) ;
00073
00074 TwoOptTabuList tabu_list ;
00075 moNoAspirCrit <TwoOpt> aspir_crit ;
00076
00077
00078
00079
00080 TwoOptRand two_opt_rand ;
00081
00082 moExponentialCoolingSchedule cool_sched (0.1, 0.98) ;
00083
00084 moGenSolContinue <Route> sa_cont (100) ;
00085
00086 moILS<TwoOpt> iterated_local_search (two_opt_rand, two_opt_incr_eval, sa_cont, 100, cool_sched,
00087 cont, comparator, perturbation, full_eval) ;
00088
00089 iterated_local_search(route) ;
00090
00091 std :: cout << "[To] " << route << std :: endl ;
00092
00093 return 0 ;
00094 }
00095