- Main Page
- Namespaces
- Classes
- Files

- Search for |

# tabu_search.cpp

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 // "tabu_search.cpp"
    00004
    00005 // (c) OPAC Team, LIFL, 2003-2006
    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 #include <two_opt_tabu_list.h>
    00024
    00025 int
    00026 main (int __argc, char * __argv [])
    00027 {
    00028   if (__argc != 2)
    00029     {
    00030       std :: cerr << "Usage : ./tabu_search [instance]" << std :: endl ;
    00031       return 1 ;
    00032     }
    00033
    00034   Graph :: load (__argv [1]) ; // Instance
    00035
    00036   Route route ; // Solution
    00037
    00038   RouteInit init ; // Sol. Random Init.
    00039   init (route) ;
    00040
    00041   RouteEval full_eval ; // Full. Eval.
    00042   full_eval (route) ;
    00043
    00044   std :: cout << "[From] " << route << std :: endl ;
    00045
    00046   /* Tools for an efficient (? :-))
    00047      local search ! */
    00048
    00049   TwoOptInit two_opt_init ; // Init.
    00050
    00051   TwoOptNext two_opt_next ; // Explorer.
    00052
    00053   TwoOptIncrEval two_opt_incr_eval ; // Eff. eval.
    00054
    00055   TwoOptTabuList tabu_list ; // Tabu List
    00056   //moSimpleMoveTabuList<TwoOpt> tabu_list(10);
    00057   //moSimpleSolutionTabuList<TwoOpt> tabu_list(10);
    00058
    00059   moNoAspirCrit <TwoOpt> aspir_crit ; // Aspiration Criterion
    00060
    00061   moGenSolContinue <Route> cont (10000) ; // Continuator
    00062
    00063   moTS <TwoOpt> tabu_search (two_opt_init, two_opt_next, two_opt_incr_eval, tabu_list, aspir_crit, cont, full_eval) ;
    00064   tabu_search (route) ;
    00065
    00066   std :: cout << "[To] " << route << std :: endl ;
    00067
    00068   return 0 ;
    00069 }
    00070