mo build done

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@652 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2007-10-08 08:18:52 +00:00
commit 8ca6135acb
61 changed files with 25878 additions and 0 deletions

View file

@ -0,0 +1,9 @@
Source Code:
Sebastien CAHON
Jean-Charles BOISSON : Jean-Charles.Boisson@lifl.fr
Lessons:
Sebastien CAHON
Documentation:
Jean-Charles BOISSON : Jean-Charles.Boisson@lifl.fr

View file

@ -0,0 +1,138 @@
######################################################################################
### 0) If you want to set your own variables in mo-conf.cmake and avoid the cmd line
######################################################################################
INCLUDE(mo-conf.cmake OPTIONAL)
######################################################################################
######################################################################################
### 1) Project properties
######################################################################################
# set the project name
PROJECT(ParadisEO-MO)
SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE)
SET(PACKAGE_NAME "ParadisEO-MO Moving Objects" CACHE STRING "Package name" FORCE)
SET(PACKAGE_STRING "ParadisEO-MO 1.0" CACHE STRING "Package string full name" FORCE)
SET(PACKAGE_VERSION "1.0" CACHE STRING "Package version" FORCE)
SET(GLOBAL_VERSION "1.0" CACHE STRING "Global version" FORCE)
SET(VERSION "1.0" CACHE STRING "Version" FORCE)
# check cmake version compatibility
CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR)
# regular expression checking
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
# set a language for the entire project.
ENABLE_LANGUAGE(CXX)
ENABLE_LANGUAGE(C)
#####################################################################################
#####################################################################################
### 2) Include required modules
#####################################################################################
INCLUDE(CMakeBackwardCompatibilityCXX)
INCLUDE(FindDoxygen)
INCLUDE(FindGnuplot)
# check for some functions
INCLUDE(CheckLibraryExists)
######################################################################################
######################################################################################
### 3) Include the main configuration variables
######################################################################################
# The "config" variable must be provided on the command line
IF(NOT DEFINED config OR NOT config)
MESSAGE(FATAL_ERROR "The \"config\" variable must be set on the command line to
give the path of the install configuration file. ")
ENDIF(NOT DEFINED config OR NOT config)
# Need the config file whose full path is given thanks to the "config" variable
INCLUDE(${config})
######################################################################################
######################################################################################
### 4) 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")
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})
######################################################################################
#####################################################################################
### 5) Manage the build type
#####################################################################################
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
SET(CMAKE_DEFAULT_BUILD_TYPE Debug CACHE STRING "Variable that stores the default CMake build type" FORCE)
IF(WIN32 AND NOT CYGWIN)
IF(NOT CMAKE_BUILD_TYPE)
SET( CMAKE_BUILD_TYPE
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "")
MESSAGE(STATUS "Warning: The type of build is: ${CMAKE_BUILD_TYPE}.")
MESSAGE(STATUS "The available types are: None Debug Release RelWithDebInfo MinSizeRel.")
MESSAGE(STATUS "You can choose it with: cmake <path-to-source> -D<build-type>")
MESSAGE(STATUS "")
ENDIF(WIN32 AND NOT CYGWIN)
#####################################################################################
######################################################################################
### 6) Where must cmake go now ?
######################################################################################
SUBDIRS(doc test tutorial)
######################################################################################
######################################################################################
### 7) Test config
######################################################################################
#SET(ENABLE_CMAKE_TESTING TRUE CACHE BOOL "Should we test using Dart")
IF (ENABLE_CMAKE_TESTING)
ENABLE_TESTING()
ENDIF (ENABLE_CMAKE_TESTING)
######################################################################################

View file

@ -0,0 +1,76 @@
PARADISEO-MO README FILE
=======================================================================
=======================================================================
Welcome to PARADISEO-MO (Moving Objects), one part of the ParadisEO framework.
=======================================================================
BUILDING PARADISEO-MO
=======================================================================
The basic installation procedure goes the following:
To compile paradiseo-mo in the default directory,
go to paradiseo-mo/build/ and run:
> cmake ../ -Dconfig=<path to the install.cmake file>
> make
// for an easy-use of the provided lessons
> make install
// optional (if the documentation is not already available)
> make doc
To compile paradiseo-mo anywhere else, simply run:
> cmake $(MO) -Dconfig=<path to the install.cmake file>
> make
// for an easy-use of the provided lessons
> make install
// optional (if the documentation is not already available)
> make doc
where $(MO) is the top-level directory of PARADISEO-MO.
To clean everything, simply run
> make clean
======================================================================
DIRECTORY STRUCTURE
======================================================================
After unpacking the archive file, you should end up with the following
structure:
.../ The MAIN PARADISEO-MO directory, created when unpacking.
|
+-- build Repertory where the executables will be produced.
|
|
+-- src SOURCE directory contains most PARADISEO-MO .h files.
|
|
+-- doc DOCUMENTATION directory (generated by Doxygen).
| |
| +- html HTML files - start at index.html.
| |
| +- latex latex files - use to generate Postcript doc.
| |
| +- man Unix man format documentation.
|
|
+-- tutorial TUTORIAL with lessons
|
+- examples APPLICATIONS - one directory per separate application.
| |
| +- tsp traveling salesman problem (TSP) example sources.
| |
| +- benchs TSP instance files.
|
+- Lesson1 How make a Hill Climbing on the TSP example (source file and lesson_1.pdf).
|
+- Lesson2 How make a Tabu Search on the TSP example (source file and lesson_2.pdf).
|
+- Lesson3 How make a Simulated Annealing on the TSP example (source file and lesson_3.pdf).
===================================================================
NOTES
===================================================================
Mailing list : paradiseo-help@lists.gforge.inria.fr

View file

@ -0,0 +1,25 @@
######################################################################################
######################################################################################
### In this file, you can specify many CMake variables used to build paradisEO-MO.
######################################################################################
######################################################################################
######################################################################################
### 1) OPTIONNAL
######################################################################################
# SET (MYVAR MYVALUE)
######################################################################################
#####################################################################################
### 2) OPTIONNAL - Overwrite subdirs
######################################################################################
# SUBDIRS(doc tutorial)
######################################################################################

View file

@ -0,0 +1,87 @@
###############################################################################
##
## CMakeLists file for ParadisEO-MO/test
##
###############################################################################
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
######################################################################################
######################################################################################
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MO_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}\\lib\\${CMAKE_BUILD_TYPE}
${ParadisEO-MO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}
)
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
######################################################################################
### 3) Define your targets and link the librairies
######################################################################################
SET (TEST_LIST t-mo)
FOREACH (test ${TEST_LIST})
SET ("T_${test}_SOURCES" "${test}.cpp")
ENDFOREACH (test)
IF(ENABLE_CMAKE_TESTING)
# Add the tests
FOREACH (test ${TEST_LIST})
ADD_EXECUTABLE(${test} ${T_${test}_SOURCES})
ADD_TEST(${test} ${test})
ENDFOREACH (test)
# Link the librairies
FOREACH (test ${TEST_LIST})
TARGET_LINK_LIBRARIES(${test} ga es eoutils eo)
ENDFOREACH (test)
ENDIF(ENABLE_CMAKE_TESTING)
######################################################################################
######################################################################################
### 5) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
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)
######################################################################################

View file

@ -0,0 +1,59 @@
/*
* <t-mo.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* Contact: paradiseo-help@lists.gforge.inria.fr
*
*/
//-----------------------------------------------------------------------------
// t-mo.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo.h> // MO
//-----------------------------------------------------------------------------
typedef EO<float> Chrom;
//-----------------------------------------------------------------------------
int main()
{
Chrom chrom1, chrom2;
std::cout << "chrom1 = " << chrom1 << std::endl
<< "chrom2 = " << chrom2 << std::endl;
return 0;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,17 @@
######################################################################################
### 1) Definitions (required for tsp target)
######################################################################################
SET(TSP_SRC_DIR ${ParadisEO-MO_SOURCE_DIR}/tutorial/examples/tsp CACHE PATH "TSP src directory")
SET(TSP_BINARY_DIR ${ParadisEO-MO_BINARY_DIR}/tutorial/examples/tsp CACHE PATH "TSP binary directory")
######################################################################################
######################################################################################
### 2) Where must cmake go now ?
######################################################################################
SUBDIRS(examples Lesson1 Lesson2 Lesson3)
######################################################################################

View file

@ -0,0 +1,83 @@
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${TSP_SRC_DIR})
######################################################################################
######################################################################################
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
######################################################################################
### 3) Define your target(s): just an executable here
######################################################################################
ADD_EXECUTABLE(hill_climbing hill_climbing.cpp)
ADD_DEPENDENCIES(hill_climbing tsp)
######################################################################################
######################################################################################
### 4) Optionnal: define your target(s)'s version: no effect for windows
######################################################################################
SET(HILLCLIMBING_VERSION ${GLOBAL_VERSION})
SET_TARGET_PROPERTIES(hill_climbing PROPERTIES VERSION "${HILLCLIMBING_VERSION}")
######################################################################################
######################################################################################
### 5) Link the librairies for your target(s)
######################################################################################
TARGET_LINK_LIBRARIES(hill_climbing tsp eo eoutils)
######################################################################################
######################################################################################
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
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)
######################################################################################

View file

@ -0,0 +1,92 @@
/*
* <hill_climbing.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sébastien Cahon, Jean-Charles Boisson
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* 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 ;
}

View file

@ -0,0 +1,81 @@
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${TSP_SRC_DIR})
######################################################################################
######################################################################################
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
######################################################################################
### 3) Define your target(s): just an executable here
######################################################################################
ADD_EXECUTABLE(tabu_search tabu_search.cpp)
ADD_DEPENDENCIES(tabu_search tsp)
######################################################################################
######################################################################################
### 4) Optionnal: define your target(s)'s version: no effect for windows
######################################################################################
SET(TABUSEARCH_VERSION ${GLOBAL_VERSION})
SET_TARGET_PROPERTIES(tabu_search PROPERTIES VERSION "${TABUSEARCH_VERSION}")
######################################################################################
######################################################################################
### 5) Link the librairies for your target(s)
######################################################################################
TARGET_LINK_LIBRARIES(tabu_search tsp eo eoutils)
######################################################################################
######################################################################################
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
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)
######################################################################################

View file

@ -0,0 +1,95 @@
/*
* <tabu_search.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sébastien Cahon, Jean-Charles Boisson
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* 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 ;
}

View file

@ -0,0 +1,81 @@
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src/utils)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${TSP_SRC_DIR})
######################################################################################
######################################################################################
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${TSP_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BIN_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
######################################################################################
### 3) Define your target(s): just an executable here
######################################################################################
ADD_EXECUTABLE(simulated_annealing simulated_annealing.cpp)
ADD_DEPENDENCIES(simulated_annealing tsp)
######################################################################################
######################################################################################
### 4) Optionnal: define your target(s)'s version: no effect for windows
######################################################################################
SET(SIMULATEDANNEALING_VERSION ${GLOBAL_VERSION})
SET_TARGET_PROPERTIES(simulated_annealing PROPERTIES VERSION "${SIMULATEDANNEALING_VERSION}")
######################################################################################
######################################################################################
### 5) Link the librairies for your target(s)
######################################################################################
TARGET_LINK_LIBRARIES(simulated_annealing tsp eo eoutils)
######################################################################################
######################################################################################
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
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)
######################################################################################

View file

@ -0,0 +1,92 @@
/*
* <simulated_annealing.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
*
* Sébastien Cahon, Jean-Charles Boisson
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
* 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_rand.h>
#include <two_opt_incr_eval.h>
int
main (int __argc, char * __argv [])
{
if (__argc != 2)
{
std :: cerr << "Usage : ./simulated_annealing [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 ! */
TwoOptRand two_opt_rand ; // Route Random. Gen.
TwoOptIncrEval two_opt_incr_eval ; // Eff. eval.
TwoOpt move ;
moExponentialCoolingSchedule cool_sched (0.1, 0.98) ; // Exponential Cooling Schedule
//moLinearCoolingSchedule cool_sched (0.1, 0.5) ; // Linear Cooling Schedule
moGenSolContinue <Route> cont (1000) ; /* Temperature Descreasing
will occur each 1000
iterations */
moSA <TwoOpt> simulated_annealing (two_opt_rand, two_opt_incr_eval, cont, 1000, cool_sched, full_eval) ;
simulated_annealing (route) ;
std :: cout << "[To] " << route << std :: endl ;
return 0 ;
}

View file

@ -0,0 +1,11 @@
######################################################################################
### 1) Where must cmake go now ?
######################################################################################
SUBDIRS(tsp)
######################################################################################

View file

@ -0,0 +1,85 @@
######################################################################################
### 0) Copy the "benchs" directory in the build directory to easily run the lessons
######################################################################################
ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-MO_SOURCE_DIR}/tutorial/examples/tsp/benchs)
ADD_CUSTOM_COMMAND(
TARGET install
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_directory
${ParadisEO-MO_SOURCE_DIR}/tutorial/examples/tsp/benchs
${ParadisEO-MO_BINARY_DIR}/tutorial/examples/tsp/benchs)
######################################################################################
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
######################################################################################
######################################################################################
### 2) Define your target(s): just the tsp here
######################################################################################
SET(TSP_LIB_OUTPUT_PATH ${TSP_BINARY_DIR}/lib)
SET(LIBRARY_OUTPUT_PATH ${TSP_LIB_OUTPUT_PATH})
SET (TSP_SOURCES graph.cpp
route_init.cpp
route_eval.cpp
part_route_eval.cpp
edge_xover.cpp
order_xover.cpp
route_valid.cpp
partial_mapped_xover.cpp
city_swap.cpp
two_opt.cpp
two_opt_init.cpp
two_opt_next.cpp
two_opt_incr_eval.cpp
two_opt_tabu_list.cpp
two_opt_rand.cpp)
ADD_LIBRARY(tsp STATIC ${TSP_SOURCES})
######################################################################################
######################################################################################
### 3) Optionnal: define your target(s)'s version: no effect for windows
######################################################################################
SET(TSP_VERSION "${GLOBAL_VERSION}")
SET_TARGET_PROPERTIES(tsp PROPERTIES VERSION "${TSP_VERSION}")
######################################################################################
######################################################################################
### 4) Windows advanced config - especially for Microsoft Visual Studio 8
######################################################################################
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)
######################################################################################

View file

@ -0,0 +1,536 @@
535
36.49 7.49
57.06 9.51
30.22 48.14
5.15 -3.56
34.59 -106.37
57.12 -2.12
16.45 -99.45
5.36 -0.1
28.56 -13.36
8.59 38.48
12.5 45.02
-34.48 138.38
30.23 -9.33
56.18 12.51
36.4 -4.3
40.38 8.17
35.11 -3.5
41.55 8.48
-37.01 174.47
38.17 -0.34
36.42 3.13
36.11 37.14
35.14 -101.42
31.58 35.59
52.18 4.46
61.1 -149.59
39.57 32.41
51.11 4.28
17.08 -61.47
43.37 13.22
29.38 35.01
59.39 17.55
15.18 38.55
-25.14 -57.31
23.58 32.47
37.54 23.44
33.46 -84.31
12.3 -70.01
24.26 54.28
36.55 30.48
26.16 50.38
40.29 50.01
39.11 -76.4
10.48 -74.52
-16.11 -52.3
10.25 45.01
41.18 2.05
32.22 -64.42
41.56 -72.41
40.39 17.57
44.49 20.19
9.21 34.31
32.06 20.16
52.29 13.24
48.27 -4.25
-19.48 3.45
33.49 35.29
54.39 -6.14
35.48 -101.22
4.24 18.31
13.04 -59.3
60.17 5.13
44.48 -68.5
33.14 44.14
45.4 9.24
33.34 -86.45
52.27 -1.45
42.33 9.29
45.48 -108.37
43.28 -1.32
13.21 -16.4
-3.19 29.19
13.55 100.36
12.38 -8.02
55.44 9.09
44.32 11.18
12.57 77.4
-15.41 34.58
27.13 56.22
-27.25 153.05
44.5 -0.43
4.42 -74.09
50.47 -1.51
19.05 72.52
67.16 14.22
42.22 -71
53.03 8.48
41.08 16.47
46.55 7.3
51.31 -2.35
50.54 4.29
-15.52 -47.55
47.35 7.32
48.1 16.13
47.27 19.15
-34.49 -58.32
42.55 -78.38
44.3 26.06
49.27 2.07
-4.15 15.15
39.15 9.04
30.08 31.24
23.11 113.16
33.33 -7.4
-11.54 22.45
4.49 -52.22
52.13 0.11
-35.19 149.12
10.36 -66.59
22.39 88.27
52.5 -1.19
49.01 2.33
43.33 6.57
45.4 -0.19
39.37 19.55
50.52 7.09
41.59 -87.54
41.48 12.36
9.34 -13.37
41.25 -81.51
3.26 -76.25
42.31 8.48
-28.02 145.37
7.11 79.53
40.04 -83.04
33.22 -7.35
48.07 7.22
44.22 28.29
45.4 -0.19
6.21 2.23
55.37 12.39
-33.58 18.36
37.28 15.04
10.27 -75.31
-26.25 146.14
39 17.05
12.12 -68.57
39.09 -84.2
39.03 -84.2
51.24 -3.12
29.11 -81.03
23.46 90.23
14.45 42.59
32.5 -96.51
33.25 36.31
-6.53 39.12
42.34 18.16
-29.58 30.57
38.51 -77.02
28.34 77.07
39.46 -104.53
32.46 -96.24
26.16 50.1
47.16 5.05
33.52 10.47
14.45 -17.3
4.01 9.43
19.08 30.26
25.16 51.34
49.22 0.1
-8.45 115.1
51.08 13.46
-12.25 130.52
42.14 -83.32
42.13 -83.21
53.26 -6.15
51.17 6.45
25.15 55.2
0.03 32.26
45.32 4.18
55.57 -3.22
51.27 5.23
31.48 -106.16
52.5 -1.19
48.19 6.04
40.07 33
40.09 82.4
40.42 -74.1
50.44 -3.25
-34.49 -58.32
64.49 -147.51
37.01 -7.58
-11.35 27.31
59.54 10.37
41.49 12.15
14.35 -61
33.56 45.8
-4.23 15.26
43.49 11.12
8.37 -13.12
41.26 15.32
50.02 8.34
44.12 12.04
-21.13 27.29
28.27 -13.52
53.29 -1
-19.27 29.52
54.23 18.28
60.12 11.05
24.57 10.1
-22.5 -43.15
55.52 -4.26
45.22 5.2
7.09 41.43
44.25 8.5
57.4 18.18
41.54 2.46
37.11 -3.47
47 15.26
51.09 -0.11
14.34 -90.32
46.14 6.07
-2.09 -79.53
52.28 9.42
53.38 10
60.19 24.58
35.2 25.11
30.2 120.51
22.19 114.12
31.4 6.09
35.33 139.46
21.2 -157.55
29.59 -95.28
38.57 -77.27
43.06 -78.57
38.52 1.22
47.34 -97.27
50.21 30.55
-25.44 -54.28
39.44 -86.17
40.59 28.49
38.17 27.1
21.3 39.12
49.13 -2.12
40.38 -73.46
11.33 43.1
-6.09 106.51
-26.08 28.15
-3.22 36.38
45.28 -73.44
12.03 8.31
34.34 69.12
63.59 -22.37
-1.58 30.08
22.34 120.17
24.54 67.09
-6.18 155.43
17.56 -76.48
50.05 19.47
15.36 32.33
27.42 85.22
3.08 101.33
29.13 47.58
-8.51 13.14
10.36 -66.59
36.04 -115.09
33.56 -118.24
53.52 -1.39
48.58 2.27
0.27 9.25
34.52 33.38
43.11 0
59.49 30.17
36.51 -2.22
51.24 12.25
51.25 12.14
6.1 1.15
40.46 -73.52
33.57 -118.24
50.38 5.27
51.09 -0.11
51.28 -0.27
50.34 3.05
-12.01 -77.07
45.27 9.16
38.46 -9.08
46.13 14.28
35.3 12.37
48.14 14.11
51.28 -0.27
6.35 3.2
27.56 -15.23
-16.3 -68.11
53.21 -2.53
6.1 1.15
51.53 -0.22
-25.55 32.34
-15.2 28.27
4.27 114
49.37 6.12
-17.49 25.49
25.41 32.43
45.44 4.56
13 80.11
40.29 -3.34
31.52 -4.13
53.21 -2.16
-3.04 -60
10.34 -71.44
-4.02 39.36
46.22 15.47
39.18 -94.44
28.32 -81.2
23.36 58.17
44.25 8.5
-37.44 144.54
24.31 39.42
-37.41 144.51
19.26 -99.04
12.07 -86.11
2.01 45.19
25.48 -80.17
20.56 -89.41
45.27 9.16
35.45 10.45
39.07 -94.36
35.52 14.29
4.11 73.32
47.45 7.26
55.33 13.22
54.31 -1.25
14.31 121.01
55.58 37.25
43.35 3.58
-25.55 32.34
-8.58 125.13
43.26 5.13
-20.26 57.41
51.21 1.21
44.53 -93.13
53.52 27.33
50.55 5.47
29.59 -90.16
-26.31 31.19
48.08 11.42
-34.5 -56.02
45.38 8.43
49.05 6.08
-17.45 177.27
40.53 14.18
25.02 -77.28
-1.19 36.56
43.4 7.13
55.02 -1.41
45.56 6.06
12.08 15.02
32.56 129.56
35.09 36.17
13.29 2.1
18.06 -15.57
-13 28.39
58.35 16.15
35.45 140.23
47.09 -1.36
49.3 11.05
52.41 1.17
40.38 -73.46
55.28 10.2
46.26 30.41
26.21 127.46
35.26 -97.46
40.54 9.31
41.07 -95.55
41.14 -8.41
41.59 -87.54
51.5 -8.29
28.26 -81.19
35.38 -0.37
48.43 2.23
34.47 135.27
60.12 11.05
51.12 2.52
44.34 26.06
12.21 -1.31
43.26 -5.5
18.34 -72.17
48.43 2.23
40.05 116.36
-31.56 115.58
4.52 7.02
37.08 -76.3
39.52 -75.15
33.26 -112.01
55.52 -4.26
46.35 0.18
40.3 -80.14
-5.15 39.49
39.33 2.44
38.1 13.06
11.33 104.51
36.49 11.58
-9.27 147.13
10.36 -61.21
9.05 -79.23
50.06 14.16
43.41 10.24
42.26 14.11
16.16 -61.32
9.03 -79.24
43.23 -0.25
45.39 12.12
31.37 -8.03
34.03 -6.45
-8.08 -34.55
38.04 15.39
64.08 -21.57
16.54 96.09
49.19 4.03
36.23 28.07
-29.43 -53.42
-22.5 -43.15
45.13 14.35
44.01 12.37
48.04 -1.44
6.14 -10.22
41.49 12.15
14.1 145.15
-32.55 -60.47
51.57 4.26
24.42 46.44
33.37 73.06
6.3 -58.15
15.29 44.13
13.42 -89.07
32.44 -117.11
-23 -47.08
29.32 -98.28
-17.56 31.06
48.31 -24.8
-33.23 -70.47
42.54 -8.25
33.14 44.14
18.26 -69.4
47.27 -122.18
27 14.27
37.33 126.48
51.34 0.42
-4.4 55.31
37.37 -122.23
31.12 121.2
25.21 55.24
16.45 -22.57
1.21 103.54
37.22 -121.56
43.49 18.2
9.58 -84.16
9.59 -84.12
18.26 -66.01
40.31 22.58
41.58 21.38
40.53 -111.57
36.58 -25.1
52.42 -8.55
42.42 23.24
43.32 16.18
-12.54 -38.2
38.45 -90.22
51.33 0.14
59.39 17.55
48.41 9.13
38.54 16.15
58.53 5.38
55.58 37.25
37.26 -5.54
48.32 7.38
52.22 13.3
-33.56 151.1
29.33 52.36
47.48 13
40.31 17.24
41.19 69.24
28.29 -16.2
38.31 -28.43
43.11 0
28.29 -16.2
14.02 -87.14
52.29 13.24
35.41 51.19
41.2 19.47
32.4 13.09
43.37 1.23
32.01 34.53
22.49 5.27
0.23 6.43
35.43 -5.55
-18.48 47.29
33.56 8.06
-24.42 -53.42
25.04 121.33
37.55 12.29
51.23 -2.43
45.12 7.39
45.5 13.28
45.39 12.12
47.26 0.43
36.18 -95.52
36.51 10.14
52.34 13.18
35.33 139.46
35.54 -83.53
40.62 13.11
-0.08 -78.29
12.41 101.01
13.45 -60.57
44.55 4.58
43.14 27.49
45.3 12.21
-23 -47.08
48.07 16.33
39.29 -0.29
41.42 -4.51
45.24 10.53
38.57 -77.27
52.1 20.58
36.45 -6.04
53.19 -113.35
44.53 -63.31
45.41 -74.02
45.19 -75.4
46.48 -71.24
42.16 -82.58
48.57 -54.34
45.28 -73.44
49.11 -123.1
49.55 -97.14
51.07 -114.01
47.37 -52.45
43.41 -79.38
44.06 15.21
45.45 16.04
41.4 -1.03
-6.13 39.13
47.28 8.33
51.33 0.14
24.58 91.53

View file

@ -0,0 +1,53 @@
52
565 575
25 185
345 750
945 685
845 655
880 660
25 230
525 1000
580 1175
650 1130
1605 620
1220 580
1465 200
1530 5
845 680
725 370
145 665
415 635
510 875
560 365
300 465
520 585
480 415
835 625
975 580
1215 245
1320 315
1250 400
660 180
410 250
420 555
575 665
1150 1160
700 580
685 595
685 610
770 610
795 645
720 635
760 650
475 960
95 260
875 920
700 500
555 815
830 485
1170 65
830 610
605 625
595 360
1340 725
1740 245

Some files were not shown because too many files have changed in this diff Show more