Commit e1124a07 authored by Alexis Lebis's avatar Alexis Lebis

initialising CEAO repo

CEAO repo initialised with queen tuto from paradiseo exo.
new readme.md for install and pointing dependencies
introducing .gitignore to prevent build directory + other stuffs from queen tuto
parent 39e88d1b
Pipeline #510 failed with stages
correction/
build/
howto.pdf
\ No newline at end of file
######################################################################################
### 0) Set your application properties
######################################################################################
# check cmake version compatibility
cmake_minimum_required(VERSION 2.6)
# Here define your project name
project(QUEEN)
# Here define the name and the version of your package
set(PACKAGE_NAME "QUEEN" CACHE STRING "Package name" FORCE)
set(PACKAGE_VERSION "2.0" CACHE STRING "aPackage version" FORCE)
# regular expression checking
include_regular_expression("^.*$" "^$")
# set a language for the entire project.
enable_language(CXX)
enable_language(C)
######################################################################################
######################################################################################
######################################################################################
### 2) Include the sources
######################################################################################
######################################
### Include required modules & utilities
#####################################################################################
include(CMakeBackwardCompatibilityCXX)
include(FindDoxygen)
include(CheckLibraryExists)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/module")
find_package(Paradiseo COMPONENTS eoutils eo)
include_directories(${PARADISEO_INCLUDE_DIR})
######################################################################################
#####################################################################################
### Manage the build type
#####################################################################################
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
find_program(MEMORYCHECK_COMMAND
NAMES purify valgrind
PATHS
"/home/alexis/.local/share/paradiseo /usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection.")
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DCMAKE_VERBOSE_MAKEFILE=ON)
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DDEPRECATED_MESSAGES)
######################################################################################
### 3) Link the librairies for your executable
######################################################################################
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(application)
######################################################################################
######################################################################################
### 0) Set your application properties
######################################################################################
# check cmake version compatibility
cmake_minimum_required(VERSION 2.6)
# Here define your project name
project(QUEEN)
# Here define the name and the version of your package
set(PACKAGE_NAME "QUEEN" CACHE STRING "Package name" FORCE)
set(PACKAGE_VERSION "2.0" CACHE STRING "aPackage version" FORCE)
# regular expression checking
include_regular_expression("^.*$" "^$")
# set a language for the entire project.
enable_language(CXX)
enable_language(C)
######################################################################################
######################################################################################
######################################################################################
### 2) Include the sources
######################################################################################
######################################
### Include required modules & utilities
#####################################################################################
include(CMakeBackwardCompatibilityCXX)
include(FindDoxygen)
include(CheckLibraryExists)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/module")
find_package(Paradiseo COMPONENTS eoutils eo)
include_directories(${PARADISEO_INCLUDE_DIR})
######################################################################################
#####################################################################################
### Manage the build type
#####################################################################################
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
find_program(MEMORYCHECK_COMMAND
NAMES purify valgrind
PATHS
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection.")
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DCMAKE_VERBOSE_MAKEFILE=ON)
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DDEPRECATED_MESSAGES)
######################################################################################
### 3) Link the librairies for your executable
######################################################################################
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(application)
######################################################################################
set(CTEST_PROJECT_NAME "ParadisEO")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.inria.fr")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO")
set(CTEST_DROP_SITE_CDASH TRUE)
# CSDVP Evolutionary Algorithm Optimization
CSDVP optimization through EA approach.
\ No newline at end of file
Constraint Satisfaction Decaying Variables Problem (CSDVP) optimization through EA approach (**CEAO**)
## Dependencies and configuration
1. CEAO project depends on the C++ [http://paradiseo.gforge.inria.fr/index.php?](Paradiseo Framework).
Therefore, you must [http://paradiseo.gforge.inria.fr/index.php?n=Download.Download](download and install) it.
If you cloned the Paradiseo's repository, do not forget to build it:
```bash
paradiseoPath> mkdir build && cd build && cmake ../ && make
```
2. Correctly link CEAO to your paradiseo install (Optional, iff you manualy build Paradiseo)
Next, you need to locate your paradiseo install while invoking cmake, in order to have the library availables while building CEAO.
To do so, invoke cmake with the following option:
```bash
ceaoPath/build> cmake -DPARADISEO_ROOT=/home/user/your/path/to/paradiseo
ceaoPath/build> make
```
Your project should now be correctly compiled.
### Word of caution
With some distros, Paradiseo project based can throw an error during the build due to linking some static objects to dynamic ones. In that case, rebuild Paradiseo with the `-fPIC` option (or `--enable-shared` if the previous does not work) in the CmakeConfig of the repository.
\ No newline at end of file
# 1) Include the sources
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
# 2) Define targets: executable and dependencies
ADD_EXECUTABLE(solveQueen main.cpp)
ADD_EXECUTABLE(tryInit tryInit.cpp)
ADD_EXECUTABLE(tryMutation tryMutation.cpp)
ADD_EXECUTABLE(tryCrossover tryCrossover.cpp)
ADD_EXECUTABLE(tryEval tryEval.cpp)
ADD_DEPENDENCIES(solveQueen lQueen)
ADD_DEPENDENCIES(tryInit lQueen)
ADD_DEPENDENCIES(tryMutation lQueen)
ADD_DEPENDENCIES(tryCrossover lQueen)
ADD_DEPENDENCIES(tryEval lQueen)
# 3) Link the librairies for your executable
TARGET_LINK_LIBRARIES(solveQueen ${PARADISEO_LIBRARIES} lQueen)
TARGET_LINK_LIBRARIES(tryInit ${PARADISEO_LIBRARIES} lQueen)
TARGET_LINK_LIBRARIES(tryMutation ${PARADISEO_LIBRARIES} lQueen)
TARGET_LINK_LIBRARIES(tryCrossover ${PARADISEO_LIBRARIES} lQueen)
TARGET_LINK_LIBRARIES(tryEval ${PARADISEO_LIBRARIES} lQueen)
#include <eo>
#include <queen.h>
#include <queenInit.h>
#include <queenMutation.h>
#include <queenCrossover.h>
#include <queenEval.h>
int main(int argc, char* argv[]){
//Define a QUEEN -> 1 line
QUEEN s1;
//Define an initializer -> 1 line
queenInit init(8,1);
//Define the evaluation function -> 1 line
queenEval eval;
//Define mutation -> 1 line
queenMutation mut;
//Define crossover -> 1 line
queenCrossover cross;
//Define a generational continuator (put 100 generation for example) -> 1 line
eoGenContinue<QUEEN> cont(100);
//Define the transformation object (it contains, the crossover, the crossover rate, the mutation and the mutation rate) -> 1 line
eoSGATransform<QUEEN> transform(cross, 0.1, mut, 0.1);
//Define a selection method that selects ONE individual by deterministic tournament(put the tournament size at 2 for example) -> 1 line
eoDetTournamentSelect<QUEEN> selectOne(2);
//Define a "eoSelectPerc" with the tournament with default parameter (allow to select the good size of individuals) -> 1 line
eoSelectPerc<QUEEN> select(selectOne);
//Define a generational replacement strategy -> 1 line
eoGenerationalReplacement<QUEEN> replace;
//Define a pop of QUEEN -> 1 line
eoPop<QUEEN> pop;
//Fill the pop with 100 initialized and evaluated QUEEN
//Use the initializer, the evaluation function and the push_back operator's vector -> A "for" included three insrtuctions
for(unsigned int i=0; i<100; i++){
init(s1);
eval(s1);
pop.push_back(s1);
}
//Print the pop -> 1 line
pop.printOn(std::cout);
//HERE you can test whether you succeded in initializing the population by compiling and executing this part of the program.
//Print end of line (endl)
std::cout << std::endl;
/*Define an eoEasyEA with good parameter:
- continuator
- evaluation function
- eoSelectPerc
- transformation object
- replacement
*/
// -> 1 line
eoEasyEA<QUEEN> algo(cont,eval,select,transform,replace);
//run the algorithm on the initialized population -> 1 line
algo(pop);
//Print the best element -> 1 line
pop.best_element().printOn(std::cout);
//If the fitness value is equal to 0, the best solution is found. Else try again.
std::cout << std::endl;
return EXIT_SUCCESS;
}
#include <eo>
#include <queen.h>
#include <queenInit.h>
#include <queenCrossover.h>
int main(int argc, char* argv[]){
//Define two solutions (QUEEN) -> 1 line
//define initializer and init the two solutions -> 3 lines
//Print the two solutions before the cross
std::cout << "Solutions before crossing" << std::endl;
//the first here -> 1 line
std::cout << std::endl;
//the second here -> 1 line
std::cout << std::endl;
std::cout << std::endl;
//Define the crossover -> 1 line
//Cross the solutions -> 1 line
//Print again the two solutions
std::cout << "Solutions after crossing" << std::endl;
//here -> 1 line
std::cout << std::endl;
//and here -> 1 line
std::cout << std::endl;
return EXIT_SUCCESS;
}
#include <eo>
#include <queen.h>
#include <queenEval.h>
int main(int argc, char* argv[]){
//Define two solutions (QUEEN) -> 1 or 2 lines
//init the solutions
//First permutation [4,2,3,1] -> 4 lines (use push_back)
//Second permutation [2,4,1,3] -> 4 lines (use push_back)
//Define evaluation function -> 1 line
//Eval the solutions -> 2 lines
//Print the two evaluated solutions
//here -> 1 line
std::cout << std::endl;
//and here -> 1 line
std::cout << std::endl;
return EXIT_SUCCESS;
}
#include <eo>
#include <queen.h>
#include <queenInit.h>
int main(int argc, char* argv[]){
//Define a solution (QUEEN) -> 1 line
//Define a queenInit -> 1 line
//Init the solution -> 1 line
//Print the solution -> 1 line
std::cout << std::endl;
return EXIT_SUCCESS;
}
#include <eo>
#include <queen.h>
#include <queenInit.h>
#include <queenMutation.h>
int main(int argc, char* argv[]){
//Define a solution (QUEEN) -> 1 line
//define initializer and init the solution -> 2 lines
//Print the solution -> 1 line
std::cout << std::endl;
//Define the mutation -> 1 line
//Mute the solution -> 1 line
//Print again the solution -> 1 line
std::cout << std::endl;
return EXIT_SUCCESS;
}
# File: FindParadiseo.cmake
# Version: 0.0.1
#
# The following variables are filled out:
# - PARADISEO_INCLUDE_DIR : EO, MO and MOEO source dir
# - EO_INCLUDE_DIR : EO source dir
# - MO_INCLUDE_DIR : MO source dir
# - MOEO_INCLUDE_DIR : MOEO source dir. WARNING : You have ton include MO before !
# - PARADISEO_LIBRARIES : the list of all required modules
# - PARADISEO_XXX_LIBRARY : the name of the library to link for the required module
# - PARADISEO_XXX_FOUND : true if the required module is found
# - PARADISEO_FOUND : true if all required modules are found
#
# Here are the components:
# - eo
# - PyEO
# - es
# - ga
# - cma
# - flowshop
# - moeo
# - smp
# - peo
# You can use find_package(Paradiseo COMPONENTS ... ) to enable one or several components. If you not specifie component, all components will be load except SMP for compatibility reasons.
#
# Output
# ------
#
# example:
# find_package(Paradiseo COMPONENTS eo eoutils cma es flowshop ga moeo REQUIRED)
# include_directories(${PARADISEO_INCLUDE_DIR})
# add_executable(example ...)
# target_link_libraries(examplep ${PARADISEO_LIBRARIES})
if(UNIX)
set(INSTALL_SUB_DIR /paradiseo)
endif()
# enabled components
if ("${Paradiseo_FIND_COMPONENTS}" STREQUAL "")
set(PARADISEO_LIBRARIES_TO_FIND eo eoutils cma es flowshop ga moeo)
else()
set(PARADISEO_LIBRARIES_TO_FIND ${Paradiseo_FIND_COMPONENTS})
endif()
#set the build directory
set(BUILD_DIR build)
# Path
set(PARADISEO_SRC_PATHS
${PARADISEO_ROOT}
$ENV{PARADISEO_ROOT}
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/
[KEY_CURRENT_USER\\Software\\Inria\\ParadisEO]/local
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadisEO]/local
)
find_path(EO_INCLUDE_DIR eo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/eo eo/src
PATHS ${PARADISEO_SRC_PATHS})
find_path(MO_INCLUDE_DIR mo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/mo mo/src
PATHS ${PARADISEO_SRC_PATHS})
find_path(MOEO_INCLUDE_DIR moeo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/moeo moeo/src
PATHS ${PARADISEO_SRC_PATHS})
# Specific for SMP and PEO
foreach(COMP ${PARADISEO_LIBRARIES_TO_FIND})
if(${COMP} STREQUAL "smp")
set(SMP_FOUND true)
find_path(SMP_INCLUDE_DIR smp
PATH_SUFFIXES include${INSTALL_SUB_DIR}/smp smp/src
PATHS ${PARADISEO_SRC_PATHS})
elseif(${COMP} STREQUAL "peo")
set(PEO_FOUND true)
find_path(PEO_INCLUDE_DIR peo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/peo peo/src
PATHS ${PARADISEO_SRC_PATHS})
endif()
endforeach()
set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR})
if(SMP_FOUND)
set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${SMP_INCLUDE_DIR})
endif()
if(PEO_FOUND)
set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${PEO_INCLUDE_DIR})
endif()
# find the requested modules
set(PARADISEO_FOUND true) # will be set to false if one of the required modules is not found
set(FIND_PARADISEO_LIB_PATHS
${PARADISEO_ROOT}/${BUILD_DIR}
$ENV{PARADISEO_ROOT}
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/
[KEY_CURRENT_USER\\Software\\Inria\\ParadisEO]/local
[HKEY_LOCAL_MACHINE\\Software\\Inria\\ParadisEO]/local
)
#Suffixes
set(PARADISEO_LIB_PATHS_SUFFIXES
eo/lib
mo/lib
moeo/lib
moeo/tutorial/examples/flowshop/lib #For flowshop library
smp/lib
peo/lib
lib
lib32
lib64
)
foreach(FIND_PARADISEO_COMPONENT ${PARADISEO_LIBRARIES_TO_FIND})
string(TOUPPER ${FIND_PARADISEO_COMPONENT} FIND_PARADISEO_COMPONENT_UPPER)
# release library
find_library(PARADISEO_${FIND_PARADISEO_COMPONENT_UPPER}_LIBRARY
NAMES ${FIND_PARADISEO_COMPONENT}
PATH_SUFFIXES ${PARADISEO_LIB_PATHS_SUFFIXES}
PATHS ${FIND_PARADISEO_LIB_PATHS})
if (PARADISEO_${FIND_PARADISEO_COMPONENT_UPPER}_LIBRARY)
# library found
set(PARADISEO_${FIND_PARADISEO_COMPONENT_UPPER}_FOUND true)
else()
# library not found
set(PARADISEO_FOUND false)
set(PARADISEO_${FIND_PARADISEO_COMPONENT_UPPER}_FOUND false)
set(FIND_PARADISEO_MISSING "${FIND_PARADISEO_MISSING} ${FIND_PARADISEO_COMPONENT}")
endif()
set(PARADISEO_LIBRARIES ${PARADISEO_LIBRARIES} "${PARADISEO_${FIND_PARADISEO_COMPONENT_UPPER}_LIBRARY}")
endforeach()
# handle result
if(PARADISEO_FOUND)
message(STATUS "Found ParadisEO includes :")
message(${EO_INCLUDE_DIR})
message(${MO_INCLUDE_DIR})
message(${MOEO_INCLUDE_DIR})
if(SMP_FOUND)
message(${SMP_INCLUDE_DIR})
endif()
if(PEO_FOUND)
message(${PEO_INCLUDE_DIR})
endif()
else()
# include directory or library not found
message(FATAL_ERROR "Could NOT find ParadisEO (missing : ${FIND_PARADISEO_MISSING})")
endif()
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
include_directories(${PARADISEO_INCLUDE_DIR})
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
SET (EXERCICE_SOURCES
queenEval.cpp
)
ADD_LIBRARY(lQueen STATIC ${EXERCICE_SOURCES})
\ No newline at end of file
#include <eoInt.h>
#include <eoScalarFitness.h>
//Here, we define a QUEEN as an eoVector of int: eoInt with a "eoMinimizingFitness" template. It allow to indicate we want to minimize the fitness (concept included in eoVector cf doc).
typedef eoInt<eoMinimizingFitness> QUEEN;
#include <eoOrderXover.h>
#include <queen.h>
typedef eoOrderXover<QUEEN> queenCrossover;
#include <queenEval.h>
void queenEval::operator()(QUEEN & _queen){
double fit=0.0;
for(int i=0; i<_queen.size()-1; i++)
for(int j=i+1; j< _queen.size(); j++)
if((_queen[i]+j-i == _queen[j]) || (_queen[i]+i-j == _queen[j]))
fit+=1.0;
_queen.fitness(fit);
}
#include <queen.h>
#include <eoEvalFunc.h>
class queenEval : public eoEvalFunc<QUEEN>
{
public:
void operator()(QUEEN & _queen);
};
#include <eoInit.h>
#include <queen.h>
typedef eoInitPermutation<QUEEN> queenInit;
#include <eoSwapMutation.h>
#include <eoShiftMutation.h>
#include <queen.h>
typedef eoSwapMutation<QUEEN> queenMutation;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment