added practices to version control
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1002 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
71d4fd59ee
commit
22c6962aa2
72 changed files with 25134 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
utilities/trunk/practices/deprecated/tp_opti_18_02_2008.tgz
Normal file
BIN
utilities/trunk/practices/deprecated/tp_opti_18_02_2008.tgz
Normal file
Binary file not shown.
BIN
utilities/trunk/practices/deprecated/tp_opti_23_10_2007.tgz
Normal file
BIN
utilities/trunk/practices/deprecated/tp_opti_23_10_2007.tgz
Normal file
Binary file not shown.
BIN
utilities/trunk/practices/deprecated/tp_opti_gis_28092007.tgz
Normal file
BIN
utilities/trunk/practices/deprecated/tp_opti_gis_28092007.tgz
Normal file
Binary file not shown.
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
######################################################################################
|
||||
### 1) Project properties
|
||||
######################################################################################
|
||||
|
||||
# set the project name
|
||||
PROJECT(paradisEO-practices)
|
||||
|
||||
# check cmake version compatibility
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR)
|
||||
|
||||
# regular expression checking
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||
|
||||
# set a language
|
||||
ENABLE_LANGUAGE(CXX)
|
||||
ENABLE_LANGUAGE(C)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Include the main configuration variables
|
||||
######################################################################################
|
||||
|
||||
# Need the config file whose full path is given thanks to the "config" variable
|
||||
INCLUDE("install.cmake")
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Paths checking
|
||||
######################################################################################
|
||||
|
||||
IF(WIN32)
|
||||
SET (ABSOLUTE_PATH_REGEX "^[A-Z]:|^[a-z]:")
|
||||
ELSE(WIN32)
|
||||
SET (ABSOLUTE_PATH_REGEX "^/")
|
||||
ENDIF(WIN32)
|
||||
|
||||
SET(REQUIRED_PATHS "EO_SRC_DIR" "EO_BIN_DIR" "MO_SRC_DIR" "MO_BIN_DIR")
|
||||
FOREACH (path ${REQUIRED_PATHS})
|
||||
IF(EXISTS ${${path}})
|
||||
MESSAGE (STATUS "Using ${path}=${${path}}")
|
||||
ELSE(EXISTS ${${path}})
|
||||
MESSAGE (FATAL_ERROR "\n Cannot find \"${${path}}\". Please, fill \"${config}\" with a correct value")
|
||||
ENDIF(EXISTS ${${path}})
|
||||
|
||||
IF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
MESSAGE (FATAL_ERROR "${${path}} MUST BE an absolute path")
|
||||
ENDIF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
ENDFOREACH (path ${REQUIRED_PATHS})
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
SUBDIRS(tsp lesson2 lesson3 lesson4 lesson5)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
PARADISEO (PARallel and DIStributed Evolving Objects) is a white-box object-oriented framework dedicated to the flexible design of metaheursitics. Based on EO, this template-based, ANSI-C++ compliant computation library is portable across both Windows system and sequential platforms (Unix, Linux, MacOS, etc.).
|
||||
|
||||
WEBSITE: http://paradiseo.gforge.inria.fr
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
#####################################################################################
|
||||
### Manage the build type
|
||||
#####################################################################################
|
||||
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
|
||||
SET(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
|
||||
|
||||
FIND_PROGRAM(MEMORYCHECK_COMMAND
|
||||
NAMES purify valgrind
|
||||
PATHS
|
||||
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
|
||||
DOC "Path to the memory checking command, used for memory error detection.")
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET( CMAKE_BUILD_TYPE
|
||||
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
|
||||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
ELSE(WIN32 AND NOT CYGWIN)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -Wall -Wextra")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF(WIN32 AND NOT CYGWIN)
|
||||
|
||||
IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
|
||||
##########################################################################################################################################
|
||||
### ParadisEO Install Configuration
|
||||
### The path to the modules EO and MO must be specified above.
|
||||
##########################################################################################################################################
|
||||
|
||||
SET(EO_SRC_DIR "E:\\temp\\ParadisEO\\paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
|
||||
SET(EO_BIN_DIR "E:\\temp\\ParadisEO\\paradiseo-eo\\build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
|
||||
|
||||
SET(MO_SRC_DIR "E:\\temp\\ParadisEO\\paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||
SET(MO_BIN_DIR "E:\\temp\\ParadisEO\\paradiseo-mo\\build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||
|
||||
###########################################################################################################################################
|
||||
|
||||
|
||||
Binary file not shown.
|
|
@ -0,0 +1,216 @@
|
|||
\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
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fichier entete
|
||||
%\input /usr/local/home/gisEns/fseynhae/Ens/Entete.tex
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
\textbf{ParadisEO Practices} {\copyright Franck Seynhaeve,
|
||||
Jean-Charles Boisson, Thomas Legrand} \Large{\textbf{\\\\
|
||||
Lesson 1: Install ParadisEO and the practices}}
|
||||
|
||||
\normalsize
|
||||
|
||||
\vspace{-0,3cm}
|
||||
|
||||
\section{The ParadisEO platform}
|
||||
|
||||
\medskip
|
||||
|
||||
ParadisEO\footnote{http$\,:$//paradiseo.gforge.inria.fr/} (PARallel and DIStributed Evolving Objects) is a white-box
|
||||
object-oriented framework dedicated to the flexible design of metaheuristics.
|
||||
Based on EO\footnote{\tt http$\,:$//eodev.sourceforge.net/} (Evolutionary Computation Framework),
|
||||
this template-based,
|
||||
ANSI-C++ compliant computation library is portable across both Windows
|
||||
system and sequential platforms (Unix, Linux, MacOS, etc.).
|
||||
|
||||
\smallskip
|
||||
ParadisEO can be used under several environments as the build process (CMake)
|
||||
is able to generate:
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Visual Studio 8 2005 (Win32 + Win64) projects
|
||||
\item[$\bullet$] Visual Studio 7 .NET 2003 projects
|
||||
\item[$\bullet$] Visual Studio 7 and 6 projects
|
||||
\item[$\bullet$] NMake Makefiles
|
||||
\item[$\bullet$] MinGW Makefiles
|
||||
\item[$\bullet$] Borland Makefiles
|
||||
\item[$\bullet$] KDevelop projects
|
||||
\item[$\bullet$] Unix Makefiles
|
||||
\item[$\bullet$] Xcode Projects
|
||||
\item[$\bullet$] MSYS Makefiles
|
||||
\item[$\bullet$] WMake Makefiles
|
||||
\end{itemize}
|
||||
|
||||
\smallskip
|
||||
Paradiseo is composed of several packages that constitute a global framework.
|
||||
|
||||
\begin{center}
|
||||
\end{center}
|
||||
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Paradiseo-EO provides tools for the development of population-based metaheuristic:
|
||||
\begin{itemize}
|
||||
\item[$\ast$] Genetic algorithm
|
||||
\item[$\ast$] Genetic programming
|
||||
\item[$\ast$] Particle Swarm Optimization
|
||||
\item[$\ast$] ...
|
||||
\end{itemize}
|
||||
\item[$\bullet$] Paradiseo-MO provides tools for the development of single solution-based metaheuristics:
|
||||
\begin{itemize}
|
||||
\item[$\ast$] Hill-Climbing
|
||||
\item[$\ast$] Tabu Search
|
||||
\item[$\ast$] Simulated annealing
|
||||
\item[$\ast$] Incremental evaluation, partial neighbourhood
|
||||
\item[$\ast$] ...
|
||||
\end{itemize}
|
||||
\item[$\bullet$] Paradiseo-MOEO provides tools for the design of Multi-objective metaheuristics:
|
||||
\begin{itemize}
|
||||
\item[$\ast$] MO fitness assignment shemes (the ones used in NSGA-II, IBEA ...)
|
||||
\item[$\ast$] MO diversity assignment shemes (sharing, crowding)
|
||||
\item[$\ast$] Elitism
|
||||
\item[$\ast$] Performance metrics (contribution, entropy ...)
|
||||
\item[$\ast$] Easy-to-use standard evolutionary algorithms (NSGA-II, IBEA ...)
|
||||
\item[$\ast$] ...
|
||||
\end{itemize}
|
||||
\item[$\bullet$] Paradiseo-PEO provides tools for the design of parallel and distributed metaheuristics:
|
||||
\begin{itemize}
|
||||
\item[$\ast$] Parallel evaluation
|
||||
\item[$\ast$] Parallel evaluation function
|
||||
\item[$\ast$] Island model
|
||||
\item[$\ast$] Cellular model
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
|
||||
\smallskip
|
||||
Furthermore, Paradiseo also introduces tools for the design of distributed, hybrid and cooperative models:
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] High level hybrid metaheuristics: coevolutionary and relay model
|
||||
\item[$\bullet$] Low level hybrid metaheuristics: coevolutionary and relay model
|
||||
\end{itemize}
|
||||
|
||||
|
||||
|
||||
\section{Installation}
|
||||
|
||||
\subsection{ParadisEO}
|
||||
|
||||
The practices require ParadisEO to be installed on your
|
||||
computer. You can easily process to the installation:
|
||||
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Make sure to have the following tools
|
||||
available in your environment:
|
||||
|
||||
\hspace{1cm}$\vartriangleright$ {\tt CMake}
|
||||
\\\hspace*{1cm}$\vartriangleright$ {\tt Tar} or a similar extractor
|
||||
|
||||
\item[$\bullet$] Download ParadisEO (choose the {\tt tar.gz} file)
|
||||
from:
|
||||
\\\hspace*{1cm}$\vartriangleright$ {\tt http$\,:$//www2.lifl.fr/OPAC/Paradiseo/licence/FrmDownload.php}
|
||||
|
||||
\item[$\bullet$] Extract the content of the archive:
|
||||
\\\hspace*{1cm}$\vartriangleright$ Put the archive {\tt
|
||||
paradiseo-ix86-1.0.tar.gz} in the directory of your
|
||||
choice. Let's suppose you put it in \textbf{{\tt
|
||||
/home/me/software}}
|
||||
\\\hspace*{1cm}$\vartriangleright$ Extract it by entering
|
||||
the following line in a terminal: {\tt tar xzf paradiseo-ix86-1.0.tar.gz}
|
||||
|
||||
\item[$\bullet$] Install it:
|
||||
\\\hspace*{1cm}$\vartriangleright$ {\tt bash installParadiseo.sh} or {\tt sh
|
||||
installParadiseo.sh} if your shell is a "sh" one
|
||||
\\\hspace*{1cm}$\vartriangleright$ \textbf{Select your generator (Unix Makefiles recommended) }
|
||||
\\\hspace*{1cm}$\vartriangleright$ \textbf{Select the minimum installation mode by choosing the \emph{basic install} }
|
||||
|
||||
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\subsection{The archive dedicated to the practices}
|
||||
|
||||
To start with the practices, you have to install the archive
|
||||
called {\tt paradiseo\_practices\_0208.tgz} that you have been
|
||||
given. This archive is also available for download at
|
||||
{\tt http$\,:$//paradiseo.gforge.inria.fr}.\\\\
|
||||
\textbf{ Let's suppose you have installed ParadisEO
|
||||
into the {\tt /home/me/software} directory. Each time
|
||||
it appears, you are to replace this path with the one
|
||||
corresponding to your ParadisEO installation directory.
|
||||
}
|
||||
\\\\When the archive has been extracted, please go in the
|
||||
{\tt practices} directory and edit the {\tt install.cmake}
|
||||
file:
|
||||
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Fill the {\tt EO\_SRC\_DIR} variable with the path to ParadisEO-EO :
|
||||
|
||||
\hspace{1cm}{\tt /home/me/software/ParadisEO/paradiseo-eo}
|
||||
\item[$\bullet$] Fill the {\tt EO\_BIN\_DIR} variable with the path to
|
||||
ParadisEO-EO build directory :
|
||||
|
||||
\hspace{1cm}{\tt /home/me/software/ParadisEO/paradiseo-eo/build}
|
||||
\item[$\bullet$] Fill the {\tt MO\_SRC\_DIR} variable with the path to ParadisEO-MO :
|
||||
|
||||
\hspace{1cm}{\tt /home/me/software/ParadisEO/paradiseo-mo}
|
||||
\item[$\bullet$] Fill the {\tt MO\_BIN\_DIR} variable with the path to
|
||||
ParadisEO-MO build directory :
|
||||
|
||||
\hspace{1cm}{\tt /home/me/software/ParadisEO/paradiseo-mo/build}
|
||||
\end{itemize}
|
||||
|
||||
\medskip
|
||||
Then, go in the {\tt build} directory and run :
|
||||
|
||||
\hspace{1cm}{\tt cmake ../}
|
||||
|
||||
\medskip
|
||||
You can now compile the practices using: {\tt make}
|
||||
|
||||
|
||||
\section{Archive content}
|
||||
|
||||
At the top level of the {\tt practices} directory, you must have:
|
||||
\begin{itemize}
|
||||
|
||||
\item[$\bullet$] {\bf tsp/src}: Contains the sources required to solve the TSP
|
||||
problem using ParadisEO. The associated benchmarks are in the
|
||||
{\bf benchs} directory.
|
||||
|
||||
\item[$\bullet$] {\bf lesson1}: ParadisEO installation practice, contains {\tt lesson1.pdf}.
|
||||
|
||||
\item[$\bullet$] {\bf lesson2}: Contains an implementation of the Hill-Climbing
|
||||
{\tt hill\_climbing.cpp} and the corresponding tutorial {\tt lesson2.pdf}.
|
||||
|
||||
\item[$\bullet$] {\bf lesson3}: Contains an implementation of a tabu
|
||||
search {\tt tabu\_search.cpp} and the corresponding tutorial {\tt lesson3.pdf}.
|
||||
|
||||
\item[$\bullet$] {\bf lesson4}: Contains an implementation of the
|
||||
Simulated Annealing {\tt simulated\_annealing.cpp} and the corresponding
|
||||
tutorial {\tt lesson4.pdf}.
|
||||
|
||||
\item[$\bullet$] {\bf lesson5}: Contains an implementation of a
|
||||
genetic algorithm {\tt gen\_algo.cpp} .
|
||||
|
||||
\item[$\bullet$] {\bf build}: Contains the built targets and
|
||||
the executables (subdirectories {\bf lesson1},
|
||||
{\bf lesson2}, {\bf lesson3}, {\bf lesson4} and {\bf lesson5}).
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\end{document}
|
||||
|
|
@ -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(hill_climbing hill_climbing.cpp)
|
||||
|
||||
ADD_DEPENDENCIES(hill_climbing tsp)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Link the librairies for your target(s)
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(hill_climbing tsp eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "hill_climbing.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>
|
||||
|
||||
int
|
||||
main (int __argc, char * __argv [])
|
||||
{
|
||||
if (__argc != 2) {
|
||||
|
||||
std :: cerr << "Usage : ./hill_climbing [instance]" << std :: endl ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
srand (1000) ;
|
||||
|
||||
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.
|
||||
|
||||
//moFirstImprSelect <TwoOpt> two_opt_select ;
|
||||
moBestImprSelect <TwoOpt> two_opt_select ;
|
||||
//moRandImprSelect <TwoOpt> two_opt_select ;
|
||||
|
||||
moHC <TwoOpt> hill_climbing (two_opt_init, two_opt_next, two_opt_incr_eval, two_opt_select, full_eval) ;
|
||||
hill_climbing (route) ;
|
||||
|
||||
std :: cout << "[To] " << route << std :: endl ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
|
@ -0,0 +1,90 @@
|
|||
\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 2: Implement a Hill-Climbing using ParadisEO}}
|
||||
|
||||
\normalsize
|
||||
|
||||
\vspace{-0,3cm}
|
||||
|
||||
\section{Example}
|
||||
|
||||
The archive {\tt paradiseo\_practices\_0208.tgz} installed
|
||||
on your computer contains a Hill-Climbing implemented using ParadisEO-MO~
|
||||
(see {\tt hill\_climbing} in the {\bf build/lesson2} directory).
|
||||
|
||||
\medskip
|
||||
To run it, please go in {\bf build/lesson2} and start the program {\tt hill\_climbing} by giving
|
||||
one of the TSP instances located in {\bf tsp/benchs}.
|
||||
|
||||
|
||||
\medskip
|
||||
When entering {\tt ./hill\_climbing ../../tsp/benchs/berlin52.tsp}, you should end up with the
|
||||
following outputs:
|
||||
|
||||
\smallskip
|
||||
\noindent
|
||||
\texttt{>> Loading [../tsp/benchs/berlin52.tsp]}\\
|
||||
\texttt{[From] -29414 52 1 20 40 48 9 27 13 22 5 28 24 29 21 26 44 38 33 37 45 31 42 18 12 3 14}\\
|
||||
\texttt{36 30 6 51 32 17 11 0 34 4 10 4350 16 2 23 35 19 46 49 39 25 15 41 8 7 47}\\
|
||||
\texttt{[To] -8724 52 1 6 41 29 22 19 49 15 28 46 13 51 12 25 26 27 11 10 50 32 42 9 8 7 40 18}\\
|
||||
\texttt{44 2 16 20 30 17 21 0 31 48 35 3438 39 37 36 33 43 45 24 3 5 4 14 23
|
||||
47} \\
|
||||
|
||||
The printed-out results show for the initial best solution and the final one~:
|
||||
\\ \hspace*{1cm}-the length of the route
|
||||
\\ \hspace*{1cm}-the number of cities
|
||||
\\ \hspace*{1cm}-the route itself (notice that the city index starts from 0).
|
||||
|
||||
|
||||
\section{Tabu search}
|
||||
|
||||
Study the {\tt hill\_climbing.cpp} file located in the {\bf lesson2} 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 Hill CLimbing}
|
||||
|
||||
Make a backup (copy) of the cpp file {\tt tabuhill\_climbing.cpp}. You can now modify the
|
||||
original {\tt hill\_climbing.cpp} and use the existing makefiles to compile it.
|
||||
|
||||
Edit and modify the {\tt hill\_climbing.cpp} file~:
|
||||
\begin{itemize}
|
||||
\item[$\bullet$] Try to tune a few parameters (random seed
|
||||
and the move selector) and observe the changes on the final
|
||||
solution.
|
||||
|
||||
\end{itemize}
|
||||
|
||||
\smallskip
|
||||
To compile {\tt hill\_climbing.cpp}, you should use the
|
||||
command {\tt make} from {\bf build/lesson2}.
|
||||
|
||||
\medskip
|
||||
Finally, test your modifications on several TSP instances ({\tt berlin52},
|
||||
{\tt eil101} ...) and compare the results you get.
|
||||
|
||||
|
||||
\end{document}
|
||||
|
|
@ -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,89 @@
|
|||
\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/berlin52.tsp]}\\
|
||||
\texttt{[From] -29414 52 1 20 40 48 9 27 13 22 5 28 24 29 21 26 44 38 33 37 45 31 42 18 12 3 14}\\
|
||||
\texttt{36 30 6 51 32 17 11 0 34 4 10 4350 16 2 23 35 19 46 49 39 25 15 41 8 7 47}\\
|
||||
\texttt{[To] -8724 52 1 6 41 29 22 19 49 15 28 46 13 51 12 25 26 27 11 10 50 32 42 9 8 7 40 18}\\
|
||||
\texttt{44 2 16 20 30 17 21 0 31 48 35 3438 39 37 36 33 43 45 24 3 5 4 14 23
|
||||
47} \\
|
||||
|
||||
The printed-out results show for the initial best solution and the final one~:
|
||||
\\ \hspace*{1cm}-the length of the route
|
||||
\\ \hspace*{1cm}-the number of cities
|
||||
\\ \hspace*{1cm}-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 ;
|
||||
}
|
||||
|
||||
|
|
@ -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(simulated_annealing simulated_annealing.cpp)
|
||||
|
||||
ADD_DEPENDENCIES(simulated_annealing tsp)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Link the librairies for your target(s)
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(simulated_annealing tsp eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue