iterated_local_search.cpp

00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 // "iterated_local_search.cpp"
00004 
00005 // (c) OPAC Team, LIFL, 2003-2007
00006 
00007 /* LICENCE TEXT
00008 
00009    Contact:  paradiseo-help@lists.gforge.inria.fr
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]) ; // Instance
00036 
00037   Route route ; // Solution
00038   
00039   RouteInit init ; // Sol. Random Init.
00040   init (route) ;
00041 
00042   RouteEval full_eval ; // Full. Eval.
00043   full_eval (route) ;
00044   
00045   std :: cout << "[From] " << route << std :: endl ;
00046   
00047   TwoOptInit two_opt_init ; // Init.
00048    
00049   TwoOptNext two_opt_next ; // Explorer.
00050   
00051   TwoOptIncrEval two_opt_incr_eval ; // Eff. eval.
00052   
00053   moBestImprSelect <TwoOpt> two_opt_select ; //Move selection
00054   
00055   moGenSolContinue <Route> cont (1000) ; //Stopping criterion
00056   
00057   moFitComparator<Route> comparator; // Route comparator
00058 
00059   CitySwap perturbation; // Route 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 

Generated on Mon Oct 8 09:55:33 2007 for ParadisEO-MOMovingObjects by  doxygen 1.4.7