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_rand.h>
00021 #include <two_opt_incr_eval.h>
00022
00023 int
00024 main (int __argc, char * __argv [])
00025 {
00026 if (__argc != 2)
00027 {
00028 std :: cerr << "Usage : ./simulated_annealing [instance]" << std :: endl ;
00029 return 1 ;
00030 }
00031
00032 Graph :: load (__argv [1]) ;
00033
00034 Route route ;
00035
00036 RouteInit init ;
00037 init (route) ;
00038
00039 RouteEval full_eval ;
00040 full_eval (route) ;
00041
00042 std :: cout << "[From] " << route << std :: endl ;
00043
00044
00045
00046
00047 TwoOptRand two_opt_rand ;
00048
00049 TwoOptIncrEval two_opt_incr_eval ;
00050
00051 TwoOpt move ;
00052
00053 moExponentialCoolingSchedule cool_sched (0.1, 0.98) ;
00054
00055
00056 moGenSolContinue <Route> cont (1000) ;
00057
00058
00059
00060 moSA <TwoOpt> simulated_annealing (two_opt_rand, two_opt_incr_eval, cont, 1000, cool_sched, full_eval) ;
00061 simulated_annealing (route) ;
00062
00063 std :: cout << "[To] " << route << std :: endl ;
00064
00065 return 0 ;
00066 }
00067