git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1004 331e1502-861f-0410-8da2-ba01fb791d7f
98 lines
3.5 KiB
TeX
98 lines
3.5 KiB
TeX
\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 5: Implement a genetic algorithm using ParadisEO}}
|
|
|
|
\normalsize
|
|
|
|
\vspace{-0,3cm}
|
|
|
|
\section{Example}
|
|
|
|
The archive {\tt paradiseo\_practices\_0208.tgz} installed
|
|
on your computer contains a genetic algorithm implemented using ParadisEO-EO~
|
|
(see {\tt gen\_algo} in the {\bf build/lesson5} directory).
|
|
|
|
\medskip
|
|
To run it, please go in {\bf build/lesson5} and start the program {\tt gen\_algo} by giving
|
|
one of the TSP instances located in {\bf tsp/benchs}.
|
|
|
|
\medskip
|
|
When entering {\tt ./gen\_algo ../../tsp/benchs/berlin52.tsp}, you should end up with the
|
|
following outputs:
|
|
|
|
\texttt{>> Loading [../../tsp/benchs/eil101.tsp]}\\
|
|
\texttt{[From] -3176 101 5 72 27 77 20 82 23 14 91 17 60 50 43 99 18 34 69}\\
|
|
\texttt{76 22 38 25 88 36 40 7 55 74 42 67 53 11 62 61 92 58 93 19 70 33 32}\\
|
|
\texttt{86 48 47 4 97 73 95 79 85 66 65 24 13 89 8 26 96 56 28 39 80 37 49}\\
|
|
\texttt{78 12 1 98 46 31 57 10 30 90 71 75 81 16 45 29 41 100 51 21 52 59 15}\\
|
|
\texttt{64 44 94 54 9 6 3 0 87 63 2 84 83 35 68 STOP in eoGenContinue:}\\
|
|
\texttt{Reached maximum number of generations [1000/1000]}\\
|
|
\texttt{[To] -1564 101 60}\\
|
|
\texttt{17 81 59 5 94 43 42 14 40 13 15 82 45 46 35 51 26 100 74 38 24 22 21}\\
|
|
\texttt{54 23 66 86 99 44 87 64 34 57 25 32 75 80 29 79 67 53 3 1 58 95 97}\\
|
|
\texttt{90 85 37 83 16 92 91 36 41 96 93 52 56 12 33 77 70 30 88 39 20 72 71}\\
|
|
\texttt{ 31 62 89 61 49 2 8 18 6 10 9 0 68 78 28 27 76 11 73 55 50 65 19 69}\\
|
|
\texttt{48 63 47 7 4 98 84}\\
|
|
|
|
|
|
\medskip
|
|
|
|
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 genetic algorithm dedicated components}
|
|
|
|
Study the {\tt gen\_algo.cpp} file located in the {\bf lesson5} directory
|
|
using~:
|
|
\begin{itemize}
|
|
\item[$\bullet$] the ParadisEO-EO API documentation available at~:
|
|
|
|
\hspace{1cm}http$\,:$//eodev.sourceforge.net/eo/doc/html/index.html
|
|
|
|
\item[$\bullet$] the source files located in the {\bf tsp/src/} directory
|
|
\end{itemize}
|
|
|
|
|
|
\section{Customize the GA}
|
|
|
|
Make a backup (copy) of the cpp file {\tt gen\_algo.cpp}. You can now modify the
|
|
original {\tt gen\_algo.cpp} and use the existing makefiles to compile it.
|
|
|
|
Edit and modify the {\tt gen\_algo.cpp} file~:
|
|
\begin{itemize}
|
|
\item[$\bullet$] Try to tune a few parameters of the GA
|
|
(selection criteria, stopping criteria ...).
|
|
\item[$\bullet$] Then, try to change the initialization of the population
|
|
by applying one of the local searches on each individual.
|
|
\end{itemize}
|
|
|
|
\smallskip
|
|
To compile {\tt gen\_algo.cpp},you should use the
|
|
command {\tt make} from {\bf build/lesson5}.
|
|
|
|
\medskip
|
|
Finally, test your modifications on several TSP instances ({\tt berlin52},
|
|
{\tt eil101} ...) and compare the results you get.
|
|
|
|
\end{document}
|