moved utilities and contribution in branchez
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2183 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6c3383d718
commit
8280cf082b
1346 changed files with 0 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils)
|
||||
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/tsp/src)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${CMAKE_BINARY_DIR}/tsp/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(tabu_search tabu_search.cpp)
|
||||
|
||||
ADD_DEPENDENCIES(tabu_search tsp)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Link the librairies for your target(s)
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(tabu_search tsp eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
Binary file not shown.
|
|
@ -0,0 +1,96 @@
|
|||
\documentclass[a4paper]{article}
|
||||
|
||||
\usepackage[english]{babel}
|
||||
\usepackage{epsf}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{here}
|
||||
\usepackage{comment}
|
||||
\usepackage{graphicx}
|
||||
|
||||
\topmargin -2.5cm
|
||||
\textheight 25,5cm
|
||||
\textwidth 16cm
|
||||
\oddsidemargin 0cm
|
||||
\evensidemargin 0cm
|
||||
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
\textbf{ParadisEO Practices} {\copyright Franck Seynhaeve,
|
||||
Jean-Charles Boisson, Thomas Legrand} \Large{\textbf{\\\\
|
||||
Lesson 4: Implement a simulated annealing using ParadisEO}}
|
||||
|
||||
\normalsize
|
||||
|
||||
\vspace{-0,3cm}
|
||||
|
||||
\section{Example}
|
||||
|
||||
The archive {\tt paradiseo\_practices\_0208.tgz} installed
|
||||
on your computer contains a simulated annealing implemented using ParadisEO-MO~
|
||||
(see {\tt simulated\_annealing} in the {\bf build/lesson4} directory).
|
||||
|
||||
\medskip
|
||||
To run it, please go in {\bf build/lesson4} and start the program {\tt simulated\_annealing} by giving
|
||||
one of the TSP instances located in {\bf tsp/benchs}.
|
||||
|
||||
|
||||
\medskip
|
||||
When entering {\tt ./simulated\_annealing ../../tsp/benchs/berlin52.tsp}, you should end up with the
|
||||
following outputs:
|
||||
|
||||
\smallskip
|
||||
\noindent
|
||||
\texttt{>> Loading [../../tsp/benchs/eil101.tsp]}\\
|
||||
\texttt{[From] -3347 101 84 20 57 71 92 19 59 10 30 55 27 63 36 26 18 21 46}\\
|
||||
\texttt{72 96 35 39 24 29 86 60 40 34 48 67 38 13 0 5 11 16 83 49 50 6 7 87}\\
|
||||
\texttt{1 53 90 74 52 58 15 8 95 25 68 61 70 65 45 33 79 23 62 4 37 91 85 78}\\
|
||||
\texttt{89 47 69 28 32 66 80 75 94 41 100 44 73 22 9 76 64 97 31 88 51 93 43}\\
|
||||
\texttt{2 3 14 56 99 12 82 81 42 17 54 98 77}\\
|
||||
\texttt{[To] -697 101 84 90 99 36 97}\\
|
||||
\texttt{ 92 60 15 85 37 43 13 41 42 14 56 86 1 40 21 73 72 20 71 74 55 22 66}\\
|
||||
\texttt{ 38 3 24 54 53 23 28 78 80 8 50 32 2 76 67 79 11 75 49 0 68 26 100 52}\\
|
||||
\texttt{ 27 25 39 57 12 93 94 96 91 58 98 95 5 88 51 17 82 59 4 83 16 44 7 45}\\
|
||||
\texttt{ 46 35 48 63 18 47 81 6 87 61 10 62 89 31 9 30 69 29 19 65 70 64 34}\\
|
||||
\texttt{ 33 77}\\
|
||||
|
||||
|
||||
The printed-out results show for the initial best solution and the final one~:
|
||||
\\ \hspace*{0.5cm}-the length of the route
|
||||
\\ \hspace*{0.5cm}-the number of cities
|
||||
\\ \hspace*{0.5cm}-the route itself (notice that the city index starts from 0).
|
||||
|
||||
|
||||
\section{Study the simulated annealing dedicated components}
|
||||
|
||||
Study the {\tt simulated\_annealing.cpp} file located in the {\bf lesson4} directory
|
||||
using~:
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] the ParadisEO-MO API documentation available at~:
|
||||
|
||||
\hspace{1cm}http$\,:$//paradiseo.gforge.inria.fr/addon/paradiseo-mo/doc/index.html
|
||||
\item[$\bullet$] the source files located in the {\bf tsp/src/} directory
|
||||
\end{itemize}
|
||||
|
||||
\section{Customize the simulated annealing}
|
||||
|
||||
Make a backup (copy) of the cpp file {\tt simulated\_annealing.cpp}. You can now modify the
|
||||
original {\tt simulated\_annealing.cpp} and use the existing makefiles to compile it.
|
||||
|
||||
Edit and modify the {\tt simulated\_annealing.cpp} file~:
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Change the cooling schedule components and parameters.
|
||||
\item[$\bullet$] Customize the temperature decrease process and try to obtain another good solution.
|
||||
\end{itemize}
|
||||
|
||||
\smallskip
|
||||
To compile {\tt simulated\_annealing.cpp},you should use the
|
||||
command {\tt make} from {\bf build/lesson4}.
|
||||
|
||||
\medskip
|
||||
Finally, test your modifications on several TSP instances ({\tt berlin52},
|
||||
{\tt eil101} ...) and compare the results you get.
|
||||
|
||||
|
||||
\end{document}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "tabu_search.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003-2006
|
||||
|
||||
/* LICENCE TEXT
|
||||
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <mo.h>
|
||||
|
||||
#include <graph.h>
|
||||
#include <route.h>
|
||||
#include <route_eval.h>
|
||||
#include <route_init.h>
|
||||
|
||||
#include <two_opt.h>
|
||||
#include <two_opt_init.h>
|
||||
#include <two_opt_next.h>
|
||||
#include <two_opt_incr_eval.h>
|
||||
#include <two_opt_tabu_list.h>
|
||||
|
||||
int
|
||||
main (int __argc, char * __argv [])
|
||||
{
|
||||
if (__argc != 2)
|
||||
{
|
||||
std :: cerr << "Usage : ./tabu_search [instance]" << std :: endl ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
Graph :: load (__argv [1]) ; // Instance
|
||||
|
||||
Route route ; // Solution
|
||||
|
||||
RouteInit init ; // Sol. Random Init.
|
||||
init (route) ;
|
||||
|
||||
RouteEval full_eval ; // Full. Eval.
|
||||
full_eval (route) ;
|
||||
|
||||
std :: cout << "[From] " << route << std :: endl ;
|
||||
|
||||
/* Tools for an efficient (? :-))
|
||||
local search ! */
|
||||
|
||||
TwoOptInit two_opt_init ; // Init.
|
||||
|
||||
TwoOptNext two_opt_next ; // Explorer.
|
||||
|
||||
TwoOptIncrEval two_opt_incr_eval ; // Eff. eval.
|
||||
|
||||
TwoOptTabuList tabu_list ; // Tabu List
|
||||
//moSimpleMoveTabuList<TwoOpt> tabu_list(10);
|
||||
//moSimpleSolutionTabuList<TwoOpt> tabu_list(10);
|
||||
|
||||
moNoAspirCrit <TwoOpt> aspir_crit ; // Aspiration Criterion
|
||||
|
||||
moGenSolContinue <Route> cont (10000) ; // Continuator
|
||||
|
||||
moTS <TwoOpt> tabu_search (two_opt_init, two_opt_next, two_opt_incr_eval, tabu_list, aspir_crit, cont, full_eval) ;
|
||||
tabu_search (route) ;
|
||||
|
||||
std :: cout << "[To] " << route << std :: endl ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue