git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1482 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cb729a7668
commit
8fb5a075e9
78 changed files with 0 additions and 6276 deletions
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
#####################################################################################
|
||||
### 1) Definitions (required for tsp target)
|
||||
######################################################################################
|
||||
|
||||
SET(TSP_SRC_DIR ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp)
|
||||
SET(TSP_BINARY_DIR ${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp)
|
||||
SET(FLOWSHOP_SRC_DIR "${MOEO_SRC_DIR}/tutorial/examples/flowshop" CACHE PATH "Flowshop source directory" FORCE)
|
||||
SET(FLOWSHOP_BIN_DIR "${MOEO_BIN_DIR}/tutorial/examples/flowshop" CACHE PATH "Flowshop binary directory" FORCE)
|
||||
|
||||
######################################################################################
|
||||
|
||||
######################################################################################
|
||||
### 2) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ADD_SUBDIRECTORY(Lesson1)
|
||||
ADD_SUBDIRECTORY(Lesson2)
|
||||
ADD_SUBDIRECTORY(Lesson3)
|
||||
ADD_SUBDIRECTORY(Lesson4)
|
||||
ADD_SUBDIRECTORY(Lesson5)
|
||||
ADD_SUBDIRECTORY(Lesson6)
|
||||
######################################################################################
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson1/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson1
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(pso mainPSO.cpp)
|
||||
ADD_DEPENDENCIES(pso peo rmc_mpi)
|
||||
ADD_EXECUTABLE(ea mainEA.cpp)
|
||||
ADD_DEPENDENCIES(ea peo rmc_mpi)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(LESSON1_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(pso PROPERTIES VERSION "${LESSON1_VERSION}")
|
||||
SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON1_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(pso ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* <mainEA.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
#include <es.h>
|
||||
|
||||
typedef eoReal<double> Indi;
|
||||
|
||||
//Evaluation function
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
||||
// => optimal : f* = 0 , with x* =(1,1)
|
||||
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
|
||||
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
||||
peo :: init( __argc, __argv );
|
||||
|
||||
//Parameters
|
||||
eoParser parser(__argc, __argv);
|
||||
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||
rng.reseed (time(0));
|
||||
|
||||
// Stopping
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
|
||||
// For a parallel evaluation
|
||||
peoEvalFunc<Indi> plainEval(f);
|
||||
peoPopEval <Indi> eval(plainEval);
|
||||
|
||||
// Initialization
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
|
||||
// Selection
|
||||
eoRankingSelect<Indi> selectionStrategy;
|
||||
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
||||
|
||||
// Transformation
|
||||
eoSegmentCrossover<Indi> crossover;
|
||||
eoUniformMutation<Indi> mutation(EPSILON);
|
||||
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||
|
||||
// Replacement
|
||||
eoPlusReplacement<Indi> replace;
|
||||
|
||||
// Creation of the population
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
|
||||
// Algorithm
|
||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
|
||||
//Parallel algorithm
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
eval.setOwner(parallelEA);
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* <mainPSO.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
|
||||
typedef eoRealParticle < double >Indi;
|
||||
|
||||
//Evaluation function
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
// Rosenbrock function f(x) = 100*(x[1]-x[0]^2)^2+(1-x[0])^2
|
||||
// => optimal : f* = 0 , with x* =(1,1)
|
||||
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
|
||||
// Initialization of the parallel environment : thanks this instruction, ParadisEO-PEO can initialize himself
|
||||
peo :: init( __argc, __argv );
|
||||
|
||||
//Parameters
|
||||
eoParser parser(__argc, __argv);
|
||||
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||
double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value();
|
||||
double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value();
|
||||
double weight = parser.createParam(1.0, "weight", "Weight",'w',"Param").value();
|
||||
double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value();
|
||||
double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value();
|
||||
unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value();
|
||||
rng.reseed (time(0));
|
||||
|
||||
// Stopping
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
|
||||
// For a parallel evaluation
|
||||
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
||||
peoPopEval< Indi > eval(plainEval);
|
||||
|
||||
// Initialization
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
|
||||
// Velocity
|
||||
eoUniformGenerator < double >sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
|
||||
eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen);
|
||||
|
||||
// Initializing the best
|
||||
eoFirstIsBestInit < Indi > localInit;
|
||||
|
||||
// Flight
|
||||
eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
|
||||
eoStandardFlight < Indi > flight(bndsFlight);
|
||||
|
||||
// Creation of the population
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
|
||||
// Topology
|
||||
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
|
||||
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
|
||||
eoStandardVelocity < Indi > velocity (topology,weight,C1,C2,bnds);
|
||||
|
||||
// Initialization
|
||||
eoInitializer <Indi> init(eval,veloRandom,localInit,topology,pop);
|
||||
|
||||
//Parallel algorithm
|
||||
eoSyncEasyPSO <Indi> psa(init,checkpoint,eval, velocity, flight);
|
||||
peoWrapper parallelPSO( psa, pop);
|
||||
eval.setOwner(parallelPSO);
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO Lesson1"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../../doc/html/lesson1
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ../../docs/images
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../ \
|
||||
../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
###### Param ######
|
||||
--popSize=20 # -P : Population size
|
||||
--maxGen=200 # -G : Maximum number of generations
|
||||
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||
--pCross=0.80 # -C : Crossover probability
|
||||
--pMut=0.30 # -M : Mutation probability
|
||||
--vecSize=2 # -V : Vector size
|
||||
--pMin=-2.0 # -N : Init position min
|
||||
--pMax=2.0 # -X : Init position max
|
||||
--vMin=-1.0 # -n : Init velocity min
|
||||
--vMax=1.0 # -x : Init velocity max
|
||||
--neighSize=6 # -H : Neighborhood size
|
||||
--weight=1.0 # -w : Weight
|
||||
--c1=0.5 # -1 : C1
|
||||
--c2=2.0 # -2 : C2
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson2/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson2
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(ea2 mainEA.cpp)
|
||||
ADD_DEPENDENCIES(ea2 peo rmc_mpi)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(LESSON2_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(ea2 PROPERTIES VERSION "${LESSON2_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(ea2 ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* <mainEA.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
#include <es.h>
|
||||
|
||||
typedef eoReal<double> Indi;
|
||||
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
|
||||
peo :: init( __argc, __argv );
|
||||
eoParser parser(__argc, __argv);
|
||||
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||
rng.reseed (time(0));
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
peoEvalFunc<Indi> plainEval(f);
|
||||
peoPopEval <Indi> eval(plainEval);
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
eoRankingSelect<Indi> selectionStrategy;
|
||||
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
||||
eoSegmentCrossover<Indi> crossover;
|
||||
eoUniformMutation<Indi> mutation(EPSILON);
|
||||
|
||||
// Parallel transformation
|
||||
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||
|
||||
eoPlusReplacement<Indi> replace;
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
eval.setOwner(parallelEA);
|
||||
|
||||
// setOwner
|
||||
transform.setOwner (parallelEA);
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO Lesson2"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../../doc/html/lesson2
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ../../docs/images
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../ \
|
||||
../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
###### Param ######
|
||||
--popSize=20 # -P : Population size
|
||||
--maxGen=300 # -G : Maximum number of generations
|
||||
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||
--pCross=0.80 # -C : Crossover probability
|
||||
--pMut=0.30 # -M : Mutation probability
|
||||
--vecSize=2 # -V : Vector size
|
||||
--pMin=-2.0 # -N : Init position min
|
||||
--pMax=2.0 # -X : Init position max
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson3/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson3
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(pso3 mainPSO.cpp)
|
||||
ADD_DEPENDENCIES(pso3 peo rmc_mpi)
|
||||
ADD_EXECUTABLE(ea3 mainEA.cpp)
|
||||
ADD_DEPENDENCIES(ea3 peo rmc_mpi)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(LESSON3_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(pso3 PROPERTIES VERSION "${LESSON3_VERSION}")
|
||||
SET_TARGET_PROPERTIES(ea3 PROPERTIES VERSION "${LESSON3_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(pso3 ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
TARGET_LINK_LIBRARIES(ea3 ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* <mainEA.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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/syncor 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 <peo>
|
||||
#include <es.h>
|
||||
|
||||
typedef eoReal<double> Indi;
|
||||
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
|
||||
peo :: init( __argc, __argv );
|
||||
eoParser parser(__argc, __argv);
|
||||
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value();
|
||||
double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value();
|
||||
double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||
unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value();
|
||||
unsigned int MIG_SIZE = parser.createParam((unsigned int)(5), "migSize", "Migration size",'S',"Param").value();
|
||||
rng.reseed (time(0));
|
||||
|
||||
// Define the topology of your island model
|
||||
RingTopology topology;
|
||||
|
||||
// First algorithm
|
||||
/*****************************************************************************************/
|
||||
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
peoEvalFunc<Indi> mainEval( f );
|
||||
peoPopEval <Indi> eval(mainEval);
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
eoRankingSelect<Indi> selectionStrategy;
|
||||
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
||||
eoSegmentCrossover<Indi> crossover;
|
||||
eoUniformMutation<Indi> mutation(EPSILON);
|
||||
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
|
||||
// Define a synchronous island
|
||||
|
||||
// Seclection
|
||||
eoRandomSelect<Indi> mig_select_one;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select (mig_select_one,MIG_SIZE,pop);
|
||||
// Replacement
|
||||
eoPlusReplacement<Indi> replace;
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace (replace,pop);
|
||||
// Island
|
||||
peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig(MIG_FREQ,mig_select,mig_replace,topology);
|
||||
checkpoint.add(mig);
|
||||
|
||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
eval.setOwner(parallelEA);
|
||||
transform.setOwner(parallelEA);
|
||||
// setOwner
|
||||
mig.setOwner(parallelEA);
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
// Second algorithm (on the same model but with others names)
|
||||
/*****************************************************************************************/
|
||||
|
||||
eoGenContinue < Indi > genContPara2 (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara2 (genContPara2);
|
||||
eoCheckPoint<Indi> checkpoint2(continuatorPara2);
|
||||
peoEvalFunc<Indi> mainEval2( f );
|
||||
peoPopEval <Indi> eval2(mainEval2);
|
||||
eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2);
|
||||
eoRankingSelect<Indi> selectionStrategy2;
|
||||
eoSelectNumber<Indi> select2(selectionStrategy2,POP_SIZE);
|
||||
eoSegmentCrossover<Indi> crossover2;
|
||||
eoUniformMutation<Indi> mutation2(EPSILON);
|
||||
peoTransform<Indi> transform2(crossover2,CROSS_RATE,mutation2,MUT_RATE);
|
||||
eoPop < Indi > pop2;
|
||||
pop2.append (POP_SIZE, random2);
|
||||
eoPlusReplacement<Indi> replace2;
|
||||
eoRandomSelect<Indi> mig_select_one2;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select2 (mig_select_one2,MIG_SIZE,pop2);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace2 (replace2,pop2);
|
||||
peoSyncIslandMig<eoPop<Indi>, eoPop<Indi> > mig2(MIG_FREQ,mig_select2,mig_replace2,topology);
|
||||
checkpoint2.add(mig2);
|
||||
eoEasyEA< Indi > eaAlg2( checkpoint2, eval2, select2, transform2, replace2 );
|
||||
peoWrapper parallelEA2( eaAlg2, pop2);
|
||||
eval2.setOwner(parallelEA2);
|
||||
transform2.setOwner(parallelEA2);
|
||||
mig2.setOwner(parallelEA2);
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
pop2.sort();
|
||||
std::cout << "Final population 1 :\n" << pop << std::endl;
|
||||
std::cout << "Final population 2 :\n" << pop2 << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
* <mainPSO.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
|
||||
typedef eoRealParticle < double >Indi;
|
||||
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
peo :: init( __argc, __argv );
|
||||
eoParser parser(__argc, __argv);
|
||||
unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value();
|
||||
unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value();
|
||||
unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value();
|
||||
double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value();
|
||||
double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value();
|
||||
double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value();
|
||||
double INIT_VELOCITY_MAX = parser.createParam(1.0, "vMax", "Init velocity max",'x',"Param").value();
|
||||
double omega = parser.createParam(1.0, "weight", "Weight",'w',"Param").value();
|
||||
double C1 = parser.createParam(0.5, "c1", "C1",'1',"Param").value();
|
||||
double C2 = parser.createParam(2.0, "c2t", "C2",'2',"Param").value();
|
||||
unsigned int NEIGHBORHOOD_SIZE = parser.createParam((unsigned int)(6), "neighSize", "Neighborhood size",'H',"Param").value();
|
||||
unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value();
|
||||
rng.reseed (time(0));
|
||||
|
||||
// Island model
|
||||
|
||||
RingTopology topologyMig;
|
||||
|
||||
// First
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
||||
peoPopEval< Indi > eval(plainEval);
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
eoUniformGenerator < double >sGen (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
|
||||
eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen);
|
||||
eoFirstIsBestInit < Indi > localInit;
|
||||
eoRealVectorBounds bndsFlight(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
|
||||
eoStandardFlight < Indi > flight(bndsFlight);
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
eoLinearTopology<Indi> topology(NEIGHBORHOOD_SIZE);
|
||||
eoRealVectorBounds bnds(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
|
||||
eoStandardVelocity < Indi > velocity (topology,omega,C1,C2,bnds);
|
||||
eoInitializer <Indi> init(eval,veloRandom,localInit,topology,pop);
|
||||
|
||||
// Island model
|
||||
|
||||
eoPeriodicContinue< Indi > mig_cont( MIG_FREQ );
|
||||
peoPSOSelect<Indi> mig_selec(topology);
|
||||
peoWorstPositionReplacement<Indi> mig_replac;
|
||||
|
||||
// Specific implementation (peoData.h)
|
||||
|
||||
eoContinuator<Indi> cont(mig_cont, pop);
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select (mig_selec,1,pop);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace (mig_replac,pop);
|
||||
|
||||
|
||||
// Second
|
||||
|
||||
eoGenContinue < Indi > genContPara2 (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara2 (genContPara2);
|
||||
eoCheckPoint<Indi> checkpoint2(continuatorPara2);
|
||||
peoEvalFunc<Indi, double, const Indi& > plainEval2(f);
|
||||
peoPopEval< Indi > eval2(plainEval2);
|
||||
eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2);
|
||||
eoUniformGenerator < double >sGen2 (INIT_VELOCITY_MIN, INIT_VELOCITY_MAX);
|
||||
eoVelocityInitFixedLength < Indi > veloRandom2 (VEC_SIZE, sGen2);
|
||||
eoFirstIsBestInit < Indi > localInit2;
|
||||
eoRealVectorBounds bndsFlight2(VEC_SIZE,INIT_POSITION_MIN,INIT_POSITION_MAX);
|
||||
eoStandardFlight < Indi > flight2(bndsFlight2);
|
||||
eoPop < Indi > pop2;
|
||||
pop2.append (POP_SIZE, random2);
|
||||
eoLinearTopology<Indi> topology2(NEIGHBORHOOD_SIZE);
|
||||
eoRealVectorBounds bnds2(VEC_SIZE,INIT_VELOCITY_MIN,INIT_VELOCITY_MAX);
|
||||
eoStandardVelocity < Indi > velocity2 (topology2,omega,C1,C2,bnds2);
|
||||
eoInitializer <Indi> init2(eval2,veloRandom2,localInit2,topology2,pop2);
|
||||
|
||||
// Island model
|
||||
|
||||
eoPeriodicContinue< Indi > mig_cont2( MIG_FREQ );
|
||||
peoPSOSelect<Indi> mig_selec2(topology2);
|
||||
peoWorstPositionReplacement<Indi> mig_replac2;
|
||||
|
||||
// Specific implementation (peoData.h)
|
||||
|
||||
eoContinuator<Indi> cont2(mig_cont2,pop2);
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select2 (mig_selec2,1,pop2);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace2 (mig_replac2,pop2);
|
||||
|
||||
|
||||
// Asynchronous island
|
||||
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig(cont,mig_select, mig_replace, topologyMig);
|
||||
checkpoint.add( mig );
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig2(cont2,mig_select2, mig_replace2, topologyMig);
|
||||
checkpoint2.add( mig2 );
|
||||
|
||||
|
||||
// Parallel algorithm
|
||||
|
||||
eoSyncEasyPSO <Indi> psa(init,checkpoint,eval, velocity, flight);
|
||||
peoWrapper parallelPSO( psa, pop);
|
||||
eval.setOwner(parallelPSO);
|
||||
mig.setOwner(parallelPSO);
|
||||
eoSyncEasyPSO <Indi> psa2(init2,checkpoint2,eval2, velocity2, flight2);
|
||||
peoWrapper parallelPSO2( psa2, pop2);
|
||||
eval2.setOwner(parallelPSO2);
|
||||
mig2.setOwner(parallelPSO2);
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
pop2.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
std::cout << "Final population :\n" << pop2 << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO Lesson3"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../../doc/html/lesson3
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ../../docs/images
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../ \
|
||||
../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
###### Param ######
|
||||
--popSize=20 # -P : Population size
|
||||
--maxGen=200 # -G : Maximum number of generations
|
||||
--mutEpsilon=0.01 # -e : epsilon for mutation
|
||||
--pCross=0.80 # -C : Crossover probability
|
||||
--pMut=0.30 # -M : Mutation probability
|
||||
--vecSize=2 # -V : Vector size
|
||||
--pMin=-2.0 # -N : Init position min
|
||||
--pMax=2.0 # -X : Init position max
|
||||
--vMin=-1.0 # -n : Init velocity min
|
||||
--vMax=1.0 # -x : Init velocity max
|
||||
--neighSize=6 # -H : Neighborhood size
|
||||
--weight=1.0 # -w : Weight
|
||||
--c1=0.5 # -1 : C1
|
||||
--c2=2.0 # -2 : C2
|
||||
--migFreq=10 # -F : Migration frequency
|
||||
--migSize=5 # -S : Migration size
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
<runner>2</runner>
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson4/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson4
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src ${TSP_SRC_DIR})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${MOEO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib ${TSP_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(eals mainEALS.cpp)
|
||||
ADD_DEPENDENCIES(eals tsp peo rmc_mpi)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(LESSON4_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(eals PROPERTIES VERSION "${LESSON4_VERSION}")
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(eals ${XML2_LIBS} tsp peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* <mainEALS.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 "param.h"
|
||||
#include "route_init.h"
|
||||
#include "route_eval.h"
|
||||
#include "order_xover.h"
|
||||
#include "edge_xover.h"
|
||||
#include "partial_mapped_xover.h"
|
||||
#include "city_swap.h"
|
||||
#include "part_route_eval.h"
|
||||
#include "merge_route_eval.h"
|
||||
#include "two_opt_init.h"
|
||||
#include "two_opt_next.h"
|
||||
#include "two_opt_incr_eval.h"
|
||||
|
||||
#include <peo>
|
||||
|
||||
#define POP_SIZE 10
|
||||
#define NUM_GEN 100
|
||||
#define CROSS_RATE 1.0
|
||||
#define MUT_RATE 0.01
|
||||
|
||||
|
||||
int main (int __argc, char * * __argv)
|
||||
{
|
||||
|
||||
peo :: init (__argc, __argv);
|
||||
loadParameters (__argc, __argv);
|
||||
RouteInit route_init;
|
||||
RouteEval full_eval;
|
||||
OrderXover order_cross;
|
||||
PartialMappedXover pm_cross;
|
||||
EdgeXover edge_cross;
|
||||
CitySwap city_swap_mut;
|
||||
|
||||
// Initialization of the local search
|
||||
TwoOptInit pmx_two_opt_init;
|
||||
TwoOptNext pmx_two_opt_next;
|
||||
TwoOptIncrEval pmx_two_opt_incr_eval;
|
||||
moBestImprSelect <TwoOpt> pmx_two_opt_move_select;
|
||||
moHC <TwoOpt> hc (pmx_two_opt_init, pmx_two_opt_next, pmx_two_opt_incr_eval, pmx_two_opt_move_select, full_eval);
|
||||
|
||||
// EA
|
||||
eoPop <Route> pop (POP_SIZE, route_init);
|
||||
eoGenContinue <Route> cont (NUM_GEN);
|
||||
eoCheckPoint <Route> checkpoint (cont);
|
||||
eoEvalFuncCounter< Route > eval(full_eval);
|
||||
eoStochTournamentSelect <Route> select_one;
|
||||
eoSelectNumber <Route> select (select_one, POP_SIZE);
|
||||
eoSGATransform <Route> transform (order_cross, CROSS_RATE, city_swap_mut, MUT_RATE);
|
||||
eoEPReplacement <Route> replace (2);
|
||||
eoEasyEA< Route > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
peo :: run ();
|
||||
peo :: finalize ();
|
||||
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std :: cout << "\nResult before the local search\n";
|
||||
for (unsigned i=0;i<pop.size();i++)
|
||||
std::cout<<"\n"<<pop[i].fitness();
|
||||
}
|
||||
|
||||
// Local search
|
||||
peo :: init (__argc, __argv);
|
||||
peoMultiStart <Route> initParallelHC (hc);
|
||||
peoWrapper parallelHC (initParallelHC, pop);
|
||||
initParallelHC.setOwner(parallelHC);
|
||||
peo :: run( );
|
||||
peo :: finalize( );
|
||||
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
std :: cout << "\nResult after the local search\n";
|
||||
pop.sort();
|
||||
for (unsigned i=0;i<pop.size();i++)
|
||||
std::cout<<"\n"<<pop[i].fitness();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO Lesson4"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../../doc/html/lesson4
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ../../docs/images
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../ \
|
||||
../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
## parameters
|
||||
|
||||
--inst=../examples/tsp/benchs/eil101.tsp
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson5/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson5
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(ea5 main.cpp)
|
||||
ADD_DEPENDENCIES(ea5 peo rmc_mpi)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(Lesson5_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(ea5 PROPERTIES VERSION "${Lesson5_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(ea5 ${XML2_LIBS} peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,313 +0,0 @@
|
|||
/*
|
||||
* <main.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
|
||||
#define SIZE 10
|
||||
#define DEF_DOMAIN 100
|
||||
#define POP_SIZE 100
|
||||
#define SELECT_RATE 0.8
|
||||
#define NB_GEN 1
|
||||
#define XOVER_P 0.75
|
||||
#define MUT_P 0.05
|
||||
#define MIGRATIONS_AT_N_GENERATIONS 5
|
||||
#define NUMBER_OF_MIGRANTS 10
|
||||
|
||||
struct Representation : public eoVector< eoMinimizingFitness, double >
|
||||
{
|
||||
|
||||
Representation()
|
||||
{
|
||||
resize( SIZE );
|
||||
}
|
||||
};
|
||||
|
||||
struct Init : public eoInit< Representation >
|
||||
{
|
||||
|
||||
void operator()( Representation& rep )
|
||||
{
|
||||
|
||||
for ( int i = 0; i < SIZE; i++ )
|
||||
{
|
||||
rep[ i ] = (rng.uniform() - 0.5) * DEF_DOMAIN;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct Eval : public eoEvalFunc< Representation >
|
||||
{
|
||||
|
||||
void operator()( Representation& rep )
|
||||
{
|
||||
|
||||
double fitnessValue = 0.0;
|
||||
for ( int i = 0; i < SIZE; i++ )
|
||||
{
|
||||
|
||||
fitnessValue += pow( rep[ i ], 2.0 );
|
||||
}
|
||||
|
||||
rep.fitness( fitnessValue );
|
||||
}
|
||||
};
|
||||
|
||||
struct MutationOp : public eoMonOp< Representation >
|
||||
{
|
||||
|
||||
bool operator()( Representation& rep )
|
||||
{
|
||||
|
||||
unsigned int pos = (unsigned int)( rng.uniform() * SIZE );
|
||||
rep[ pos ] = (rng.uniform() - 0.5) * DEF_DOMAIN;
|
||||
|
||||
rep.invalidate();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct XoverOp : public eoQuadOp< Representation >
|
||||
{
|
||||
|
||||
bool operator()( Representation& repA, Representation& repB )
|
||||
{
|
||||
|
||||
static Representation offA, offB;
|
||||
double lambda = rng.uniform();
|
||||
|
||||
for ( int i = 0; i < SIZE; i++ )
|
||||
{
|
||||
|
||||
offA[ i ] = lambda * repA[ i ] + ( 1.0 - lambda ) * repB[ i ];
|
||||
offB[ i ] = lambda * repB[ i ] + ( 1.0 - lambda ) * repA[ i ];
|
||||
}
|
||||
|
||||
repA = offA;
|
||||
repB = offB;
|
||||
|
||||
repA.invalidate();
|
||||
repB.invalidate();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void pack( const Representation& rep )
|
||||
{
|
||||
|
||||
if ( rep.invalid() ) ::pack( (unsigned int)0 );
|
||||
else
|
||||
{
|
||||
::pack( (unsigned int)1 );
|
||||
::pack( (double)(rep.fitness()) );
|
||||
}
|
||||
|
||||
for ( unsigned int index = 0; index < SIZE; index++ )
|
||||
{
|
||||
::pack( (double)rep[ index ] );
|
||||
}
|
||||
}
|
||||
|
||||
void unpack( Representation& rep )
|
||||
{
|
||||
|
||||
eoScalarFitness<double, std::greater<double> > fitness;
|
||||
unsigned int validFitness;
|
||||
|
||||
unpack( validFitness );
|
||||
if ( validFitness )
|
||||
{
|
||||
|
||||
double fitnessValue;
|
||||
::unpack( fitnessValue );
|
||||
rep.fitness( fitnessValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
rep.invalidate();
|
||||
}
|
||||
|
||||
double value;
|
||||
for ( unsigned int index = 0; index < SIZE; index++ )
|
||||
{
|
||||
::unpack( value );
|
||||
rep[ index ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
int main( int __argc, char** __argv )
|
||||
{
|
||||
|
||||
|
||||
rng.reseed( time( NULL ) );
|
||||
srand( time( NULL ) );
|
||||
|
||||
peo::init( __argc, __argv );
|
||||
|
||||
|
||||
eoParser parser ( __argc, __argv );
|
||||
|
||||
eoValueParam < unsigned int > nbGenerations( NB_GEN, "maxGen");
|
||||
parser.processParam ( nbGenerations );
|
||||
|
||||
eoValueParam < double > selectionRate( SELECT_RATE, "select");
|
||||
parser.processParam ( selectionRate );
|
||||
|
||||
|
||||
RingTopology ring,topo;
|
||||
unsigned int dataA, dataB, dataC;
|
||||
|
||||
dataA = 1;
|
||||
dataB = 5;
|
||||
dataC = 10;
|
||||
|
||||
peoSyncDataTransfer dataTransfer( dataA, ring );
|
||||
peoSyncDataTransfer dataTransferb( dataB, ring );
|
||||
peoSyncDataTransfer dataTransferc( dataC, ring );
|
||||
|
||||
|
||||
Init init;
|
||||
Eval eval;
|
||||
eoPop< Representation > pop( POP_SIZE, init );
|
||||
MutationOp mut;
|
||||
XoverOp xover;
|
||||
eoSGATransform< Representation > transform( xover, XOVER_P, mut, MUT_P );
|
||||
eoStochTournamentSelect< Representation > select;
|
||||
eoSelectMany< Representation > selectN( select, selectionRate.value() );
|
||||
eoSSGAStochTournamentReplacement< Representation > replace( 1.0 );
|
||||
eoWeakElitistReplacement< Representation > elitReplace( replace );
|
||||
eoGenContinue< Representation > cont( nbGenerations.value() );
|
||||
eoCheckPoint< Representation > checkpoint( cont );
|
||||
eoEasyEA< Representation > algo( checkpoint, eval, selectN, transform, elitReplace );
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// MIGRATION CONTEXT DEFINITION
|
||||
|
||||
eoPeriodicContinue< Representation > mig_conti( MIGRATIONS_AT_N_GENERATIONS );
|
||||
eoContinuator<Representation> mig_cont(mig_conti,pop);
|
||||
eoRandomSelect<Representation> mig_select_one;
|
||||
eoSelector <Representation, eoPop<Representation> > mig_select (mig_select_one,NUMBER_OF_MIGRANTS,pop);
|
||||
eoPlusReplacement<Representation> replace_one;
|
||||
eoReplace <Representation, eoPop<Representation> > mig_replace (replace_one,pop);
|
||||
// peoSyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig(MIGRATIONS_AT_N_GENERATIONS,mig_select,mig_replace,topo);
|
||||
peoAsyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig(mig_cont,mig_select,mig_replace,topo);
|
||||
checkpoint.add( mig );
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
eoPop< Representation > pop2( POP_SIZE, init );
|
||||
eoSGATransform< Representation > transform2( xover, XOVER_P, mut, MUT_P );
|
||||
eoStochTournamentSelect< Representation > select2;
|
||||
eoSelectMany< Representation > selectN2( select2, selectionRate.value() );
|
||||
eoSSGAStochTournamentReplacement< Representation > replace2( 1.0 );
|
||||
eoWeakElitistReplacement< Representation > elitReplace2( replace2 );
|
||||
eoGenContinue< Representation > cont2( nbGenerations.value() );
|
||||
eoCheckPoint< Representation > checkpoint2( cont2 );
|
||||
eoEasyEA< Representation > algo2( checkpoint2, eval, selectN2, transform2, elitReplace2 );
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// MIGRATION CONTEXT DEFINITION
|
||||
|
||||
eoPeriodicContinue< Representation > mig_conti2( MIGRATIONS_AT_N_GENERATIONS );
|
||||
eoContinuator<Representation> mig_cont2(mig_conti2,pop2);
|
||||
eoRandomSelect<Representation> mig_select_one2;
|
||||
eoSelector <Representation, eoPop<Representation> > mig_select2 (mig_select_one2,NUMBER_OF_MIGRANTS,pop2);
|
||||
eoPlusReplacement<Representation> replace_one2;
|
||||
eoReplace <Representation, eoPop<Representation> > mig_replace2 (replace_one2,pop2);
|
||||
// peoSyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig2(MIGRATIONS_AT_N_GENERATIONS,mig_select2,mig_replace2,topo);
|
||||
peoAsyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig2(mig_cont2,mig_select2,mig_replace2,topo);
|
||||
checkpoint2.add( mig2 );
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
eoPop< Representation > pop3( POP_SIZE, init );
|
||||
eoSGATransform< Representation > transform3( xover, XOVER_P, mut, MUT_P );
|
||||
eoStochTournamentSelect< Representation > select3;
|
||||
eoSelectMany< Representation > selectN3( select3, selectionRate.value() );
|
||||
eoSSGAStochTournamentReplacement< Representation > replace3( 1.0 );
|
||||
eoWeakElitistReplacement< Representation > elitReplace3( replace3 );
|
||||
eoGenContinue< Representation > cont3( nbGenerations.value() );
|
||||
eoCheckPoint< Representation > checkpoint3( cont3 );
|
||||
eoEasyEA< Representation > algo3( checkpoint3, eval, selectN3, transform3, elitReplace3 );
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// MIGRATION CONTEXT DEFINITION
|
||||
|
||||
eoPeriodicContinue< Representation > mig_conti3( MIGRATIONS_AT_N_GENERATIONS );
|
||||
eoContinuator<Representation> mig_cont3(mig_conti3,pop3);
|
||||
eoRandomSelect<Representation> mig_select_one3;
|
||||
eoSelector <Representation, eoPop<Representation> > mig_select3 (mig_select_one3,NUMBER_OF_MIGRANTS,pop3);
|
||||
eoPlusReplacement<Representation> replace_one3;
|
||||
eoReplace <Representation, eoPop<Representation> > mig_replace3 (replace_one3,pop3);
|
||||
// peoSyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig3(MIGRATIONS_AT_N_GENERATIONS,mig_select3,mig_replace3,topo);
|
||||
peoAsyncIslandMig< eoPop< Representation >, eoPop< Representation > > mig3(mig_cont3,mig_select3,mig_replace3,topo);
|
||||
|
||||
checkpoint3.add( mig3 );
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
peoWrapper algoPar( algo, pop );
|
||||
mig.setOwner( algoPar );
|
||||
checkpoint.add( dataTransfer );
|
||||
dataTransfer.setOwner( algoPar );
|
||||
|
||||
|
||||
peoWrapper algoPar2( algo2, pop2 );
|
||||
mig2.setOwner( algoPar2 );
|
||||
checkpoint2.add( dataTransferb );
|
||||
dataTransferb.setOwner( algoPar2 );
|
||||
|
||||
|
||||
peoWrapper algoPar3( algo3, pop3 );
|
||||
mig3.setOwner( algoPar3 );
|
||||
checkpoint3.add( dataTransferc );
|
||||
dataTransferc.setOwner( algoPar3 );
|
||||
|
||||
peo::run();
|
||||
peo::finalize();
|
||||
|
||||
if ( getNodeRank() == 1 )
|
||||
std::cout << "A: " << dataA << std::endl;
|
||||
if ( getNodeRank() == 2 )
|
||||
std::cout << "B: " << dataB << std::endl;
|
||||
if ( getNodeRank() == 3 )
|
||||
std::cout << "C: " << dataC << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
###### Param ######
|
||||
--maxGen=1
|
||||
--select=0.8
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
|
||||
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
<runner>2</runner>
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
<runner>3</runner>
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml)
|
||||
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_if_different
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src ${TSP_SRC_DIR})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib ${TSP_BINARY_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(ea6 main.cpp)
|
||||
ADD_DEPENDENCIES(ea6 peo rmc_mpi)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(Lesson6_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(ea6 PROPERTIES VERSION "${Lesson6_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(ea6 ${XML2_LIBS} tsp peo rmc_mpi eo eoutils peo)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* <main.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, INRIA, 2008
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* 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 <peo>
|
||||
|
||||
#include "route.h"
|
||||
#include "route_init.h"
|
||||
#include "route_eval.h"
|
||||
#include "order_xover.h"
|
||||
#include "city_swap.h"
|
||||
#include "param.h"
|
||||
|
||||
|
||||
|
||||
#define POP_SIZE 10
|
||||
#define NUM_GEN 100
|
||||
#define CROSS_RATE 1.0
|
||||
#define MUT_RATE 0.01
|
||||
|
||||
|
||||
struct CoSearch
|
||||
{
|
||||
|
||||
CoSearch(
|
||||
eoPop< Route >& A, eoPop< Route >& B,
|
||||
peoAsyncDataTransfer& asyncTransferA, peoAsyncDataTransfer& asyncTransferB
|
||||
)
|
||||
: transferA( A ), transferB( B ),
|
||||
asyncDataTransferA( asyncTransferA ), asyncDataTransferB( asyncTransferB )
|
||||
{
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
for ( unsigned int index = 0; index < 100; index++ )
|
||||
{
|
||||
|
||||
asyncDataTransferA();
|
||||
asyncDataTransferB();
|
||||
|
||||
eoPop< Route > intermed;
|
||||
intermed = transferA;
|
||||
transferA = transferB;
|
||||
transferB = intermed;
|
||||
}
|
||||
}
|
||||
|
||||
eoPop< Route >& transferA;
|
||||
eoPop< Route >& transferB;
|
||||
|
||||
peoAsyncDataTransfer& asyncDataTransferA;
|
||||
peoAsyncDataTransfer& asyncDataTransferB;
|
||||
};
|
||||
|
||||
|
||||
struct PushBackAggregation
|
||||
{
|
||||
|
||||
void operator()( eoPop< Route >& A, eoPop< Route >& B )
|
||||
{
|
||||
|
||||
for ( unsigned int index = 0; index < B.size(); index++ )
|
||||
{
|
||||
|
||||
A.push_back( B[ index ] );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int __argc, char** __argv )
|
||||
{
|
||||
|
||||
peo :: init( __argc, __argv );
|
||||
|
||||
loadParameters( __argc, __argv );
|
||||
|
||||
RouteInit route_init;
|
||||
RouteEval full_eval;
|
||||
OrderXover crossover;
|
||||
CitySwap mutation;
|
||||
eoPop< Route > population( POP_SIZE, route_init );
|
||||
eoGenContinue< Route > eaCont( NUM_GEN );
|
||||
eoCheckPoint< Route > eaCheckpointContinue( eaCont );
|
||||
eoRankingSelect< Route > selectionStrategy;
|
||||
eoSelectNumber< Route > eaSelect( selectionStrategy, POP_SIZE );
|
||||
eoSGATransform< Route > transformA( crossover, CROSS_RATE, mutation, MUT_RATE );
|
||||
eoPlusReplacement< Route > eaReplace;
|
||||
RingTopology ring;
|
||||
eoPlusReplacement< Route > transferReplace;
|
||||
peoAsyncDataTransfer asyncEAEndPoint( population, population, ring, transferReplace );
|
||||
eaCheckpointContinue.add( asyncEAEndPoint );
|
||||
eoEasyEA< Route > eaAlg( eaCheckpointContinue, full_eval, eaSelect, transformA, eaReplace );
|
||||
peoWrapper paraEAAlg( eaAlg, population );
|
||||
asyncEAEndPoint.setOwner( paraEAAlg );
|
||||
|
||||
eoPop< Route > populationB( POP_SIZE, route_init );
|
||||
eoGenContinue< Route > eaContB( NUM_GEN );
|
||||
eoCheckPoint< Route > eaCheckpointContinueB( eaContB );
|
||||
eoRankingSelect< Route > selectionStrategyB;
|
||||
eoSelectNumber< Route > eaSelectB( selectionStrategyB, POP_SIZE );
|
||||
RingTopology ringB;
|
||||
eoPlusReplacement< Route > transferReplaceB;
|
||||
peoAsyncDataTransfer asyncEAEndPointB( populationB, populationB, ringB, transferReplaceB );
|
||||
eaCheckpointContinueB.add( asyncEAEndPointB );
|
||||
eoSGATransform< Route > transformB ( crossover, CROSS_RATE, mutation, MUT_RATE );
|
||||
eoEasyEA< Route > eaAlgB( eaCheckpointContinueB, full_eval, eaSelectB, transformB, eaReplace );
|
||||
peoWrapper paraEAAlgB( eaAlgB, populationB );
|
||||
asyncEAEndPointB.setOwner( paraEAAlgB );
|
||||
|
||||
|
||||
eoPop< Route > A, B;
|
||||
PushBackAggregation pushBackA, pushBackB;
|
||||
|
||||
peoAsyncDataTransfer coSearchEndPointA( A, A, ring, pushBackA );
|
||||
peoAsyncDataTransfer coSearchEndPointB( B, B, ringB, pushBackB );
|
||||
|
||||
CoSearch coSearch( A, B, coSearchEndPointA, coSearchEndPointB );
|
||||
peoWrapper paraCoSearch( coSearch );
|
||||
coSearchEndPointA.setOwner( paraCoSearch );
|
||||
coSearchEndPointB.setOwner( paraCoSearch );
|
||||
|
||||
|
||||
|
||||
peo::run();
|
||||
peo::finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
###### Param ######
|
||||
--maxGen=1
|
||||
--select=0.8
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
## parameters
|
||||
|
||||
--inst=../examples/tsp/benchs/eil101.tsp
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
</node>
|
||||
<node name="2" num_workers="1">
|
||||
<runner>2</runner>
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
<runner>3</runner>
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
|
||||
#######################################################################################
|
||||
### 1) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
ADD_SUBDIRECTORY(tsp)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Copy the "benchs" directory in the build directory to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
#ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs)
|
||||
#ADD_CUSTOM_COMMAND(
|
||||
# TARGET install
|
||||
# POST_BUILD
|
||||
# COMMAND ${CMAKE_COMMAND}
|
||||
# ARGS -E copy_directory
|
||||
# ${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs
|
||||
# ${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp/benchs)
|
||||
|
||||
|
||||
SET(BENCH_LIST
|
||||
eil101.opt.tour
|
||||
eil101.tsp
|
||||
eil101.tsp.hc
|
||||
)
|
||||
|
||||
FOREACH (bench ${BENCH_LIST})
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/examples/tsp/benchs/${bench}
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/examples/tsp/benchs/${bench}
|
||||
)
|
||||
ENDFOREACH (bench)
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Define your target(s): just the tsp lib here
|
||||
######################################################################################
|
||||
|
||||
SET(TSP_LIB_OUTPUT_PATH ${TSP_BINARY_DIR}/lib)
|
||||
SET(LIBRARY_OUTPUT_PATH ${TSP_LIB_OUTPUT_PATH})
|
||||
|
||||
SET (TSP_SOURCES data.h
|
||||
data.cpp
|
||||
opt_route.h
|
||||
opt_route.cpp
|
||||
param.h
|
||||
param.cpp
|
||||
node.h
|
||||
node.cpp
|
||||
route.h
|
||||
route.cpp
|
||||
route_init.h
|
||||
route_init.cpp
|
||||
route_eval.h
|
||||
route_eval.cpp
|
||||
two_opt.h
|
||||
two_opt.cpp
|
||||
two_opt_init.h
|
||||
two_opt_init.cpp
|
||||
two_opt_incr_eval.h
|
||||
two_opt_incr_eval.cpp
|
||||
two_opt_next.h
|
||||
two_opt_next.cpp
|
||||
order_xover.h
|
||||
order_xover.cpp
|
||||
partial_mapped_xover.h
|
||||
partial_mapped_xover.cpp
|
||||
edge_xover.h
|
||||
edge_xover.cpp
|
||||
city_swap.h
|
||||
city_swap.cpp
|
||||
part_route_eval.h
|
||||
part_route_eval.cpp
|
||||
merge_route_eval.h
|
||||
merge_route_eval.cpp)
|
||||
|
||||
ADD_LIBRARY(tsp STATIC ${TSP_SOURCES})
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Optionnal: define your lib's version
|
||||
######################################################################################
|
||||
|
||||
SET(TSP_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(tsp PROPERTIES VERSION "${TSP_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
NAME : eil101.opt.tour
|
||||
COMMENT : Optimum tour for eil101.tsp (Length 629)
|
||||
TYPE : TOUR
|
||||
DIMENSION : 101
|
||||
TOUR_SECTION
|
||||
1
|
||||
69
|
||||
27
|
||||
101
|
||||
53
|
||||
28
|
||||
26
|
||||
12
|
||||
80
|
||||
68
|
||||
29
|
||||
24
|
||||
54
|
||||
55
|
||||
25
|
||||
4
|
||||
39
|
||||
67
|
||||
23
|
||||
56
|
||||
75
|
||||
41
|
||||
22
|
||||
74
|
||||
72
|
||||
73
|
||||
21
|
||||
40
|
||||
58
|
||||
13
|
||||
94
|
||||
95
|
||||
97
|
||||
87
|
||||
2
|
||||
57
|
||||
15
|
||||
43
|
||||
42
|
||||
14
|
||||
44
|
||||
38
|
||||
86
|
||||
16
|
||||
61
|
||||
85
|
||||
91
|
||||
100
|
||||
98
|
||||
37
|
||||
92
|
||||
59
|
||||
93
|
||||
99
|
||||
96
|
||||
6
|
||||
89
|
||||
52
|
||||
18
|
||||
83
|
||||
60
|
||||
5
|
||||
84
|
||||
17
|
||||
45
|
||||
8
|
||||
46
|
||||
47
|
||||
36
|
||||
49
|
||||
64
|
||||
63
|
||||
90
|
||||
32
|
||||
10
|
||||
62
|
||||
11
|
||||
19
|
||||
48
|
||||
82
|
||||
7
|
||||
88
|
||||
31
|
||||
70
|
||||
30
|
||||
20
|
||||
66
|
||||
71
|
||||
65
|
||||
35
|
||||
34
|
||||
78
|
||||
81
|
||||
9
|
||||
51
|
||||
33
|
||||
79
|
||||
3
|
||||
77
|
||||
76
|
||||
50
|
||||
-1
|
||||
EOF
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
NAME : eil101
|
||||
COMMENT : 101-city problem (Christofides/Eilon)
|
||||
TYPE : TSP
|
||||
DIMENSION : 101
|
||||
EDGE_WEIGHT_TYPE : EUC_2D
|
||||
NODE_COORD_SECTION
|
||||
1 41 49
|
||||
2 35 17
|
||||
3 55 45
|
||||
4 55 20
|
||||
5 15 30
|
||||
6 25 30
|
||||
7 20 50
|
||||
8 10 43
|
||||
9 55 60
|
||||
10 30 60
|
||||
11 20 65
|
||||
12 50 35
|
||||
13 30 25
|
||||
14 15 10
|
||||
15 30 5
|
||||
16 10 20
|
||||
17 5 30
|
||||
18 20 40
|
||||
19 15 60
|
||||
20 45 65
|
||||
21 45 20
|
||||
22 45 10
|
||||
23 55 5
|
||||
24 65 35
|
||||
25 65 20
|
||||
26 45 30
|
||||
27 35 40
|
||||
28 41 37
|
||||
29 64 42
|
||||
30 40 60
|
||||
31 31 52
|
||||
32 35 69
|
||||
33 53 52
|
||||
34 65 55
|
||||
35 63 65
|
||||
36 2 60
|
||||
37 20 20
|
||||
38 5 5
|
||||
39 60 12
|
||||
40 40 25
|
||||
41 42 7
|
||||
42 24 12
|
||||
43 23 3
|
||||
44 11 14
|
||||
45 6 38
|
||||
46 2 48
|
||||
47 8 56
|
||||
48 13 52
|
||||
49 6 68
|
||||
50 47 47
|
||||
51 49 58
|
||||
52 27 43
|
||||
53 37 31
|
||||
54 57 29
|
||||
55 63 23
|
||||
56 53 12
|
||||
57 32 12
|
||||
58 36 26
|
||||
59 21 24
|
||||
60 17 34
|
||||
61 12 24
|
||||
62 24 58
|
||||
63 27 69
|
||||
64 15 77
|
||||
65 62 77
|
||||
66 49 73
|
||||
67 67 5
|
||||
68 56 39
|
||||
69 37 47
|
||||
70 37 56
|
||||
71 57 68
|
||||
72 47 16
|
||||
73 44 17
|
||||
74 46 13
|
||||
75 49 11
|
||||
76 49 42
|
||||
77 53 43
|
||||
78 61 52
|
||||
79 57 48
|
||||
80 56 37
|
||||
81 55 54
|
||||
82 15 47
|
||||
83 14 37
|
||||
84 11 31
|
||||
85 16 22
|
||||
86 4 18
|
||||
87 28 18
|
||||
88 26 52
|
||||
89 26 35
|
||||
90 31 67
|
||||
91 15 19
|
||||
92 22 22
|
||||
93 18 24
|
||||
94 26 27
|
||||
95 25 24
|
||||
96 22 27
|
||||
97 25 21
|
||||
98 19 21
|
||||
99 20 26
|
||||
100 18 18
|
||||
101 35 35
|
||||
EOF
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
101
|
||||
41 49
|
||||
35 17
|
||||
55 45
|
||||
55 20
|
||||
15 30
|
||||
25 30
|
||||
20 50
|
||||
10 43
|
||||
55 60
|
||||
30 60
|
||||
20 65
|
||||
50 35
|
||||
30 25
|
||||
15 10
|
||||
30 5
|
||||
10 20
|
||||
5 30
|
||||
20 40
|
||||
15 60
|
||||
45 65
|
||||
45 20
|
||||
45 10
|
||||
55 5
|
||||
65 35
|
||||
65 20
|
||||
45 30
|
||||
35 40
|
||||
41 37
|
||||
64 42
|
||||
40 60
|
||||
31 52
|
||||
35 69
|
||||
53 52
|
||||
65 55
|
||||
63 65
|
||||
2 60
|
||||
20 20
|
||||
5 5
|
||||
60 12
|
||||
40 25
|
||||
42 7
|
||||
24 12
|
||||
23 3
|
||||
11 14
|
||||
6 38
|
||||
2 48
|
||||
8 56
|
||||
13 52
|
||||
6 68
|
||||
47 47
|
||||
49 58
|
||||
27 43
|
||||
37 31
|
||||
57 29
|
||||
63 23
|
||||
53 12
|
||||
32 12
|
||||
36 26
|
||||
21 24
|
||||
17 34
|
||||
12 24
|
||||
24 58
|
||||
27 69
|
||||
15 77
|
||||
62 77
|
||||
49 73
|
||||
67 5
|
||||
56 39
|
||||
37 47
|
||||
37 56
|
||||
57 68
|
||||
47 16
|
||||
44 17
|
||||
46 13
|
||||
49 11
|
||||
49 42
|
||||
53 43
|
||||
61 52
|
||||
57 48
|
||||
56 37
|
||||
55 54
|
||||
15 47
|
||||
14 37
|
||||
11 31
|
||||
16 22
|
||||
4 18
|
||||
28 18
|
||||
26 52
|
||||
26 35
|
||||
31 67
|
||||
15 19
|
||||
22 22
|
||||
18 24
|
||||
26 27
|
||||
25 24
|
||||
22 27
|
||||
25 21
|
||||
19 21
|
||||
20 26
|
||||
18 18
|
||||
35 35
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* <city_swap.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <utils/eoRNG.h>
|
||||
|
||||
#include "city_swap.h"
|
||||
|
||||
bool CitySwap :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
std :: swap (__route [rng.random (__route.size ())],
|
||||
__route [rng.random (__route.size ())]) ;
|
||||
|
||||
__route.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* <city_swap.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef city_swap_h
|
||||
#define city_swap_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Its swaps two vertices
|
||||
randomly choosen */
|
||||
class CitySwap : public eoMonOp <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
* <data.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "node.h"
|
||||
|
||||
#define MAX_TRASH_LENGTH 1000
|
||||
#define MAX_FIELD_LENGTH 1000
|
||||
#define MAX_LINE_LENGTH 1000
|
||||
|
||||
static void getNextField (FILE * __f, char * __buff)
|
||||
{
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^:\n]", __buff); /* Reading the field */
|
||||
fgetc (__f);
|
||||
}
|
||||
|
||||
static void getLine (FILE * __f, char * __buff)
|
||||
{
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^\n]", __buff); /* Reading the line */
|
||||
}
|
||||
|
||||
void loadData (const char * __filename)
|
||||
{
|
||||
|
||||
FILE * f = fopen (__filename, "r");
|
||||
|
||||
if (f)
|
||||
{
|
||||
|
||||
printf ("Loading '%s'.\n", __filename);
|
||||
|
||||
char field [MAX_FIELD_LENGTH];
|
||||
|
||||
getNextField (f, field); /* Name */
|
||||
assert (strstr (field, "NAME"));
|
||||
getNextField (f, field);
|
||||
printf ("NAME: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Comment */
|
||||
assert (strstr (field, "COMMENT"));
|
||||
getLine (f, field);
|
||||
printf ("COMMENT: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Type */
|
||||
assert (strstr (field, "TYPE"));
|
||||
getNextField (f, field);
|
||||
printf ("TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Dimension */
|
||||
assert (strstr (field, "DIMENSION"));
|
||||
getNextField (f, field);
|
||||
printf ("DIMENSION: %s.\n", field);
|
||||
numNodes = atoi (field);
|
||||
|
||||
getNextField (f, field); /* Edge weight type */
|
||||
assert (strstr (field, "EDGE_WEIGHT_TYPE"));
|
||||
getNextField (f, field);
|
||||
printf ("EDGE_WEIGHT_TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Node coord section */
|
||||
assert (strstr (field, "NODE_COORD_SECTION"));
|
||||
loadNodes (f);
|
||||
|
||||
getNextField (f, field); /* End of file */
|
||||
assert (strstr (field, "EOF"));
|
||||
printf ("EOF.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fprintf (stderr, "Can't open '%s'.\n", __filename);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loadData (eoParser & __parser)
|
||||
{
|
||||
|
||||
/* Getting the path of the instance */
|
||||
|
||||
eoValueParam <std :: string> param ("", "inst", "Path of the instance") ;
|
||||
__parser.processParam (param) ;
|
||||
loadData (param.value ().c_str ());
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* <data.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __data_h
|
||||
#define __data_h
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
extern void loadData (const char * __filename);
|
||||
|
||||
extern void loadData (eoParser & __parser);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
* <display.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "node.h"
|
||||
#include "opt_route.h"
|
||||
|
||||
#define BORDER 20
|
||||
#define RATIO 0.5
|
||||
|
||||
#define screen_width 1024
|
||||
#define screen_height 768
|
||||
|
||||
static const char * filename;
|
||||
|
||||
/* Computed coordinates */
|
||||
static unsigned * X_new_coord, * Y_new_coord ;
|
||||
|
||||
/* this variable will contain the handle to the returned graphics context. */
|
||||
static GC gc;
|
||||
|
||||
/* this variable will contain the pointer to the Display structure */
|
||||
static Display* disp;
|
||||
|
||||
/* this variable will store the ID of the newly created window. */
|
||||
static Window win;
|
||||
|
||||
static int screen;
|
||||
|
||||
/* Create a new backing pixmap of the appropriate size */
|
||||
|
||||
/* Best tour */
|
||||
/*
|
||||
gdk_gc_set_line_attributes (gc, 2, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER) ;
|
||||
|
||||
gdk_gc_set_foreground (gc, & color_green) ;
|
||||
|
||||
for (int i = 0 ; i < (int) numNodes ; i ++) {
|
||||
|
||||
gdk_draw_line (pixmap, gc,
|
||||
X_new_coord [opt_route [i]],
|
||||
Y_new_coord [opt_route [i]],
|
||||
X_new_coord [opt_route [(i + 1) % numNodes]],
|
||||
Y_new_coord [opt_route [(i + 1) % numNodes]]);
|
||||
|
||||
}*/
|
||||
|
||||
void openMainWindow (const char * __filename)
|
||||
{
|
||||
|
||||
filename = __filename;
|
||||
|
||||
/* Map */
|
||||
int map_width = (int) (X_max - X_min);
|
||||
int map_height = (int) (Y_max - Y_min);
|
||||
int map_side = std :: max (map_width, map_height);
|
||||
|
||||
/* Calculate the window's width and height. */
|
||||
int win_width = (int) (screen_width * RATIO * map_width / map_side);
|
||||
int win_height = (int) (screen_height * RATIO * map_height / map_side);
|
||||
|
||||
/* Computing the coordinates */
|
||||
X_new_coord = new unsigned [numNodes];
|
||||
Y_new_coord = new unsigned [numNodes];
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
{
|
||||
X_new_coord [i] = (unsigned) (win_width * (1.0 - (X_coord [i] - X_min) / map_width) + BORDER);
|
||||
Y_new_coord [i] = (unsigned) (win_height * (1.0 - (Y_coord [i] - Y_min) / map_height) + BORDER);
|
||||
}
|
||||
|
||||
/* Initialisation */
|
||||
XGCValues val ;
|
||||
|
||||
disp = XOpenDisplay (NULL) ;
|
||||
screen = DefaultScreen (disp) ;
|
||||
win = XCreateSimpleWindow (disp, RootWindow (disp, screen), 0, 0, win_width + 2 * BORDER, win_height + 2 * BORDER, 2, BlackPixel (disp, screen), WhitePixel (disp, screen)) ;
|
||||
val.foreground = BlackPixel(disp, screen) ;
|
||||
val.background = WhitePixel(disp, screen) ;
|
||||
gc = XCreateGC (disp, win, GCForeground | GCBackground, & val) ;
|
||||
|
||||
XMapWindow (disp, win) ;
|
||||
XFlush (disp) ;
|
||||
|
||||
while (true)
|
||||
{
|
||||
XClearWindow (disp, win) ;
|
||||
|
||||
/* Vertices as circles */
|
||||
for (unsigned i = 1 ; i < numNodes ; i ++)
|
||||
XDrawArc (disp, win, gc, X_new_coord [i] - 1, Y_new_coord [i] - 1, 3, 3, 0, 364 * 64) ;
|
||||
|
||||
/* New tour */
|
||||
std :: ifstream f (filename);
|
||||
if (f)
|
||||
{
|
||||
Route route;
|
||||
f >> route;
|
||||
f.close ();
|
||||
|
||||
for (int i = 0; i < (int) numNodes; i ++)
|
||||
XDrawLine (disp, win, gc,
|
||||
X_new_coord [route [i]],
|
||||
Y_new_coord [route [i]],
|
||||
X_new_coord [route [(i + 1) % numNodes]],
|
||||
Y_new_coord [route [(i + 1) % numNodes]]);
|
||||
}
|
||||
XFlush (disp) ;
|
||||
sleep (1) ;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* <display.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __display_h
|
||||
#define __display_h
|
||||
|
||||
#include "route.h"
|
||||
|
||||
extern void openMainWindow (const char * __filename);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* <display_best_route.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "display_best_route.h"
|
||||
#include "display.h"
|
||||
|
||||
DisplayBestRoute :: DisplayBestRoute (eoPop <Route> & __pop
|
||||
) : pop (__pop)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayBestRoute :: operator () ()
|
||||
{
|
||||
|
||||
displayRoute (pop.best_element ());
|
||||
}
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* <display_best_route.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __display_best_route_h
|
||||
#define __display_best_route_h
|
||||
|
||||
#include <utils/eoUpdater.h>
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class DisplayBestRoute : public eoUpdater
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
DisplayBestRoute (eoPop <Route> & __pop);
|
||||
|
||||
void operator () ();
|
||||
|
||||
private :
|
||||
|
||||
eoPop <Route> & pop;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* <edge_xover.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <assert.h>
|
||||
#include <values.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "edge_xover.h"
|
||||
|
||||
void EdgeXover :: build_map (const Route & __par1, const Route & __par2)
|
||||
{
|
||||
|
||||
unsigned len = __par1.size () ;
|
||||
|
||||
/* Initialization */
|
||||
_map.clear () ;
|
||||
_map.resize (len) ;
|
||||
|
||||
for (unsigned i = 0 ; i < len ; i ++)
|
||||
{
|
||||
_map [__par1 [i]].insert (__par1 [(i + 1) % len]) ;
|
||||
_map [__par2 [i]].insert (__par2 [(i + 1) % len]) ;
|
||||
_map [__par1 [i]].insert (__par1 [(i - 1 + len) % len]) ;
|
||||
_map [__par2 [i]].insert (__par2 [(i - 1 + len) % len]) ;
|
||||
}
|
||||
|
||||
visited.clear () ;
|
||||
visited.resize (len, false) ;
|
||||
}
|
||||
|
||||
void EdgeXover :: remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map)
|
||||
{
|
||||
|
||||
std :: set <unsigned> & neigh = __map [__vertex] ;
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++)
|
||||
__map [* it].erase (__vertex) ;
|
||||
|
||||
}
|
||||
|
||||
void EdgeXover :: add_vertex (unsigned __vertex, Route & __child)
|
||||
{
|
||||
|
||||
visited [__vertex] = true ;
|
||||
__child.push_back (__vertex) ;
|
||||
remove_entry (__vertex, _map) ; /* Removing entries */
|
||||
}
|
||||
|
||||
void EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __child)
|
||||
{
|
||||
|
||||
build_map (__par1, __par2) ;
|
||||
|
||||
unsigned len = __par1.size () ;
|
||||
|
||||
/* Go ! */
|
||||
__child.clear () ;
|
||||
|
||||
unsigned cur_vertex = rng.random (len) ;
|
||||
|
||||
add_vertex (cur_vertex, __child) ;
|
||||
|
||||
for (unsigned i = 1 ; i < len ; i ++)
|
||||
{
|
||||
|
||||
unsigned len_min_entry = MAXINT ;
|
||||
|
||||
std :: set <unsigned> & neigh = _map [cur_vertex] ;
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++)
|
||||
{
|
||||
unsigned l = _map [* it].size () ;
|
||||
if (len_min_entry > l)
|
||||
len_min_entry = l ;
|
||||
}
|
||||
|
||||
std :: vector <unsigned> cand ; /* Candidates */
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++)
|
||||
{
|
||||
unsigned l = _map [* it].size () ;
|
||||
if (len_min_entry == l)
|
||||
cand.push_back (* it) ;
|
||||
}
|
||||
|
||||
if (! cand.size ())
|
||||
{
|
||||
|
||||
/* Oh no ! Implicit mutation */
|
||||
for (unsigned j = 0 ; j < len ; j ++)
|
||||
if (! visited [j])
|
||||
cand.push_back (j) ;
|
||||
}
|
||||
|
||||
cur_vertex = cand [rng.random (cand.size ())] ;
|
||||
|
||||
add_vertex (cur_vertex, __child) ;
|
||||
}
|
||||
}
|
||||
|
||||
bool EdgeXover :: operator () (Route & __route1, Route & __route2)
|
||||
{
|
||||
|
||||
// Init. copy
|
||||
Route par [2] ;
|
||||
par [0] = __route1 ;
|
||||
par [1] = __route2 ;
|
||||
|
||||
cross (par [0], par [1], __route1) ;
|
||||
cross (par [1], par [0], __route2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* <edge_xover.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef edge_xover_h
|
||||
#define edge_xover_h
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Edge Crossover */
|
||||
class EdgeXover : public eoQuadOp <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void cross (const Route & __par1, const Route & __par2, Route & __child) ; /* Binary */
|
||||
|
||||
void remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map) ;
|
||||
/* Updating the map of entries */
|
||||
|
||||
void build_map (const Route & __par1, const Route & __par2) ;
|
||||
|
||||
void add_vertex (unsigned __vertex, Route & __child) ;
|
||||
|
||||
std :: vector <std :: set <unsigned> > _map ; /* The handled map */
|
||||
|
||||
std :: vector <bool> visited ; /* Vertices that are already visited */
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* <merge_route_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "merge_route_eval.h"
|
||||
|
||||
void MergeRouteEval :: operator () (Route & __route, const int & __part_fit)
|
||||
{
|
||||
|
||||
int len = __route.fitness ();
|
||||
len += __part_fit;
|
||||
__route.fitness (len);
|
||||
}
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <merge_route_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __merge_route_eval_h
|
||||
#define __merge_route_eval_h
|
||||
|
||||
#include <peoAggEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class MergeRouteEval : public peoAggEvalFunc <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route, const int & __part_fit) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <mix.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __mix_h
|
||||
#define __mix_h
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
template <class T> void mix (std :: vector <T> & __v)
|
||||
{
|
||||
|
||||
unsigned len = __v.size () ;
|
||||
|
||||
for (unsigned i = 0 ; i < len ; i ++)
|
||||
std :: swap (__v [i], __v [rng.random (len)]) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* <node.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <math.h>
|
||||
#include <values.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
unsigned numNodes; /* Number of nodes */
|
||||
|
||||
//static unsigned * * dist; /* Square matrix of distances */
|
||||
|
||||
double * X_coord, * Y_coord;
|
||||
|
||||
double X_min = MAXDOUBLE, X_max = MINDOUBLE, Y_min = MAXDOUBLE, Y_max = MINDOUBLE;
|
||||
|
||||
void loadNodes (FILE * __f)
|
||||
{
|
||||
|
||||
/* Coord */
|
||||
|
||||
X_coord = new double [numNodes];
|
||||
|
||||
Y_coord = new double [numNodes];
|
||||
|
||||
unsigned num;
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
{
|
||||
|
||||
fscanf (__f, "%u%lf%lf", & num, X_coord + i, Y_coord + i);
|
||||
|
||||
if (X_coord [i] < X_min)
|
||||
X_min = X_coord [i];
|
||||
if (X_coord [i] > X_max)
|
||||
X_max = X_coord [i];
|
||||
if (Y_coord [i] < Y_min)
|
||||
Y_min = Y_coord [i];
|
||||
if (Y_coord [i] > Y_max)
|
||||
Y_max = Y_coord [i];
|
||||
}
|
||||
|
||||
/* Allocation */
|
||||
/*
|
||||
dist = new unsigned * [numNodes];
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
dist [i] = new unsigned [numNodes];
|
||||
*/
|
||||
/* Computation of the distances */
|
||||
|
||||
/*
|
||||
for (unsigned i = 0; i < numNodes; i ++) {
|
||||
|
||||
dist [i] [i] = 0;
|
||||
|
||||
for (unsigned j = 0; j < numNodes; j ++) {
|
||||
|
||||
double dx = X_coord [i] - X_coord [j], dy = Y_coord [i] - Y_coord [j];
|
||||
|
||||
dist [i] [j] = dist [j] [i] = (unsigned) (sqrt (dx * dx + dy * dy) + 0.5) ;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
unsigned distance (Node __from, Node __to)
|
||||
{
|
||||
|
||||
// return dist [__from] [__to];
|
||||
|
||||
double dx = X_coord [__from] - X_coord [__to], dy = Y_coord [__from] - Y_coord [__to];
|
||||
|
||||
return (unsigned) (sqrt (dx * dx + dy * dy) + 0.5) ;
|
||||
}
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* <node.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __node_h
|
||||
#define __node_h
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned Node;
|
||||
|
||||
extern double X_min, X_max, Y_min, Y_max;
|
||||
|
||||
extern double * X_coord, * Y_coord;
|
||||
|
||||
extern unsigned numNodes; /* Number of nodes */
|
||||
|
||||
extern void loadNodes (FILE * __f);
|
||||
|
||||
extern unsigned distance (Node __from, Node __to);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* <opt_route.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "opt_route.h"
|
||||
|
||||
#define MAX_TRASH_LENGTH 1000
|
||||
#define MAX_FIELD_LENGTH 1000
|
||||
#define MAX_LINE_LENGTH 1000
|
||||
|
||||
static void getNextField (FILE * __f, char * __buff)
|
||||
{
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^:\n]", __buff); /* Reading the field */
|
||||
fgetc (__f);
|
||||
}
|
||||
|
||||
static void getLine (FILE * __f, char * __buff)
|
||||
{
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^\n]", __buff); /* Reading the line */
|
||||
}
|
||||
|
||||
static void loadBestRoute (FILE * __f)
|
||||
{
|
||||
|
||||
opt_route.clear ();
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
{
|
||||
Node node;
|
||||
fscanf (__f, "%u", & node);
|
||||
opt_route.push_back (node - 1);
|
||||
}
|
||||
int d; /* -1 ! */
|
||||
fscanf (__f, "%d", & d);
|
||||
}
|
||||
|
||||
void loadOptimumRoute (const char * __filename)
|
||||
{
|
||||
|
||||
FILE * f = fopen (__filename, "r");
|
||||
|
||||
if (f)
|
||||
{
|
||||
|
||||
printf ("Loading '%s'.\n", __filename);
|
||||
|
||||
char field [MAX_FIELD_LENGTH];
|
||||
|
||||
getNextField (f, field); /* Name */
|
||||
assert (strstr (field, "NAME"));
|
||||
getNextField (f, field);
|
||||
//printf ("NAME: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Comment */
|
||||
assert (strstr (field, "COMMENT"));
|
||||
getLine (f, field);
|
||||
// printf ("COMMENT: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Type */
|
||||
assert (strstr (field, "TYPE"));
|
||||
getNextField (f, field);
|
||||
//printf ("TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Dimension */
|
||||
assert (strstr (field, "DIMENSION"));
|
||||
getNextField (f, field);
|
||||
// printf ("DIMENSION: %s.\n", field);
|
||||
numNodes = atoi (field);
|
||||
|
||||
getNextField (f, field); /* Tour section */
|
||||
assert (strstr (field, "TOUR_SECTION"));
|
||||
loadBestRoute (f);
|
||||
|
||||
getNextField (f, field); /* End of file */
|
||||
assert (strstr (field, "EOF"));
|
||||
//printf ("EOF.\n");
|
||||
|
||||
printf ("The length of the best route is %u.\n", length (opt_route));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fprintf (stderr, "Can't open '%s'.\n", __filename);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loadOptimumRoute (eoParser & __parser)
|
||||
{
|
||||
|
||||
/* Getting the path of the instance */
|
||||
|
||||
eoValueParam <std :: string> param ("", "optimumTour", "Optimum tour") ;
|
||||
__parser.processParam (param) ;
|
||||
if (strlen (param.value ().c_str ()))
|
||||
loadOptimumRoute (param.value ().c_str ());
|
||||
else
|
||||
opt_route.fitness (0);
|
||||
}
|
||||
|
||||
Route opt_route; /* Optimum route */
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <opt_route.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __opt_route_h
|
||||
#define __opt_route_h
|
||||
|
||||
#include <cassert>
|
||||
#include <utils/eoParser.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
extern void loadOptimumRoute (const char * __filename);
|
||||
|
||||
extern void loadOptimumRoute (eoParser & __parser);
|
||||
|
||||
extern Route opt_route; /* Optimum route */
|
||||
|
||||
#endif
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* <order_xover.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "order_xover.h"
|
||||
|
||||
void OrderXover :: cross (const Route & __par1, const Route & __par2, Route & __child)
|
||||
{
|
||||
|
||||
unsigned cut2 = 1 + rng.random (numNodes) ;
|
||||
unsigned cut1 = rng.random (cut2);
|
||||
unsigned l = 0;
|
||||
|
||||
/* To store vertices that have already been crossed */
|
||||
std :: vector <bool> v (numNodes, false);
|
||||
|
||||
/* Copy of the left partial route of the first parent */
|
||||
for (unsigned i = cut1 ; i < cut2 ; i ++)
|
||||
{
|
||||
__child [l ++] = __par1 [i] ;
|
||||
v [__par1 [i]] = true ;
|
||||
}
|
||||
|
||||
/* Searching the vertex of the second path, that ended the previous first one */
|
||||
unsigned from = 0 ;
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
if (__par2 [i] == __child [cut2 - 1])
|
||||
{
|
||||
from = i ;
|
||||
break ;
|
||||
}
|
||||
|
||||
/* Selecting a direction (Left or Right) */
|
||||
char direct = rng.flip () ? 1 : -1 ;
|
||||
|
||||
for (unsigned i = 0; i < numNodes + 1; i ++)
|
||||
{
|
||||
unsigned bidule = (direct * i + from + numNodes) % numNodes;
|
||||
if (! v [__par2 [bidule]])
|
||||
{
|
||||
__child [l ++] = __par2 [bidule] ;
|
||||
v [__par2 [bidule]] = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OrderXover :: operator () (Route & __route1, Route & __route2)
|
||||
{
|
||||
|
||||
// Init. copy
|
||||
Route par [2] ;
|
||||
par [0] = __route1 ;
|
||||
par [1] = __route2 ;
|
||||
|
||||
cross (par [0], par [1], __route1) ;
|
||||
cross (par [1], par [0], __route2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* <order_xover.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef order_xover_h
|
||||
#define order_xover_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Order Crossover */
|
||||
class OrderXover : public eoQuadOp <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void cross (const Route & __par1, const Route & __par2, Route & __child) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "@PACKAGE_NAME@ - Lessons"
|
||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
||||
OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc/html/lsnshared
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = @EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html \
|
||||
@MO_BIN_DIR@/doc/mo.doxytag=@MO_BIN_DIR@/doc/html \
|
||||
@ParadisEO-PEO_BINARY_DIR@/doc/peo.doxytag=@ParadisEO-PEO_BINARY_DIR@/doc/html
|
||||
GENERATE_TAGFILE = @CMAKE_BINARY_DIR@/doc/paradiseo-peo-lsn-shared.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* <param.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <utils/eoParser.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "opt_route.h"
|
||||
|
||||
void loadParameters (int __argc, char * * __argv)
|
||||
{
|
||||
|
||||
eoParser parser (__argc, __argv);
|
||||
|
||||
loadData (parser);
|
||||
|
||||
loadOptimumRoute (parser);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* <param.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __param_h
|
||||
#define __param_h
|
||||
|
||||
extern void loadParameters (int __argc, char * * __argv);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* <part_route_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "part_route_eval.h"
|
||||
#include "node.h"
|
||||
|
||||
PartRouteEval :: PartRouteEval (float __from,
|
||||
float __to
|
||||
) : from (__from),
|
||||
to (__to)
|
||||
{}
|
||||
|
||||
void PartRouteEval :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
|
||||
unsigned len = 0 ;
|
||||
|
||||
for (unsigned i = (unsigned) (__route.size () * from) ;
|
||||
i < (unsigned) (__route.size () * to) ;
|
||||
i ++)
|
||||
len += distance (__route [i], __route [(i + 1) % numNodes]) ;
|
||||
|
||||
__route.fitness (- (int) len) ;
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* <part_route_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __part_route_eval_h
|
||||
#define __part_route_eval_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Route Evaluator */
|
||||
class PartRouteEval : public eoEvalFunc <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
/** Constructor */
|
||||
PartRouteEval (float __from, float __to) ;
|
||||
|
||||
void operator () (Route & __route) ;
|
||||
|
||||
private :
|
||||
|
||||
float from, to ;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* <partial_mapped_xover.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <assert.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "partial_mapped_xover.h"
|
||||
#include "mix.h"
|
||||
|
||||
void PartialMappedXover :: repair (Route & __route, unsigned __cut1, unsigned __cut2)
|
||||
{
|
||||
|
||||
unsigned v [__route.size ()] ; // Number of times a cities are visited ...
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
v [i] = 0 ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
v [__route [i]] ++ ;
|
||||
|
||||
std :: vector <unsigned> vert ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
if (! v [i])
|
||||
vert.push_back (i) ;
|
||||
|
||||
mix (vert) ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
if (i < __cut1 || i >= __cut2)
|
||||
if (v [__route [i]] > 1)
|
||||
{
|
||||
__route [i] = vert.back () ;
|
||||
vert.pop_back () ;
|
||||
}
|
||||
}
|
||||
|
||||
bool PartialMappedXover :: operator () (Route & __route1, Route & __route2)
|
||||
{
|
||||
|
||||
unsigned cut1 = rng.random (__route1.size ()), cut2 = rng.random (__route2.size ()) ;
|
||||
|
||||
if (cut2 < cut1)
|
||||
std :: swap (cut1, cut2) ;
|
||||
|
||||
// Between the cuts
|
||||
for (unsigned i = cut1 ; i < cut2 ; i ++)
|
||||
std :: swap (__route1 [i], __route2 [i]) ;
|
||||
|
||||
// Outside the cuts
|
||||
repair (__route1, cut1, cut2) ;
|
||||
repair (__route2, cut1, cut2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* <partial_mapped_xover.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef partial_mapped_xover_h
|
||||
#define partial_mapped_xover_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Partial Mapped Crossover */
|
||||
class PartialMappedXover : public eoQuadOp <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void repair (Route & __route, unsigned __cut1, unsigned __cut2) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* <route.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "route.h"
|
||||
|
||||
unsigned length (const Route & __route)
|
||||
{
|
||||
|
||||
unsigned len = 0 ;
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
len += distance (__route [i], __route [(i + 1) % numNodes]) ;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* <route.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __route_h
|
||||
#define __route_h
|
||||
|
||||
#include <eoVector.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
typedef eoVector <int, Node> Route;
|
||||
|
||||
unsigned length (const Route & __route);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* <route_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "route_eval.h"
|
||||
|
||||
void RouteEval :: operator () (Route & __route)
|
||||
{
|
||||
__route.fitness (- (int) length (__route));
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* <route_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __route_eval_h
|
||||
#define __route_eval_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class RouteEval : public eoEvalFunc <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* <route_init.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <utils/eoRNG.h>
|
||||
|
||||
#include "route_init.h"
|
||||
#include "node.h"
|
||||
|
||||
void RouteInit :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
__route.clear ();
|
||||
|
||||
for (unsigned i = 0 ; i < numNodes ; i ++)
|
||||
__route.push_back (i);
|
||||
|
||||
for (unsigned i = 0 ; i < numNodes ; i ++)
|
||||
std :: swap (__route [i], __route [rng.random (numNodes)]);
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* <route_init.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __route_init_h
|
||||
#define __route_init_h
|
||||
|
||||
#include <eoInit.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class RouteInit : public eoInit <Route>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route);
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* <two_opt.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "two_opt.h"
|
||||
|
||||
void TwoOpt :: operator () (Route & __route)
|
||||
{
|
||||
|
||||
unsigned i = 0;
|
||||
|
||||
while ((2 * i) < (second - first))
|
||||
{
|
||||
|
||||
std :: swap (__route [first + i], __route [second - i]);
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* <two_opt.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_h
|
||||
#define __two_opt_h
|
||||
|
||||
#include <utility>
|
||||
#include <moMove.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class TwoOpt : public moMove <Route>, public std :: pair <unsigned, unsigned>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route);
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <two_opt_incr_eval.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "two_opt_incr_eval.h"
|
||||
#include "node.h"
|
||||
|
||||
int TwoOptIncrEval :: operator () (const TwoOpt & __move, const Route & __route)
|
||||
{
|
||||
|
||||
/* From */
|
||||
Node v1 = __route [__move.first], v1_left = __route [(__move.first - 1 + numNodes) % numNodes];
|
||||
|
||||
/* To */
|
||||
Node v2 = __route [__move.second], v2_right = __route [(__move.second + 1) % numNodes];
|
||||
|
||||
if (v1 == v2 || v2_right == v1)
|
||||
return __route.fitness ();
|
||||
else
|
||||
return __route.fitness () - distance (v1_left, v2) - distance (v1, v2_right) + distance (v1_left, v1) + distance (v2, v2_right);
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* <two_opt_incr_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_incr_eval_h
|
||||
#define __two_opt_incr_eval_h
|
||||
|
||||
#include <moMoveIncrEval.h>
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptIncrEval : public moMoveIncrEval <TwoOpt>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
int operator () (const TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* <two_opt_init.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "two_opt_init.h"
|
||||
|
||||
void TwoOptInit :: operator () (TwoOpt & __move, const Route & __route)
|
||||
{
|
||||
|
||||
__move.first = __move.second = 0;
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <two_opt_init.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_init_h
|
||||
#define __two_opt_init_h
|
||||
|
||||
#include <moMoveInit.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptInit : public moMoveInit <TwoOpt>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* <two_opt_next.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 "two_opt_next.h"
|
||||
#include "node.h"
|
||||
|
||||
bool TwoOptNext :: operator () (TwoOpt & __move, const Route & __route)
|
||||
{
|
||||
|
||||
if (__move.first == numNodes - 1 && __move.second == numNodes - 1)
|
||||
return false;
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
__move.second ++;
|
||||
if (__move.second == numNodes)
|
||||
{
|
||||
|
||||
__move.first ++;
|
||||
__move.second = __move.first;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <two_opt_next.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_next_h
|
||||
#define __two_opt_next_h
|
||||
|
||||
#include <moNextMove.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptNext : public moNextMove <TwoOpt>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (TwoOpt & __move, const Route & __route);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* <two_opt_rand.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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 <utils/eoRNG.h>
|
||||
|
||||
#include "two_opt_rand.h"
|
||||
#include "node.h"
|
||||
|
||||
void TwoOptRand :: operator () (TwoOpt & __move, const Route & __route)
|
||||
{
|
||||
|
||||
__move.second = rng.random (numNodes);
|
||||
|
||||
__move.first = rng.random (__move.second);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* <two_opt_rand.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_rand_h
|
||||
#define __two_opt_rand_h
|
||||
|
||||
#include <eoMoveRand.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptRand : public eoMoveRand <TwoOpt>
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void operator () (TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue