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 int
00025 main (int __argc, char * __argv [])
00026 {
00027 if (__argc != 2) {
00028
00029 std :: cerr << "Usage : ./hill_climbing [instance]" << std :: endl ;
00030 return 1 ;
00031 }
00032
00033 srand (1000) ;
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
00048
00049
00050 TwoOptInit two_opt_init ;
00051
00052 TwoOptNext two_opt_next ;
00053
00054 TwoOptIncrEval two_opt_incr_eval ;
00055
00056
00057 moBestImprSelect <TwoOpt> two_opt_select ;
00058
00059
00060 moHC <TwoOpt> hill_climbing (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select, full_eval) ;
00061 hill_climbing (route) ;
00062
00063 std :: cout << "[To] " << route << std :: endl ;
00064
00065 return 0 ;
00066 }
00067