Compare commits

..

99 commits

Author SHA1 Message Date
Johann Dreo
3259d1b452 doc: bump version + clean authors list 2025-04-16 13:42:29 +02:00
Alessandro Sidero
c660489eaf
Optimize eoRanking: Add caching and index vector (#80)
* Adds eoRankingCached with better documentation
* Optimize eoRanking with caching and index vector
* Adds t-eoRankingCached.cpp
2025-04-15 18:04:35 +02:00
Johann Dreo
400c69c49a doc: mention Apptainer in INSTALL 2025-04-08 19:45:59 +02:00
Johann Dreo
bee47592af doc: adds howto_build_paradiseo script for apptainer 2025-04-07 23:06:52 +02:00
Johann Dreo
e14220ff69 fix(checkpoint): initialize a pointer 2025-04-07 22:57:21 +02:00
Johann Dreo
c218a19de6 fix(doc): disable doc-mpi 2025-04-07 22:56:58 +02:00
Johann Dreo
4b4344664b update(README): link to cmake-gui, citation ref 2025-04-07 14:50:03 +02:00
Johann Dreo
b8efdda6a2 Merge branch 'setup-ccache' of github.com:Jxtopher/nojhan_paradiseo 2025-04-07 14:18:58 +02:00
Johann Dreo
22275e434b fix several warnings
Probably fixes a bug in es/CMA, which has been deprecated for a long time in favor of the EDO module anyway.
2025-04-07 14:16:37 +02:00
Jxtopher
cfcd6e22bb Ccache setup
The goal is to speed up recompilation using ccache.

Ccache is a tool that speeds up recompilation of C/C++ code. It does this by caching the results of previous compilations.
When you recompile code, ccache checks if it has already compiled the same code with the same compiler flags. If so, it uses the cached result instead of recompiling.
2025-04-04 21:59:27 +02:00
48ca0fa5b8 Merge branch 'master' of github.jdreo:jdreo/paradiseo 2025-04-04 21:46:33 +02:00
172798a637 revert 399b22266 (virtual fitness interface temptative)
Incompatible with MOEO's change of interface.
2025-04-04 21:46:04 +02:00
7c88ec4fa7 feat(EO): allow overriding fitness accessors
May be useful for debugging, by tracing when fitness assignement occurs.
2025-04-04 21:45:56 +02:00
aa242bd4d6 Merge tag 'v3.0.0' 2025-04-04 21:23:53 +02:00
3dc2058400
Merge pull request #78 from Alessandro624/fix-mpi-ale
fix(MPI): resolved cyclic inclusion and MPI issue
2025-03-21 09:05:54 +01:00
Alessandro Sidero
77148b5a97 fix(MPI): resolved cyclic inclusion and MPI issue 2025-02-24 19:07:10 +01:00
Johann Dreo
d3a2ab5e84 fix(EDO): constructor declarations without templates 2024-10-03 10:08:00 +02:00
Johann Dreo
190a30495e fix(EO): allow readFrom to work on std::cin + invalidTag
- std::cin does not allow seekg/tellg, so instead one wrap the read string
  in a istringstream, and then read from it.
  This allows to read from any istream, with or without seekg.
- Adds an EO::invalidTag member, in case someone would need to use it
  (for instance as a regexp to sanitize inputs).
2024-09-30 20:42:20 +02:00
Johann Dreo
8ea6e2b680 feat(eo): adds eoRealToIntInit 2024-09-27 12:20:10 +02:00
Johann Dreo
19ec4c4ff7 feat(eo): wrap ops on float vecs into ops on int vecs
Adds wrapper classes to make any MonOp or QuadOp that operates on eoReal embbedable in any operator needing an eoInt.
2024-09-26 13:24:10 +02:00
Johann Dreo
846006c613 feat(moSA): adds a constructor without cool but with cont 2024-09-21 13:53:38 +02:00
Johann Dreo
db24e611b7 refactor(tests): reduce runtime for foundry tests 2024-09-11 11:04:29 +02:00
cf086ea9b9 fix(moBinaryPartition): finalize integration in <mo> 2024-09-10 20:26:36 +02:00
1c853ecdb9 revert 399b22266 (virtual fitness interface temptative)
Incompatible with MOEO's change of interface.
2023-02-10 11:54:45 +01:00
dcac78cdf5 fix(mo): missing include 2023-02-10 11:54:18 +01:00
e5c387b567 fix(eoStandardBitMutation):
- Fix all operators in eoStandardBitMutation.h
- Bitflip componennt was not bound, use explicit assignement of rates.
- Fix normal and fast operators algorithms.

Co-authored-by: Potalas <potalas@free.fr>
2023-02-10 11:53:53 +01:00
ab375d55ac refactor(mo): use clog instead of cout & use at accessors in Debug builds
Should really use eo::log, but waiting for logger refactoring.
2023-02-10 09:52:59 +01:00
399b222661 feat(EO): allow overriding fitness accessors
May be useful for debugging, by tracing when fitness assignement occurs.
2023-02-10 09:52:59 +01:00
BertheasLeo
afa0d18d1e Update edoEstimatorNormalAdaptive.h
Correction aliasing errror on Eigen
2023-02-10 09:45:06 +01:00
BertheasLeo
7b8e393670 Update eoSIGContinue.h
Correction sighandler is not defined on Windows
2023-02-10 09:45:06 +01:00
Johann Dreo
e23151d666 feat: prepare the use of binary partitions for signatures 2022-09-12 15:20:05 +02:00
Johann Dreo
b96b537ed1 fix(nbhood): make accessors const 2024-09-10 16:47:28 +02:00
Johann Dreo
a376921f07 add save-sol to output all solutions to a file 2023-03-28 18:58:51 +02:00
Johann Dreo
d64f2b38ed refactor: put cache in lib + clean doc 2023-02-06 23:12:36 +01:00
Johann Dreo
e57b504cd6 refactor(app): usable output 2023-02-03 11:46:17 +01:00
Johann Dreo
79e2c01ca8 refactor(app): separate main exe and datatester
better log
2023-02-03 10:35:10 +01:00
Johann Dreo
df723331be refactor(fitness): store cache with the fitness
to allow rollback with minimal mem footprint
2023-02-02 14:48:02 +01:00
Johann Dreo
237426a6b4 refactor while hunting a bug 2023-01-26 11:48:44 +01:00
Johann Dreo
36fe6e6f7d fix a warning 2023-01-18 11:28:50 +01:00
Johann Dreo
86c750618f more doc 2023-01-18 11:14:13 +01:00
Johann Dreo
bfce997ce8 first part of partial signature evaluation 2022-10-18 11:12:38 +02:00
Johann Dreo
1d640b3251 feat: adds partial eval and tests 2022-10-03 16:11:37 +02:00
Johann Dreo
2accb17599 document everything and remove dead code 2022-09-13 15:25:33 +02:00
Johann Dreo
11f49e58d7 feat: prepare the use of binary partitions for signatures 2022-09-12 15:20:05 +02:00
Johann Dreo
a6a3f799e7 fix(eoParallel): declutch _t_start under _OPENMP 2024-09-10 10:57:50 +02:00
Johann Dreo
df8c457f75 fix(moeoSPEA2Archive): correct members init order 2024-09-10 10:45:18 +02:00
Johann Dreo
867b1c289b fix(eoEvalUserTimeThrowException): preprocessor test for POSIX and UNIX 2024-09-10 10:44:42 +02:00
Johann Dreo
32195a480b fix(selectors): comment out unused variable 2024-09-10 09:26:00 +02:00
Johann Dreo
c23b9c160a fix(selectors): correctly initialize rawTotal 2024-09-10 09:22:16 +02:00
Johann Dreo
1a61cd1f1c fix(eoGnuplot): get rid of warnings about unused variables 2024-09-10 09:21:51 +02:00
Johann Dreo
8dd4f529f2 fix(eoExceptions): do not return a ref from a temp 2024-09-10 09:21:15 +02:00
Johann Dreo
51be7e324b fix(moRndVectorVNSelection): use shuffle for modern compilers 2024-09-05 14:42:40 +02:00
Johann Dreo
732fe097cb fix(doc): use current source dir and not the root one.
Allow Paradiseo to be built as a Git submodule of another project.
2024-09-04 08:55:48 +02:00
Johann Dreo
84148824e0 fix: remove a lot of trivial warnings 2024-08-23 18:00:31 +02:00
Johann Dreo
a16298c58b Merge branch 'master' of https://gitlab.inria.fr/paradiseo/paradiseo 2024-08-23 16:25:23 +02:00
Johann Dreo
332d078902 feat(doc): recent articles first 2024-08-23 16:21:05 +02:00
Johann Dreo
dde057b12b feat(doc): mention partial evaluation for combinatorics 2024-08-23 15:22:17 +02:00
Eremey Valetov
a5d3bf8601 docs: add accelerator physics paper to publications list 2024-08-23 14:55:58 +02:00
Johann Dreo
22b74e9c07 fix(eoEvalFoundryEA): reorder members to avoid warning 2024-08-23 14:53:01 +02:00
Johann Dreo
fefb2af4dd REFACTOR!eoForge*): separate raw pointres from shared ones
- Move the instantiate(double) interfaces of eoForgeVector as instantiate_from.
- Adds two separated sets members for instantiation.

BREAKING CHANGE
2024-08-23 14:53:01 +02:00
Johann Dreo
3cc374ce5c fix(warnings): do not ignore return from system 2024-08-23 14:53:01 +02:00
Johann Dreo
b4e89d8f51 fix(deprecated): guard from bind and *_function
Deprecated since C++11, removed in C++17.
2024-08-23 14:53:01 +02:00
Johann Dreo
09a26fdc62 fix(eoForge): missing header 2024-08-23 14:53:01 +02:00
Johann Dreo
4bbb4a595e fix(mpi): fix some namespaces issues with mpi 2024-08-23 14:53:01 +02:00
Johann Dreo
c442d8a0a2 Revert "fix!(eoBit): defaults to char for scalar type"
This reverts commit 06e0cc0162b6f753d92076c510d7124d82a3def1.
2024-08-23 14:53:01 +02:00
Jxtopher
93e89828b8 Fix CI: random class issue, t-eoRoulette and update the workflow 2024-08-23 14:52:58 +02:00
Johann Dreo
ec1a0f0c62 fix(eoForgeVector): use shared_ptr insteadof raw ones + adds instantiate_ptr interface 2024-08-22 22:21:57 +02:00
Johann Dreo
6f7d505a2a fix(rnd): use STL's rand gen for shuffles
Previous implementation used Paradiseo's own random generator system,
now superseeded by the STL's one.
2024-08-19 11:14:21 +02:00
Johann Dreo
55b2f57d19 fix!(eoBit): defaults to char for scalar type
Since STL's vector of bool is not a vector of bool, `swap`ing bool elements in an eoBit can lead to errors.
Using `char` is a saner default.

Potential BREAKING CHANGE.
2024-08-19 11:13:53 +02:00
e643468de8 revert 399b22266 (virtual fitness interface temptative)
Incompatible with MOEO's change of interface.
2024-04-08 22:20:00 +02:00
f30240cb44 fix(mo): missing include 2024-04-08 22:20:00 +02:00
ff744aea7c fix(eoStandardBitMutation):
- Fix all operators in eoStandardBitMutation.h
- Bitflip componennt was not bound, use explicit assignement of rates.
- Fix normal and fast operators algorithms.

Co-authored-by: Potalas <potalas@free.fr>
2024-04-08 22:20:00 +02:00
9cb60e4b10 refactor(mo): use clog instead of cout & use at accessors in Debug builds
Should really use eo::log, but waiting for logger refactoring.
2024-04-08 22:20:00 +02:00
5a7fdf7ed3 feat(EO): allow overriding fitness accessors
May be useful for debugging, by tracing when fitness assignement occurs.
2024-04-08 22:20:00 +02:00
BertheasLeo
bad5d6cbb8 Update edoEstimatorNormalAdaptive.h
Correction aliasing errror on Eigen
2024-04-08 22:20:00 +02:00
BertheasLeo
5e0e6fcd79 Update eoSIGContinue.h
Correction sighandler is not defined on Windows
2024-04-08 22:20:00 +02:00
c2a3ed4e7f fix(mo): comment out unused parameters
Removes -Wunused-parameters warnings.
2022-09-10 06:27:58 +02:00
843aa6fc37 fix(mo): comment out unused parameters
Removes -Wunused-parameters warnings.
2022-09-10 06:27:46 +02:00
1a980c442d feat: add an eoForgeMap
Same features than an eoForgeVector,
but allowing to bind a string name to the instance.
2022-09-10 06:02:15 +02:00
ff09b4bcc7 fix logo display in readme 2022-09-10 06:02:15 +02:00
AI Xin
1f1f598314 add mo tutorial doc in Markdown format
The original tutorial link[http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials] is broken. I found the archive from here: https://web.archive.org/web/20210119160107/http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials
2022-09-10 06:02:15 +02:00
80140ddcc3 feat: add an eoForgeMap
Same features than an eoForgeVector,
but allowing to bind a string name to the instance.
2022-09-10 06:01:37 +02:00
c2f2e635c8 fix Ubuntu-related memory allocation bug 2022-09-10 06:01:37 +02:00
023cb45ca5
fix logo display in readme 2022-08-31 23:46:46 +02:00
c8d02c23cf
Merge pull request #65 from Scicomath/add-mo-tuturial-doc
Add mo tutorial doc in Markdown format
2022-05-09 10:21:33 +03:00
AI Xin
0d3580ae2d add mo tutorial doc in Markdown format
The original tutorial link[http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials] is broken. I found the archive from here: https://web.archive.org/web/20210119160107/http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials
2022-05-08 18:59:34 +08:00
3b7ffbbfae fix Ubuntu-related memory allocation bug 2022-01-31 20:14:38 +01:00
132eb4f50e refactor doc style 2022-01-27 13:11:20 +01:00
8948f0a3dc fix doc: big update
- use single doxyfile instead of one per module
- use a cleaner and more modern style
- reorder sections to put details first
- hide diagrams by default
- remove deprecated doxygen variables
- disable latex generation by default
- fix some doc typos
2022-01-26 16:45:51 +01:00
02eb0e967d fix eoAlgoFoundry management of numeric parameters
- Use a variant to avoid implicit casting to integer when selecting with brace-initialization.
- Add more doc around parameter forges.
2022-01-26 10:40:50 +01:00
3a6236594e fix foundries examples
Were declaring forges for parameters, the old way.
2022-01-23 18:18:40 +01:00
4ee48e760b refactor UF_random_generator to fit the new std::shuffle 2022-01-23 18:17:48 +01:00
009ef5e1d8 fix warning about useless arg 2022-01-23 18:17:14 +01:00
ef0e6531ee fix warnings about useless typedef 2022-01-23 18:15:38 +01:00
dfb6f7c2d9 fix warning on signedess of comparison 2022-01-22 18:40:02 +01:00
Potalas
e5b5e8807d The new feature onlymutga with new mutation and experiments 2022-01-05 10:57:49 +01:00
345dc16df6 Merge branch 'master' of github.jdreo:jdreo/paradiseo 2022-01-04 11:05:49 +01:00
a96db239c4 update the doc index
- get rid of several INRIA's gforge links
- update the last reference
2022-01-04 11:04:11 +01:00
00b66afcaa fix a missing update in fastga.sindef 2022-01-04 11:03:53 +01:00
274 changed files with 6817 additions and 1264 deletions

View file

@ -1,10 +1,5 @@
name: Build Debug (Ubuntu) name: Build Debug (Ubuntu)
on: [push, pull_request]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env: env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@ -21,8 +16,15 @@ jobs:
compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12] compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Caching objects
id: cache-objects
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ${{ runner.os }}-${{env.BUILD_TYPE}}-${{ matrix.compiler }}-objects
- name: Install Dependencies - name: Install Dependencies
shell: bash shell: bash
run: | run: |

14
.gitignore vendored
View file

@ -1,11 +1,20 @@
# ignore html files # ignore generated files
*.html *.html
*.pdf
# ignore all textual files # ignore all textual files
*.txt *.txt
*.swp
*.swo
.kak_history
*.log
*.csv
*.ods
# ignore object and archive files # ignore object and archive files
*.[oa] *.[oa]
*.bak
*.tar*
tags tags
# ignore auto-saved files # ignore auto-saved files
@ -29,4 +38,7 @@ debug/*
build/* build/*
website/EO_star.png website/EO_star.png
website/paradiseo_logo.png website/paradiseo_logo.png
Release/*
Debug/*
Build/*

35
AUTHORS
View file

@ -1,41 +1,52 @@
Current maintainers Current maintainers
=================== ===================
Arnaud Liefooghe <arnaud.liefooghe@univ-lille1.fr>
Clive Canape <clive.canape@inria.fr>
Johann Dreo <johann@dreo.fr>
Sébastien Verel <sebastien.verel@inria.fr>
Active developpers Johann Dreo <johann@dreo.fr>
==================
Alexandre Quemy <alexandre.quemy@inria.fr>
Benjamin Bouvier <bnjbouv@gmail.com>
Caner Candan <caner@candan.fr>
Pierre Savéant <pierre.saveant@thalesgroup.com>
Past contributors Past contributors
================= =================
atantar atantar
Alesandro Sidero
Alexandre Quemy
Alix Zheng
Amine Aziz-Alaoui
Arnaud Liefooghe
Benjamin Bouvier
Bahri
Caner Candan
Clive Canape
fatene fatene
Gustavo Romero Lopez Gustavo Romero Lopez
jboisson jboisson
Jeroen Eggermont Jeroen Eggermont
Jochen Küpper Jochen Küpper
Joost <joost@dsj.nl> Joost
Juan Julian Merelo Guervos Juan Julian Merelo Guervos
Jérémie Humeau Jérémie Humeau
Jxtopher
Karima Boufaras Karima Boufaras
legillon legillono
Leo Bertheas
Louis Da Costa Louis Da Costa
Loïc Jean David Arjanen Loïc Jean David Arjanen
Maarten Keijzer Maarten Keijzer
Mammar Amara
Manu
Marc Schoenauer Marc Schoenauer
Marie-Éleonore Marie-Éleonore
Mostepha Khouadjia Mostepha Khouadjia
Olivier König Olivier König
Pierre Savéant
Pedro Angel Castillo Valdivieso Pedro Angel Castillo Valdivieso
Potalas
Ronald Pinho
Steve Madere Steve Madere
Sébastien Cahon Sébastien Cahon
Sébastien Verel
Thomas Legrand Thomas Legrand
Thibault Lasnier
Victor Manuel Rivas Santos Victor Manuel Rivas Santos
wcancino wcancino
xohm xohm

View file

@ -13,13 +13,24 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
## Name ## Name
project("ParadisEO" project("ParadisEO"
VERSION 3.0.0 VERSION 3.1.3
DESCRIPTION "Evolutionary optimization framework" DESCRIPTION "Evolutionary optimization framework"
LANGUAGES C CXX) LANGUAGES C CXX)
## Language ## Language
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
## ccache
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
message(NOTICE "-- ccache is enabled (found here: ${CCACHE_PROGRAM})")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "\"${CCACHE_PROGRAM}\"")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "\"${CCACHE_PROGRAM}\"")
else ()
message(NOTICE "-- ccache has not been found")
endif ()
###################################################################################### ######################################################################################
### 2) Check dependencies ### 2) Check dependencies
@ -81,31 +92,34 @@ set(SMP "false" CACHE BOOL "Build the SMP module")
set(MPI "false" CACHE BOOL "Build the MPI module") set(MPI "false" CACHE BOOL "Build the MPI module")
## EO Module ## EO Module
set(EO_MODULE_NAME "Evolving Object") set(MODULE_NAME "Paradiseo")
set(DOXYGEN_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doxygen)
# set(EO_MODULE_NAME "Evolving Objects")
set(CMAKE_SOURCE_DIR ${EO_SRC_DIR}) set(CMAKE_SOURCE_DIR ${EO_SRC_DIR})
add_subdirectory(${EO_SRC_DIR}) add_subdirectory(${EO_SRC_DIR})
if(NOT EO_ONLY) if(NOT EO_ONLY)
## MO Module ## MO Module
set(MO_MODULE_NAME "Moving objects") # set(MO_MODULE_NAME "Moving Objects")
# set(MODULE_NAME "Moving Objects")
set(CMAKE_SOURCE_DIR ${MO_SRC_DIR}) set(CMAKE_SOURCE_DIR ${MO_SRC_DIR})
add_subdirectory(${MO_SRC_DIR}) add_subdirectory(${MO_SRC_DIR})
## EDO Module ## EDO Module
if(EDO) if(EDO)
set(EDO_MODULE_NAME "Evolving Distribution Objects") # set(EDO_MODULE_NAME "Evolving Distribution Objects")
set(CMAKE_SOURCE_DIR ${EDO_SRC_DIR}) set(CMAKE_SOURCE_DIR ${EDO_SRC_DIR})
add_subdirectory(${EDO_SRC_DIR}) add_subdirectory(${EDO_SRC_DIR})
endif() endif()
## MOEO Module ## MOEO Module
set(MOEO_MODULE_NAME "Multi-Objectives EO") # set(MOEO_MODULE_NAME "Multi-Objectives EO")
set(CMAKE_SOURCE_DIR ${MOEO_SRC_DIR}) set(CMAKE_SOURCE_DIR ${MOEO_SRC_DIR})
add_subdirectory(${MOEO_SRC_DIR}) add_subdirectory(${MOEO_SRC_DIR})
## SMP Module ## SMP Module
if(SMP) if(SMP)
set(SMP_MODULE_NAME "Symmetric Multi-Processing") # set(SMP_MODULE_NAME "Symmetric Multi-Processing")
set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR}) set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR})
add_subdirectory(${SMP_SRC_DIR}) add_subdirectory(${SMP_SRC_DIR})
endif() endif()

View file

@ -2,7 +2,8 @@
Summary Summary
======= =======
As Paradiseo is a development framework, you do not really need to install it on all your systems. Just put it somewhere on your development computer, compile it from here and indicate where to find it to your favorite build system. As Paradiseo is a development framework, you do not really need to install it on all your systems.
Just put it somewhere on your development computer, compile it from here and indicate where to find it to your favorite build system.
Build Build
@ -18,6 +19,11 @@ Paradiseo use the CMake build system, so building it should be as simple as:
mkdir build ; cd build ; cmake -DEDO=ON .. && make -j mkdir build ; cd build ; cmake -DEDO=ON .. && make -j
``` ```
The file `howto_build_paradiseo.apptainer.def` shows you how to install and build from scratch.
It is a definition file for the [Apptainer](https://apptainer.org/) container system,
which is often used on HPC clusters.
Develop Develop
------- -------
@ -187,13 +193,13 @@ Examples and lessons are generated when `ENABLE_CMAKE_EXAMPLE` is set.
If you want to build a specific lesson or example, you can check the list of available targets with `make help`. If you want to build a specific lesson or example, you can check the list of available targets with `make help`.
All lessons are build on the same pattern: `<module>Lesson<number>`. All lessons are build on the same pattern: `<module>Lesson<number>`.
For instance, make `moLesson4` will build the Lesson 4 from the MO module. For instance, make `moLesson4` will build the Lesson 4 from the MO module.
Easy, isn't it ? Easy, isn't it ?
Tests Tests
----- -----
By performing tests, you can check your installation. By performing tests, you can check your installation.
Testing is disable by default, except if you build with the full install type. Testing is disable by default, except if you build with the full install type.
To enable testing, define `ENABLE_CMAKE_TESTING` when you run cmake. To enable testing, define `ENABLE_CMAKE_TESTING` when you run cmake.

View file

@ -8,7 +8,9 @@ It focus on the efficiency of the implementation of solvers, by providing:
- tools for ***automated design and selection*** of algorithms, - tools for ***automated design and selection*** of algorithms,
- a focus on ***speed*** and several ***parallelization*** options. - a focus on ***speed*** and several ***parallelization*** options.
![Paradiseo logo](https://github.com/nojhan/paradiseo/blob/master/website/paradiseo_logo_200px_dark.png) <div align="center">
<img width="640" alt="Paradiseo logo" src="https://raw.githubusercontent.com/nojhan/paradiseo/master/docs/img/paradiseo_logo_dark.svg"/>
</div>
# Quick Start # Quick Start
@ -166,7 +168,7 @@ It is, for instance, easy to start with a simple local search, then add multi-ob
Paradiseo is mainly developed under Linux operating systems, where its dependencies and the C++ toolchain are easy to install. Recent versions have been tested with gcc and clang compilers. Paradiseo is mainly developed under Linux operating systems, where its dependencies and the C++ toolchain are easy to install. Recent versions have been tested with gcc and clang compilers.
Stable versions should however work on Windows and any Unix-like operating system with a standard-conforming C++ development system. Stable versions should however work on Windows and any Unix-like operating system with a standard-conforming C++ development system.
# Code # Code
@ -193,7 +195,7 @@ The build chain uses the classical workflow of CMake. The recommended method is
Under Linux, the default is make, and a build command is straitghtforward: `mkdir build ; cd build ; cmake .. && make -j`. Under Linux, the default is make, and a build command is straitghtforward: `mkdir build ; cd build ; cmake .. && make -j`.
There is, however, several build options which you may want to switch. To see them, we recommend the use of a CMake gui, like ccmake or cmake-gui . On the command line, you can see the available options with: `cmake -LH ..` . Those options can be set with the `-D<option>=<value>` argument to cmake. There is, however, several build options which you may want to switch. To see them, we recommend the use of a CMake gui, like ccmake or cmake-gui. On the command line, you can see the available options with: `cmake -LH ..` . Those options can be set with the `-D<option>=<value>` argument to cmake.
**The first option to consider is `CMAKE_BUILD_TYPE`, which you most probably want to set to `Debug` (during development/tests) or `Release` (for production/validation).** **The first option to consider is `CMAKE_BUILD_TYPE`, which you most probably want to set to `Debug` (during development/tests) or `Release` (for production/validation).**
@ -206,6 +208,13 @@ If you `ENABLE_CMAKE_TESTING` and `BUILD_TESTING`, it will be the tests, which y
If you `ENABLE_CMAKE_EXAMPLE`, it will also build the examples. If you `ENABLE_CMAKE_EXAMPLE`, it will also build the examples.
If may want to make build scripts more verbose (especially when building the
doc) by enabling `CMAKE_VERBOSE_MAKEFILE`.
If `ccache` installed in your environment, it will try its best to re-use other compilations,
which may speed-up your builds if you manage several compatible builds at the same time.
To clear all cached objects, execute `ccache -C`.
## Licenses ## Licenses
Paradiseo is distributed under the GNU Lesser General Public License and the CeCILL license (depending on the modules). Paradiseo is distributed under the GNU Lesser General Public License and the CeCILL license (depending on the modules).
@ -230,11 +239,35 @@ For academic articles, books, more tutorials, presentations slides,
real life example of solvers and contact information, real life example of solvers and contact information,
please see the web site (available in `paradiseo/website/index.html`). please see the web site (available in `paradiseo/website/index.html`).
There is also an [online wiki](https://gitlab.inria.fr/paradiseo/paradiseo/-/wikis/home)
# Citing Paradiseo
If you use Paradiseo, please cite the following publication:
Johann Dreo, Arnaud Liefooghe, Sébastien Verel, Marc Schoenauer, Juan J. Merelo, Alexandre Quemy, Benjamin Bouvier, and Jan Gmys, [Paradiseo: from a modular framework for evolutionary computation to the automated design of metaheuristics —22 years of Paradiseo—](https://doi.org/10.1145/3449726.3463276), GECCO'21: Proceedings of the Genetic and Evolutionary Computation Conference Companion, 15221530 (2021).
BiBTeX entry:
```
@inproceedings{Dreo-al_2021_Paradiseo,
author = {Dreo, Johann and Liefooghe, Arnaud and Verel, S\'{e}bastien and Schoenauer, Marc and Merelo, Juan J. and Quemy, Alexandre and Bouvier, Benjamin and Gmys, Jan},
title = {Paradiseo: From a Modular Framework for Evolutionary Computation to the Automated Design of Metaheuristics: 22 Years of Paradiseo},
year = {2021},
isbn = {9781450383516},
publisher = {Association for Computing Machinery},
address = {Online conference},
url = {https://doi.org/10.1145/3449726.3463276},
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference Companion},
pages = {15221530},
numpages = {9}
}
```
# Contact # Contact
For further information about ParadisEO, help or to report any For further information about ParadisEO, help or to report any
problem, you can send an e-mail to: `paradiseo-help@lists.gforge.inria.fr` problem, you can either:
- Chat with us on our Matrix chatroom: https://app.element.io/#/room/#paradiseo:matrix.org
- Post an issue: https://github.com/nojhan/paradiseo/issues

View file

@ -27,7 +27,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
# set(DOC_SMP "") # set(DOC_SMP "")
# endif() # endif()
# if(MPI) # if(MPI)
# set(DOC_MPI "make doc-mpi") # set(DOC_MPI "make doc-mpi")
# else() # else()
# set(DOC_MPI "") # set(DOC_MPI "")
# endif() # endif()
@ -78,7 +78,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-eo COMMAND make doc-eo
COMMAND make doc-mo COMMAND make doc-mo
COMMAND make doc-moeo COMMAND make doc-moeo
COMMAND make doc-mpi # COMMAND make doc-mpi
) )
endif() endif()
@ -89,7 +89,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-mo COMMAND make doc-mo
COMMAND make doc-moeo COMMAND make doc-moeo
COMMAND make doc-smp COMMAND make doc-smp
COMMAND make doc-mpi # COMMAND make doc-mpi
) )
endif() endif()
if(EDO AND NOT SMP AND MPI) if(EDO AND NOT SMP AND MPI)
@ -98,7 +98,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-mo COMMAND make doc-mo
COMMAND make doc-moeo COMMAND make doc-moeo
COMMAND make doc-edo COMMAND make doc-edo
COMMAND make doc-mpi # COMMAND make doc-mpi
) )
endif() endif()
if(EDO AND SMP AND NOT MPI) if(EDO AND SMP AND NOT MPI)
@ -119,7 +119,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-moeo COMMAND make doc-moeo
COMMAND make doc-edo COMMAND make doc-edo
COMMAND make doc-smp COMMAND make doc-smp
COMMAND make doc-mpi # COMMAND make doc-mpi
) )
endif() endif()
@ -131,7 +131,7 @@ endif(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
###################################################################################### ######################################################################################
if(PROFILING) if(PROFILING)
find_program(LCOV find_program(LCOV
NAMES lcov NAMES lcov
PATHS PATHS
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder] [HKEY_CURRENT_USER\\Software]" "/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder] [HKEY_CURRENT_USER\\Software]"

View file

@ -28,8 +28,8 @@
<p>Shortcuts:</p> <p>Shortcuts:</p>
<ul> <ul>
<li><a href="#Why">Why choosing <em class="logo">Paradis<span class="logo_eo">eo</span></em>?</a></li> <li><a href="#Why">Why choosing <em class="logo">Paradis<span class="logo_eo">eo</span></em>?</a></li>
<li><a href="https://gforge.inria.fr/frs/?group_id=145">Downloads</a></li> <li><a href="https://github.com/nojhan/paradiseo/releases">Downloads</a></li>
<li><a href="https://gforge.inria.fr/scm/?group_id=145">Git repository</a></li> <li><a href="https://github.com/nojhan/paradiseo">Git repository</a></li>
<li><a href="https://app.element.io/#/room/#paradiseo:matrix.org">Chat with us</a></li> <li><a href="https://app.element.io/#/room/#paradiseo:matrix.org">Chat with us</a></li>
</ul> </ul>
</div> </div>
@ -125,9 +125,9 @@
<div id="Download"> <div id="Download">
<h2><a name="Download"></a>Download</h2> <h2><a name="Download"></a>Download</h2>
Download the <a href="https://gforge.inria.fr/frs/download.php/31733/Paradiseo-2.0.1.zip">latest stable release</a>. Download the <a href="https://github.com/nojhan/paradiseo/releases">latest stable release</a>.
<p>Or clone the latest version: <code class="command">git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git</code></p> <p>Or clone the latest version: <code class="command">git clone https://github.com/nojhan/paradiseo.git</code></p>
</div> </div>
<div id="Build"> <div id="Build">
@ -147,7 +147,9 @@
<div id="Develop"> <div id="Develop">
<h2><a name="Develop"></a>Develop</h2> <h2><a name="Develop"></a>Develop</h2>
<!--
<p>Download the <a href="https://gforge.inria.fr/frs/download.php/31755/QuickStart.zip">quick start project template</a>, edit the <code>CMakeLists.txt</code> file to indicate where to find <em class="logo">Paradis<span class="logo_eo">eo</span></em> and start developing your own solver.</p> <p>Download the <a href="https://gforge.inria.fr/frs/download.php/31755/QuickStart.zip">quick start project template</a>, edit the <code>CMakeLists.txt</code> file to indicate where to find <em class="logo">Paradis<span class="logo_eo">eo</span></em> and start developing your own solver.</p>
-->
<p>To show you how does a <em class="logo">Paradis<span class="logo_eo">eo</span></em> code look, you will find here a minimal implementation of the popular <a href="https://en.wikipedia.org/wiki/CMA-ES">CMA-ES algorithm</a>.</p> <p>To show you how does a <em class="logo">Paradis<span class="logo_eo">eo</span></em> code look, you will find here a minimal implementation of the popular <a href="https://en.wikipedia.org/wiki/CMA-ES">CMA-ES algorithm</a>.</p>
@ -300,7 +302,7 @@
<div id="Why_efficiency"> <div id="Why_efficiency">
<h3>Efficient</h3> <h3>Efficient</h3>
<p class="excerpt"><em class="logo">Paradis<span class="logo_eo">eo</span></em> is <em>the fastest</em> framework on the market, which is a crucial feature for modern and robust approach to solver <em>design and validation</em>.</p> <p class="excerpt"><em class="logo">Paradis<span class="logo_eo">eo</span></em> is <em>the fastest</em> framework on the market, which is a crucial feature for modern and robust approach to solver <em>design and validation</em> (especially on combinatorial problems).</p>
</div> </div>
<div id="Why_efficiency_details"> <div id="Why_efficiency_details">
@ -309,6 +311,7 @@
<p>Another classical criticism against <em class="logo">Paradis<span class="logo_eo">eo</span></em> is that C++ is hard and that a fast language is useless because speed is not a concern when your objective function is dominating all the runtime.</p> <p>Another classical criticism against <em class="logo">Paradis<span class="logo_eo">eo</span></em> is that C++ is hard and that a fast language is useless because speed is not a concern when your objective function is dominating all the runtime.</p>
<p>However, we argue that: <p>However, we argue that:
<ul> <ul>
<li>The numerical optimization community often sees objective functions as monolithic “black-box”, but in combinatorial opimization, it is very often the case that the objective function can be only partially evaluated on neighbor solutions, which allows for (tremendous) speed gains. The Paradiseo-mo module is architectured around that idea, a feature that is not so often found in other frameworks.</li>
<li>During the design phase of your solver, you will need to estimate its performance against synthetic benchmarks that are fast to compute. In that case, fast computation means fast design iterations. And it's even more true if you plan to use automated design to find the best solver for your problem.</li> <li>During the design phase of your solver, you will need to estimate its performance against synthetic benchmarks that are fast to compute. In that case, fast computation means fast design iterations. And it's even more true if you plan to use automated design to find the best solver for your problem.</li>
<li>Modern C++ makes use of the very same high-level abstractions you would find in more accepted languages like Python. Sure, the syntax is cumbersome, but you will not see it after a while, given that you will work at the algorithm level.</li> <li>Modern C++ makes use of the very same high-level abstractions you would find in more accepted languages like Python. Sure, the syntax is cumbersome, but you will not see it after a while, given that you will work at the algorithm level.</li>
<li>C++ provides full type checking and the largest set of tooling for any modern language, which are your first line of defense against long-term bugs. Sure, it sometimes gives you the impression that you fight against the compiler, but chasing subtle interface bugs across a complex Python code is even harder.</li> <li>C++ provides full type checking and the largest set of tooling for any modern language, which are your first line of defense against long-term bugs. Sure, it sometimes gives you the impression that you fight against the compiler, but chasing subtle interface bugs across a complex Python code is even harder.</li>
@ -808,18 +811,32 @@
<ul> <ul>
<li> <li>
<p>The core EO module is described in the following scientific article: <p>The latest state of the whole <em class="logo">Paradis<span class="logo_eo">eo</span></em> framework is introduced in the following article (see also <a href="https://arxiv.org/abs/2105.00420">the preprint</a>):
<blockquote>M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer, <blockquote>Johann Dreo, Arnaud Liefooghe, Sébastien Verel, Marc Schoenauer, Juan J. Merelo, Alexandre Quemy, Benjamin Bouvier, and Jan Gmys,
<a href= "http://www.lri.fr/~marc/EO/EO-EA01.ps.gz">Evolving <a href= "https://doi.org/10.1145/3449726.3463276">Paradiseo: from a modular framework for evolutionary computation to the automated design of metaheuristics —22 years of Paradiseo—</a>, <i>GECCO'21: Proceedings of the Genetic and Evolutionary Computation Conference Companion</i>, 15221530 (2021).</blockquote>
objects: A general purpose evolutionary computation
library</a>, <i>Artificial Evolution</i>, <b>2310</b>, 829--888 (2002).</blockquote>
</p> </p>
<button class="collapsible">BiBTeX entry for citing EO</button> <button class="collapsible">BiBTeX entry for citing <em class="logo">Paradis<span class="logo_eo">eo</span></em></button>
<div class="details"> <div class="details">
<p>If you used EO in a study, please cite it. As of today, it has been <a href="https://scholar.google.com/scholar?cites=900770489172177244&as_sdt=2005&sciodt=0,5&hl=fr">cited more than 250 times.</a></p> <p>If you used <em class="logo">Paradis<span class="logo_eo">eo</span></em> in a study, please cite the publication above:</p>
<figure style="text-align:left;"> <figure style="text-align:left;">
<p> <p>
<font face="monospace">
@<font color="#f917f3">inproceedings</font>{<font color="#519f50">Dreo-al_2021_Paradiseo</font>,<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>author</b></font>&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{Dreo, Johann and Liefooghe, Arnaud and Verel, S\'{e}bastien and Schoenauer, Marc and Merelo, Juan J. and Quemy, Alexandre and Bouvier, Benjamin and Gmys, Jan},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>title</b></font>&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;{Paradiseo: From a Modular Framework for Evolutionary Computation to the Automated Design of Metaheuristics: 22 Years of Paradiseo},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>year</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{2021},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>isbn</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{9781450383516},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>publisher</b></font>&nbsp;=&nbsp;{Association for Computing Machinery},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>address</b></font>&nbsp;&nbsp; =&nbsp;{Online conference},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>url</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;{<a href="https://doi.org/10.1145/3449726.3463276},">https://doi.org/10.1145/3449726.3463276},</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>booktitle</b></font>&nbsp;=&nbsp;{Proceedings of the Genetic and Evolutionary Computation Conference Companion},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#da4939"><b>pages</b></font>&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;{15221530},<br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#6d9cbe">numpages</font>&nbsp;&nbsp;=&nbsp;{9}<br>
}<br>
</font>
<!--
<font face="monospace"> <font face="monospace">
@<font color="#0000ff">Article</font>{<font color="#ff00ff">Keijzer2001</font>,<br/> @<font color="#0000ff">Article</font>{<font color="#ff00ff">Keijzer2001</font>,<br/>
&nbsp;&nbsp;<font color="#a52a2a">title</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Evolving Objects: A General Purpose Evolutionary Computation Library &quot;,<br/> &nbsp;&nbsp;<font color="#a52a2a">title</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Evolving Objects: A General Purpose Evolutionary Computation Library &quot;,<br/>
@ -831,21 +848,25 @@
&nbsp;&nbsp;<font color="#a020f0">keywords</font>&nbsp;=&nbsp; &quot;genetic algorithms, genetic programming, evolutionary computation, metaheuristic, computational intelligence, optimization&quot;,<br/> &nbsp;&nbsp;<font color="#a020f0">keywords</font>&nbsp;=&nbsp; &quot;genetic algorithms, genetic programming, evolutionary computation, metaheuristic, computational intelligence, optimization&quot;,<br/>
&nbsp;&nbsp;<font color="#a020f0">URL</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;<a href="http://www.lri.fr/~marc/EO/EO-EA01.ps.gz">http://www.lri.fr/~marc/EO/EO-EA01.ps.gz</a>&quot;,<br/> &nbsp;&nbsp;<font color="#a020f0">URL</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;<a href="http://www.lri.fr/~marc/EO/EO-EA01.ps.gz">http://www.lri.fr/~marc/EO/EO-EA01.ps.gz</a>&quot;,<br/>
&nbsp;&nbsp;<font color="#ff00ff">size</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;12 pages&quot;,<br/> &nbsp;&nbsp;<font color="#ff00ff">size</font>&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;12 pages&quot;,<br/>
<!-- &nbsp;&nbsp;<font color="#a020f0">abstract</font>&nbsp;=&nbsp; &quot;This paper presents the evolving objects library<br/> -->
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (EOlib), an object-oriented framework for evolutionary<br/> -->
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; computation (EC)&nbsp;that aims to provide a flexible set of<br/> -->
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; classes to build EC applications. EOlib design<br/> -->
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objective is to be able to evolve any object in which<br/> -->
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fitness makes sense.&quot;,<br/> -->
}<br/> }<br/>
<br/> <br/>
</font> </font>
-->
</p> </p>
<figcaption></figcaption> <figcaption></figcaption>
</figure> </figure>
</div> </div>
</li> </li>
<li>
<p>The core EO module is described in the following scientific article:
<blockquote>M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer,
<a href= "http://www.lri.fr/~marc/EO/EO-EA01.ps.gz">Evolving
objects: A general purpose evolutionary computation
library</a>, <i>Artificial Evolution</i>, <b>2310</b>, 829--888 (2002).</blockquote>
</p>
</li>
<!-- <li> --> <!-- <li> -->
<!-- <p>The parallelization modules have been described in: --> <!-- <p>The parallelization modules have been described in: -->
<!-- <blockquote>S. Cahon, N. Melab and E-G. Talbi, <a href="http://www.springerlink.com/content/up02m74726v1526u/"><em class="logo">Paradis<span class="logo_eo">eo</span></em>: A Framework for the Reusable Design of Parallel and Distributed Metaheuristics</a>, Journal of Heuristics, vol. 10(3), pp.357-380, May 2004.</blockquote> --> <!-- <blockquote>S. Cahon, N. Melab and E-G. Talbi, <a href="http://www.springerlink.com/content/up02m74726v1526u/"><em class="logo">Paradis<span class="logo_eo">eo</span></em>: A Framework for the Reusable Design of Parallel and Distributed Metaheuristics</a>, Journal of Heuristics, vol. 10(3), pp.357-380, May 2004.</blockquote> -->
@ -906,10 +927,31 @@ ISBN: 978-0-470-27858-1</blockquote>
<ul class="publications"> <ul class="publications">
</ul> </ul>
<h3>Accelerator Physics</h3>
<ul>
<li>E. Valetov, G. Dal Maso, P-R. Kettle, A. Knecht, A. Papa, on behalf of the HIMB Project. <a href="https://doi.org/10.3390/particles7030039">Beamline Optimisation for High-Intensity Muon Beams at PSI Using the Heterogeneous Island Model</a>. <i>Particles</i> (2024), <i>7</i>, 683-691.</li>
</ul>
<h3>Bioinformatics</h3>
<ul>
<li> Emile Zakiev, Johann Dreo, Mara Santarelli, Benno Schwikowski, <a href="https://hal.science/hal-04110700">Statistical Discovery of Transcriptomic Cancer Signatures using Multimodal Local Search</a>, <i>PGMO Days</i> (2022).</li>
</ul>
<h3>Metaheuristics Design</h3>
<ul>
<li>Johann Dreo, Carola Doerr, Amine Aziz-Alaoui, Alix Zheng, <a href="https://hal.science/hal-04110704/document">Using irace, paradiseo and iohprofiler for large-scale algorithm configuration</a>, <i>8th COnfiguration and SElection of ALgorithms (COSEAL) workshop</i> (2021).</li>
<li>Amine Aziz-Alaoui, Carola Doerr, Johann Dreo, <a href="https://arxiv.org/abs/2102.06435">Towards large scale automated algorithm design by integrating modular benchmarking frameworks</a>, <i>Proceedings of the Genetic and Evolutionary Computation Conference Companion</i> (2021).</li>
<li>Johann Dréo, Carola Doerr, Yann Semet, <a href="https://hal.sorbonne-universite.fr/hal-02179604/document">Coupling the design of benchmark with algorithm in landscape-aware solver design</a>, <i>Proceedings of the Genetic and Evolutionary Computation Conference Companion</i> (2019).</li>
<li>Johann Dreo, <a href="https://dl.acm.org/doi/10.1145/1570256.1570301">Using Performance Fronts for Parameter Setting of Stochastic Metaheuristics</a>, <i>Genetic and Evolutionary Computation Conference</i>, (2009).</li>
</ul>
<h3>Automated Planning</h3> <h3>Automated Planning</h3>
<ul> <ul>
<li>Mostepha Redouane Khouadjia, Marc Schoenauer, Vincent Vidal, Johann Dreo, Pierre Savéant, <a href="https://arxiv.org/abs/1305.2265v1">Quality measures of parameter tuning for aggregated multi-objective temporal planning</a>, <i>7th International Conference on Learning and Intelligent Optimization (LION 7)</i> (2013).</li>
<li>Mostepha Redouane Khouadjia, Marc Schoenauer, Vincent Vidal, Johann Dreo, Pierre Savéant, <a href="https://arxiv.org/abs/1305.1169v1">Multi-Objective AI Planning: Comparing Aggregation and Pareto Approaches</a>, <i>Conference on Evolutionary Computation in Combinatorial Optimization (EvoCOP)</i> (2013).</li>
<li>Mostepha Redouane Khouadjia, Marc Schoenauer, Vincent Vidal, Johann Dreo, Pierre Savéant, <a href="https://arxiv.org/abs/1212.5276">Multi-Objective AI Planning: Evaluating DAE-YAHSP on a Tunable Benchmark</a>, <i>7th International Conference on Evolutionary Multi-Criterion Optimization</i> (2013).</li>
<li>Jacques Bibaï, Pierre Savéant, Marc Schoenauer, Vincent Vidal, <a href="http://www.aaai.org/ocs/index.php/ICAPS/ICAPS10/paper/view/1414">An Evolutionary Metaheuristic Based on State Decomposition for Domain-Independent Satisficing Planning</a>, <i>Twentieth International Conference on Automated Planning and Scheduling </i> (2010). <strong>Winner of the International Planning Competition</strong></li> <li>Jacques Bibaï, Pierre Savéant, Marc Schoenauer, Vincent Vidal, <a href="http://www.aaai.org/ocs/index.php/ICAPS/ICAPS10/paper/view/1414">An Evolutionary Metaheuristic Based on State Decomposition for Domain-Independent Satisficing Planning</a>, <i>Twentieth International Conference on Automated Planning and Scheduling </i> (2010). <strong>Winner of the International Planning Competition</strong></li>
<li>Jacques Bibaï, Pierre Savéant, Marc Schoenauer, Vincent Vidal, <a href="">An Evolutionary Metaheuristic for Domain-Independent Satisficing Planning</a>, <i>Genetic and Evolutionary Computation Conference</i> (2010). <strong>Silver Medal at the Human-Competitive Competition</strong></li> <li>Jacques Bibaï, Pierre Savéant, Marc Schoenauer, Vincent Vidal, <a href="">An Evolutionary Metaheuristic for Domain-Independent Satisficing Planning</a>, <i>Genetic and Evolutionary Computation Conference</i> (2010). <strong>Silver Medal at the Human-Competitive Competition</strong></li>
</ul> </ul>
@ -973,11 +1015,6 @@ undiscovered knowledge.
physics/0603108 (2006)</a>.</li> physics/0603108 (2006)</a>.</li>
</ul> </ul>
<h3>Metaheuristics Design</h3>
<ul>
<li>Johann Dreo, <a href="https://dl.acm.org/doi/10.1145/1570256.1570301">Using Performance Fronts for Parameter Setting of Stochastic Metaheuristics</a>, <i>Genetic and Evolutionary Computation Conference</i>, (2009).</li>
</ul>
</div> </div>
</div> </div>
@ -1132,16 +1169,17 @@ undiscovered knowledge.
<div id="Downloads"> <div id="Downloads">
<h2><a name="Downloads"></a>Downloads</h2> <h2><a name="Downloads"></a>Downloads</h2>
<p>The current stable release is version 2.0.1: <a href="https://gforge.inria.fr/frs/download.php/31733/Paradiseo-2.0.1.ziph">ParadisEO 2.0.1</a>. Some other releases (older or newer) can be found on <a href="https://github.com/nojhan/paradiseo/releases">GitHub/paradiseo/releases</a>.</p> <p>The current stable release is version: <a href="https://github.com/nojhan/paradiseo/releases">Paradiseo 3.1.3</a>. Some other releases (older or newer) can be found on <a href="https://github.com/nojhan/paradiseo/tags">GitHub/paradiseo/releases</a>.</p>
<p> You can obtain the latest stable and beta version directly via the official Git repository: <p> You can obtain the latest stable and beta version directly via the Git repository:
<code class="command">git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git</code>. <code class="command">git clone https://github.com/jdreo/paradiseo.git</code>.
The release are on the "master" branch. The release are on the "master" branch.
</p> </p>
<p>Or you can use (at your own risks) the development repositories of the developers: <p>Or you can use (at your own risks) the development repositories of the developers:
<ul> <ul>
<li>Johann Dreo's: <a href="https://github.com/nojhan/paradiseo">on GitHub</b>.</li> <li>Johann Dreo's: <a href="https://github.com/jdreo/paradiseo">on GitHub</a>.</li>
<li>INRIA's: <a href="https://gitlab.inria.fr/paradiseo/paradiseo">on their Gitlab</a>.</li>
</ul> </ul>
</p> </p>
</div> </div>
@ -1183,7 +1221,7 @@ undiscovered knowledge.
</p> </p>
<p>There is, however, several build options which you may want to switch. <p>There is, however, several build options which you may want to switch.
To see them, we recommend the use of a CMake gui, like <code>ccmake</code> or <code>cmake-gui</code>. To see them, we recommend the use of a CMake gui, like <code>ccmake</code> (available through the <code>cmake-curses-gui</code> package in Debian/Ubuntu) or <a href="https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#cmake-gui-tool">cmake-gui</a>.
On the command line, you can see the available options with: <code class="command">cmake -LH ..</code>. On the command line, you can see the available options with: <code class="command">cmake -LH ..</code>.
Those options can be set with the <code>-D&lt;option&gt;=&lt;value&gt;</code> argument to cmake. Those options can be set with the <code>-D&lt;option&gt;=&lt;value&gt;</code> argument to cmake.
</p> </p>
@ -1214,7 +1252,7 @@ undiscovered knowledge.
<h2><a name="Contribute"></a>Contribute</h2> <h2><a name="Contribute"></a>Contribute</h2>
<p><em class="logo">Paradis<span class="logo_eo">eo</span></em> development is open and contributions are welcomed.</p> <p><em class="logo">Paradis<span class="logo_eo">eo</span></em> development is open and contributions are welcomed.</p>
<p>The official bug tracker is available on the <a href="https://gforge.inria.fr/projects/paradiseo/">project page</a>. But you may be more confortable using the <a href="https://github.com/nojhan/paradiseo/issues">issue tracker of Johann Dreo's project page on GitHub</a>.</p> <p>The official bug tracker is available on the <a href="https://github.com/nojhan/paradiseo/issues">project page</a>.</p>
<p>If you have any question about contributing: subscribe to our <a href='http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/paradiseo-users'>(low traffic) mailing-list</a>.</p> <p>If you have any question about contributing: subscribe to our <a href='http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/paradiseo-users'>(low traffic) mailing-list</a>.</p>
</div> </div>
@ -1231,7 +1269,8 @@ undiscovered knowledge.
<ul> <ul>
<li><a href="https://www.inria.fr">INRIA</a> (current maintainer)</li> <li><a href="https://www.inria.fr">INRIA</a> (current maintainer)</li>
<li><a href="https://www.univ-littoral.fr/">University of the Littoral Opal Coast</a> (current maintainer)</li> <li><a href="https://www.univ-littoral.fr/">University of the Littoral Opal Coast</a> (current maintainer)</li>
<li><a href="https://thalesgroup.com">Thales</a> (current maintainer)</li> <li><a href="https://www.pasteur.fr/">Institut Pasteur</a> (current maintainer)</li>
<li><a href="https://thalesgroup.com">Thales group</a></li>
<li><a href="https://www.polytechnique.edu/">École Polytechnique</a></li> <li><a href="https://www.polytechnique.edu/">École Polytechnique</a></li>
<li><a href="https://www.ugr.es">University of Granada</a></li> <li><a href="https://www.ugr.es">University of Granada</a></li>
<li><a href="https://www.vu.nl">Vrije Universiteit Amsterdam</a></li> <li><a href="https://www.vu.nl">Vrije Universiteit Amsterdam</a></li>

226
doxygen/DoxygenLayout.xml Normal file
View file

@ -0,0 +1,226 @@
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.17 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="interfaces" visible="yes" title="">
<tab type="interfacelist" visible="yes" title="" intro=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="structs" visible="yes" title="">
<tab type="structlist" visible="yes" title="" intro=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
</tab>
<tab type="exceptions" visible="yes" title="">
<tab type="exceptionlist" visible="yes" title="" intro=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<detaileddescription title=""/>
<memberdecl>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<detaileddescription title=""/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<detaileddescription title=""/>
<memberdecl>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<detaileddescription title=""/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<functions title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<detaileddescription title=""/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
</directory>
</doxygenlayout>

View file

@ -25,13 +25,21 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
PROJECT_NAME = @PACKAGE_NAME@ PROJECT_NAME = @MODULE_NAME@
# With the PROJECT_LOGO tag one can specify a logo or an icon
# that is included in the documentation.
# The maximum height of the logo should not exceed 55 pixels
# and the maximum width should not exceed 200 pixels.
# Doxygen will copy the logo to the output directory.
PROJECT_LOGO = @CMAKE_SOURCE_DIR@/docs/img/paradiseo_logo.svg
# The PROJECT_NUMBER tag can be used to enter a project or revision number. # The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = @PACKAGE_VERSION@ PROJECT_NUMBER = @PROJECT_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
@ -272,22 +280,6 @@ SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -500,7 +492,7 @@ FILE_VERSION_FILTER =
# file name after the option, if omitted DoxygenLayout.xml will be used as the name # file name after the option, if omitted DoxygenLayout.xml will be used as the name
# of the layout file. # of the layout file.
LAYOUT_FILE = LAYOUT_FILE = @CMAKE_SOURCE_DIR@/doxygen/DoxygenLayout.xml
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
@ -594,7 +586,7 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag. # subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = @CMAKE_SOURCE_DIR@/src/obsolete @CMAKE_SOURCE_DIR@/test @CMAKE_SOURCE_DIR@/tutorial @CMAKE_SOURCE_DIR@/contrib @CMAKE_SOURCE_DIR@/app EXCLUDE = @CMAKE_SOURCE_DIR@/deprecated @CMAKE_SOURCE_DIR@/eo/contrib @CMAKE_SOURCE_DIR@/eo/app @CMAKE_SOURCE_DIR@/eo/tutorial @CMAKE_SOURCE_DIR@/mo/tutorial @CMAKE_SOURCE_DIR@/moeo/tutorial @CMAKE_SOURCE_DIR@/smp/tutorial
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded # directories that are symbolic links (a Unix filesystem feature) are excluded
@ -608,7 +600,7 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories # against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/* # for example use the pattern */test/*
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS = *.sif/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the # (namespaces, classes, functions, etc.) that should be excluded from the
@ -622,7 +614,7 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see
# the \include command). # the \include command).
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/test EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/eo/test @CMAKE_SOURCE_DIR@/edo/test @CMAKE_SOURCE_DIR@/mo/test @CMAKE_SOURCE_DIR@/moeo/test @CMAKE_SOURCE_DIR@/smp/test
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@ -784,14 +776,14 @@ HTML_HEADER =
HTML_FOOTER = HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading # The HTML_EXTRA_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to # style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen # fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy # will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own # the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased! # stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen/doxygen-style.css
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
@ -800,7 +792,7 @@ HTML_STYLESHEET =
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = NO HTML_DYNAMIC_SECTIONS = YES
# If the GENERATE_DOCSET tag is set to YES, additional index files # If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3 # will be generated that can be used as input for Apple's Xcode 3
@ -970,7 +962,7 @@ SEARCHENGINE = YES
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output. # generate Latex output.
GENERATE_LATEX = YES GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be # If a relative path is entered the value of OUTPUT_DIRECTORY will be
@ -1129,18 +1121,6 @@ GENERATE_XML = NO
XML_OUTPUT = xml XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting # dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that # and cross-referencing information) to the XML output. Note that
@ -1301,11 +1281,6 @@ ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -1319,15 +1294,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide # If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented # inheritance and usage relations if the target is undocumented
# or is not a class. # or is not a class.
@ -1350,7 +1316,7 @@ HAVE_DOT = YES
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font. # containing the font.
DOT_FONTNAME = FreeSans DOT_FONTNAME =
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt. # The default size is 10pt.
@ -1392,7 +1358,7 @@ UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the # If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances. # relations between templates and their instances.
TEMPLATE_RELATIONS = NO TEMPLATE_RELATIONS = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented # tags are set to YES then doxygen will generate a graph for each documented
@ -1440,7 +1406,18 @@ DIRECTORY_GRAPH = YES
# generated by dot. Possible values are png, jpg, or gif # generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used. # If left blank png will be used.
DOT_IMAGE_FORMAT = png DOT_IMAGE_FORMAT = svg
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES
# to enable generation of interactive SVG images that allow zooming and panning.
# Note that this requires a modern browser other than Internet Explorer.
# Tested and working are Firefox, Chrome, Safari, and Opera.
# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml
# in order to make the SVG files visible.
# Older versions of IE do not have SVG support.
# This tag requires that the tag HAVE_DOT is set to YES.
INTERACTIVE_SVG = YES
# The tag DOT_PATH can be used to specify the path where the dot tool can be # The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path. # found. If left blank, it is assumed the dot tool can be found in the path.
@ -1486,7 +1463,7 @@ DOT_TRANSPARENT = NO
# makes dot run faster, but since only newer versions of dot (>1.8.10) # makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default. # support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and # generate a legend page explaining the meaning of the various boxes and

791
doxygen/doxygen-style.css Normal file
View file

@ -0,0 +1,791 @@
/* This doxygen theme is free to use. If you like this, please Star https://github.com/kcwongjoe/doxygen_theme_flat_design */
/* Color Pattern. You can change this pattern to design your theme. */
:root {
/* Content */
--bgcolor: #ffffff;
--bgfont: #303030;
--bgfont2: #3771c8;
--bgfont-hover: #3771c8;
--bgfont-hover-text-decoration: underline solid #3771c8;
--bgborder: #7d7d7d;
--bgborder2: #f6f6f6;
--bgfont-link:#1751a8;
/* Main Header */
--bg1color: #303030;
--bg1font: #ffffff;
--bg1font2: #3771c8;
/* Second header */
--bg2color: #E2E2E2;
--bg2font: #7D7D7D;
--bg2-hover-bg: #ffffff;
--bg2-hover-font: #303030;
--bg2-hover-topborder: #3771c8;
/* Third header */
--bg3color: #f6f6f6;
--bg3font: #303030;
--bg3font2: #7D7D7D;
/* Code */
--code-bg: #232323;
--code-comment: #a5c261;
--code-keyword: #db4939;
--code-preprocessor: #efcd45;
--code-keywordtype: #87bbff;
--code-text: #b1cfb1;
--code-code: #d3d0cc;
--code-line: #73707c;
--code-line-bg: #232323;
--code-link: #b7dbff;
/* Namespace List, Class List icon */
--icon-bg: #303030
--icon-font: #3771c8;
/* Class Index */
--qindex-menu-bg: #303030;
--qindex-menu-font: #ffffff;
--qindex-menu-font-hover: #3771c8;
--qindex-icon-bg: #3771c8;
--qindex-icon-font: #303030;
/* Member table */
--mem-title-bg: #3771c8;
--mem-title-font: #ffffff;
--mem-subtitle-bg: #77b1f8;
--mem-subtitle-font: #303030;
--mem-subtitle-font-hover: #303030;
--mem-content-bg: #ffffff;
--mem-content-font: #303030;
--mem-content-border: grey;
--mem-content-highlighted:#3771c8;
/* Nav Tree */
--nav-tree-bg: #E2E2E2;
--nav-tree-bg-hover: #ffffff;
--nav-tree-font: #7D7D7D;
--nav-tree-font-hover: #303030;
--nav-tree-bg-selected: #3771c8;
--nav-tree-font-selected: white;
}
body, table, div, p, dl {
color: var(--bgfont);
background-color: var(--bgcolor);
line-height: 150%;
font: 14px/22px, Roboto, Arial;
}
div.contents {
margin: 20px 40px;
}
div.contents ul {
line-height: 200%;
}
/***********************************/
/********** Project header *********/
/***********************************/
#titlearea {
border-bottom: none;
padding-bottom: 20px;
padding-top: 20px;
}
#titlearea, #titlearea * {
color: var(--bg1font);
background-color: var(--bg1color);
}
#projectname {
padding: 0px 40px !important;
}
#projectbrief {
padding: 0px 40px !important;
}
#projectalign {
padding: 0px !important;
vertical-align: bottom;
}
/***********************************/
/************ Main Menu ************/
/***********************************/
/* Margin */
#main-menu {
padding: 0px 30px;
}
#main-menu a, #main-menu a:hover {
padding-top: 10px;
padding-bottom: 10px;
}
/* Menu button */
#main-menu li a {
background-image: none;
font-family: Arial;
text-shadow: none;
font-size: 14px;
font-weight: 700;
}
#main-menu, #main-menu>li>a {
background-image: none;
background-color: var(--bg2color);
color: var(--bg2font);
transition: 0.2s;
}
/* hover Effect */
#main-menu>li {
border-top: 5px solid var(--bg2color);
}
#main-menu>li:hover {
color: var(--bg2-hover-font);
background-color: var(--bg2-hover-bg);
border-top: 5px solid var(--bg2-hover-topborder);
font-width: bold;
}
#main-menu>li:hover, #main-menu>li>a:hover, #main-menu>li>a.highlighted {
color: var(--bg2-hover-font);
background-color: var(--bg2-hover-bg);
font-width: bold;
}
/* Search Bar */
#MSearchBox {
border-radius: 0;
box-shadow: none;
}
#MSearchBox>span {
margin: 10px;
}
#main-menu>li:last-child {
padding: 25px 0px;
}
/* Reset search hover color*/
#main-menu>li:last-child:hover {
color: var(--bg2font);
background-color: var(--bg2color);
border-top: 5px solid var(--bg2color);
}
#MSearchResultsWindow {
border: 1px solid var(--bg3font2);
background-color: var(--bg3color);
padding: 10px;
}
body.SRPage, body.SRPage * {
font-family: Arial;
}
/* Sub Menu */
#main-menu>li ul {
transition: max-height 0.2s ease-in-out;
padding: 0px;
border-radius: 0px !important;
}
#main-menu>li ul:before, #main-menu>li ul:after {
border-width: 0px;
}
#main-menu>li>ul li a, #main-menu>li>ul li {
background-color: var(--bgcolor);
color: var(--bgfont);
background-image: none;
}
#main-menu>li>ul li a:hover, #main-menu>li>ul li:hover {
background-color: var(--bgfont2);
/*color: var(--bgfont);*/
color: white;
font-width: bold;
}
/***********************************/
/************** Header *************/
/***********************************/
div.headertitle {
padding: 5px 40px;
}
div.header, div.header * {
color: var(--bg3font);
background-color: var(--bg3color);
border-bottom: none;
}
div.summary {
padding-right: 40px;
}
/***********************************/
/************** Link *************/
/***********************************/
a, a:visited, a:active, .contents a:visited, body.SRPage a, body.SRPage a:visited, body.SRPage a:active {
color: var(--bgfont-link);
text-decoration: none;
}
a:hover, .contents a:hover, body.SRPage a:hover {
color: var(--bgfont-hover);
text-decoration: var(--bgfont-hover-text-decoration);
}
.dynheader {
color: var(--bgfont-link);
text-decoration: none;
}
.dynheader:hover {
color: var(--bgfont-hover);
text-decoration: var(--bgfont-hover-text-decoration);
}
/***********************************/
/************ Nav-path ************/
/***********************************/
#nav-path, #nav-path ul {
background-image: none;
}
#nav-path ul {
padding: 5px 30px;
}
#nav-path, #nav-path * {
color: var(--bg3font2);
background-color: var(--bg3color);
border: none;
font-family: Arial;
}
li.navelem {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuY29tL3N2Z2pzIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDI5Mi4zNTkgMjkyLjM1OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgY2xhc3M9IiI+PGc+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+Cgk8cGF0aCBkPSJNMjIyLjk3OSwxMzMuMzMxTDk1LjA3Myw1LjQyNEM5MS40NTYsMS44MDcsODcuMTc4LDAsODIuMjI2LDBjLTQuOTUyLDAtOS4yMzMsMS44MDctMTIuODUsNS40MjQgICBjLTMuNjE3LDMuNjE3LTUuNDI0LDcuODk4LTUuNDI0LDEyLjg0N3YyNTUuODEzYzAsNC45NDgsMS44MDcsOS4yMzIsNS40MjQsMTIuODQ3YzMuNjIxLDMuNjE3LDcuOTAyLDUuNDI4LDEyLjg1LDUuNDI4ICAgYzQuOTQ5LDAsOS4yMy0xLjgxMSwxMi44NDctNS40MjhsMTI3LjkwNi0xMjcuOTA3YzMuNjE0LTMuNjEzLDUuNDI4LTcuODk3LDUuNDI4LTEyLjg0NyAgIEMyMjguNDA3LDE0MS4yMjksMjI2LjU5NCwxMzYuOTQ4LDIyMi45NzksMTMzLjMzMXoiIGZpbGw9IiM3ZDdkN2QiIGRhdGEtb3JpZ2luYWw9IiMwMDAwMDAiIHN0eWxlPSIiIGNsYXNzPSIiPjwvcGF0aD4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8L2c+PC9zdmc+);
background-size: 9px;
}
li.navelem a {
margin-right: 20px;
}
/***********************************/
/*************** mem ***************/
/***********************************/
.memtitle {
padding: 15px;
margin-top: 30px;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
.memtitle, .memtitle *, .memtitle a:visited {
border: none;
background-image: none;
color: var(--mem-title-font);
background-color: var(--mem-title-bg);
}
.memproto {
padding: 2em;
text-shadow: none;
border-top-right-radius: 0px;
-moz-border-radius-topright: 0px;
-webkit-border-top-right-radius: 0px;
}
.memproto, .memproto *, .memproto a:visited {
border: none;
background-image: none;
background-color: var(--mem-subtitle-bg);
color: var(--mem-subtitle-font);
font-size: inherit;
line-height: 100%
}
.memproto a:hover {
color: var(--mem-subtitle-font-hover);
}
.memdoc {
border-bottom: 1px solid var(--mem-content-border);
border-left: 1px solid var(--mem-content-border);
border-right: 1px solid var(--mem-content-border);
background-color: var(--mem-content-bg);
color: var(--mem-content-font);
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
-moz-border-radius-bottomleft: 0px;
-moz-border-radius-bottomright: 0px;
-webkit-border-bottom-left-radius: 0px;
-webkit-border-bottom-right-radius: 0px;
padding:1em;
}
.memdoc p, .memdoc dt {
/*padding: 0px 20px;*/
}
.memdoc > p {
font-size:1em;
}
.paramname {
color:black;
}
td.memItemRight > a:first-of-type {
font-size:1.3em;
}
/***********************************/
/************* Contents ************/
/***********************************/
a.anchor {
padding-top: 20px;
}
dl {
border-left: 5px solid;
padding:1em;
}
dt {
font-variant-caps: small-caps;
}
dl.warning {
border-top: thin solid red;
border-right: thin solid red;
border-bottom: thin solid red;
border-left-color: red;
background-color: #fee;
}
dl.warning > dt {
color: #500;
}
dl.note {
border-top:thin solid green;
border-right:thin solid green;
border-bottom:thin solid green;
border-left-color:green;
background-color: #efe;
}
dl.note > dt {
color: #050;
}
div.textblock {
padding:2em;
border: 2px solid var(--bgfont2);
box-shadow:0.5em 0.5em 0.5em var(--bgfont);
background-color: #fafaff;
}
div.textblock > p {
font-size:1.2em;
}
div.textblock > p.definition {
font-size:0.8em;
}
p.definition {
font-size: 0.8em;
}
p.reference {
font-size: 0.8em;
}
p {
background-color: transparent;
}
table {
margin-top:4em;
}
table.memname {
margin-top:0.1em;
}
table.mlabels {
margin-top:0.1em;
}
/***********************************/
/************* fragment ************/
/***********************************/
h2.groupheader {
color: #303030;
font-size: 200%;
font-weight: bold;
border-bottom: thin solid var(--bgfont2);
padding-bottom:1px;
margin-top:3em;
}
h3 {
background-color:var(--bgfont2);
color: var(--bgcolor);
font-size: 1.5em;
margin:0px;
padding:1em;
margin-bottom:2em;
border: 2px solid var(--bgfont2);
box-shadow:0.5em 0.5em 0.5em var(--bgfont);
font-family:monospace;
}
div.fragment, pre.fragment {
border: none;
padding: 1em;
margin-left: 1em;
margin-right: 1em;
background-color: var(--code-bg);
border-left: 2px solid black;
border-top: 2px solid black;
border-right: 2px solid grey;
border-bottom: 2px solid grey;
}
div.fragment > div.line {
font-size:1em;
line-height:150%;
color: var(--code-code);
}
.textblock > div.fragment {
font-size: 1em;
}
.textblock > dl.section {
font-size: 1.2em;
}
div.line {
background-color: var(--code-bg);
}
span.comment {
color: var(--code-comment);
}
span.keyword {
color: var(--code-keyword);
}
span.preprocessor {
color: var(--code-preprocessor);
}
span.keywordtype {
color: var(--code-keywordtype);
}
span.stringliteral {
color: var(--code-text);
}
span.mlabel {
background-color: var(--code-text);
color: var(--code-bg);
border-top: none;
border-left: none;
border-right: none;
border-bottom: none;
padding: 10px;
border-radius: 0px;
}
div.fragment > div.line > a.code {
color: var(--code-link);
}
span.lineno, span.lineno>* {
color: var(--code-line);
border-right: none;
background-color: var(--code-bg);
}
span.lineno a {
background-color: var(--code-line-bg);
}
span.lineno a:hover {
color: var(--bg3font);
background-color: var(--code-line-bg);
}
code {
color:black;
}
/***********************************/
/************* directory ***********/
/***********************************/
.directory tr.even {
background-color: inherit;
}
.iconfclosed {
background-image: url(closed-folder.png);
margin-right: 10px;
}
.iconfopen {
background-image: url(opened-folder.png);
margin-right: 10px;
}
.icondoc {
background-image: url(document.png);
margin-right: 10px;
}
.arrow {
color: #7d7d7d;
}
.icona {
vertical-align: middle;
margin-right: 5px;
}
.icon {
background-color: var(--icon-bg);
color: var(--icon-font);
display: table-cell;
vertical-align: middle;
height: 20px;
width: 20px;
}
div.ah {
background-color: var(--qindex-icon-bg);
color: var(--qindex-icon-font);
text-align: center;
background-image: none;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 0px;
border-radius: 0px;
border: none;
}
div.qindex {
background-color: var(--qindex-menu-bg);
border: none;
padding: 20px;
}
a.qindex {
color: var(--qindex-menu-font);
font-weight: normal;
font-size: 20px;
}
a:hover.qindex {
color: var(--qindex-menu-font-hover);
}
a:visited.qindex {
color: var(--qindex-menu-font);
}
table.classindex {
margin-top: 30px;
margin-bottom: 30px;
}
table.classindex a.el {
font-weight: normal;
}
table.params {
margin-top:1em;
}
#titlearea > table {
margin-top:0px;
}
table.directory > tbody > tr {
border-top: thin solid var(--nav-tree-bg);
border-bottom: thin solid var(--nav-tree-bg);
}
/***********************************/
/************** footer *************/
/***********************************/
div.directory {
border-top: 1px solid var(--bgborder);
border-bottom: none;
margin: 20px 0px;
}
div.directory a.el {
font-weight: normal;
}
div.directory>table {
margin: 20px 0px;
}
hr.footer {
border: none;
}
.contents>hr {
border-top: 0px;
}
/***********************************/
/*********** memberdecls ***********/
/***********************************/
.memItemLeft, .memItemRight {
padding: 15px 30px;
background-color: inherit;
}
.mdescRight {
padding: 0px 30px 10px 30px;
}
.memberdecls * {
background-color: inherit;
}
.memSeparator {
border-bottom: 1px solid var(--bgborder2);
}
.memTemplParams {
color: var(--bgfont);
}
/***********************************/
/*********** nav-tree ***********/
/***********************************/
#nav-tree-contents {
background-color: var(--nav-tree-bg);
margin: 0px;
}
#side-nav, #nav-tree {
background-image: none;
background-color: var(--nav-tree-bg);
}
#nav-tree .item {
background-color: var(--nav-tree-bg);
font-family: Arial;
text-shadow: none;
font-size: 14px;
font-weight: 700;
padding: 10px;
color: var(--nav-tree-font);
}
#nav-tree .arrow {
color: var(--nav-tree-font);
}
#nav-tree .selected {
background-image: none;
background-color: var(--nav-tree-bg-selected);
}
#nav-tree .selected a {
color: var(--nav-tree-font-selected);
}
#nav-tree .item:hover {
background-color: var(--nav-tree-bg-hover);
color: var(--nav-tree-font-hover);
}
#nav-tree .item a:hover {
color: var(--nav-tree-font-hover);
}
#side-nav .ui-resizable-e {
background-image: none;
background-color: var(--nav-tree-bg);
}
#nav-sync {
background-color: transparent;
}
#nav-sync>img {
content: url(off_sync.png);
}
#nav-sync.sync>img {
content: url(on_sync.png);
}
/***********************************/
/*********** Plant UML ***********/
/***********************************/
.plantumlgraph > img {
width: 80%;
}

View file

@ -22,7 +22,8 @@ if(DOXYGEN_FOUND)
) )
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
endif(DOXYGEN_EXECUTABLE) endif(DOXYGEN_EXECUTABLE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake" # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake"
configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
"${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}") "${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}")
install( install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

View file

@ -25,13 +25,13 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project. # by quotes) that should identify the project.
PROJECT_NAME = @PACKAGE_NAME@ PROJECT_NAME = @EDO_MODULE_NAME@
# The PROJECT_NUMBER tag can be used to enter a project or revision number. # The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = @PACKAGE_VERSION@ PROJECT_NUMBER = @PROJECT_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
@ -1030,7 +1030,7 @@ SERVER_BASED_SEARCH = NO
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output. # generate Latex output.
GENERATE_LATEX = YES GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be # If a relative path is entered the value of OUTPUT_DIRECTORY will be

View file

@ -45,7 +45,7 @@ class edoEstimatorAdaptive : public edoEstimator<D>
public: public:
typedef typename D::EOType EOType; typedef typename D::EOType EOType;
edoEstimatorAdaptive<D>( D& distrib ) : _distrib(distrib) {} edoEstimatorAdaptive( D& distrib ) : _distrib(distrib) {}
// virtual D operator() ( eoPop< EOT >& )=0 (provided by eoUF< A1, R >) // virtual D operator() ( eoPop< EOT >& )=0 (provided by eoUF< A1, R >)

View file

@ -41,12 +41,12 @@ class edoEstimatorAdaptiveReset : public edoEstimatorAdaptive<D>
public: public:
typedef typename D::EOType EOType; typedef typename D::EOType EOType;
edoEstimatorAdaptiveReset<D>( D& distrib ) : edoEstimatorAdaptiveReset( D& distrib ) :
edoEstimatorAdaptive<D>(distrib), edoEstimatorAdaptive<D>(distrib),
_dim(0) _dim(0)
{ } { }
edoEstimatorAdaptiveReset<D>( D& distrib, size_t dim ) : edoEstimatorAdaptiveReset( D& distrib, size_t dim ) :
edoEstimatorAdaptive<D>(distrib), edoEstimatorAdaptive<D>(distrib),
_dim(dim) _dim(dim)
{ } { }

View file

@ -43,12 +43,12 @@ class edoEstimatorCombinedAdaptive : public edoEstimatorAdaptive<D>, public std:
public: public:
typedef typename D::EOType EOType; typedef typename D::EOType EOType;
edoEstimatorCombinedAdaptive<D>( D& distrib, edoEstimator<D>& estim) : edoEstimatorCombinedAdaptive( D& distrib, edoEstimator<D>& estim) :
edoEstimatorAdaptive<D>(distrib), edoEstimatorAdaptive<D>(distrib),
std::vector<edoEstimator<D>*>(1,&estim) std::vector<edoEstimator<D>*>(1,&estim)
{} {}
edoEstimatorCombinedAdaptive<D>( D& distrib, std::vector<edoEstimator<D>*> estims) : edoEstimatorCombinedAdaptive( D& distrib, std::vector<edoEstimator<D>*> estims) :
edoEstimatorAdaptive<D>(distrib), edoEstimatorAdaptive<D>(distrib),
std::vector<edoEstimator<D>*>(estims) std::vector<edoEstimator<D>*>(estims)
{} {}
@ -78,11 +78,11 @@ class edoEstimatorCombinedStateless : public edoEstimatorCombinedAdaptive<D>
public: public:
typedef typename D::EOType EOType; typedef typename D::EOType EOType;
edoEstimatorCombinedStateless<D>( edoEstimator<D>& estim ) : edoEstimatorCombinedStateless( edoEstimator<D>& estim ) :
edoEstimatorCombinedAdaptive<D>(*(new D), estim) edoEstimatorCombinedAdaptive<D>(*(new D), estim)
{} {}
edoEstimatorCombinedStateless<D>( std::vector<edoEstimator<D>*> estims) : edoEstimatorCombinedStateless( std::vector<edoEstimator<D>*> estims) :
edoEstimatorCombinedAdaptive<D>(*(new D), estims) edoEstimatorCombinedAdaptive<D>(*(new D), estims)
{} {}

View file

@ -233,7 +233,7 @@ public:
Matrix mD = eigensolver.eigenvalues().asDiagonal(); Matrix mD = eigensolver.eigenvalues().asDiagonal();
// from variance to standard deviations // from variance to standard deviations
mD.cwiseSqrt(); mD=mD.cwiseSqrt();
d.scaling( mD.diagonal() ); d.scaling( mD.diagonal() );
d.coord_sys( eigensolver.eigenvectors() ); d.coord_sys( eigensolver.eigenvectors() );

View file

@ -39,7 +39,7 @@ template < typename EOT >
class edoRepairerModulo: public edoRepairerApplyBinary<EOT> class edoRepairerModulo: public edoRepairerApplyBinary<EOT>
{ {
public: public:
edoRepairerModulo<EOT>( double denominator ) : edoRepairerApplyBinary<EOT>( std::fmod, denominator ) {} edoRepairerModulo( double denominator ) : edoRepairerApplyBinary<EOT>( std::fmod, denominator ) {}
}; };

View file

@ -76,8 +76,7 @@ edoFileSnapshot::edoFileSnapshot(std::string dirname,
s = " "; s = " ";
} }
int dummy; (void)/*ignore returned*/ system(s.c_str());
dummy = system(s.c_str());
// all done // all done
_descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() ); _descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() );

View file

@ -108,7 +108,12 @@ public:
if (is) { if (is) {
virus.resize(bits.size()); virus.resize(bits.size());
std::transform(bits.begin(), bits.end(), virus.begin(), std::transform(bits.begin(), bits.end(), virus.begin(),
#if __cplusplus >= 201103L
std::bind(std::equal_to<char>(), std::placeholders::_1, '1'));
#else
// Deprecated since C++11.
std::bind2nd(std::equal_to<char>(), '1')); std::bind2nd(std::equal_to<char>(), '1'));
#endif
} }
} }

View file

@ -70,6 +70,9 @@ endif()
###################################################################################### ######################################################################################
add_executable(fastga fastga.cpp) add_executable(fastga fastga.cpp)
# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) # Link to stdc++fs at the end because of an Ubuntu bug, see: https://stackoverflow.com/a/57760267
target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt) target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt stdc++fs)
add_executable(onlymutga onlymutga.cpp)
target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} fmt)

View file

@ -0,0 +1,119 @@
#!/usr/bin/python
###############################################################################
# This script is the command that is executed every run.
# Check the examples in examples/
#
# This script is run in the execution directory (execDir, --exec-dir).
#
# PARAMETERS:
# argv[1] is the candidate configuration ID
# argv[2] is the instance ID
# argv[3] is the seed
# argv[4] is the instance name
# The rest (argv[5:]) are parameters to the run
#
# RETURN VALUE:
# This script should print one numerical value: the cost that must be minimized.
# Exit with 0 if no error, with 1 in case of error
###############################################################################
import datetime
import os.path
import re
import subprocess
import sys
exe = "../../../../release/onlymutga"
problem = 19
pop_size = 1
offspring_size = 100
fixed_parameters = ["--problem", str(problem), "--crossover-rate", "0", "--mutation-rate", "1", "--pop-size", str(pop_size), " --offspring-size", str(offspring_size)]
if __name__=='__main__':
if len(sys.argv) < 5:
print("\nUsage: ./target-runner.py <configuration_id> <instance_id> <seed> <instance_path_name> <list of parameters>\n")
sys.exit(1)
# Get the parameters as command line arguments.
configuration_id = sys.argv[1]
instance_id = sys.argv[2]
seed = sys.argv[3]
instance = sys.argv[4]
slices_prop = sys.argv[5:]
#print(sys.argv)
exe = os.path.expanduser(exe)
cmd = [exe] + fixed_parameters + ["--instance", instance, "--seed", seed]
residual_prob = 1
cl_probs = []
residual_size = 1
cl_sizes = []
values = ""
sizes = ""
for i in range(len(slices_prop)):
cl_probs.append(residual_prob * float(slices_prop[i]))
cl_sizes.append(residual_size * (1-float(slices_prop[i])))
residual_prob -= cl_probs[-1]
residual_size -= cl_sizes[-1]
values += "%.2f,"%cl_probs[-1]
sizes += "%.2f,"%cl_sizes[-1]
cl_probs.append(residual_prob)
values += "%.2f"%cl_probs[-1]
sizes += "%.2f"%cl_sizes[-1]
cmd += ["--cl-probs", values, "--cl-sizes", sizes]
# Define the stdout and stderr files.
out_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stdout"
err_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stderr"
def target_runner_error(msg):
now = datetime.datetime.now()
print(str(now) + " error: " + msg)
sys.exit(1)
def check_executable(fpath):
fpath = os.path.expanduser(fpath)
if not os.path.isfile(fpath):
target_runner_error(str(fpath) + " not found")
if not os.access(fpath, os.X_OK):
target_runner_error(str(fpath) + " is not executable")
# This is an example of reading a number from the output.
def parse_output(out):
match = re.search(r'Best ([-+0-9.eE]+)', out.strip())
if match:
return match.group(1);
else:
return "No match"
check_executable (exe)
outf = open(out_file, "w")
errf = open(err_file, "w")
return_code = subprocess.call(cmd, stdout = outf, stderr = errf)
outf.close()
errf.close()
if return_code != 0:
target_runner_error("command returned code " + str(return_code))
if not os.path.isfile(out_file):
target_runner_error("output file " + out_file + " not found.")
cost = parse_output (open(out_file).read())
#print(cost)
print(open(out_file).read().strip())
os.remove(out_file)
os.remove(err_file)
sys.exit(0)

View file

@ -0,0 +1,267 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "04867792",
"metadata": {},
"source": [
"# Imports"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "435212a6",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import seaborn as sb\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.ticker import MaxNLocator\n",
"import matplotlib.animation\n",
"from math import sqrt, log, cos, sin, pi\n",
"import numpy as np\n",
"import os\n",
"import shutil\n",
"import re\n",
"from subprocess import call\n",
"sb.set_style(\"whitegrid\")\n",
"#sb.set_palette(\"cubehelix\")\n",
"sb.set_palette(\"husl\")\n",
"sb.set(font_scale=1) # crazy big\n",
"sb.set_style('whitegrid', {'legend.frameon':True})\n",
"myfontsize = 12\n",
"titlesize = 15\n",
"%matplotlib notebook"
]
},
{
"cell_type": "markdown",
"id": "d76bdf6b",
"metadata": {},
"source": [
"# Function to generate the scenario file for irace"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "d86a9ca8",
"metadata": {},
"outputs": [],
"source": [
"def scenario(filename=\"scenario.txt\", \n",
" parameterFile=\"parameters.txt\", \n",
" execDir=\".\", \n",
" logFile=\"./irace.Rdata\", \n",
" targetRunner = \"target-runner.py\", \n",
" maxExperiments = 100000,\n",
" digits = 2):\n",
" f = open(filename, \"w\")\n",
" f.write(\"parameterFile=\" + parameterFile +\"\\n\")\n",
" f.write(\"execDir=\" + execDir + \"\\n\")\n",
" f.write(\"logFile=\" + logFile + \"\\n\")\n",
" f.write(\"targetRunner=\" + targetRunner + \"\\n\")\n",
" f.write(\"maxExperiments=\" + maxExperiments + \"\\n\")\n",
" f.write(\"digits=\" + digits + \"\\n\")\n",
" f.close()"
]
},
{
"cell_type": "markdown",
"id": "1213321a",
"metadata": {},
"source": [
"# Function to generate the parameter file for irace"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "70d221c9",
"metadata": {},
"outputs": [],
"source": [
"# Generate the param file for irace with all configuarable parameters\n",
"def parameters(filename=\"parameters.txt\"):\n",
" f = open(\"parameters.txt\", \"w\")\n",
" f.write(\"# name\\tswitch\\ttype\\tvalues\\n\") # head of the param file\n",
" cl_nb_part = 10 # number of category for the custom categorial probabilistic law\n",
" for i in range(cl_nb_part-1): # minus 1 slice than the number of categories\n",
" f.write(\"slice_prob_%s\\t\\\"\\\"\\tr\\t(0,1)\\n\"%i) # percentage of the residual probability for the slice\n",
"\n",
" ######################################### NOT USED YET ##########################################\n",
" #for i in range(cl_nb_part-1): # minus 1 slice than the number of categories\n",
" # f.write(\"slice_size_%s\\t\\\"\\\"\\tr\\t(0,1)\\n\"%i) # percentage of the residual size for the slice\n",
" #################################################################################################\n",
" f.close()"
]
},
{
"cell_type": "markdown",
"id": "65fcb69d",
"metadata": {},
"source": [
"# Fonction to generate problem dedicated target-runner.py"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "a18ba251",
"metadata": {},
"outputs": [],
"source": [
"def target_runner(origin=\"irace-config/target-runner.py\", path=\"target-runner.py\", problem=1):\n",
" \n",
" generalTR = open(origin, \"r\")\n",
" dedicatedTR = open(path, \"w\")\n",
" for line in generalTR:\n",
" if re.search(\"problem = \", line, flags=0):\n",
" dedicatedTR.write(\"problem = \" + str(problem) + \"\\n\")\n",
" else:\n",
" dedicatedTR.write(line)\n",
" generalTR.close()\n",
" dedicatedTR.close()"
]
},
{
"cell_type": "markdown",
"id": "59421dee",
"metadata": {},
"source": [
"# Run script"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "38dfec96",
"metadata": {},
"outputs": [],
"source": [
"results_directory = \"results\"\n",
"irace_path = \"/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/irace/bin/irace\"\n",
"instances_file = \"instances.txt\"\n",
"scenario_file = \"scenario.txt\"\n",
"parameters_file = \"parameters.txt\"\n",
"target_runner_file = \"target-runner.py\"\n",
"\n",
"# create or clear the results directory\n",
"if not os.path.isdir(results_directory):\n",
" os.mkdir(results_directory)\n",
" \n",
"for pb in range(1,3): # for each problem\n",
" # create or clear a subdirectory for the problem\n",
" problem_directory = results_directory + \"/problem_%s\"%pb\n",
" if os.path.isdir(problem_directory):\n",
" shutil.rmtree(problem_directory)\n",
" os.mkdir(problem_directory)\n",
" \n",
" # generate a custom target runner file for the problem\n",
" target_runner(path = problem_directory + \"/\" + target_runner_file, problem = pb)\n",
"\n",
" # copy the config files for iraces\n",
" for filename in [instances_file, scenario_file, parameters_file, target_runner_file]:\n",
" src = r'irace-config/' + filename\n",
" dst = problem_directory + \"/\" + filename\n",
" shutil.copyfile(src, dst)\n",
" \n",
" # run irace for\n",
" cmd = [irace_path, \"--scenario\", problem_directory + \"/\" + scenario_file] #, \"&> irace.log\"\n",
" call(cmd)\n",
"#call(cmd)\n"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "b707ff3b",
"metadata": {},
"outputs": [],
"source": [
"shutil.rmtree(\"results\")"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "460c588e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-10"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"call([\"../../release/onlymutga\"])"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "eb234425",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'problem_1/default.instances'"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import shutil\n",
"import os\n",
"src = r'irace-config/default.instances'\n",
"dst = r'problem_1/default.instances'\n",
"shutil.copyfile(src, dst)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7a62c411",
"metadata": {},
"outputs": [],
"source": [
"chmod u+x script.py\n",
"cp -a a b"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View file

@ -0,0 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 14 12:16:17 2021
@author: labeiros
"""
import sys
print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))

View file

@ -0,0 +1,119 @@
#!/usr/bin/python
###############################################################################
# This script is the command that is executed every run.
# Check the examples in examples/
#
# This script is run in the execution directory (execDir, --exec-dir).
#
# PARAMETERS:
# argv[1] is the candidate configuration ID
# argv[2] is the instance ID
# argv[3] is the seed
# argv[4] is the instance name
# The rest (argv[5:]) are parameters to the run
#
# RETURN VALUE:
# This script should print one numerical value: the cost that must be minimized.
# Exit with 0 if no error, with 1 in case of error
###############################################################################
import datetime
import os.path
import re
import subprocess
import sys
exe = "../../../../release/onlymutga"
problem = blabla
pop_size = 1
offspring_size = 100
fixed_parameters = ["--problem", str(problem), "--crossover-rate", "0", "--mutation-rate", "1", "--pop-size", str(pop_size), " --offspring-size", str(offspring_size)]
if __name__=='__main__':
if len(sys.argv) < 5:
print("\nUsage: ./target-runner.py <configuration_id> <instance_id> <seed> <instance_path_name> <list of parameters>\n")
sys.exit(1)
# Get the parameters as command line arguments.
configuration_id = sys.argv[1]
instance_id = sys.argv[2]
seed = sys.argv[3]
instance = sys.argv[4]
slices_prop = sys.argv[5:]
#print(sys.argv)
exe = os.path.expanduser(exe)
cmd = [exe] + fixed_parameters + ["--instance", instance, "--seed", seed]
residual_prob = 1
cl_probs = []
residual_size = 1
cl_sizes = []
values = ""
sizes = ""
for i in range(len(slices_prop)):
cl_probs.append(residual_prob * float(slices_prop[i]))
cl_sizes.append(residual_size * (1-float(slices_prop[i])))
residual_prob -= cl_probs[-1]
residual_size -= cl_sizes[-1]
values += "%.2f,"%cl_probs[-1]
sizes += "%.2f,"%cl_sizes[-1]
cl_probs.append(residual_prob)
values += "%.2f"%cl_probs[-1]
sizes += "%.2f"%cl_sizes[-1]
cmd += ["--cl-probs", values, "--cl-sizes", sizes]
# Define the stdout and stderr files.
out_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stdout"
err_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stderr"
def target_runner_error(msg):
now = datetime.datetime.now()
print(str(now) + " error: " + msg)
sys.exit(1)
def check_executable(fpath):
fpath = os.path.expanduser(fpath)
if not os.path.isfile(fpath):
target_runner_error(str(fpath) + " not found")
if not os.access(fpath, os.X_OK):
target_runner_error(str(fpath) + " is not executable")
# This is an example of reading a number from the output.
def parse_output(out):
match = re.search(r'Best ([-+0-9.eE]+)', out.strip())
if match:
return match.group(1);
else:
return "No match"
check_executable (exe)
outf = open(out_file, "w")
errf = open(err_file, "w")
return_code = subprocess.call(cmd, stdout = outf, stderr = errf)
outf.close()
errf.close()
if return_code != 0:
target_runner_error("command returned code " + str(return_code))
if not os.path.isfile(out_file):
target_runner_error("output file " + out_file + " not found.")
cost = parse_output (open(out_file).read())
#print(cost)
print(open(out_file).read().strip())
os.remove(out_file)
os.remove(err_file)
sys.exit(0)

View file

@ -16,8 +16,6 @@
* ParadisEO algorithmic grammar definition. * ParadisEO algorithmic grammar definition.
*****************************************************************************/ *****************************************************************************/
// using Particle = eoRealParticle<eoMaximizingFitness>;
using Ints = eoInt<eoMaximizingFitnessT<int>, size_t>;
using Bits = eoBit<eoMaximizingFitnessT<int>, int>; using Bits = eoBit<eoMaximizingFitnessT<int>, int>;
// by enumerating candidate operators and their parameters. // by enumerating candidate operators and their parameters.
@ -341,7 +339,7 @@ int main(int argc, char* argv[])
"problem", "Problem ID", "problem", "Problem ID",
'p', "Problem", /*required=*/true); 'p', "Problem", /*required=*/true);
const size_t problem = problem_p.value(); const size_t problem = problem_p.value();
assert(0 <= problem and problem < benchmark.size()); assert(problem < benchmark.size());
// const size_t dimension = parser.getORcreateParam<size_t>(1000, // const size_t dimension = parser.getORcreateParam<size_t>(1000,
// "dimension", "Dimension size", // "dimension", "Dimension size",
@ -624,7 +622,7 @@ int main(int argc, char* argv[])
eoInitFixedLength<Bits> onemax_init(/*bitstring size=*/dimension, bgen); eoInitFixedLength<Bits> onemax_init(/*bitstring size=*/dimension, bgen);
auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target); auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target);
Ints encoded_algo(foundry.size()); eoAlgoFoundry<Bits>::Encodings encoded_algo(foundry.size());
encoded_algo[foundry.crossover_rates .index()] = crossover_rate; encoded_algo[foundry.crossover_rates .index()] = crossover_rate;
encoded_algo[foundry.crossover_selectors .index()] = crossover_selector; encoded_algo[foundry.crossover_selectors .index()] = crossover_selector;
@ -641,16 +639,6 @@ int main(int argc, char* argv[])
foundry.select(encoded_algo); foundry.select(encoded_algo);
std::clog << foundry.name() << std::endl; std::clog << foundry.name() << std::endl;
// // Evaluation of a forged encoded_algo on the sub-problem
// eoEvalFoundryFastGA<Ints, Bits> eval_foundry(
// foundry, pop_size,
// onemax_init, onemax_eval,
// /*penalization=*/ dimension, // Worst case penalization.
// /*normalized=*/ false); // Use direct integer encoding.
//
// // Actually instanciate and run the algorithm.
// eval_foundry(encoded_algo);
/***************************************************************************** /*****************************************************************************
* Run and output results. * Run and output results.
*****************************************************************************/ *****************************************************************************/
@ -661,7 +649,7 @@ int main(int argc, char* argv[])
onemax_eval(pop,pop); onemax_eval(pop,pop);
foundry(pop); // Actually run the selected algorithm. foundry(pop); // Actually run the selected algorithm.
} catch(eoMaxEvalException e) { } catch(eoMaxEvalException & e) {
eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl; eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl;
} }

View file

@ -1,9 +1,10 @@
Bootstrap: library https://github.com/drbild/json2yaml.gitBootstrap: library
From: ubuntu:20.04 From: ubuntu:20.04
%post %post
# Dependencies # Dependencies
apt -y update
apt -y install software-properties-common apt -y install software-properties-common
add-apt-repository universe add-apt-repository universe
apt -y update apt -y update

View file

@ -0,0 +1,770 @@
#include <filesystem>
#include <iostream>
#include <cstdlib>
#include <string>
#include <memory>
#include <eo>
#include <ga.h>
#include <utils/checkpointing>
#include <eoInt.h>
#include <problems/eval/eoEvalIOH.h>
#include <ioh.hpp>
/*****************************************************************************
* ParadisEO algorithmic grammar definition.
*****************************************************************************/
// using Particle = eoRealParticle<eoMaximizingFitness>;
using Ints = eoInt<eoMaximizingFitnessT<int>, size_t>;
using Bits = eoBit<eoMaximizingFitnessT<int>, int>;
// by enumerating candidate operators and their parameters.
eoAlgoFoundryFastGA<Bits>& make_foundry(
eoFunctorStore& store,
eoInit<Bits>& init,
eoEvalFunc<Bits>& eval,
const size_t max_evals,
const size_t generations,
const double optimum,
const size_t pop_size,
const size_t offspring_size,
std::vector<double> cl_sizes,
std::vector<double> cl_values
)
{
// FIXME using max_restarts>1 does not allow to honor max evals.
auto& foundry = store.pack< eoAlgoFoundryFastGA<Bits> >(init, eval, max_evals, /*max_restarts=*/1);
/***** Continuators ****/
auto& fitcont = store.pack< eoFitContinue<Bits> >(optimum);
auto& gencont = store.pack< eoGenContinue<Bits> >(generations);
auto combconts = std::make_shared< std::vector<eoContinue<Bits>*> >();
combconts->push_back( &fitcont );
combconts->push_back( &gencont );
foundry.continuators.add< eoCombinedContinue<Bits> >( *combconts );
// for(size_t i=1; i<10; i++) {
// foundry.continuators.add< eoGenContinue<Bits> >(i);
// }
// for(size_t i=10; i < 100; i+=2 ) {
// foundry.continuators.add< eoSteadyFitContinue<Bits> >(10,i);
// }
// for(double i=0.0; i<1.0; i+=0.2) {
// foundry.crossover_rates.add<double>(i);
// foundry.mutation_rates.add<double>(i);
// }
/***** Offsprings size *****/
// for(size_t i=5; i<100; i+=10) {
// foundry.offspring_sizes.add<size_t>(i);
// }
foundry.offspring_sizes.setup(0,offspring_size); // 0 = use parents fixed pop size.
/***** Crossovers ****/
for(double i=0.1; i<1.0; i+=0.2) {
foundry.crossovers.add< eoUBitXover<Bits> >(i); // preference over 1
}
for(size_t i=1; i < 10; i+=2) {
foundry.crossovers.add< eoNPtsBitXover<Bits> >(i); // nb of points
}
// foundry.crossovers.add< eo1PtBitXover<Bits> >(); // Same as NPts=1
/***** Mutations ****/
/* ######################## Removed by Alexis ######################## */
/*
double p = 1.0; // Probability of flipping each bit.
// proba of flipping k bits, k drawn in uniform distrib
foundry.mutations.add< eoUniformBitMutation<Bits> >(p);
// proba of flipping k bits, k drawn in binomial distrib
foundry.mutations.add< eoStandardBitMutation<Bits> >(p);
// proba of flipping k bits, k drawn in binomial distrib, minus zero
foundry.mutations.add< eoConditionalBitMutation<Bits> >(p);
// proba of flipping k bits, k drawn in binomial distrib, changing zeros to one
foundry.mutations.add< eoShiftedBitMutation<Bits> >(p);
// proba of flipping k bits, k drawn in normal distrib
foundry.mutations.add< eoNormalBitMutation<Bits> >(p);
// proba of flipping k bits, k drawn in powerlaw distrib
foundry.mutations.add< eoFastBitMutation<Bits> >(p);
for(size_t i=1; i < 11; i+=2) {
// mutate k bits without duplicates
foundry.mutations.add< eoDetSingleBitFlip<Bits> >(i);
}
*/
/* ######################## RbA END ######################## */
/* ######################## Add by Alexis ######################## */
foundry.mutations.add< eoBucketBitMutation<Bits> >(cl_sizes, cl_values);
/* ######################## AbA END ######################## */
/***** Selectors *****/
for(eoOperatorFoundry<eoSelectOne<Bits>>& ops :
{std::ref(foundry.crossover_selectors),
std::ref(foundry.mutation_selectors) }) {
ops.add< eoRandomSelect<Bits> >();
ops.add< eoStochTournamentSelect<Bits> >(0.5);
ops.add< eoSequentialSelect<Bits> >();
ops.add< eoProportionalSelect<Bits> >();
for(size_t i=2; i < 11; i+=4) {
ops.add< eoDetTournamentSelect<Bits> >(i);
}
}
foundry.aftercross_selectors.add< eoRandomSelect<Bits> >();
/***** Replacements ****/
/* ######################## Removed by Alexis ######################## */
/*
foundry.replacements.add< eoPlusReplacement<Bits> >();
foundry.replacements.add< eoCommaReplacement<Bits> >();
foundry.replacements.add< eoSSGAWorseReplacement<Bits> >();
for(double i=0.51; i<0.92; i+=0.2) {
foundry.replacements.add< eoSSGAStochTournamentReplacement<Bits> >(i);
}
for(size_t i=2; i < 11; i+=2) {
foundry.replacements.add< eoSSGADetTournamentReplacement<Bits> >(i);
}
*/
/* ######################## RbA END ######################## */
/* ######################## Add by Alexis ######################## */
//foundry.replacements.add< eoSSGADetTournamentReplacement<Bits> >(1);
foundry.replacements.add< eoCommaReplacement<Bits> >();
/* ######################## AbA END ######################## */
return foundry;
}
/*****************************************************************************
* irace helper functions.
*****************************************************************************/
Bits::Fitness fake_func(const Bits&) { return 0; }
void print_irace_categorical(const eoParam& param, const size_t slot_size, std::string type="c", std::ostream& out = std::cout)
{
// If there is no choice to be made on this operator, comment it out.
if(slot_size - 1 <= 0) {
out << "# ";
}
// irace doesn't support "-" in names.
std::string irace_name = param.longName();
irace_name.erase(std::remove(irace_name.begin(), irace_name.end(), '-'), irace_name.end());
out << irace_name
<< "\t\"--" << param.longName() << "=\""
<< "\t" << type;
out << "\t(0";
for(size_t i=1; i<slot_size; ++i) {
out << "," << i;
}
out << ")" << std::endl;
}
template<class T>
void print_irace_ranged(const eoParam& param, const T min, const T max, std::string type="r", std::ostream& out = std::cout)
{
// If there is no choice to be made on this operator, comment it out.
if(max - min <= 0) {
out << "# ";
}
// irace doesn't support "-" in names.
std::string irace_name = param.longName();
irace_name.erase(std::remove(irace_name.begin(), irace_name.end(), '-'), irace_name.end());
out << irace_name
<< "\t\"--" << param.longName() << "=\""
<< "\t" << type;
if(max-min <= 0) {
out << "\t(?)";
} else {
out << "\t(" << min << "," << max << ")";
}
out << std::endl;
}
template<class ITF>
void print_irace_oper(const eoParam& param, const eoOperatorFoundry<ITF>& op_foundry, std::ostream& out = std::cout)
{
print_irace_categorical(param, op_foundry.size(), "c", out);
}
// FIXME generalize to any scalar type with enable_if
// template<class ITF>
void print_irace_param(
const eoParam& param,
// const eoParameterFoundry<typename std::enable_if< std::is_floating_point<ITF>::value >::type>& op_foundry,
const eoParameterFoundry<double>& op_foundry,
std::ostream& out)
{
print_irace_ranged(param, op_foundry.min(), op_foundry.max(), "r", out);
}
// template<class ITF>
void print_irace_param(
const eoParam& param,
// const eoParameterFoundry<typename std::enable_if< std::is_integral<ITF>::value >::type>& op_foundry,
const eoParameterFoundry<size_t>& op_foundry,
std::ostream& out)
{
print_irace_ranged(param, op_foundry.min(), op_foundry.max(), "i", out);
}
template<class ITF>
void print_irace(const eoParam& param, const eoOperatorFoundry<ITF>& op_foundry, std::ostream& out = std::cout)
{
print_irace_oper<ITF>(param, op_foundry, out);
}
template<class ITF>
void print_irace(const eoParam& param, const eoParameterFoundry<ITF>& op_foundry, std::ostream& out = std::cout)
{
print_irace_param/*<ITF>*/(param, op_foundry, out);
}
void print_irace(const eoParam& param, const size_t min, const size_t max, std::ostream& out = std::cout)
{
print_irace_ranged(param, min, max, "i", out);
}
void print_operator_typed(const eoFunctorBase& op, std::ostream& out)
{
out << op.className();
}
void print_operator_typed(const double& op, std::ostream& out)
{
out << op;
}
template<class ITF>
void print_operators(const eoParam& param, eoOperatorFoundry<ITF>& op_foundry, std::ostream& out = std::cout, std::string indent=" ")
{
out << indent << op_foundry.size() << " " << param.longName() << ":" << std::endl;
for(size_t i=0; i < op_foundry.size(); ++i) {
out << indent << indent << i << ": ";
auto& op = op_foundry.instantiate(i);
print_operator_typed(op, out);
out << std::endl;
}
}
template<class T>
void print_operators(const eoParam& param, T min, T max, std::ostream& out = std::cout, std::string indent=" ")
{
out << indent << "[" << min << "," << max << "] " << param.longName() << "." << std::endl;
}
template<class ITF>
void print_operators(const eoParam& param, eoParameterFoundry<ITF>& op_foundry, std::ostream& out = std::cout, std::string indent=" ")
{
print_operators(param, op_foundry.min(), op_foundry.max(), out, indent);
}
// Problem configuration.
struct Problem {
double dummy;
size_t epistasis;
size_t neutrality;
size_t ruggedness;
size_t max_target;
size_t dimension;
friend std::ostream& operator<<(std::ostream& os, const Problem& pb);
};
std::ostream& operator<<(std::ostream& os, const Problem& pb)
{
os << "u=" << pb.dummy << "_"
<< "e=" << pb.epistasis << "_"
<< "n=" << pb.neutrality << "_"
<< "r=" << pb.ruggedness << "_"
<< "t=" << pb.max_target << "_"
<< "d=" << pb.dimension;
return os;
}
/*****************************************************************************
* IOH problem adaptation.
*****************************************************************************/
class WModelFlat : public ioh::problem::wmodel::WModelOneMax
{
public:
WModelFlat(const int instance, const int n_variables,
const double dummy_para, const int epistasis_para, const int neutrality_para,
const int ruggedness_para)
: WModelOneMax(instance, n_variables, dummy_para, epistasis_para, neutrality_para, ruggedness_para)
{ }
protected:
double transform_objectives(const double y) override
{ // Disable objective function shift & scaling.
return y;
}
};
/*****************************************************************************
* Command line interface.
*****************************************************************************/
int main(int argc, char* argv[])
{
/***** Global parameters. *****/
enum { NO_ERROR = 0, ERROR_USAGE = 100 };
std::map<size_t, Problem> benchmark {
/* ┌ problem index in the map
* problem ID in IOH experimenter
* dummy
* epistasis
* neutrality
* ruggedness
* max target
* dimension (bitstring length) */
{ 0 /* 1*/, {0, 6, 2, 10, 10, 20 }},
{ 1 /* 2*/, {0, 6, 2, 18, 10, 20 }},
{ 2 /* 3*/, {0, 5, 1, 72, 16, 16 }},
{ 3 /* 4*/, {0, 9, 3, 72, 16, 48 }},
{ 4 /* 5*/, {0, 23, 1, 90, 25, 25 }},
{ 5 /* 6*/, {0, 2, 1, 397, 32, 32 }},
{ 6 /* 7*/, {0, 11, 4, 0, 32, 128 }},
{ 7 /* 8*/, {0, 14, 4, 0, 32, 128 }},
{ 8 /* 9*/, {0, 8, 4, 128, 32, 128 }},
{ 9 /*10*/, {0, 36, 1, 245, 50, 50 }},
{10 /*11*/, {0, 21, 2, 256, 50, 100 }},
{11 /*12*/, {0, 16, 3, 613, 50, 150 }},
{12 /*13*/, {0, 32, 2, 256, 64, 128 }},
{13 /*14*/, {0, 21, 3, 16, 64, 192 }},
{14 /*15*/, {0, 21, 3, 256, 64, 192 }},
{15 /*16*/, {0, 21, 3, 403, 64, 192 }},
{16 /*17*/, {0, 52, 4, 2, 64, 256 }},
{17 /*18*/, {0, 60, 1, 16, 75, 75 }},
{18 /*19*/, {0, 32, 2, 4, 75, 150 }},
{19 /*20?*/, {0, 0, 0, 0, 0, 64 }} // Add by Alexis
};
eoFunctorStore store;
eoParser parser(argc, argv, "OnlymutGA interface for iRace");
/***** Problem parameters *****/
auto problem_p = parser.getORcreateParam<size_t>(0,
"problem", "Problem ID",
'p', "Problem", /*required=*/true);
const size_t problem = problem_p.value();
assert(0 <= problem and problem < benchmark.size());
// const size_t dimension = parser.getORcreateParam<size_t>(1000,
// "dimension", "Dimension size",
// 'd', "Problem").value();
const size_t dimension = benchmark[problem].dimension;
auto instance_p = parser.getORcreateParam<size_t>(0,
"instance", "Instance ID",
'i', "Instance", /*required=*/false);
const size_t instance = instance_p.value();
const size_t max_evals = parser.getORcreateParam<size_t>(5 * dimension,
"max-evals", "Maximum number of evaluations (default: 5*dim, else the given value)",
'e', "Stopping criterion").value();
const size_t buckets = parser.getORcreateParam<size_t>(100,
"buckets", "Number of buckets for discretizing the ECDF",
'b', "Performance estimation").value();
/***** Generic options *****/
uint32_t seed =
parser.getORcreateParam<uint32_t>(0,
"seed", "Random number seed (0 = epoch)",
'S').value();
if(seed == 0) {
seed = time(0);
}
// rng is a global
rng.reseed(seed);
bool full_log =
parser.getORcreateParam<bool>(0,
"full-log", "Log the full search in CSV files"/* (using the IOH profiler format)"*/,
'F').value();
bool output_mat =
parser.getORcreateParam<bool>(0,
"output-mat", "Output the aggregated attainment matrix instead of its scalar sum (fancy colormap on stderr, parsable CSV on stdout).",
'A').value();
/***** populations sizes *****/
auto pop_size_p = parser.getORcreateParam<size_t>(1,
"pop-size", "Population size",
'P', "Operator Choice", /*required=*/false); // Changed by Alexis: 5 -> 1
const size_t pop_size = pop_size_p.value();
const size_t pop_size_max = 10;
auto offspring_size_p = parser.getORcreateParam<size_t>(10,
"offspring-size", "Offsprings size (0 = same size than the parents pop, see --pop-size)",
'O', "Operator Choice", /*required=*/false); // Single alternative, not required. // Changed by Alexis: 0 -> 10
const size_t offspring_size = offspring_size_p.value();
size_t generations = static_cast<size_t>(std::floor(
static_cast<double>(max_evals) / static_cast<double>(pop_size)));
// const size_t generations = std::numeric_limits<size_t>::max();
if(generations < 1) {
generations = 1;
}
/***** metric parameters *****/
auto crossover_rate_p = parser.getORcreateParam<double>(0,
"crossover-rate", "",
'C', "Operator Choice", /*required=*/false); // Changed by Alexis: 0.5 -> 0 | true -> false
const double crossover_rate = crossover_rate_p.value();
auto mutation_rate_p = parser.getORcreateParam<double>(1,
"mutation-rate", "",
'M', "Operator Choice", /*required=*/false); // Changed by Alexis: 0 -> 1 | true -> false
const double mutation_rate = mutation_rate_p.value();
/***** operators *****/
auto continuator_p = parser.getORcreateParam<size_t>(0,
"continuator", "Stopping criterion",
'o', "Operator Choice", /*required=*/false); // Single alternative, not required.
const size_t continuator = continuator_p.value();
auto crossover_selector_p = parser.getORcreateParam<size_t>(0,
"cross-selector", "How to selects candidates for cross-over",
's', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false
const size_t crossover_selector = crossover_selector_p.value();
auto crossover_p = parser.getORcreateParam<size_t>(0,
"crossover", "",
'c', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false
const size_t crossover = crossover_p.value();
auto aftercross_selector_p = parser.getORcreateParam<size_t>(0,
"aftercross-selector", "How to selects between the two individuals altered by cross-over which one will mutate",
'a', "Operator Choice", /*required=*/false); // Single alternative, not required.
const size_t aftercross_selector = aftercross_selector_p.value();
auto mutation_selector_p = parser.getORcreateParam<size_t>(0,
"mut-selector", "How to selects candidate for mutation",
'u', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false
const size_t mutation_selector = mutation_selector_p.value();
auto mutation_p = parser.getORcreateParam<size_t>(0,
"mutation", "",
'm', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false
const size_t mutation = mutation_p.value();
auto replacement_p = parser.getORcreateParam<size_t>(0,
"replacement", "",
'r', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false
const size_t replacement = replacement_p.value();
/* ######################## Add by Alexis ######################## */
auto cl_values_p = parser.getORcreateParam<std::string>("0.8,0.2",
"cl-probs", "Probabilities of each part for the custom law (sum = 1)",
'y', "Operator Choice", false);
std::string cl_v = cl_values_p.value();
std::vector<double> cl_probs = std::vector<double>();
std::string sep = ",";
size_t pos = 0;
std::string token;
while ((pos = cl_v.find(sep)) != std::string::npos) {
token = cl_v.substr(0, pos);
cl_probs.push_back(std::stod(token));
cl_v.erase(0, pos + sep.length());
}
cl_probs.push_back(std::stod(cl_v));
auto cl_sizes_p = parser.getORcreateParam<std::string>("0.5,0.5",
"cl-sizes", "Proportion sizes of each part for the custom law (sum = 1)",
'x', "Operator Choice", false);
std::string cl_s = cl_sizes_p.value();
std::vector<double> cl_sizes = std::vector<double>();
pos = 0;
while ((pos = cl_s.find(sep)) != std::string::npos) {
token = cl_s.substr(0, pos);
cl_sizes.push_back(std::stod(token));
cl_s.erase(0, pos + sep.length());
}
cl_sizes.push_back(std::stod(cl_s));
/* ######################## AbA END ######################## */
// Help + Verbose routines
make_verbose(parser);
make_help(parser, /*exit_after*/false, std::clog);
if(parser.userNeedsHelp()) {
// Fake operators, just to be able to call make_foundry
// to get the configured operators slots.
eoEvalFuncPtr<Bits> fake_eval(fake_func);
eoUniformGenerator<int> fake_gen(0, 1);
eoInitFixedLength<Bits> fake_init(/*bitstring size=*/1, fake_gen);
auto fake_foundry = make_foundry(store, fake_init, fake_eval, max_evals, /*generations=*/ 1, 0, pop_size_max, offspring_size, cl_sizes, cl_probs);
std::clog << std::endl << "Available operators:" << std::endl;
print_operators( continuator_p, fake_foundry.continuators , std::clog);
print_operators( crossover_rate_p, fake_foundry.crossover_rates , std::clog);
print_operators( crossover_selector_p, fake_foundry.crossover_selectors , std::clog);
print_operators(aftercross_selector_p, fake_foundry.aftercross_selectors, std::clog);
print_operators( crossover_p, fake_foundry.crossovers , std::clog);
print_operators( mutation_rate_p, fake_foundry.mutation_rates , std::clog);
print_operators( mutation_selector_p, fake_foundry.mutation_selectors , std::clog);
print_operators( mutation_p, fake_foundry.mutations , std::clog);
print_operators( replacement_p, fake_foundry.replacements , std::clog);
print_operators( offspring_size_p, fake_foundry.offspring_sizes , std::clog);
print_operators( pop_size_p, (size_t)1, pop_size_max , std::clog);
/* ######################## Add by Alexis ######################## */
print_operators( cl_values_p, "(1)", "(0.01,...,0.99)" , std::clog);
print_operators( cl_sizes_p, "(1)", "(0.01,...,0.99)" , std::clog);
/* ######################## AbA END ######################## */
std::clog << std::endl;
// If we were to make a DoE sampling numeric parameters,
// we would use that many samples:
size_t fake_sample_size = 10;
std::clog << "With " << fake_sample_size << " samples for numeric parameters..." << std::endl;
size_t n =
fake_sample_size //crossover_rates
* fake_foundry.crossover_selectors.size()
* fake_foundry.crossovers.size()
* fake_foundry.aftercross_selectors.size()
* fake_sample_size //mutation_rates
* fake_foundry.mutation_selectors.size()
* fake_foundry.mutations.size()
* fake_foundry.replacements.size()
* fake_foundry.continuators.size()
* fake_sample_size //offspring_sizes
* fake_sample_size //pop_size
;
std::clog << "~" << n << " possible algorithms configurations." << std::endl;
std::clog << "Ranges of configurable parameters (redirect the stdout in a file to use it with iRace): " << std::endl;
// Do not print problem and instances, as they are managed separately by irace.
std::cout << "# name\tswitch\ttype\trange" << std::endl;
/* ######################## Removed by Alexis ######################## */
/*
print_irace( continuator_p, fake_foundry.continuators , std::cout);
print_irace( crossover_rate_p, fake_foundry.crossover_rates , std::cout);
print_irace( crossover_selector_p, fake_foundry.crossover_selectors , std::cout);
print_irace(aftercross_selector_p, fake_foundry.aftercross_selectors, std::cout);
print_irace( crossover_p, fake_foundry.crossovers , std::cout);
print_irace( mutation_rate_p, fake_foundry.mutation_rates , std::cout);
print_irace( mutation_selector_p, fake_foundry.mutation_selectors , std::cout);
print_irace( mutation_p, fake_foundry.mutations , std::cout);
print_irace( replacement_p, fake_foundry.replacements , std::cout);
print_irace( offspring_size_p, fake_foundry.offspring_sizes , std::cout);
print_irace( pop_size_p, 1, pop_size_max , std::cout);
*/
/* ######################## RbA END ######################## */
//std::ofstream irace_param("fastga.params");
//irace_param << "# name\tswitch\ttype\tvalues" << std::endl;
exit(NO_ERROR);
}
eo::log << eo::debug << "Maximum number of evaluations: " << max_evals << std::endl;
eo::log << eo::debug << "Number of generations: " << generations << std::endl;
/*****************************************************************************
* IOH stuff.
*****************************************************************************/
/***** IOH logger *****/
auto max_target = benchmark[problem].max_target;
ioh::logger::eah::Log10Scale<double> target_range(0, max_target, buckets);
ioh::logger::eah::Log10Scale<size_t> budget_range(0, max_evals, buckets);
ioh::logger::EAH eah_logger(target_range, budget_range);
ioh::logger::Combine loggers(eah_logger);
std::shared_ptr<ioh::logger::FlatFile> csv_logger = nullptr;
if(full_log) {
// Build up an algorithm name from main parameters.
std::ostringstream name;
name << "OnlymutGA";
for(auto& p : {
crossover_selector_p,
crossover_p,
aftercross_selector_p,
mutation_selector_p,
mutation_p,
replacement_p }) {
name << "_" << p.shortName() << "=" << p.getValue();
}
for(auto& p : {
crossover_rate_p,
mutation_rate_p }) {
name << "_" << p.shortName() << "=" << p.getValue();
}
for(auto& p : {pop_size_p,
offspring_size_p }) {
name << "_" << p.shortName() << "=" << p.getValue();
}
std::clog << name.str() << std::endl;
// Build up a problem description.
std::ostringstream desc;
desc << "pb=" << problem << "_";
desc << benchmark[problem]; // Use the `operator<<` above.
std::clog << desc.str() << std::endl;
std::filesystem::path folder = desc.str();
std::filesystem::create_directories(folder);
ioh::trigger::OnImprovement on_improvement;
ioh::watch::Evaluations evaluations;
ioh::watch::TransformedYBest transformed_y_best;
std::vector<std::reference_wrapper<ioh::logger::Trigger >> t = {on_improvement};
std::vector<std::reference_wrapper<ioh::logger::Property>> w = {evaluations,transformed_y_best};
csv_logger = std::make_shared<ioh::logger::FlatFile>(
// {std::ref(on_improvement)},
// {std::ref(evaluations),std::ref(transformed_y_best)},
t, w,
name.str(),
folder
);
loggers.append(*csv_logger);
}
/***** IOH problem *****/
double w_dummy = benchmark[problem].dummy;
int w_epitasis = benchmark[problem].epistasis;
int w_neutrality = benchmark[problem].neutrality;
int w_ruggedness = benchmark[problem].ruggedness;
// std::string problem_name = "OneMax";
// problem_name = problem_name
// + "_D" + std::to_string((int)(w_dummy * dimension))
// + "_E" + std::to_string(w_epitasis)
// + "_N" + std::to_string(w_neutrality)
// + "_R" + std::to_string(w_ruggedness);
// ioh::problem::wmodel::WModelOneMax w_model_om(
WModelFlat w_model_om(
instance,
dimension,
w_dummy,
w_epitasis,
w_neutrality,
w_ruggedness);
/***** Bindings *****/
w_model_om.attach_logger(loggers);
/*****************************************************************************
* Binding everything together.
*****************************************************************************/
eoEvalIOHproblem<Bits> onemax_pb(w_model_om, loggers);
// eoEvalPrint<Bits> eval_print(onemax_pb, std::clog, "\n");
// eoEvalFuncCounter<Bits> eval_count(onemax_pb);
eoEvalCounterThrowException<Bits> eval_count(onemax_pb, max_evals);
eoPopLoopEval<Bits> onemax_eval(eval_count);
/***** Instanciate and run the algo *****/
eoBooleanGenerator<int> bgen;
eoInitFixedLength<Bits> onemax_init(/*bitstring size=*/dimension, bgen);
auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target, pop_size_max, offspring_size, cl_sizes, cl_probs);
Ints encoded_algo(foundry.size());
encoded_algo[foundry.crossover_rates .index()] = crossover_rate;
encoded_algo[foundry.crossover_selectors .index()] = crossover_selector;
encoded_algo[foundry.crossovers .index()] = crossover;
encoded_algo[foundry.aftercross_selectors.index()] = aftercross_selector;
encoded_algo[foundry.mutation_rates .index()] = mutation_rate;
encoded_algo[foundry.mutation_selectors .index()] = mutation_selector;
encoded_algo[foundry.mutations .index()] = mutation;
encoded_algo[foundry.replacements .index()] = replacement;
encoded_algo[foundry.continuators .index()] = continuator;
encoded_algo[foundry.offspring_sizes .index()] = offspring_size;
// std::clog << "Encoded algorithm:" << std::endl;
foundry.select(encoded_algo);
std::clog << foundry.name() << std::endl;
// // Evaluation of a forged encoded_algo on the sub-problem
// eoEvalFoundryFastGA<Ints, Bits> eval_foundry(
// foundry, pop_size,
// onemax_init, onemax_eval,
// /*penalization=*/ dimension, // Worst case penalization.
// /*normalized=*/ false); // Use direct integer encoding.
//
// // Actually instanciate and run the algorithm.
// eval_foundry(encoded_algo);
/*****************************************************************************
* Run and output results.
*****************************************************************************/
eoPop<Bits> pop;
pop.append(pop_size, onemax_init);
try {
onemax_eval(pop,pop);
foundry(pop); // Actually run the selected algorithm.
} catch(eoMaxEvalException e) {
eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl;
}
/***** IOH perf stats *****/
double perf = ioh::logger::eah::stat::under_curve::volume(eah_logger);
if(perf == 0 or perf > max_target * max_evals * 1.0) {
std::cerr << "WARNING: illogical performance? " << perf
<< " Check the bounds or the algorithm." << std::endl;
}
// std::clog << "After " << eval_count.getValue() << " / " << max_evals << " evaluations" << std::endl;
if(output_mat) {
std::vector<std::vector<double>> mat = ioh::logger::eah::stat::distribution(eah_logger);
// Fancy color map on clog.
std::clog << ioh::logger::eah::colormap(mat) << std::endl;
// Parsable CSV on cout.
std::clog << "Attainment matrix distribution: " << std::endl;
assert(mat.size() > 0);
assert(mat[0].size() > 1);
for(size_t i = mat.size()-1; i > 0; --i) {
assert(mat[i].size() >= 1);
std::cout << mat[i][0];
for(size_t j = 1; j < mat[i].size(); ++j) {
std::cout << "," << mat[i][j];
}
std::cout << std::endl;
}
} else {
// iRace expects minimization
std::cout << -1 * perf << std::endl;
}
}

View file

@ -32,8 +32,9 @@ IF (DOXYGEN_FOUND)
ENDIF (DOXYGEN_EXECUTABLE) ENDIF (DOXYGEN_EXECUTABLE)
# configure cfg file # configure cfg file
# "${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake"
CONFIGURE_FILE( CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake" "${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${EO_DOC_CONFIG_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${EO_DOC_CONFIG_FILE}"
) )

View file

@ -64,6 +64,8 @@ template<class F = double> class EO: public eoObject, public eoPersistent
public: public:
typedef F Fitness; typedef F Fitness;
static constexpr const char* invalidTag = "INVALID";
/** Default constructor. /** Default constructor.
*/ */
EO(): repFitness(Fitness()), invalidFitness(true) { } EO(): repFitness(Fitness()), invalidFitness(true) { }
@ -72,7 +74,9 @@ public:
virtual ~EO() {}; virtual ~EO() {};
/// Return fitness value. /// Return fitness value.
const Fitness& fitness() const { // virtual const Fitness& fitness() const { // This would be impossible with MOEO.
// virtual Fitness fitness() const { // Cannot do that either, MOEO changes the interface.
Fitness fitness() const {
if (invalid()) if (invalid())
throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness");
return repFitness; return repFitness;
@ -86,7 +90,7 @@ public:
} }
// Set fitness as invalid. // Set fitness as invalid.
void invalidate() { invalidFitness = true; repFitness = Fitness(); } virtual void invalidate() { invalidFitness = true; repFitness = Fitness(); }
/** Set fitness. At the same time, validates it. /** Set fitness. At the same time, validates it.
* @param _fitness New fitness value. * @param _fitness New fitness value.
@ -122,25 +126,21 @@ public:
* The read and print methods should be compatible and have the same format. * The read and print methods should be compatible and have the same format.
* In principle, format is "plain": they just print a number * In principle, format is "plain": they just print a number
* @param _is a std::istream. * @param _is a std::istream.
* @throw eoInvalidFitnessError If a valid object can't be read.
*/ */
virtual void readFrom(std::istream& _is) { virtual void readFrom(std::istream& _is)
{
// the new version of the reafFrom function.
// It can distinguish between valid and invalid fitness values.
std::string fitness_str; std::string fitness_str;
int pos = _is.tellg();
_is >> fitness_str; _is >> fitness_str;
if (fitness_str == "INVALID") if (fitness_str == invalidTag)
{ {
invalidFitness = true; invalidFitness = true;
} }
else else
{ {
invalidFitness = false; invalidFitness = false;
_is.seekg(pos); // rewind std::istringstream iss(fitness_str);
_is >> repFitness; iss >> repFitness;
} }
} }
@ -148,12 +148,11 @@ public:
* Write object. Called printOn since it prints the object _on_ a stream. * Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream. * @param _os A std::ostream.
*/ */
virtual void printOn(std::ostream& _os) const { virtual void printOn(std::ostream& _os) const
{
if (invalid())
// the latest version of the code. Very similar to the old code {
if (invalid()) { _os << invalidTag << ' ';
_os << "INVALID ";
} }
else else
{ {

View file

@ -65,7 +65,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
#ifndef _MSC_VER #ifndef _MSC_VER
// the CtrlC monitoring interception // the CtrlC monitoring interception
eoSignal<EOT> *mon_ctrlCCont; eoSignal<EOT> *mon_ctrlCCont = nullptr;
eoValueParam<bool>& mon_ctrlCParam = _parser.createParam(false, "monitor-with-CtrlC", "Monitor current generation upon Ctrl C",0, "Stopping criterion"); eoValueParam<bool>& mon_ctrlCParam = _parser.createParam(false, "monitor-with-CtrlC", "Monitor current generation upon Ctrl C",0, "Stopping criterion");
if (mon_ctrlCParam.value()) if (mon_ctrlCParam.value())
{ {

View file

@ -224,6 +224,11 @@
#include "utils/eoLogger.h" #include "utils/eoLogger.h"
#include "utils/eoParallel.h" #include "utils/eoParallel.h"
#include "eoInt.h"
#include "eoRealToIntMonOp.h"
#include "eoRealToIntQuadOp.h"
#include "eoRealToIntInit.h"
#endif #endif
// Local Variables: // Local Variables:

View file

@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group © 2020 Thales group
© 2022 Institut Pasteur
Authors: Authors:
Johann Dreo <johann.dreo@thalesgroup.com> Johann Dreo <johann.dreo@thalesgroup.com>
@ -24,6 +25,7 @@
#define _eoAlgoFoundry_H_ #define _eoAlgoFoundry_H_
#include <vector> #include <vector>
#include <variant>
/** A vector of eoForge which hold an index. /** A vector of eoForge which hold an index.
* *
@ -36,13 +38,13 @@
* which takes the class name as template and its constructor's parameters * which takes the class name as template and its constructor's parameters
* as arguments. For example: * as arguments. For example:
* @code * @code
* eoOperatorFoundry< eoSelectOne<EOT> > selectors; * eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* selectors.add< eoStochTournamentSelect<EOT> >( 0.5 ); * selectors.add< eoStochTournamentSelect<EOT> >( 0.5 );
* @endcode * @endcode
* *
* @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it * @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it
* in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy,
* which would effectively disable any link between operators. * which would effectively disable any link between operators.
* *
* @ingroup Core * @ingroup Core
* @ingroup Foundry * @ingroup Foundry
@ -51,11 +53,18 @@ template<class Itf>
class eoOperatorFoundry : public eoForgeVector< Itf > class eoOperatorFoundry : public eoForgeVector< Itf >
{ {
public: public:
/** Constructor
*
* @param encoding_index The slot position in the encodings, at which this operator is held.
* @param always_reinstantiate If false, will enable cache for the forges in this container.
*/
eoOperatorFoundry(size_t encoding_index, bool always_reinstantiate = true ) : eoOperatorFoundry(size_t encoding_index, bool always_reinstantiate = true ) :
eoForgeVector<Itf>(always_reinstantiate), eoForgeVector<Itf>(always_reinstantiate),
_index(encoding_index) _index(encoding_index)
{ } { }
/** Returns the slot index at which this is registered.
*/
size_t index() const { return _index; } size_t index() const { return _index; }
protected: protected:
@ -63,6 +72,24 @@ class eoOperatorFoundry : public eoForgeVector< Itf >
size_t _index; size_t _index;
}; };
/** A vector of eoForge which hold a scalar numeric value.
*
* To be used in conjunction with a subclass of an eoAlgoFoundry,
* where it can hold a range of parameter values
* and hold the link to the encoding. @see eoAlgoFoundryEA
*
* As with eoForgeScalar, managed parameters
* are represented through a [min,max] range.
*
* For example:
* @code
* eoParameterFoundry< double > proba(0.0, 1.0);
* @endcode
*
* @ingroup Core
* @ingroup Foundry
*/
template<class Itf> template<class Itf>
class eoParameterFoundry : public eoForgeScalar< Itf > class eoParameterFoundry : public eoForgeScalar< Itf >
{ {
@ -70,11 +97,26 @@ class eoParameterFoundry : public eoForgeScalar< Itf >
"eoParameterFoundry should only be used on arithmetic types (i.e. integer or floating point types)"); "eoParameterFoundry should only be used on arithmetic types (i.e. integer or floating point types)");
public: public:
/** Underlying type of the parameter.
*
* @note You probably only want to use either `double` or `size_t`.
* @see eoAlgoFoundry
*/
using Type = Itf;
/** Constructor
*
* @param encoding_index The slot position in the encodings, at which this parameter is held.
* @param min Minimium possible value.
* @param max Maximum possible value.
*/
eoParameterFoundry(size_t encoding_index, Itf min, Itf max) : eoParameterFoundry(size_t encoding_index, Itf min, Itf max) :
eoForgeScalar<Itf>(min, max), eoForgeScalar<Itf>(min, max),
_index(encoding_index) _index(encoding_index)
{ } { }
/** Returns the slot index at which this is registered.
*/
size_t index() const { return _index; } size_t index() const { return _index; }
protected: protected:
@ -84,48 +126,55 @@ class eoParameterFoundry : public eoForgeScalar< Itf >
/** Interface of a Foundry: a class that instantiate an eoAlgo on-the-fly, given a choice of its operators. /** Interface of a Foundry: a class that instantiate an eoAlgo on-the-fly, given a choice of its operators.
* *
* The chosen operators are encoded in a vector of indices. * The chosen operators are encoded in a vector of numbers.
* *
* The foundry subclass should first be set up with sets of operators of the same interface, * The foundry subclass should first be set up with sets of operators of the same interface,
* held within an eoOperatorFoundry member. * held within an eoOperatorFoundry member.
* @code * @code
* eoOperatorFoundry< eoSelectOne<EOT> > selectors; * eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* @endcode * @endcode
* *
* In a second step, the operators to be used should be selected * In a second step, the operators to be used should be selected
* by indicating their index, just like if the foundry was an array: * by indicating their index, just like if the foundry was an array:
* @code * @code
* foundry.select({0, 1, 2}); * foundry.select({size_t{0}, size_t{1}, size_t{2}});
* // ^ ^ ^ * // ^ ^ ^
* // | | | * // | | |
* // | | + 3d operator * // | | + 3d operator
* // | + 2d operator * // | + 2d operator
* // + 1st operator * // + 1st operator
* @endcode * @endcode
* *
* If you don't (want to) recall the order of the operators in the encoding, * If you don't (want to) recall the order of the operators in the encoding,
* you can use the `index()` member of eoOperatorFoundry, for example: * you can use the `index()` member of eoOperatorFoundry, for example:
* @code * @code
* foundry.at(foundry.continuators.index()) = 2; // select the third continuator * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator
* @endcode * @endcode
* *
* Now, you must implement the foundry just like any eoAlgo, by using the eoPop interface: * Now, you must implement the foundry just like any eoAlgo, by using the eoPop interface:
* @code * @code
* foundry(pop); * foundry(pop);
* @encode * @endcode
*
* It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * It will instantiate the needed operators (only) and the algorithm itself on-the-fly,
* and then run it. * and then run it.
*
* @note The "encoding" which represent the selected options, figuring the actual meta-algorithm,
* is a vector of `std::variant`, which can hold either a `size_t` or a `double`.
* The first one is used to indicate the index of an operator class
* *or* a parameter which is a size.
* The second is used to store numerical parameters values.
* *
* @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated.
* Every instantiation is deferred upon actual use. That way, you can still reconfigure them * Every instantiation is deferred upon actual use. That way, you can still reconfigure them
* at any time with `eoForgeOperator::setup`, for example: * at any time with `eoForgeOperator::setup`, for example:
* @code * @code
* foundry.selector.at(0).setup(0.5); // using constructor's arguments * foundry.selector.at(0).setup(0.5); // using constructor's arguments
* @endcode * @endcode
* *
* @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it * @warning If the managed constructor takes a reference *YOU SHOULD ABSOLUTELY* wrap it
* in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy,
* which would effectively disable any link between operators. * which would effectively disable any link between operators.
* *
* @ingroup Core * @ingroup Core
* @ingroup Foundry * @ingroup Foundry
@ -135,30 +184,104 @@ template<class EOT>
class eoAlgoFoundry : public eoAlgo<EOT> class eoAlgoFoundry : public eoAlgo<EOT>
{ {
public: public:
/** // We could use `std::any` instead of a variant,
// but this would be more prone to errors from the end user, at the end.
// Either the encoding is an index (of the operator within the list of instances)
// either it's a real-valued parameter,
// either it's a size.
// So there's no need for more types (AFAIK).
/** The type use to represent a selected option in the meta-algorithm.
*
* This can figure, either:
* - the index of an operator in the list of possible ones,
* - the actual value of a numeric paramater,
* - the value of a parameter which is a size.
*/ */
eoAlgoFoundry( size_t nb_operators ) : using Encoding = std::variant<size_t, double>;
_size(nb_operators),
_encoding(_size,0) /** The type use to store all selected options.
*/
using Encodings = std::vector<Encoding>;
/** Constructor.
*
* @param nb_slots Number of operators or parameters that are assembled to make an algorithm.
*/
eoAlgoFoundry( size_t nb_slots ) :
_size(nb_slots)
{ } { }
/** Select indices of all the operators. /** Select indices of all the operators.
* *
* i.e. Select an algorithm to instantiate. * i.e. Select an algorithm to instantiate.
*
* @note You need to indicate the type of each item
* if you want to call this with a brace-initialized vector.
*
* For example:
* @code
* foundry.select({ size_t{1}, double{0.5}, size_t{3} });
* @endcode
*
* Or you can initialize the vector first:
* @code
* double crossover_rate = 0.5;
* size_t crossover_oper = 3;
* eoAlgoFoundry<EOT>::Encodings encoded_algo(foundry.size());
* encoded_algo[foundry.crossover_rates.index()] = crossover_rate;
* encoded_algo[foundry.crossover_opers.index()] = crossover_oper;
* @endcode
*/ */
void select( std::vector<size_t> encoding ) void select( Encodings encodings )
{ {
assert(encoding.size() == _encoding.size()); assert(encodings.size() == _size);
_encoding = encoding; _encodings = encodings;
} }
/** Access to the index of the currently selected operator. /** Access to the encoding of the currently selected operator.
*
* @warning This returns a `std::variant`, which you should `std::get<T>`.
*
* For example:
* @code
* size_t opera_id = std::get<size_t>(foundry.at(2));
* double param_id = std::get<double>(foundry.at(3));
* @endcode
*
* @see rank, @see value or @see len to have automatic casting.
*/ */
size_t& at(size_t i) Encoding & at(size_t i)
{ {
return _encoding.at(i); return _encodings.at(i);
} }
/** Access to the currently selected ID of an operator.
*/
template<class OP>
size_t rank(const OP& op)
{
return std::get<size_t>( at(op.index()) );
}
/** Access to the currently selected value of a numeric parameter.
*/
template<class OP>
double value(const OP& param)
{
return std::get<double>( at(param.index()) );
}
/** Access to the currently selected value of a unsigned integer parameter.
*/
template<class OP>
size_t len(const OP& param)
{
return std::get<size_t>( at(param.index()) );
}
/** Returns the number of slots that makes this algorithm.
*/
size_t size() const size_t size() const
{ {
return _size; return _size;
@ -166,14 +289,14 @@ class eoAlgoFoundry : public eoAlgo<EOT>
/** Return the underlying encoding vector. /** Return the underlying encoding vector.
*/ */
std::vector<size_t> encoding() const Encodings encodings() const
{ {
return _encoding; return _encodings;
} }
protected: protected:
const size_t _size; const size_t _size;
std::vector<size_t> _encoding; std::vector<Encoding> _encodings;
}; };

View file

@ -15,9 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group © 2020 Thales group
© 2022 Institut Pasteur
Authors: Authors:
Johann Dreo <johann.dreo@thalesgroup.com> Johann Dreo <johann@dreo.fr>
*/ */
#ifndef _eoAlgoFoundryEA_H_ #ifndef _eoAlgoFoundryEA_H_
@ -36,7 +37,7 @@
* which takes the class name as template and its constructor's parameters * which takes the class name as template and its constructor's parameters
* as arguments. For example: * as arguments. For example:
* @code * @code
* foundry.selectors.add< eoStochTournamentSelect<EOT> >( 0.5 ); * foundry.selectors.add< eoStochTournamentSelect<EOT> >( 0.5 );
* @endcode * @endcode
* *
* @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it * @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it
@ -46,34 +47,34 @@
* In a second step, the operators to be used should be selected * In a second step, the operators to be used should be selected
* by indicating their index, just like the foundry was a array of five elements: * by indicating their index, just like the foundry was a array of five elements:
* @code * @code
* foundry = {0, 1, 2, 0, 3}; * foundry = {size_t{0}, size_t{1}, size_t{2}, size_t{0}, size_t{3}};
* // ^ ^ ^ ^ ^ replacement * // ^ ^ ^ ^ ^ replacement
* // | | | + selection * // | | | + selection
* // | | + mutation * // | | + mutation
* // | + crossover * // | + crossover
* // + continue * // + continue
* @endcode * @endcode
* *
* @note: by default, the firsts of the five operators are selected. * @note by default, the firsts of the five operators are select ed.
* *
* If you don't (want to) recall the order of the operators in the encoding, * If you don't (want to) recall the order of the operators in the encoding,
* you can use the `index()` member, for example: * you can use the `index()` member, for example:
* @code * @code
* foundry.at(foundry.continuators.index()) = 2; // select the third continuator * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator
* @endcode * @endcode
* *
* Now, you can call the fourdry just like any eoAlgo, by passing it an eoPop: * Now, you can call the fourdry just like any eoAlgo, by passing it an eoPop:
* @code * @code
* foundry(pop); * foundry(pop);
* @encode * @endcode
* It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * It will instantiate the needed operators (only) and the algorithm itself on-the-fly,
* and then run it. * and then run it.
* *
* @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated.
* Every instantiation is deferred upon actual use. That way, you can still reconfigure them * Every instantiation is deferred upon actual use. That way, you can still reconfigure them
* at any time with `eoForgeOperator::setup`, for example: * at any time with `eoForgeOperator::setup`, for example:
* @code * @code
* foundry.selector.at(0).setup(0.5); // using constructor's arguments * foundry.selectors.at(0).setup(0.5); // using constructor's arguments
* @endcode * @endcode
* *
* @ingroup Foundry * @ingroup Foundry
@ -111,11 +112,11 @@ class eoAlgoFoundryEA : public eoAlgoFoundry<EOT>
*/ */
void operator()(eoPop<EOT>& pop) void operator()(eoPop<EOT>& pop)
{ {
assert(continuators.size() > 0); assert(this->at(continuators.index()) < continuators.size()); assert(continuators.size() > 0); assert(this->rank(continuators) < continuators.size());
assert( crossovers.size() > 0); assert(this->at( crossovers.index()) < crossovers.size()); assert( crossovers.size() > 0); assert(this->rank( crossovers) < crossovers.size());
assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size()); assert( mutations.size() > 0); assert(this->rank( mutations) < mutations.size());
assert( selectors.size() > 0); assert(this->at( selectors.index()) < selectors.size()); assert( selectors.size() > 0); assert(this->rank( selectors) < selectors.size());
assert(replacements.size() > 0); assert(this->at(replacements.index()) < replacements.size()); assert(replacements.size() > 0); assert(this->rank(replacements) < replacements.size());
eoSequentialOp<EOT> variator; eoSequentialOp<EOT> variator;
variator.add(this->crossover(), 1.0); variator.add(this->crossover(), 1.0);
@ -134,17 +135,17 @@ class eoAlgoFoundryEA : public eoAlgoFoundry<EOT>
/** Return an approximate name of the seected algorithm. /** Return an approximate name of the seected algorithm.
* *
* @note: does not take into account parameters of the operators, * @note does not take into account parameters of the operators,
* only show class names. * only show class names.
*/ */
std::string name() std::string name()
{ {
std::ostringstream name; std::ostringstream name;
name << this->at(continuators.index()) << " (" << this->continuator().className() << ") + "; name << this->continuator().className() << " [" << this->rank(continuators) << "] + ";
name << this->at(crossovers.index()) << " (" << this->crossover().className() << ") + "; name << this->crossover() .className() << " [" << this->rank(crossovers) << "] + ";
name << this->at(mutations.index()) << " (" << this->mutation().className() << ") + "; name << this->mutation() .className() << " [" << this->rank(mutations) << "] + ";
name << this->at(selectors.index()) << " (" << this->selector().className() << ") + "; name << this->selector() .className() << " [" << this->rank(selectors) << "] + ";
name << this->at(replacements.index()) << " (" << this->replacement().className() << ")"; name << this->replacement().className() << " [" << this->rank(replacements) << "]";
return name.str(); return name.str();
} }
@ -153,34 +154,44 @@ class eoAlgoFoundryEA : public eoAlgoFoundry<EOT>
const size_t _max_gen; const size_t _max_gen;
public: public:
/** Currently selected continuator.
*/
eoContinue<EOT>& continuator() eoContinue<EOT>& continuator()
{ {
assert(this->at(continuators.index()) < continuators.size()); assert(this->rank(continuators) < continuators.size());
return continuators.instantiate(this->at(continuators.index())); return continuators.instantiate(this->rank(continuators));
} }
/** Currently selected crossover.
*/
eoQuadOp<EOT>& crossover() eoQuadOp<EOT>& crossover()
{ {
assert(this->at(crossovers.index()) < crossovers.size()); assert(this->rank(crossovers) < crossovers.size());
return crossovers.instantiate(this->at(crossovers.index())); return crossovers.instantiate(this->rank(crossovers));
} }
/** Currently selected mutation.
*/
eoMonOp<EOT>& mutation() eoMonOp<EOT>& mutation()
{ {
assert(this->at(mutations.index()) < mutations.size()); assert(this->rank(mutations) < mutations.size());
return mutations.instantiate(this->at(mutations.index())); return mutations.instantiate(this->rank(mutations));
} }
/** Currently selected selector.
*/
eoSelectOne<EOT>& selector() eoSelectOne<EOT>& selector()
{ {
assert(this->at(selectors.index()) < selectors.size()); assert(this->rank(selectors) < selectors.size());
return selectors.instantiate(this->at(selectors.index())); return selectors.instantiate(this->rank(selectors));
} }
/** Currently selected replacement.
*/
eoReplacement<EOT>& replacement() eoReplacement<EOT>& replacement()
{ {
assert(this->at(replacements.index()) < replacements.size()); assert(this->rank(replacements) < replacements.size());
return replacements.instantiate(this->at(replacements.index())); return replacements.instantiate(this->rank(replacements));
} }
}; };

View file

@ -29,48 +29,61 @@
/** A class that assemble an eoFastGA on the fly, given a combination of available operators. /** A class that assemble an eoFastGA on the fly, given a combination of available operators.
* *
* The foundry should first be set up with sets of operators * The foundry should first be set up with sets of operators/parameters
* for the main modules of a FastGA: * for the main modules of a FastGA:
* continuators, crossovers, mutations, selections, replacement operators, etc. * continuators, crossovers (and rate of call), mutations (and rate of call),
* selections, replacement operators, offspring size, etc.
* *
* This is done through public member variable's `add` method, * This is done through public member variable's `add` method,
* which takes the class name as template and its constructor's parameters * which takes the class name as template and its constructor's parameters
* as arguments. For example: * as arguments. For example:
* @code * @code
* foundry.selectors.add< eoRandomSelect<EOT> >(); * foundry.selectors.add< eoRandomSelect<EOT> >();
* @endcode * @endcode
* *
* @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it * @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it
* in a `std::ref`, or it will silently be passed as a copy, * in a `std::ref`, or it will silently be passed as a copy,
* which would effectively disable any link with other operator(s). * which would effectively disable any link with other operator(s).
* *
* In a second step, the operators to be used should be selected * In a second step, the operators to be used should be selected
* by indicating their index, passing an array of 10 elements: * by indicating their wanted index or value, passing an array of 10 elements:
* @code * @code
* foundry.select({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); * foundry.select({
* double{0.1}, // crossover rate
* size_t{1}, // crossover selector
* size_t{2}, // crossover
* size_t{3}, // selector after crossover
* double{0.4}, // mutation rate
* size_t{5}, // mutation selector
* size_t{6}, // mutation
* size_t{7}, // replacement
* size_t{8}, // continuator
* size_t{9} // nb of offsprings
* });
* @endcode * @endcode
* *
* @note: by default, the firsts of the 10 operators are selected. * @note by default, the firsts of the 10 operators are selected.
* *
* If you don't (want to) recall the order of the operators in the encoding, * If you don't (want to) recall the order of the operators in the encoding,
* you can use the `index()` member, for example: * you can use the `index()` member, for example:
* @code * @code
* foundry.at(foundry.continuators.index()) = 2; // select the third continuator * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator
* @endcode * @endcode
* *
* Now, you can call the foundry just like any eoAlgo, by passing it an eoPop: * Now, you can call the foundry just like any eoAlgo, by passing it an eoPop:
* @code * @code
* foundry(pop); * foundry(pop);
* @encode * @endcode
*
* It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * It will instantiate the needed operators (only) and the algorithm itself on-the-fly,
* and then run it. * and then run it.
* *
* @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated.
* Every instantiation is deferred upon actual use. That way, you can still reconfigure them * Every instantiation is deferred upon actual use. That way, you can still reconfigure them
* at any time with `eoForgeOperator::setup`, for example: * at any time with `eoForgeOperator::setup`, for example:
* @code * @code
* foundry.selector.at(0).setup(0.5); // Will call constructor's arguments * foundry.selector.at(0).setup(0.5); // Will call constructor's arguments
* @endcode * @endcode
* *
* @ingroup Foundry * @ingroup Foundry
* @ingroup Algorithms * @ingroup Algorithms
@ -111,31 +124,31 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
public: public:
/* Operators containers @{ */ /* Operators containers @{ */
eoParameterFoundry< double > crossover_rates; eoParameterFoundry< double > crossover_rates;
eoOperatorFoundry< eoSelectOne<EOT> > crossover_selectors; eoOperatorFoundry< eoSelectOne<EOT> > crossover_selectors;
eoOperatorFoundry< eoQuadOp<EOT> > crossovers; eoOperatorFoundry< eoQuadOp<EOT> > crossovers;
eoOperatorFoundry< eoSelectOne<EOT> > aftercross_selectors; eoOperatorFoundry< eoSelectOne<EOT> > aftercross_selectors;
eoParameterFoundry< double > mutation_rates; eoParameterFoundry< double > mutation_rates;
eoOperatorFoundry< eoSelectOne<EOT> > mutation_selectors; eoOperatorFoundry< eoSelectOne<EOT> > mutation_selectors;
eoOperatorFoundry< eoMonOp<EOT> > mutations; eoOperatorFoundry< eoMonOp<EOT> > mutations;
eoOperatorFoundry< eoReplacement<EOT> > replacements; eoOperatorFoundry< eoReplacement<EOT> > replacements;
eoOperatorFoundry< eoContinue<EOT> > continuators; eoOperatorFoundry< eoContinue<EOT> > continuators;
eoParameterFoundry< size_t > offspring_sizes; eoParameterFoundry< size_t > offspring_sizes;
/* @} */ /* @} */
/** instantiate and call the pre-selected algorithm. /** instantiate and call the pre-selected algorithm.
*/ */
void operator()(eoPop<EOT>& pop) void operator()(eoPop<EOT>& pop)
{ {
assert( crossover_selectors.size() > 0); assert(this->at( crossover_selectors.index()) < crossover_selectors.size()); assert( crossover_selectors.size() > 0); assert(this->rank( crossover_selectors) < crossover_selectors.size());
assert( crossovers.size() > 0); assert(this->at( crossovers.index()) < crossovers.size()); assert( crossovers.size() > 0); assert(this->rank( crossovers) < crossovers.size());
assert(aftercross_selectors.size() > 0); assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size()); assert(aftercross_selectors.size() > 0); assert(this->rank(aftercross_selectors) < aftercross_selectors.size());
assert( mutation_selectors.size() > 0); assert(this->at( mutation_selectors.index()) < mutation_selectors.size()); assert( mutation_selectors.size() > 0); assert(this->rank( mutation_selectors) < mutation_selectors.size());
assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size()); assert( mutations.size() > 0); assert(this->rank( mutations) < mutations.size());
assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size()); assert( replacements.size() > 0); assert(this->rank( replacements) < replacements.size());
assert( continuators.size() > 0); assert(this->at( continuators.index()) < continuators.size()); assert( continuators.size() > 0); assert(this->rank( continuators) < continuators.size());
// Objective function calls counter // Objective function calls counter
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals); eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
@ -165,7 +178,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
try { try {
// restart(pop); // restart(pop);
algo(pop); algo(pop);
} catch(eoMaxEvalException e) { } catch(eoMaxEvalException & e) {
#ifndef NDEBUG #ifndef NDEBUG
eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl; eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl;
#endif #endif
@ -181,17 +194,18 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
std::string name() std::string name()
{ {
std::ostringstream name; std::ostringstream name;
name << "crossover_rates: " << this->at( crossover_rates.index()) << " (" << this-> crossover_rate() << ") + "; name << "crossover_rate: " << this-> crossover_rate() << " + ";
name << "crossover_selectors: " << this->at( crossover_selectors.index()) << " (" << this-> crossover_selector().className() << ") + "; name << "crossover_selector: " << this-> crossover_selector().className() << " [" << this->rank( crossover_selectors) << "] + ";
name << "aftercross_selector: " << this->at(aftercross_selectors.index()) << " (" << this->aftercross_selector().className() << ") + "; name << "aftercross_selector: " << this->aftercross_selector().className() << " [" << this->rank(aftercross_selectors) << "] + ";
name << "crossovers: " << this->at( crossovers.index()) << " (" << this-> crossover().className() << ") + "; name << "crossover: " << this-> crossover().className() << " [" << this->rank( crossovers) << "] + ";
name << "mutation_rates: " << this->at( mutation_rates.index()) << " (" << this-> mutation_rate() << ") + "; name << "mutation_rate: " << this-> mutation_rate() << " + ";
name << "mutation_selectors: " << this->at( mutation_selectors.index()) << " (" << this-> mutation_selector().className() << ") + "; name << "mutation_selector: " << this-> mutation_selector().className() << " [" << this->rank( mutation_selectors) << "] + ";
name << "mutations: " << this->at( mutations.index()) << " (" << this-> mutation().className() << ") + "; name << "mutation: " << this-> mutation().className() << " [" << this->rank( mutations) << "] + ";
name << "replacements: " << this->at( replacements.index()) << " (" << this-> replacement().className() << ") + "; name << "replacement: " << this-> replacement().className() << " [" << this->rank( replacements) << "] + ";
name << "continuators: " << this->at( continuators.index()) << " (" << this-> continuator().className() << ") + "; name << "continuator: " << this-> continuator().className() << " [" << this->rank( continuators) << "] + ";
name << "offspring_sizes: " << this->at( offspring_sizes.index()) << " (" << this-> offspring_size() << ")"; name << "offspring_size: " << this-> offspring_size() << "";
return name.str();
return name.str();
} }
protected: protected:
@ -201,61 +215,97 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
const size_t _max_restarts; const size_t _max_restarts;
public: public:
/** Currently selected continuator.
*/
eoContinue<EOT>& continuator() eoContinue<EOT>& continuator()
{ {
assert(this->at(continuators.index()) < continuators.size()); const size_t r = this->rank(continuators);
return continuators.instantiate(this->at(continuators.index())); assert(r < continuators.size());
return continuators.instantiate(r);
} }
/** Currently selected crossover_rate.
*/
double& crossover_rate() double& crossover_rate()
{ {
return crossover_rates.instantiate(this->at(crossover_rates.index())); // We could have used `decltype(crossover_rates)::Type` instead of `double`, here,
// but this is less readable and the type is declared just above,
// so we are supposed to know it.
const double val = this->value(crossover_rates);
assert(crossover_rates.min() <= val and val <= crossover_rates.max());
return crossover_rates.instantiate(val);
} }
/** Currently selected crossover.
*/
eoQuadOp<EOT>& crossover() eoQuadOp<EOT>& crossover()
{ {
assert(this->at(crossovers.index()) < crossovers.size()); const size_t r = this->rank(crossovers);
return crossovers.instantiate(this->at(crossovers.index())); assert(r < crossovers.size());
return crossovers.instantiate(r);
} }
/** Currently selected mutation_rate.
*/
double& mutation_rate() double& mutation_rate()
{ {
return mutation_rates.instantiate(this->at(mutation_rates.index())); const double val = this->value(mutation_rates);
assert(mutation_rates.min() <= val and val <= mutation_rates.max());
return mutation_rates.instantiate(val);
} }
/** Currently selected mutation.
*/
eoMonOp<EOT>& mutation() eoMonOp<EOT>& mutation()
{ {
assert(this->at(mutations.index()) < mutations.size()); const size_t r = this->rank(mutations);
return mutations.instantiate(this->at(mutations.index())); assert(r < mutations.size());
return mutations.instantiate(r);
} }
/** Currently selected crossover_selector.
*/
eoSelectOne<EOT>& crossover_selector() eoSelectOne<EOT>& crossover_selector()
{ {
assert(this->at(crossover_selectors.index()) < crossover_selectors.size()); const size_t r = this->rank(crossover_selectors);
return crossover_selectors.instantiate(this->at(crossover_selectors.index())); assert(r < crossover_selectors.size());
return crossover_selectors.instantiate(r);
} }
/** Currently selected aftercross_selector.
*/
eoSelectOne<EOT>& aftercross_selector() eoSelectOne<EOT>& aftercross_selector()
{ {
assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size()); const size_t r = this->rank(aftercross_selectors);
return aftercross_selectors.instantiate(this->at(aftercross_selectors.index())); assert(r < aftercross_selectors.size());
return aftercross_selectors.instantiate(r);
} }
/** Currently selected mutation_selector.
*/
eoSelectOne<EOT>& mutation_selector() eoSelectOne<EOT>& mutation_selector()
{ {
assert(this->at(mutation_selectors.index()) < mutation_selectors.size()); const size_t r = this->rank(mutation_selectors);
return mutation_selectors.instantiate(this->at(mutation_selectors.index())); assert(r < mutation_selectors.size());
return mutation_selectors.instantiate(r);
} }
/** Currently selected offspring_size.
*/
size_t& offspring_size() size_t& offspring_size()
{ {
return offspring_sizes.instantiate(this->at(offspring_sizes.index())); const size_t val = this->len(offspring_sizes);
assert(offspring_sizes.min() <= val and val <= offspring_sizes.max());
return offspring_sizes.instantiate(val);
} }
/** Currently selected replacement.
*/
eoReplacement<EOT>& replacement() eoReplacement<EOT>& replacement()
{ {
assert(this->at(replacements.index()) < replacements.size()); const size_t r = this->rank(replacements);
return replacements.instantiate(this->at(replacements.index())); assert(r < replacements.size());
return replacements.instantiate(r);
} }
}; };

View file

@ -174,18 +174,18 @@ protected:
// if the flight does not need to be used, use the dummy flight instance // if the flight does not need to be used, use the dummy flight instance
class eoDummyFlight:public eoFlight < POT > class eoDummyFlight:public eoFlight < POT >
{ {
public: public:
eoDummyFlight () {} eoDummyFlight () {}
void operator () (POT &) {} void operator() (POT &) override {}
}dummyFlight; } dummyFlight;
// if the initializer does not need to be used, use the dummy one instead // if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT > class eoDummyInitializer:public eoInitializerBase < POT >
{ {
public: public:
eoDummyInitializer () {} eoDummyInitializer () {}
void operator () (POT &) {} void operator() () override {}
}dummyInit; } dummyInit;
}; };
/** /**

View file

@ -15,9 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group © 2020 Thales group
© 2022 Institut Pasteur
Authors: Authors:
Johann Dreo <johann.dreo@thalesgroup.com> Johann Dreo <johann@dreo.fr>
*/ */
#ifndef _eoEvalFoundryEA_H_ #ifndef _eoEvalFoundryEA_H_
@ -70,13 +71,6 @@ public:
i_repl(foundry.replacements.index()) i_repl(foundry.replacements.index())
{ } { }
protected:
const size_t i_cont;
const size_t i_cros;
const size_t i_muta;
const size_t i_sele;
const size_t i_repl;
public: public:
/** Decode the high-level problem encoding as an array of indices. /** Decode the high-level problem encoding as an array of indices.
@ -90,7 +84,7 @@ public:
* auto& cont = foundry.continuator(); // Get the configured operator * auto& cont = foundry.continuator(); // Get the configured operator
* @encode * @encode
*/ */
std::vector<size_t> decode( const EOT& sol ) const typename eoAlgoFoundry<SUB>::Encodings decode( const EOT& sol ) const
{ {
// // Denormalize // // Denormalize
// size_t cont = static_cast<size_t>(std::ceil( sol[i_cont] * _foundry.continuators.size() )); // size_t cont = static_cast<size_t>(std::ceil( sol[i_cont] * _foundry.continuators.size() ));
@ -125,18 +119,18 @@ public:
_subpb_eval(pop,pop); _subpb_eval(pop,pop);
auto config = decode(sol); auto config = decode(sol);
double cont = config[i_cont]; size_t cont = std::get<size_t>(config[i_cont]);
double cros = config[i_cros]; size_t cros = std::get<size_t>(config[i_cros]);
double muta = config[i_muta]; size_t muta = std::get<size_t>(config[i_muta]);
double sele = config[i_sele]; size_t sele = std::get<size_t>(config[i_sele]);
double repl = config[i_repl]; size_t repl = std::get<size_t>(config[i_repl]);
if( if(
0 <= cont and cont < _foundry.continuators.size() cont < _foundry.continuators.size()
and 0 <= cros and cros < _foundry.crossovers .size() and cros < _foundry.crossovers .size()
and 0 <= muta and muta < _foundry.mutations .size() and muta < _foundry.mutations .size()
and 0 <= sele and sele < _foundry.selectors .size() and sele < _foundry.selectors .size()
and 0 <= repl and repl < _foundry.replacements.size() and repl < _foundry.replacements.size()
) { ) {
_foundry.select(config); _foundry.select(config);
@ -155,6 +149,13 @@ protected:
eoAlgoFoundryEA<SUB>& _foundry; eoAlgoFoundryEA<SUB>& _foundry;
const typename EOT::Fitness _penalization; const typename EOT::Fitness _penalization;
const size_t _pop_size; const size_t _pop_size;
const size_t i_cont;
const size_t i_cros;
const size_t i_muta;
const size_t i_sele;
const size_t i_repl;
}; };
/** Helper function to instanciate an eoEvalFoundryEA without having to indicate the template for the sub-problem encoding. /** Helper function to instanciate an eoEvalFoundryEA without having to indicate the template for the sub-problem encoding.

View file

@ -21,9 +21,9 @@ Authors:
Johann Dréo <johann.dreo@thalesgroup.com> Johann Dréo <johann.dreo@thalesgroup.com>
*/ */
#if !defined(__unix__) && !defined(_WINDOWS) #if !defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS)
#warning "Warning: class 'eoEvalUserTimeThrowException' is only available under UNIX (defining 'rusage' in 'sys/resource.h') or Win32 (defining 'GetProcessTimes' in 'WinBase.h') systems, contributions for other systems are welcomed." #warning "Warning: class 'eoEvalUserTimeThrowException' is only available under UNIX (defining 'rusage' in 'sys/resource.h') or Win32 (defining 'GetProcessTimes' in 'WinBase.h') systems, contributions for other systems are welcomed."
#else //!defined(__unix__) && !defined(_WINDOWS) #else // defined(_POSIX_VERSION) || defined(__unix__) || defined(_WINDOWS)
#ifndef __EOEVALUSERTIMETHROWEXCEPTION_H__ #ifndef __EOEVALUSERTIMETHROWEXCEPTION_H__
#define __EOEVALUSERTIMETHROWEXCEPTION_H__ #define __EOEVALUSERTIMETHROWEXCEPTION_H__
@ -40,7 +40,7 @@ Johann Dréo <johann.dreo@thalesgroup.com>
#include "eoExceptions.h" #include "eoExceptions.h"
#ifdef __unix__ #if defined(_POSIX_VERSION) || defined(__unix__)
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
@ -106,6 +106,6 @@ protected:
}; };
#endif // _WINDOWS #endif // _WINDOWS
#endif //__unix__ #endif // defined(_POSIX_VERSION) || defined(__unix__)
#endif // __EOEVALUSERTIMETHROWEXCEPTION_H__ #endif // __EOEVALUSERTIMETHROWEXCEPTION_H__
#endif //!defined(__unix__) && !defined(_WINDOWS) #endif //!defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS)

View file

@ -45,7 +45,7 @@ public:
const char* what() const throw() const char* what() const throw()
{ {
return message().c_str(); return _msg.c_str();
} }
~eoException() throw() {} ~eoException() throw() {}

View file

@ -13,6 +13,11 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2022 Institut Pasteur
Authors:
Johann Dreo <johann@dreo.fr>
*/ */
#ifndef _eoFastGA_H_ #ifndef _eoFastGA_H_
@ -116,6 +121,11 @@ public:
eoPop<EOT> crossed; eoPop<EOT> crossed;
crossed.push_back(sol1); crossed.push_back(sol1);
crossed.push_back(sol2); crossed.push_back(sol2);
// The aftercross selector may need fitness,
// so we evaluate those two solutions, if needed.
_pop_eval(crossed,crossed);
_select_aftercross.setup(crossed); _select_aftercross.setup(crossed);
EOT sol3 = _select_aftercross(crossed); EOT sol3 = _select_aftercross(crossed);

View file

@ -15,9 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group © 2020 Thales group
© 2022 Institut Pasteur
Authors: Authors:
Johann Dreo <johann.dreo@thalesgroup.com> Johann Dreo <johann@dreo.fr>
*/ */
#ifndef _eoForge_H_ #ifndef _eoForge_H_
@ -26,6 +27,7 @@
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include <memory>
// In case you want to debug arguments captured in tuples: // In case you want to debug arguments captured in tuples:
// template<typename Type, unsigned N, unsigned Last> // template<typename Type, unsigned N, unsigned Last>
@ -73,6 +75,7 @@ class eoForgeInterface
{ {
public: public:
virtual Itf& instantiate(bool no_cache = true) = 0; virtual Itf& instantiate(bool no_cache = true) = 0;
virtual std::shared_ptr<Itf> instantiate_ptr(bool no_cache = true) = 0;
virtual ~eoForgeInterface() {} virtual ~eoForgeInterface() {}
}; };
@ -111,6 +114,7 @@ class eoForgeOperator : public eoForgeInterface<Itf>
template<class ...Args2> template<class ...Args2>
eoForgeOperator(Args2... args) : eoForgeOperator(Args2... args) :
_args(std::forward<Args2>(args)...), _args(std::forward<Args2>(args)...),
_instantiated_ptr(nullptr),
_instantiated(nullptr) _instantiated(nullptr)
{ } { }
@ -122,9 +126,9 @@ class eoForgeOperator : public eoForgeInterface<Itf>
* *
* @param no_cache If false, will enable caching previous instances. * @param no_cache If false, will enable caching previous instances.
*/ */
Itf& instantiate(bool no_cache = true) Itf& instantiate(bool no_cache = true) override
{ {
if(no_cache or not _instantiated) { if(no_cache or _instantiated == nullptr) {
if(_instantiated) { if(_instantiated) {
delete _instantiated; delete _instantiated;
} }
@ -133,7 +137,19 @@ class eoForgeOperator : public eoForgeInterface<Itf>
return *_instantiated; return *_instantiated;
} }
virtual ~eoForgeOperator() std::shared_ptr<Itf> instantiate_ptr(bool no_cache = true) override
{
if(no_cache or _instantiated == nullptr) {
// if(_instantiated) {
// delete _instantiated;
// }
_instantiated_ptr = op_constructor_ptr(_args);
// _instantiated = op_constructor(_args);
}
return _instantiated_ptr;
}
virtual ~eoForgeOperator() override
{ {
delete _instantiated; delete _instantiated;
} }
@ -149,9 +165,16 @@ class eoForgeOperator : public eoForgeInterface<Itf>
// FIXME double-check that the copy-constructor is a good idea to make_from_tuple with dynamic storage duration. // FIXME double-check that the copy-constructor is a good idea to make_from_tuple with dynamic storage duration.
return new Op(std::make_from_tuple<Op>(args)); return new Op(std::make_from_tuple<Op>(args));
} }
template<class T>
std::shared_ptr<Op> op_constructor_ptr(T& args)
{
return std::make_shared<Op>( std::make_from_tuple<Op>(args) );
}
/** @} */ /** @} */
protected: protected:
std::shared_ptr<Itf> _instantiated_ptr;
Itf* _instantiated; Itf* _instantiated;
}; };
@ -162,12 +185,13 @@ class eoForgeOperator<Itf,Op> : public eoForgeInterface<Itf>
{ {
public: public:
eoForgeOperator() : eoForgeOperator() :
_instantiated_ptr(nullptr),
_instantiated(nullptr) _instantiated(nullptr)
{ } { }
Itf& instantiate( bool no_cache = true ) Itf& instantiate( bool no_cache = true ) override
{ {
if(no_cache or not _instantiated) { if(no_cache or _instantiated == nullptr) {
if(_instantiated) { if(_instantiated) {
delete _instantiated; delete _instantiated;
} }
@ -176,28 +200,37 @@ class eoForgeOperator<Itf,Op> : public eoForgeInterface<Itf>
return *_instantiated; return *_instantiated;
} }
virtual ~eoForgeOperator() std::shared_ptr<Itf> instantiate_ptr( bool no_cache = true ) override
{
if(no_cache or _instantiated == nullptr) {
_instantiated_ptr = std::shared_ptr<Op>();
}
return _instantiated_ptr;
}
virtual ~eoForgeOperator() override
{ {
delete _instantiated; delete _instantiated;
} }
protected: protected:
std::shared_ptr<Itf> _instantiated_ptr;
Itf* _instantiated; Itf* _instantiated;
}; };
/** A vector holding an operator with deferred instantiation at a given index. /** A vector holding an operator (with deferred instantiation) at a given index.
* *
* @note You can actually store several instances of the same class, * @note You can actually store several instances of the same class,
* with different parametrization (or not). * with different parametrization (or not).
* *
* @warning When passing a reference (as it is often the case within ParadisEO), * @warning When passing a reference (as it is often the case within ParadisEO),
* it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy.
* This is is a source of bug which your compiler will to detect and that would * This is is a source of bug which your compiler will fail to detect and that would
* disable any link between operators. * disable any link between operators.
* *
* @warning You may want to enable instantiation cache to grab some performances. * @warning You may want to enable instantiation cache to grab some performances.
* The default is set to disable the cache, because its use with operators * The default is set to disable the cache, because its use with operators
* which hold a state will lead to unwanted behaviour. * which hold a state will lead to unwanted behaviour.
* *
* @code * @code
eoForgeVector<eoSelect<EOT>> factories(false); eoForgeVector<eoSelect<EOT>> factories(false);
@ -240,7 +273,7 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
/** instantiate the operator managed at the given index. /** instantiate the operator managed at the given index.
*/ */
Itf& instantiate(double index) Itf& instantiate_from(double index)
{ {
double frac_part, int_part; double frac_part, int_part;
frac_part = std::modf(index, &int_part); frac_part = std::modf(index, &int_part);
@ -248,9 +281,33 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl; eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl;
assert(frac_part != 0); assert(frac_part != 0);
} }
return instantiate(index);
}
std::shared_ptr<Itf> instantiate_ptr_from(double index)
{
double frac_part, int_part;
frac_part = std::modf(index, &int_part);
if(frac_part != 0) {
eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl;
assert(frac_part != 0);
}
return instantiate_ptr(index);
}
/** instantiate the operator managed at the given index.
*/
Itf& instantiate(size_t index)
{
return this->at(static_cast<size_t>(index))->instantiate(_no_cache); return this->at(static_cast<size_t>(index))->instantiate(_no_cache);
} }
std::shared_ptr<Itf> instantiate_ptr(size_t index)
{
return this->at(static_cast<size_t>(index))->instantiate_ptr(_no_cache);
}
/** Add an operator to the list. /** Add an operator to the list.
* *
* @warning When passing a reference (as it is often the case within ParadisEO), * @warning When passing a reference (as it is often the case within ParadisEO),
@ -319,18 +376,169 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
bool _no_cache; bool _no_cache;
}; };
/** A map holding an operator (with deferred instantiation) at a given name.
*
* @note You can actually store several instances of the same class,
* with different parametrization (or not).
*
* @warning When passing a reference (as it is often the case within ParadisEO),
* it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy.
* This is is a source of bug which your compiler will fail to detect and that would
* disable any link between operators.
*
* @warning You may want to enable instantiation cache to grab some performances.
* The default is set to disable the cache, because its use with operators
* which hold a state will lead to unwanted behaviour.
*
* @code
eoForgeMap<eoSelect<EOT>> factories(false);
// Capture constructor's parameters and defer instantiation.
factories.add<eoRankMuSelect<EOT>>(1);
factories.setup<eoRankMuSelect<EOT>>(0, 5); // Edit
// Actually instantiate.
eoSelect<EOT>& op = factories.instantiate(0);
// Call.
op();
* @endcode
*
* @ingroup Foundry
*/
template<class Itf, typename Enable = void>
class eoForgeMap : public std::map<std::string,eoForgeInterface<Itf>*>
{
public:
using Interface = Itf;
/** Default constructor do not cache instantiations.
*
* @warning
* You most probably want to disable caching for operators that hold a state.
* If you enable the cache, the last used instantiation will be used,
* at its last state.
* For example, continuators should most probably not be cached,
* as they very often hold a state in the form of a counter.
* At the end of a search, the continuator will be in the end state,
* and thus always ask for a stop.
* Reusing an instance in this state will de facto disable further searches.
*
* @param always_reinstantiate If false, will enable cache for the forges in this container.
*/
eoForgeMap( bool always_reinstantiate = true ) :
_no_cache(always_reinstantiate)
{ }
/** instantiate the operator managed at the given name.
*/
Itf& instantiate(const std::string& name)
{
return this->at(name)->instantiate(_no_cache);
}
/** Add an operator to the list.
*
* @warning When passing a reference (as it is often the case within ParadisEO),
* it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy.
* This is is a source of bug which your compiler will to detect and that would
* disable any link between operators.
*
*/
template<class Op, typename... Args>
void add(const std::string& name, Args... args)
{
// We decay all args to ensure storing everything by value within the forge.
// The references should thus be wrapped in a std::ref.
auto pfo = new eoForgeOperator<Itf,Op,std::decay_t<Args>...>(
std::forward<Args>(args)...);
this->insert({name, pfo});
}
/** Specialization for operators with empty constructors.
*/
template<class Op>
void add(const std::string& name)
{
eoForgeInterface<Itf>* pfo = new eoForgeOperator<Itf,Op>;
this->insert({name, pfo});
}
/** Change the set up arguments to the constructor.
*
* @warning When passing a reference (as it is often the case within ParadisEO),
* it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy.
* This is is a source of bug which your compiler will to detect and that would
* disable any link between operators.
*
* @warning The operator at `name` should have been added with eoForgeMap::add already..
*/
template<class Op, typename... Args>
void setup(const std::string& name, Args... args)
{
delete this->at(name); // Silent on nullptr.
auto pfo = new eoForgeOperator<Itf,Op,std::decay_t<Args>...>(
std::forward<Args>(args)...);
this->emplace({name, pfo});
}
/** Specialization for empty constructors.
*/
template<class Op>
void setup(const std::string& name)
{
delete this->at(name);
auto pfo = new eoForgeOperator<Itf,Op>;
this->emplace({name, pfo});
}
virtual ~eoForgeMap()
{
for(auto kv : *this) {
delete kv.second;
}
}
protected:
bool _no_cache;
};
/** A range holding a parameter value at a given index.
*
* This is essential a scalar numerical parameter, with bounds check
* and an interface similar to an eoForgeVector.
*
* @note Contrary to eoForgeVector, this does not store a set of possible values.
*
* @code
eoForgeScalar<double> factories(0.0, 1.0);
// Actually instantiate.
double param = factories.instantiate(0.5);
* @endcode
*
* @ingroup Foundry
*/
template<class Itf> template<class Itf>
class eoForgeScalar class eoForgeScalar
{ {
public: public:
using Interface = Itf; using Interface = Itf;
/** Constructor
*
* @param min Minimum possible value.
* @param may Maximum possible value.
*/
eoForgeScalar(Itf min, Itf max) : eoForgeScalar(Itf min, Itf max) :
_min(min), _min(min),
_max(max) _max(max)
{ } { }
/** Just return the same value, without managing any instantiation. /** Just return the same value, without managing any instantiation.
*
* Actually checks if value is in range.
*/ */
Itf& instantiate(double value) Itf& instantiate(double value)
{ {
@ -353,18 +561,24 @@ class eoForgeScalar
Itf min() const { return _min; } Itf min() const { return _min; }
Itf max() const { return _max; } Itf max() const { return _max; }
/** Set the minimum possible value.
*/
void min(Itf min) void min(Itf min)
{ {
assert(_min <= _max); assert(_min <= _max);
_min = min; _min = min;
} }
/** Set the maximum possible value.
*/
void max(Itf max) void max(Itf max)
{ {
assert(_max >= _min); assert(_max >= _min);
_max = max; _max = max;
} }
/** Set the possible range of values.
*/
void setup(Itf min, Itf max) void setup(Itf min, Itf max)
{ {
_min = min; _min = min;

View file

@ -114,7 +114,12 @@ eoFunctorBase::procedure_tag functor_category(const eoF<R>&)
result_type result_type
**/ **/
template <class A1, class R> template <class A1, class R>
#if __cplusplus >= 201103L
class eoUF : public eoFunctorBase, public std::function<R(A1)>
#else
// Deprecated in C++11
class eoUF : public eoFunctorBase, public std::unary_function<A1, R> class eoUF : public eoFunctorBase, public std::unary_function<A1, R>
#endif
{ {
public : public :
@ -151,7 +156,12 @@ eoFunctorBase::unary_function_tag functor_category(const eoUF<A1, R>&)
result_type result_type
**/ **/
template <class A1, class A2, class R> template <class A1, class A2, class R>
#if __cplusplus >= 201103L
class eoBF : public eoFunctorBase, public std::function<R(A1, A2)>
#else
// Deprecated in C++11
class eoBF : public eoFunctorBase, public std::binary_function<A1, A2, R> class eoBF : public eoFunctorBase, public std::binary_function<A1, A2, R>
#endif
{ {
public : public :
/// virtual dtor here so there is no need to define it in derived classes /// virtual dtor here so there is no need to define it in derived classes

View file

@ -29,11 +29,12 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <random>
#include "eoOp.h" #include "eoOp.h"
#include "eoSTLFunctor.h" #include "eoSTLFunctor.h"
#include "utils/eoRndGenerators.h" #include "utils/eoRndGenerators.h"
#include "utils/rnd_generators.h" // for shuffle method // #include "utils/rnd_generators.h" // for shuffle method
#include "eoExceptions.h" #include "eoExceptions.h"
@ -193,17 +194,20 @@ class eoInitPermutation: public eoInit<EOT> // FIXME inherit from eoInitWithDim
virtual void operator()(EOT& chrom) virtual void operator()(EOT& chrom)
{ {
chrom.resize(chromSize); chrom.resize(chromSize);
for(unsigned idx=0;idx <chrom.size();idx++) for(unsigned idx=0; idx < chrom.size(); idx++) {
chrom[idx]=idx+startFrom; chrom[idx] = idx+startFrom;
}
std::shuffle(chrom.begin(), chrom.end(),gen); std::random_device rd;
std::mt19937 gen(rd());
std::shuffle(chrom.begin(), chrom.end(), gen);
chrom.invalidate(); chrom.invalidate();
} }
private : private :
unsigned chromSize; unsigned chromSize;
unsigned startFrom; unsigned startFrom;
UF_random_generator<unsigned int> gen; // UF_random_generator<unsigned int> gen;
}; };
/** @example t-eoInitPermutation.cpp /** @example t-eoInitPermutation.cpp
*/ */

View file

@ -36,9 +36,12 @@
* *
* @ingroup Representations * @ingroup Representations
*/ */
template <class FitT, class T = size_t> class eoInt: public eoVector<FitT, T> template <class FitT, class T = size_t>
class eoInt: public eoVector<FitT, T>
{ {
public: public:
using AtomType = size_t;
using FitnessType = FitT;
/** /**
* (Default) Constructor. * (Default) Constructor.

View file

@ -82,9 +82,9 @@ public:
// replace if necessary // replace if necessary
for(i = 0; i < i1; i++) { for(i = 0; i < i1; i++) {
while (p1[ _solution1[i] ] != -1) while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values!
_solution1[i] = p1[_solution1[i]]; _solution1[i] = p1[_solution1[i]];
while (p2[ _solution2[i] ] != -1) while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values!
_solution2[i] = p2[_solution2[i]]; _solution2[i] = p2[_solution2[i]];
} }
@ -96,9 +96,9 @@ public:
// replace if necessary // replace if necessary
for(i = i2 + 1; i < _solution1.size(); i++) { for(i = i2 + 1; i < _solution1.size(); i++) {
while (p1[ _solution1[i] ] != -1) while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values!
_solution1[i] = p1[_solution1[i]]; _solution1[i] = p1[_solution1[i]];
while (p2[ _solution2[i] ] != -1) while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values!
_solution2[i] = p2[_solution2[i]]; _solution2[i] = p2[_solution2[i]];
} }

View file

@ -45,7 +45,7 @@ Authors:
#include "eoOp.h" // for eoInit #include "eoOp.h" // for eoInit
#include "eoPersistent.h" #include "eoPersistent.h"
#include "eoInit.h" #include "eoInit.h"
#include "utils/rnd_generators.h" // for shuffle method // #include "utils/rnd_generators.h" // for shuffle method
#include "eoExceptions.h" #include "eoExceptions.h"
/** A std::vector of EO object, to be used in all algorithms /** A std::vector of EO object, to be used in all algorithms

View file

@ -68,16 +68,12 @@ public:
} }
assert(not _pop[0].invalid()); assert(not _pop[0].invalid());
const typename EOT::Fitness min_fit
= std::min_element( std::begin(_pop), std::end(_pop) )
->fitness();
cumulative.clear(); cumulative.clear();
cumulative.push_back(_pop[0].fitness() - min_fit); cumulative.push_back(_pop[0].fitness() );
for (unsigned i = 1; i < _pop.size(); ++i) { for (unsigned i = 1; i < _pop.size(); ++i) {
assert(not _pop[i].invalid()); assert(not _pop[i].invalid());
cumulative.push_back(cumulative.back() + _pop[i].fitness() - min_fit); cumulative.push_back(cumulative.back() + _pop[i].fitness());
} }
assert(cumulative.size() == _pop.size()); assert(cumulative.size() == _pop.size());
} }
@ -95,7 +91,7 @@ public:
// assert(fortune <= cumulative.back()); // assert(fortune <= cumulative.back());
if(result - cumulative.begin() >= _pop.size()) { if(static_cast<size_t>(result - cumulative.begin()) >= _pop.size()) {
return _pop.back(); return _pop.back();
} else { } else {
return _pop[result - cumulative.begin()]; return _pop[result - cumulative.begin()];

View file

@ -40,73 +40,73 @@ template <class EOT>
class eoRanking : public eoPerf2Worth<EOT> // false: do not cache fitness class eoRanking : public eoPerf2Worth<EOT> // false: do not cache fitness
{ {
public: public:
using eoPerf2Worth<EOT>::value; using eoPerf2Worth<EOT>::value;
/* Ctor: /* Ctor:
@param _p selective pressure (in (1,2] @param _p selective pressure (in (1,2]
@param _e exponent (1 == linear) @param _e exponent (1 == linear)
*/ */
eoRanking(double _p=2.0, double _e=1.0): eoRanking(double _p = 2.0, double _e = 1.0) : pressure(_p), exponent(_e)
pressure(_p), exponent(_e) {}
/* helper function: finds index in _pop of _eo, an EOT * */
int lookfor(const EOT *_eo, const eoPop<EOT>& _pop)
{ {
typename eoPop<EOT>::const_iterator it; assert(1 < pressure and pressure <= 2);
for (it=_pop.begin(); it<_pop.end(); it++)
{
if (_eo == &(*it))
return it-_pop.begin();
}
throw eoException("Not found in eoLinearRanking");
} }
/* COmputes the ranked fitness: fitnesses range in [m,M] /* helper function: finds index in _pop of _eo, an EOT * */
with m=2-pressure/popSize and M=pressure/popSize. int lookfor(const EOT *_eo, const eoPop<EOT> &_pop)
in between, the progression depstd::ends on exponent (linear if 1).
*/
virtual void operator()(const eoPop<EOT>& _pop)
{ {
std::vector<const EOT *> rank; typename eoPop<EOT>::const_iterator it;
_pop.sort(rank); for (it = _pop.begin(); it < _pop.end(); it++)
unsigned pSize =_pop.size();
unsigned int pSizeMinusOne = pSize-1;
if (pSize <= 1)
throw eoPopSizeException(pSize,"cannot do ranking with population of size <= 1");
// value() refers to the std::vector of worthes (we're in an eoParamvalue)
value().resize(pSize);
double beta = (2-pressure)/pSize;
if (exponent == 1.0) // no need for exponetial then
{ {
double alpha = (2*pressure-2)/(pSize*pSizeMinusOne); if (_eo == &(*it))
for (unsigned i=0; i<pSize; i++) return it - _pop.begin();
}
throw eoException("Not found in eoLinearRanking");
}
/* COmputes the ranked fitness: fitnesses range in [m,M]
with m=2-pressure/popSize and M=pressure/popSize.
in between, the progression depstd::ends on exponent (linear if 1).
*/
virtual void operator()(const eoPop<EOT> &_pop)
{
std::vector<const EOT *> rank;
_pop.sort(rank);
unsigned pSize = _pop.size();
unsigned int pSizeMinusOne = pSize - 1;
if (pSize <= 1)
throw eoPopSizeException(pSize, "cannot do ranking with population of size <= 1");
// value() refers to the std::vector of worthes (we're in an eoParamvalue)
value().resize(pSize);
double beta = (2 - pressure) / pSize;
if (exponent == 1.0) // no need for exponential then
{
double alpha = (2 * pressure - 2) / (pSize * pSizeMinusOne);
for (unsigned i = 0; i < pSize; i++)
{ {
int which = lookfor(rank[i], _pop); int which = lookfor(rank[i], _pop);
value()[which] = alpha*(pSize-i)+beta; // worst -> 1/[P(P-1)/2] value()[which] = alpha * (pSize - i) + beta; // worst -> 1/[P(P-1)/2]
} }
} }
else // exponent != 1 else // exponent != 1
{ {
double gamma = (2*pressure-2)/pSize; double gamma = (2 * pressure - 2) / pSize;
for (unsigned i=0; i<pSize; i++) for (unsigned i = 0; i < pSize; i++)
{ {
int which = lookfor(rank[i], _pop); int which = lookfor(rank[i], _pop);
// value in in [0,1] // value is in [0,1]
double tmp = ((double)(pSize-i))/pSize; double tmp = ((double)(pSize - i)) / pSize;
// to the exponent, and back to [m,M] // to the exponent, and back to [m,M]
value()[which] = gamma*pow(tmp, exponent)+beta; value()[which] = gamma * pow(tmp, exponent) + beta;
} }
} }
} }
private:
double pressure; // selective pressure private:
double exponent; double pressure; // selective pressure
double exponent;
}; };
#endif #endif

139
eo/src/eoRankingCached.h Normal file
View file

@ -0,0 +1,139 @@
/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
-----------------------------------------------------------------------------
eoRankingCached.h
(c) Maarten Keijzer, Marc Schoenauer, 2001
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
#ifndef eoRankingCached_h
#define eoRankingCached_h
#include "eoPerf2Worth.h"
/**
* @class eoRankingCached
* @brief Cached version of eoRanking that stores precomputed values for better performance
*
* This class implements the same ranking algorithm as eoRanking but adds a caching layer
* that stores frequently used values when the population size remains constant between
* calls. This optimization is particularly useful in steady-state evolution where the
* population size typically doesn't change between selection operations.
*
* The caching mechanism stores:
* - Population size related values (pSize, pSizeMinusOne)
* - Precomputed coefficients (alpha, beta, gamma)
*
* @warning This optimization should only be used when the population size remains constant
* between calls to the operator. For dynamic population sizes, use the standard eoRanking.
*
* @ingroup Selectors
*/
template <class EOT>
class eoRankingCached : public eoPerf2Worth<EOT>
{
public:
using eoPerf2Worth<EOT>::value;
/* Ctor:
@param _p selective pressure (in (1,2]
@param _e exponent (1 == linear)
*/
eoRankingCached(double _p = 2.0, double _e = 1.0) : pressure(_p), exponent(_e), cached_pSize(0)
{
assert(1 < pressure and pressure <= 2);
}
/*
Computes the ranked fitness with caching optimization
Fitnesses range in [m,M] where:
- m = 2-pressure/popSize
- M = pressure/popSize
The progression between m and M depends on the exponent (linear when exponent=1)
@param _pop The population to rank
*/
virtual void operator()(const eoPop<EOT> &_pop)
{
unsigned pSize = _pop.size();
if (pSize <= 1)
throw eoPopSizeException(pSize, "cannot do ranking with population of size <= 1");
// value() refers to the std::vector of worthes (we're in an eoParamvalue)
value().resize(pSize);
// Cache population-size dependent values only when population size changes
if (pSize != cached_pSize)
{
cached_pSize = pSize;
cached_pSizeMinusOne = pSize - 1;
cached_beta = (2 - pressure) / pSize;
cached_gamma = (2 * pressure - 2) / pSize;
cached_alpha = (2 * pressure - 2) / (pSize * cached_pSizeMinusOne);
}
std::vector<const EOT *> rank;
_pop.sort(rank);
// map of indices for the population
std::unordered_map<const EOT *, unsigned> indexMap;
for (unsigned i = 0; i < pSize; ++i)
{
indexMap[&_pop[i]] = i;
}
if (exponent == 1.0) // no need for exponential then (linear case)
{
for (unsigned i = 0; i < pSize; i++)
{
const EOT *indiv = rank[i];
int which = indexMap[indiv];
value()[which] = cached_alpha * (pSize - i) + cached_beta;
}
}
else // non-linear case (exponent != 1)
{
for (unsigned i = 0; i < pSize; i++)
{
const EOT *indiv = rank[i];
int which = indexMap[indiv];
// value is in [0,1]
double tmp = ((double)(pSize - i)) / pSize;
// to the exponent, and back to [m,M]
value()[which] = cached_gamma * pow(tmp, exponent) + cached_beta;
}
}
}
private:
double pressure; // selective pressure (1 < pressure <= 2)
double exponent; // exponent (1 = linear)
// Cached values (recomputed only when population size changes)
unsigned cached_pSize; // last seen population size
unsigned cached_pSizeMinusOne; // pSize - 1
double cached_alpha; // linear scaling coefficient
double cached_beta; // base value coefficient
double cached_gamma; // non-linear scaling coefficient
};
#endif

74
eo/src/eoRealToIntInit.h Normal file
View file

@ -0,0 +1,74 @@
#ifndef eoRealToIntInit_h_INCLUDED
#define eoRealToIntInit_h_INCLUDED
#include "es/eoReal.h"
#include "utils/eoIntBounds.h"
template<class EOTINT, class EOTREAL = eoReal<typename EOTINT::FitnessType>>
class eoRealToIntInit : public eoInit<EOTINT>
{
public:
using EOTreal = EOTREAL;
enum Repair {
folds,
truncate
};
eoRealToIntInit( eoInit<EOTreal>& init ) :
_whenout(Repair::truncate),
_nobounds(),
_bounds(_nobounds),
_init(init)
{ }
eoRealToIntInit( eoInit<EOTreal>& init, eoIntBounds& bounds, Repair whenout = Repair::truncate ) :
_whenout(whenout),
_nobounds(),
_bounds(bounds),
_init(init)
{ }
virtual void operator()(EOTINT& intsol) override
{
#ifndef NDEBUG
for(size_t i=0; i < intsol.size(); ++i) {
assert(_bounds.isInBounds(intsol[i]));
}
#endif
EOTreal floatsol;
std::copy( std::begin(intsol), std::end(intsol), std::back_inserter(floatsol) );
_init(floatsol);
intsol.resize(floatsol.size());
for(size_t i=0; i < floatsol.size(); ++i) {
typename EOTreal::AtomType rounded = std::round(floatsol[i]);
if( not _bounds.isInBounds(rounded) ) {
switch(_whenout) {
case Repair::truncate:
_bounds.truncate(rounded);
break;
case Repair::folds:
_bounds.foldsInBounds(rounded);
break;
}
}
intsol[i] = static_cast<typename EOTINT::AtomType>(rounded);
}
}
protected:
Repair _whenout;
eoIntNoBounds _nobounds;
eoIntBounds& _bounds;
eoInit<EOTreal>& _init;
};
#endif // eoRealToIntInit_h_INCLUDED

73
eo/src/eoRealToIntMonOp.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef eoRealToIntMonOp_h_INCLUDED
#define eoRealToIntMonOp_h_INCLUDED
#include "es/eoReal.h"
#include "utils/eoIntBounds.h"
template<class EOTINT, class EOTREAL = eoReal<typename EOTINT::FitnessType>>
class eoRealToIntMonOp : public eoMonOp<EOTINT>
{
public:
using EOTreal = EOTREAL;
enum Repair {
folds,
truncate
};
eoRealToIntMonOp( eoMonOp<EOTreal>& monop ) :
_whenout(Repair::truncate),
_nobounds(),
_bounds(_nobounds),
_monop(monop)
{ }
eoRealToIntMonOp( eoMonOp<EOTreal>& monop, eoIntBounds& bounds, Repair whenout = Repair::truncate ) :
_whenout(whenout),
_nobounds(),
_bounds(bounds),
_monop(monop)
{ }
bool operator()(EOTINT& intsol)
{
#ifndef NDEBUG
for(size_t i=0; i < intsol.size(); ++i) {
assert(_bounds.isInBounds(intsol[i]));
}
#endif
EOTreal floatsol;
std::copy( std::begin(intsol), std::end(intsol), std::back_inserter(floatsol) );
bool changed = _monop(floatsol);
if(changed) {
for(size_t i=0; i < floatsol.size(); ++i) {
typename EOTreal::AtomType rounded = std::round(floatsol[i]);
if( not _bounds.isInBounds(rounded) ) {
switch(_whenout) {
case Repair::truncate:
_bounds.truncate(rounded);
break;
case Repair::folds:
_bounds.foldsInBounds(rounded);
break;
}
}
intsol[i] = static_cast<typename EOTINT::AtomType>(rounded);
}
}
return changed;
}
protected:
Repair _whenout;
eoIntNoBounds _nobounds;
eoIntBounds& _bounds;
eoMonOp<EOTreal>& _monop;
};
#endif // eoRealToIntMonOp_h_INCLUDED

View file

@ -0,0 +1,94 @@
#ifndef eoRealToIntQuadOp_h_INCLUDED
#define eoRealToIntQuadOp_h_INCLUDED
#include "es/eoReal.h"
#include "utils/eoIntBounds.h"
template<class EOTINT, class EOTREAL = eoReal<typename EOTINT::FitnessType>>
class eoRealToIntQuadOp : public eoQuadOp<EOTINT>
{
public:
using EOTreal = EOTREAL;
enum Repair {
folds,
truncate
};
eoRealToIntQuadOp( eoQuadOp<EOTreal>& quadop ) :
_whenout(Repair::truncate),
_nobounds(),
_bounds(_nobounds),
_quadop(quadop)
{ }
eoRealToIntQuadOp( eoQuadOp<EOTreal>& quadop, eoIntBounds& bounds, Repair whenout = Repair::truncate ) :
_whenout(whenout),
_nobounds(),
_bounds(bounds),
_quadop(quadop)
{ }
bool operator()(EOTINT& intsol1, EOTINT& intsol2)
{
#ifndef NDEBUG
for(size_t i=0; i < intsol1.size(); ++i) {
assert(_bounds.isInBounds(intsol1[i]));
}
for(size_t i=0; i < intsol2.size(); ++i) {
assert(_bounds.isInBounds(intsol2[i]));
}
#endif
EOTreal floatsol1;
std::copy( std::begin(intsol1), std::end(intsol1), std::back_inserter(floatsol1) );
EOTreal floatsol2;
std::copy( std::begin(intsol2), std::end(intsol2), std::back_inserter(floatsol2) );
bool changed = _quadop(floatsol1, floatsol2);
if(changed) {
for(size_t i=0; i < floatsol1.size(); ++i) {
typename EOTreal::AtomType rounded = std::round(floatsol1[i]);
if( not _bounds.isInBounds(rounded) ) {
switch(_whenout) {
case Repair::truncate:
_bounds.truncate(rounded);
break;
case Repair::folds:
_bounds.foldsInBounds(rounded);
break;
}
}
intsol1[i] = static_cast<typename EOTINT::AtomType>(rounded);
}
for(size_t i=0; i < floatsol2.size(); ++i) {
typename EOTreal::AtomType rounded = std::round(floatsol2[i]);
if( not _bounds.isInBounds(rounded) ) {
switch(_whenout) {
case Repair::truncate:
_bounds.truncate(rounded);
break;
case Repair::folds:
_bounds.foldsInBounds(rounded);
break;
}
}
intsol2[i] = static_cast<typename EOTINT::AtomType>(rounded);
}
}
return changed;
}
protected:
Repair _whenout;
eoIntNoBounds _nobounds;
eoIntBounds& _bounds;
eoQuadOp<EOTreal>& _quadop;
};
#endif // eoRealToIntQuadOp_h_INCLUDED

View file

@ -35,6 +35,8 @@
#include <csignal> #include <csignal>
#include "eoContinue.h" #include "eoContinue.h"
typedef void (*sighandler_t)(int);
/** @addtogroup Continuators /** @addtogroup Continuators
* @{ * @{
*/ */

View file

@ -79,7 +79,12 @@ void eoSTLF<void>::operator()(void)
respectively respectively
*/ */
template <class A1, class R> template <class A1, class R>
#if __cplusplus >= 201103L
class eoSTLUF : public std::function<R(A1)>
#else
// Deprecated since C++11
class eoSTLUF : public std::unary_function<A1, R> class eoSTLUF : public std::unary_function<A1, R>
#endif
{ {
public: public:
eoSTLUF(eoUF<A1,R>& _f) : f(_f) {} eoSTLUF(eoUF<A1,R>& _f) : f(_f) {}
@ -102,7 +107,12 @@ class eoSTLUF : public std::unary_function<A1, R>
respectively respectively
*/ */
template <class A1, class A2, class R> template <class A1, class A2, class R>
#if __cplusplus >= 201103L
class eoSTLBF : public std::function<R(A1, A2)>
#else
// Deprecated since C++11
class eoSTLBF : public std::binary_function<A1, A2, R> class eoSTLBF : public std::binary_function<A1, A2, R>
#endif
{ {
public: public:
eoSTLBF(eoUF<A1,R>& _f) : f(_f) {} eoSTLBF(eoUF<A1,R>& _f) : f(_f) {}

View file

@ -44,7 +44,7 @@ template <class EOT> class eoStochasticUniversalSelect: public eoSelectOne<EOT>
{ {
public: public:
/// Sanity check /// Sanity check
eoStochasticUniversalSelect(const eoPop<EOT>& pop = eoPop<EOT>()) eoStochasticUniversalSelect(/*const eoPop<EOT>& pop = eoPop<EOT>()*/)
{ {
if (minimizing_fitness<EOT>()) if (minimizing_fitness<EOT>())
throw eoException("eoStochasticUniversalSelect: minimizing fitness"); throw eoException("eoStochasticUniversalSelect: minimizing fitness");

View file

@ -230,27 +230,25 @@ protected:
// if the eval does not need to be used, use the dummy eval instance // if the eval does not need to be used, use the dummy eval instance
class eoDummyEval : public eoEvalFunc<POT> class eoDummyEval : public eoEvalFunc<POT>
{
public:
void operator()(POT &)
{}
}
dummyEval;
class eoDummyFlight:public eoFlight < POT >
{ {
public: public:
eoDummyFlight () {} void operator()(POT &) override {}
void operator () (POT &) {} } dummyEval;
}dummyFlight;
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator() (POT &) override {}
} dummyFlight;
// if the initializer does not need to be used, use the dummy one instead // if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT > class eoDummyInitializer:public eoInitializerBase < POT >
{ {
public: public:
eoDummyInitializer () {} eoDummyInitializer () {}
void operator () (POT &) {} void operator() () override {}
}dummyInit; } dummyInit;
}; };
/** @example t-eoSyncEasyPSO.cpp /** @example t-eoSyncEasyPSO.cpp

View file

@ -113,16 +113,19 @@ CMAParams::CMAParams(eoParser& parser, unsigned dimensionality) {
for (unsigned i = 0; i < weights.size(); ++i) { for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = mu - i; weights[i] = mu - i;
} }
break;
} }
case 2: case 2:
{ {
weights = 1.; weights = 1.;
break;
} }
default : default :
{ {
for (unsigned i = 0; i < weights.size(); ++i) { for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = log(mu+1.)-log(i+1.); weights[i] = log(mu+1.)-log(i+1.);
} }
break;
} }
} }

View file

@ -39,6 +39,7 @@
template <class FitT> class eoReal: public eoVector<FitT, double> template <class FitT> class eoReal: public eoVector<FitT, double>
{ {
public: public:
using AtomType = double;
using FitnessType = FitT; using FitnessType = FitT;
/** /**

View file

@ -361,10 +361,10 @@ template<class Chrom> class eoUBitXover: public eoQuadOp<Chrom>
{ {
if (chrom1[i] != chrom2[i] && eo::rng.flip(preference)) if (chrom1[i] != chrom2[i] && eo::rng.flip(preference))
{ {
// bool tmp = chrom1[i]; bool tmp = chrom1[i];
// chrom1[i]=chrom2[i]; chrom1[i]=chrom2[i];
// chrom2[i] = tmp; chrom2[i] = tmp;
std::swap(chrom1[i], chrom2[i]); // std::swap(chrom1[i], chrom2[i]);
changed = true; changed = true;
} }
} }

View file

@ -7,6 +7,8 @@
/** Standard bit mutation with mutation rate p: /** Standard bit mutation with mutation rate p:
* choose k from the binomial distribution Bin(n,p) and apply flip_k(x). * choose k from the binomial distribution Bin(n,p) and apply flip_k(x).
* *
* If rate is null (the default), use 1/chrom.size().
*
* @ingroup Bitstrings * @ingroup Bitstrings
* @ingroup Variators * @ingroup Variators
*/ */
@ -14,7 +16,11 @@ template<class EOT>
class eoStandardBitMutation : public eoMonOp<EOT> class eoStandardBitMutation : public eoMonOp<EOT>
{ {
public: public:
eoStandardBitMutation(double rate = 0.5) : /** Constructor.
*
* @param rate mutation rate, 1/chrom.size() if ignored or zero (the default)
*/
eoStandardBitMutation(double rate = 0) :
_rate(rate), _rate(rate),
_nb(1), _nb(1),
_bitflip(_nb) _bitflip(_nb)
@ -22,9 +28,12 @@ class eoStandardBitMutation : public eoMonOp<EOT>
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
assert(chrom.size()>0);
if(_rate == 0) {
_rate = (double) 1/chrom.size();
}
_nb = eo::rng.binomial(chrom.size(),_rate); _nb = eo::rng.binomial(chrom.size(),_rate);
// BitFlip operator is bound to the _nb reference, _bitflip.number_bits(_nb);
// thus one don't need to re-instantiate.
return _bitflip(chrom); return _bitflip(chrom);
} }
@ -46,8 +55,7 @@ template<class EOT>
class eoUniformBitMutation : public eoMonOp<EOT> class eoUniformBitMutation : public eoMonOp<EOT>
{ {
public: public:
eoUniformBitMutation(double rate = 0.5) : eoUniformBitMutation() :
_rate(rate),
_nb(1), _nb(1),
_bitflip(_nb) _bitflip(_nb)
{} {}
@ -55,15 +63,13 @@ class eoUniformBitMutation : public eoMonOp<EOT>
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
_nb = eo::rng.random(chrom.size()); _nb = eo::rng.random(chrom.size());
// BitFlip operator is bound to the _nb reference, _bitflip.number_bits(_nb);
// thus one don't need to re-instantiate.
return _bitflip(chrom); return _bitflip(chrom);
} }
virtual std::string className() const {return "eoUniformBitMutation";} virtual std::string className() const {return "eoUniformBitMutation";}
protected: protected:
double _rate;
unsigned _nb; unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip; eoDetSingleBitFlip<EOT> _bitflip;
}; };
@ -84,17 +90,21 @@ template<class EOT>
class eoConditionalBitMutation : public eoStandardBitMutation<EOT> class eoConditionalBitMutation : public eoStandardBitMutation<EOT>
{ {
public: public:
eoConditionalBitMutation(double rate = 0.5) : eoConditionalBitMutation(double rate = 0) :
eoStandardBitMutation<EOT>(rate) eoStandardBitMutation<EOT>(rate)
{} {}
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
assert(chrom.size()>0); assert(chrom.size()>0);
this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); if(this->_rate == 0) {
this->_nb++; this->_rate = (double) 1/chrom.size();
// BitFlip operator is bound to the _nb reference, }
// thus one don't need to re-instantiate. this->_nb = 0;
while(this->_nb < 1) {
this->_nb = eo::rng.binomial(chrom.size(),this->_rate);
}
this->_bitflip.number_bits(this->_nb);
return this->_bitflip(chrom); return this->_bitflip(chrom);
} }
@ -123,12 +133,14 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
assert(chrom.size()>0); assert(chrom.size()>0);
this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); if(this->_rate == 0) {
this->_rate = (double) 1/chrom.size();
}
this->_nb = eo::rng.binomial(chrom.size(),this->_rate);
if(this->_nb == 0) { if(this->_nb == 0) {
this->_nb = 1; this->_nb = 1;
} }
// BitFlip operator is bound to the _nb reference, this->_bitflip.number_bits(this->_nb);
// thus one don't need to re-instantiate.
return this->_bitflip(chrom); return this->_bitflip(chrom);
} }
@ -142,7 +154,7 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
* *
* From: * From:
* Furong Ye, Carola Doerr, and Thomas Back. * Furong Ye, Carola Doerr, and Thomas Back.
* Interpolating local and global search by controllingthe variance of standard bit mutation. * Interpolating local and global search by controlling the variance of standard bit mutation.
* In 2019 IEEE Congress on Evolutionary Computation(CEC), pages 22922299. * In 2019 IEEE Congress on Evolutionary Computation(CEC), pages 22922299.
* *
* In contrast to standard bit mutation, this operators allows to scale * In contrast to standard bit mutation, this operators allows to scale
@ -152,29 +164,40 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
* @ingroup Variators * @ingroup Variators
*/ */
template<class EOT> template<class EOT>
class eoNormalBitMutation : public eoStandardBitMutation<EOT> class eoNormalBitMutation : public eoMonOp<EOT>
{ {
public: public:
eoNormalBitMutation(double rate = 0.5, double variance = 1) : eoNormalBitMutation(double mean = 0, double variance = 0) :
eoStandardBitMutation<EOT>(rate), _mean(mean),
_variance(variance) _variance(variance),
_nb(1),
_bitflip(_nb)
{} {}
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
this->_nb = eo::rng.normal(this->_rate * chrom.size(), _variance); assert(chrom.size() > 0);
if(this->_nb >= chrom.size()) { if(_mean == 0) {
this->_nb = eo::rng.random(chrom.size()); _mean = (double) 1/chrom.size();
} }
// BitFlip operator is bound to the _nb reference, if(_variance == 0) {
// thus one don't need to re-instantiate. _variance = std::log(chrom.size());
return this->_bitflip(chrom); }
_nb = eo::rng.normal(_mean, _variance);
if(_nb >= chrom.size()) {
_nb = eo::rng.random(chrom.size());
}
_bitflip.number_bits(_nb);
return _bitflip(chrom);
} }
virtual std::string className() const {return "eoNormalBitMutation";} virtual std::string className() const {return "eoNormalBitMutation";}
protected: protected:
double _mean;
double _variance; double _variance;
unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip;
}; };
/** Fast mutation which size is sampled from an adaptive power law. /** Fast mutation which size is sampled from an adaptive power law.
@ -188,11 +211,10 @@ class eoNormalBitMutation : public eoStandardBitMutation<EOT>
* @ingroup Variators * @ingroup Variators
*/ */
template<class EOT> template<class EOT>
class eoFastBitMutation : public eoStandardBitMutation<EOT> class eoFastBitMutation : public eoMonOp<EOT>
{ {
public: public:
eoFastBitMutation(double rate = 0.5, double beta = 1.5) : eoFastBitMutation(double beta = 1.5) :
eoStandardBitMutation<EOT>(rate),
_beta(beta) _beta(beta)
{ {
assert(beta > 1); assert(beta > 1);
@ -200,26 +222,96 @@ class eoFastBitMutation : public eoStandardBitMutation<EOT>
virtual bool operator()(EOT& chrom) virtual bool operator()(EOT& chrom)
{ {
this->_nb = powerlaw(chrom.size(),_beta); _nb = powerlaw(chrom.size(),_beta);
// BitFlip operator is bound to the _nb reference, _bitflip.number_bits(_nb);
// thus one don't need to re-instantiate. return _bitflip(chrom);
return this->_bitflip(chrom);
} }
virtual std::string className() const {return "eoFastBitMutation";} virtual std::string className() const {return "eoFastBitMutation";}
protected: protected:
double powerlaw(unsigned int n, double beta)
double powerlaw(unsigned n, double beta)
{ {
double cnb = 0; double cnb = 0;
for(unsigned i=1; i<n; ++i) { for(unsigned int i=1; i<=n/2; ++i) {
cnb += std::pow(i,-beta); cnb += std::pow(i,-beta);
} }
return eo::rng.powerlaw(0,n,beta) / cnb; double trigger = eo::rng.uniform(0,1);
double cursor = 0;
double rate = 1;
for(unsigned int i=1; i<=n/2; ++i) {
cursor += std::pow(i,-beta) / cnb;
if(cursor >= trigger) {
rate = static_cast<double>(i) / static_cast<double>(n);
break;
}
}
return eo::rng.binomial(n,rate);
} }
// double powerlaw(unsigned n, double beta)
// {
// double cnb = 0;
// for(unsigned i=1; i<n; ++i) {
// cnb += std::pow(i,-beta);
// }
// return eo::rng.powerlaw(0,n,beta) / cnb;
// }
double _beta; double _beta;
unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip;
};
/** Bucket mutation which assign probability for each bucket
*
* @warning Highly untested code, use with caution.
*
* From:
* Carola Doerr, Johann Dreo, Alexis Robbes
*/
template<class EOT>
class eoBucketBitMutation : public eoMonOp<EOT>
{
public:
eoBucketBitMutation(std::vector<std::vector<int>> buckets, std::vector<double> bucketsValues) :
_buckets(buckets),
_bucketsValues(bucketsValues)
{
assert(buckets.size() == bucketsValues.size());
}
virtual bool operator()(EOT& chrom)
{
_nb = customlaw(chrom.size(), _buckets, _bucketsValues);
_bitflip.number_bits(_nb);
return _bitflip(chrom);
}
virtual std::string className() const {return "eoBucketBitMutation";}
protected:
double customlaw(unsigned n, std::vector<std::vector<int>> buckets, std::vector<double> bucketsValues)
{
int bucketIndex = eo::rng.roulette_wheel(bucketsValues);
int startBit = buckets[bucketIndex][0];
int endBit = buckets[bucketIndex][1];
int gapBit = endBit - startBit;
int nbBits;
if (gapBit > 0) {
nbBits = rand() % gapBit + startBit;
} else {
nbBits = endBit;
}
return nbBits;
}
std::vector<double> _bucketsValues;
std::vector<std::vector<int>> _buckets;
unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip;
}; };
#endif // _eoStandardBitMutation_h_ #endif // _eoStandardBitMutation_h_

View file

@ -50,7 +50,11 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree<FType, Node> >
protected: protected:
// a binary predicate for sorting // a binary predicate for sorting
// hopefully this will work with M$VC++ 6.0 // hopefully this will work with M$VC++ 6.0
#if __cplusplus >= 201103L
struct lt_arity:public std::function<bool(Node,Node)>
#else
struct lt_arity:public std::binary_function<Node,Node,bool> struct lt_arity:public std::binary_function<Node,Node,bool>
#endif
{ {
bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());}; bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());};
}; };

View file

@ -468,8 +468,11 @@ private :
switch(new_arity) switch(new_arity)
{ {
case 3 : args[2].copy(s.args[2]); args[2].parent = this; // no break! case 3 : args[2].copy(s.args[2]); args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].copy(s.args[1]); args[1].parent = this; case 2 : args[1].copy(s.args[1]); args[1].parent = this;
[[fallthrough]];
case 1 : args[0].copy(s.args[0]); args[0].parent = this; case 1 : args[0].copy(s.args[0]); args[0].parent = this;
[[fallthrough]];
case 0 : break; case 0 : break;
default : default :
{ {
@ -523,7 +526,9 @@ private :
switch(arity()) switch(arity())
{ {
case 3 : args[2].parent = 0; // no break! case 3 : args[2].parent = 0; // no break!
[[fallthrough]];
case 2 : args[1].parent = 0; case 2 : args[1].parent = 0;
[[fallthrough]];
case 1 : args[0].parent = 0; break; case 1 : args[0].parent = 0; break;
case 0 : break; case 0 : break;
default : default :
@ -542,7 +547,9 @@ private :
switch(arity()) switch(arity())
{ {
case 3 : args[2].parent = this; // no break! case 3 : args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].parent = this; case 2 : args[1].parent = this;
[[fallthrough]];
case 1 : args[0].parent = this; break; case 1 : args[0].parent = this; break;
case 0 : break; case 0 : break;
default : default :

View file

@ -29,6 +29,7 @@ Authors:
# include "../eoFunctor.h" # include "../eoFunctor.h"
# include "../eoExceptions.h" # include "../eoExceptions.h"
# include "mpi/implMpi.h"
# include "eoMpiNode.h" # include "eoMpiNode.h"
# include "eoMpiAssignmentAlgorithm.h" # include "eoMpiAssignmentAlgorithm.h"
@ -669,7 +670,7 @@ namespace eo
timerStat.start("master_wait_for_all_responses"); timerStat.start("master_wait_for_all_responses");
while( assignmentAlgo.availableWorkers() != totalWorkers ) while( assignmentAlgo.availableWorkers() != totalWorkers )
{ {
bmpi::status status = comm.probe( bmpi::any_source, eo::mpi::Channel::Messages ); eo::mpi::status status = comm.probe( eo::mpi::any_source, eo::mpi::Channel::Messages );
int wrkRank = status.source(); int wrkRank = status.source();
that.handleResponse( wrkRank ); that.handleResponse( wrkRank );
comm.send( wrkRank, Channel::Commands, Message::Finish ); comm.send( wrkRank, Channel::Commands, Message::Finish );
@ -686,7 +687,7 @@ namespace eo
AssignmentAlgorithm& assignmentAlgo; AssignmentAlgorithm& assignmentAlgo;
Job< JobData > & that; Job< JobData > & that;
bmpi::communicator & comm; eo::mpi::communicator & comm;
}; };
/** /**
@ -713,7 +714,7 @@ namespace eo
{ {
eo::log << eo::debug << "[M" << comm.rank() << "] Waitin' for node..." << std::endl; eo::log << eo::debug << "[M" << comm.rank() << "] Waitin' for node..." << std::endl;
bmpi::status status = comm.probe( bmpi::any_source, eo::mpi::Channel::Messages ); eo::mpi::status status = comm.probe( eo::mpi::any_source, eo::mpi::Channel::Messages );
int wrkRank = status.source(); int wrkRank = status.source();
eo::log << eo::debug << "[M" << comm.rank() << "] Node " << wrkRank << " just terminated." << std::endl; eo::log << eo::debug << "[M" << comm.rank() << "] Node " << wrkRank << " just terminated." << std::endl;
@ -797,7 +798,7 @@ namespace eo
AssignmentAlgorithm& assignmentAlgo; AssignmentAlgorithm& assignmentAlgo;
int masterRank; int masterRank;
const int workerStopCondition; const int workerStopCondition;
bmpi::communicator& comm; eo::mpi::communicator& comm;
JobStore<JobData>& store; JobStore<JobData>& store;
SendTaskFunction<JobData> & sendTask; SendTaskFunction<JobData> & sendTask;

View file

@ -27,14 +27,14 @@ namespace eo
{ {
void Node::init( int argc, char** argv ) void Node::init( int argc, char** argv )
{ {
static bmpi::environment env( argc, argv ); static eo::mpi::environment env( argc, argv );
} }
bmpi::communicator& Node::comm() eo::mpi::communicator& Node::comm()
{ {
return _comm; return _comm;
} }
bmpi::communicator Node::_comm; eo::mpi::communicator Node::_comm;
} }
} }

View file

@ -23,7 +23,7 @@ Authors:
# define __MPI_NODE_H__ # define __MPI_NODE_H__
# include "implMpi.h" # include "implMpi.h"
namespace bmpi = mpi; // namespace bmpi = mpi;
namespace eo namespace eo
{ {
@ -54,10 +54,10 @@ namespace eo
/** /**
* @brief Returns the global mpi::communicator * @brief Returns the global mpi::communicator
*/ */
static bmpi::communicator& comm(); static eo::mpi::communicator& comm();
protected: protected:
static bmpi::communicator _comm; static eo::mpi::communicator _comm;
}; };
} }
} }

View file

@ -54,7 +54,7 @@ namespace eo
typedef eoUF< eoPop<EOT>&, void> ResetAlgo; typedef eoUF< eoPop<EOT>&, void> ResetAlgo;
MultiStartData( MultiStartData(
bmpi::communicator& _comm, eo::mpi::communicator& _comm,
eoAlgo<EOT>& _algo, eoAlgo<EOT>& _algo,
int _masterRank, int _masterRank,
ResetAlgo & _resetAlgo ) ResetAlgo & _resetAlgo )
@ -87,7 +87,7 @@ namespace eo
/** /**
* @brief Communicator, used to send and retrieve messages. * @brief Communicator, used to send and retrieve messages.
*/ */
bmpi::communicator& comm; eo::mpi::communicator& comm;
/** /**
* @brief Algorithm which will be performed by the worker. * @brief Algorithm which will be performed by the worker.

View file

@ -137,7 +137,7 @@ namespace eo
std::vector<EOT> tempArray; std::vector<EOT> tempArray;
int masterRank; int masterRank;
bmpi::communicator& comm; eo::mpi::communicator& comm;
}; };
/** /**

View file

@ -21,6 +21,8 @@ Authors:
*/ */
#include "implMpi.h" #include "implMpi.h"
namespace eo
{
namespace mpi namespace mpi
{ {
const int any_source = MPI_ANY_SOURCE; const int any_source = MPI_ANY_SOURCE;
@ -159,8 +161,9 @@ namespace mpi
MPI_Barrier( MPI_COMM_WORLD ); MPI_Barrier( MPI_COMM_WORLD );
} }
void broadcast( communicator & comm, int value, int root ) void broadcast( communicator & /*comm*/, int value, int root )
{ {
MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD ); MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD );
} }
} } // namespace mpi
} // namespace eo

View file

@ -22,7 +22,7 @@ Authors:
#ifndef __EO_IMPL_MPI_HPP__ #ifndef __EO_IMPL_MPI_HPP__
#define __EO_IMPL_MPI_HPP__ #define __EO_IMPL_MPI_HPP__
#include "eoMpi.h" #include <mpi.h>
#include "../serial/eoSerial.h" #include "../serial/eoSerial.h"
/** /**
@ -41,282 +41,290 @@ Authors:
* The entities are here shortly described, if you need further details, don't hesitate * The entities are here shortly described, if you need further details, don't hesitate
* to visit the boost URL. * to visit the boost URL.
*/ */
namespace eo
namespace mpi
{ {
/** namespace mpi
* @ingroup Parallel
* @{
*/
/**
* @brief Constant indicating that a message can come from any process.
*/
extern const int any_source;
/**
* @brief Constant indicating that a message can come from any tag (channel).
*/
extern const int any_tag;
/**
* @brief Wrapper class to have a MPI environment.
*
* Instead of calling MPI_Init and MPI_Finalize, it is only necessary to instantiate
* this class once, in the global context.
*/
class environment
{ {
public: /**
* @ingroup Parallel
* @{
*/
/** /**
* @brief Inits MPI context. * @brief Constant indicating that a message can come from any process.
*/
extern const int any_source;
/**
* @brief Constant indicating that a message can come from any tag (channel).
*/
extern const int any_tag;
/**
* @brief Wrapper class to have a MPI environment.
* *
* @param argc Number of params in command line (same as one in main) * Instead of calling MPI_Init and MPI_Finalize, it is only necessary to instantiate
* @param argv Strings containing params (same as one in main) * this class once, in the global context.
*/ */
environment(int argc, char**argv); class environment
{
/**
* @brief Closes MPI context.
*/
~environment();
};
/**
* @brief Wrapper class for MPI_Status
*
* Consists only in a C++ wrapper class, giving getters on status attributes.
*/
class status
{
public: public:
/**
* @brief Inits MPI context.
*
* @param argc Number of params in command line (same as one in main)
* @param argv Strings containing params (same as one in main)
*/
environment(int argc, char **argv);
/**
* @brief Closes MPI context.
*/
~environment();
};
/* struct MPI_Status
{
int count;
int cancelled;
int MPI_SOURCE;
int MPI_TAG;
int MPI_ERROR;
}; */
/** /**
* @brief Converts a MPI_Status into a status. * @brief Wrapper class for MPI_Status
*
* Consists only in a C++ wrapper class, giving getters on status attributes.
*/ */
status( const MPI_Status & s ); class status
{
public:
/**
* @brief Converts a MPI_Status into a status.
*/
status(const MPI_Status &s);
/** /**
* @brief Returns the tag of the associated communication. * @brief Returns the tag of the associated communication.
*/ */
int tag() { return _tag; } int tag() { return _tag; }
/** /**
* @brief Indicates which error number we obtained in the associated communication. * @brief Indicates which error number we obtained in the associated communication.
*/ */
int error() { return _error; } int error() { return _error; }
/** /**
* @brief Returns the MPI rank of the source of the associated communication. * @brief Returns the MPI rank of the source of the associated communication.
*/ */
int source() { return _source; } int source() { return _source; }
private: private:
int _source; int _source;
int _tag; int _tag;
int _error; int _error;
}; };
/** /**
* @brief Main object, used to send / receive messages, get informations about the rank and the size of the world, * @brief Main object, used to send / receive messages, get informations about the rank and the size of the world,
* etc. * etc.
*/ */
class communicator class communicator
{ {
public: public:
/**
* Creates the communicator, using the whole world as a MPI_Comm.
*
* @todo Allow the user to precise which MPI_Comm to use
*/
communicator();
/** ~communicator();
* Creates the communicator, using the whole world as a MPI_Comm.
*
* @todo Allow the user to precise which MPI_Comm to use
*/
communicator( );
~communicator(); /**
* @brief Returns the MPI rank of the current process.
*/
int rank();
/** /**
* @brief Returns the MPI rank of the current process. * @brief Returns the size of the MPI cluster.
*/ */
int rank(); int size();
/** /*
* @brief Returns the size of the MPI cluster. * SEND / RECV INT
*/ */
int size();
/* /**
* SEND / RECV INT * @brief Sends an integer to dest on channel "tag".
*/ *
* @param dest MPI rank of the receiver
* @param tag MPI tag of message
* @param n The integer to send
*/
void send(int dest, int tag, int n);
/** /*
* @brief Sends an integer to dest on channel "tag". * @brief Receives an integer from src on channel "tag".
* *
* @param dest MPI rank of the receiver * @param src MPI rank of the sender
* @param tag MPI tag of message * @param tag MPI tag of message
* @param n The integer to send * @param n Where to save the received integer
*/ */
void send( int dest, int tag, int n ); void recv(int src, int tag, int &n);
/* /*
* @brief Receives an integer from src on channel "tag". * SEND / RECV STRING
* */
* @param src MPI rank of the sender
* @param tag MPI tag of message
* @param n Where to save the received integer
*/
void recv( int src, int tag, int& n );
/* /**
* SEND / RECV STRING * @brief Sends a string to dest on channel "tag".
*/ *
* @param dest MPI rank of the receiver
* @param tag MPI tag of message
* @param str The std::string to send
*/
void send(int dest, int tag, const std::string &str);
/** /*
* @brief Sends a string to dest on channel "tag". * @brief Receives a string from src on channel "tag".
* *
* @param dest MPI rank of the receiver * @param src MPI rank of the sender
* @param tag MPI tag of message * @param tag MPI tag of message
* @param str The std::string to send * @param std::string Where to save the received string
*/ */
void send( int dest, int tag, const std::string& str ); void recv(int src, int tag, std::string &str);
/* /*
* @brief Receives a string from src on channel "tag". * SEND / RECV Objects
* */
* @param src MPI rank of the sender
* @param tag MPI tag of message
* @param std::string Where to save the received string
*/
void recv( int src, int tag, std::string& str );
/* /**
* SEND / RECV Objects * @brief Sends an eoserial::Persistent to dest on channel "tag".
*/ *
* @param dest MPI rank of the receiver
* @param tag MPI tag of message
* @param persistent The object to send (it must absolutely implement eoserial::Persistent)
*/
void send(int dest, int tag, const eoserial::Persistent &persistent);
/** /**
* @brief Sends an eoserial::Persistent to dest on channel "tag". * @brief Sends an array of eoserial::Persistent to dest on channel "tag".
* *
* @param dest MPI rank of the receiver * @param dest MPI rank of the receiver
* @param tag MPI tag of message * @param tag MPI tag of message
* @param persistent The object to send (it must absolutely implement eoserial::Persistent) * @param table The array of eoserial::Persistent objects
*/ * @param size The number of elements to send (no check is done, the user has to be sure that the size won't
void send( int dest, int tag, const eoserial::Persistent & persistent ); * overflow!)
*/
/** template <class T>
* @brief Sends an array of eoserial::Persistent to dest on channel "tag". void send(int dest, int tag, T *table, int size)
*
* @param dest MPI rank of the receiver
* @param tag MPI tag of message
* @param table The array of eoserial::Persistent objects
* @param size The number of elements to send (no check is done, the user has to be sure that the size won't
* overflow!)
*/
template< class T >
void send( int dest, int tag, T* table, int size )
{
// Puts all the values into an array
eoserial::Array* array = new eoserial::Array;
for( int i = 0; i < size; ++i )
{ {
array->push_back( table[i].pack() ); // Puts all the values into an array
eoserial::Array *array = new eoserial::Array;
for (int i = 0; i < size; ++i)
{
array->push_back(table[i].pack());
}
// Encapsulates the array into an object
eoserial::Object *obj = new eoserial::Object;
obj->add("array", array);
std::stringstream ss;
obj->print(ss);
delete obj;
// Sends the object as a string
send(dest, tag, ss.str());
} }
// Encapsulates the array into an object /*
eoserial::Object* obj = new eoserial::Object; * @brief Receives an eoserial::Persistent object from src on channel "tag".
obj->add( "array", array ); *
std::stringstream ss; * @param src MPI rank of the sender
obj->print( ss ); * @param tag MPI tag of message
delete obj; * @param persistent Where to unpack the serialized object?
*/
void recv(int src, int tag, eoserial::Persistent &persistent);
// Sends the object as a string /*
send( dest, tag, ss.str() ); * @brief Receives an array of eoserial::Persistent from src on channel "tag".
} *
* @param src MPI rank of the sender
/* * @param tag MPI tag of message
* @brief Receives an eoserial::Persistent object from src on channel "tag". * @param table The table in which we're saving the received objects. It must have been allocated by the user,
* * as no allocation is performed here.
* @param src MPI rank of the sender * @param size The number of elements to receive (no check is done, the user has to be sure that the size won't
* @param tag MPI tag of message * overflow!)
* @param persistent Where to unpack the serialized object? */
*/ template <class T>
void recv( int src, int tag, eoserial::Persistent & persistent ); void recv(int src, int tag, T *table, int size)
/*
* @brief Receives an array of eoserial::Persistent from src on channel "tag".
*
* @param src MPI rank of the sender
* @param tag MPI tag of message
* @param table The table in which we're saving the received objects. It must have been allocated by the user,
* as no allocation is performed here.
* @param size The number of elements to receive (no check is done, the user has to be sure that the size won't
* overflow!)
*/
template< class T >
void recv( int src, int tag, T* table, int size )
{
// Receives the string which contains the object
std::string asText;
recv( src, tag, asText );
// Parses the object and retrieves the table
eoserial::Object* obj = eoserial::Parser::parse( asText );
eoserial::Array* array = static_cast<eoserial::Array*>( (*obj)["array"] );
// Retrieves all the values from the array
for( int i = 0; i < size; ++i )
{ {
eoserial::unpackObject( *array, i, table[i] ); // Receives the string which contains the object
std::string asText;
recv(src, tag, asText);
// Parses the object and retrieves the table
eoserial::Object *obj = eoserial::Parser::parse(asText);
eoserial::Array *array = static_cast<eoserial::Array *>((*obj)["array"]);
// Retrieves all the values from the array
for (int i = 0; i < size; ++i)
{
eoserial::unpackObject(*array, i, table[i]);
}
delete obj;
} }
delete obj;
}
/* /*
* Other methods * Other methods
*/ */
/** /**
* @brief Wrapper for MPI_Probe * @brief Wrapper for MPI_Probe
* *
* Waits for a message to come from process having rank src, on the channel * Waits for a message to come from process having rank src, on the channel
* tag. * tag.
* *
* @param src MPI rank of the sender (any_source if it can be any sender) * @param src MPI rank of the sender (any_source if it can be any sender)
* @param tag MPI tag of the expected message (any_tag if it can be any tag) * @param tag MPI tag of the expected message (any_tag if it can be any tag)
*/ */
status probe( int src = any_source, int tag = any_tag ); status probe(int src = any_source, int tag = any_tag);
/** /**
* @brief Wrapper for MPI_Barrier * @brief Wrapper for MPI_Barrier
* *
* *
*/ */
void barrier(); void barrier();
private: private:
int _rank; int _rank;
int _size; int _size;
char* _buf; // temporary buffer for sending and receiving strings. Avoids reallocations char *_buf; // temporary buffer for sending and receiving strings. Avoids reallocations
int _bufsize; // size of the above temporary buffer int _bufsize; // size of the above temporary buffer
}; };
/** /**
* @brief Wrapper for MPI_Bcast * @brief Wrapper for MPI_Bcast
* *
* Broadcasts an integer value on the communicator comm, from the process having the MPI rank root. * Broadcasts an integer value on the communicator comm, from the process having the MPI rank root.
* *
* @param comm The communicator on which to broadcast * @param comm The communicator on which to broadcast
* @param value The integer value to send * @param value The integer value to send
* @param root The MPI rank of the broadcaster * @param root The MPI rank of the broadcaster
* *
* @todo Actually comm isn't used and broadcast is performed on the whole MPI_COMM_WORLD. TODO: Use comm instead * @todo Actually comm isn't used and broadcast is performed on the whole MPI_COMM_WORLD. TODO: Use comm instead
*/ */
void broadcast( communicator & comm, int value, int root ); void broadcast(communicator &comm, int value, int root);
/** /**
* @} * @}
*/ */
} // namespace mpi } // namespace mpi
} // namespace eo
# endif //__EO_IMPL_MPI_HPP__ #endif //__EO_IMPL_MPI_HPP__

View file

@ -56,22 +56,24 @@ eoGnuplot::~eoGnuplot()
} }
#ifdef HAVE_GNUPLOT
void eoGnuplot::gnuplotCommand(const char *_command) void eoGnuplot::gnuplotCommand(const char *_command)
{ {
#ifdef HAVE_GNUPLOT
if(gpCom) { if(gpCom) {
PipeComSend( gpCom, _command ); PipeComSend( gpCom, _command );
PipeComSend( gpCom, "\n" ); PipeComSend( gpCom, "\n" );
} }
#endif
} }
#else
void eoGnuplot::gnuplotCommand(const char *)
{ }
#endif
#ifdef HAVE_GNUPLOT
void eoGnuplot::initGnuPlot(std::string _title, std::string _extra) void eoGnuplot::initGnuPlot(std::string _title, std::string _extra)
{ {
#ifdef HAVE_GNUPLOT
std::ostringstream os; std::ostringstream os;
os << "250x150-0+" << 170 * numWindow++; os << "250x150-0+" << 170 * numWindow++;
char *args[6]; char *args[6];
@ -89,8 +91,12 @@ void eoGnuplot::initGnuPlot(std::string _title, std::string _extra)
PipeComSend( gpCom, _extra.c_str() ); PipeComSend( gpCom, _extra.c_str() );
PipeComSend( gpCom, "\n" ); PipeComSend( gpCom, "\n" );
} }
#endif
} }
#else
void eoGnuplot::initGnuPlot(std::string, std::string)
{ }
#endif

View file

@ -39,8 +39,10 @@ eoParallel::eoParallel() :
_nthreads( 0, "parallelize-nthreads", "Define the number of threads you want to use, nthreads = 0 means you want to use all threads available", '\0' ), _nthreads( 0, "parallelize-nthreads", "Define the number of threads you want to use, nthreads = 0 means you want to use all threads available", '\0' ),
_enableResults( false, "parallelize-enable-results", "Enable the generation of results", '\0' ), _enableResults( false, "parallelize-enable-results", "Enable the generation of results", '\0' ),
_doMeasure( false, "parallelize-do-measure", "Do some measures during execution", '\0' ), _doMeasure( false, "parallelize-do-measure", "Do some measures during execution", '\0' ),
_packetSize( 1U, "parallelize-packet-size", "Number of elements which should be sent in a single message during a parallel evaluation based on message passing.", '\0'), _packetSize( 1U, "parallelize-packet-size", "Number of elements which should be sent in a single message during a parallel evaluation based on message passing.", '\0')
_t_start(0) #ifdef _OPENMP
, _t_start(0)
#endif
{ {
} }

View file

@ -71,7 +71,9 @@ private:
eoValueParam<bool> _enableResults; eoValueParam<bool> _enableResults;
eoValueParam<bool> _doMeasure; eoValueParam<bool> _doMeasure;
eoValueParam<unsigned int> _packetSize; eoValueParam<unsigned int> _packetSize;
#ifdef _OPENMP
double _t_start; double _t_start;
#endif
}; };
void make_parallel(eoParser&); void make_parallel(eoParser&);

View file

@ -55,6 +55,7 @@ typedef unsigned long uint32_t;
#include "../eoObject.h" #include "../eoObject.h"
/** Random Number Generator /** Random Number Generator
@class eoRng eoRNG.h utils/eoRNG.h @class eoRng eoRNG.h utils/eoRNG.h

View file

@ -42,16 +42,16 @@ int Check( PCom *com )
} }
PCom * PipeComOpen( char *prog ) PCom * PipeComOpen( const char *prog )
{ {
char *args[2]; char *args[2];
args[0] = prog; args[0] = strdup( prog );
args[1] = NULL; args[1] = NULL;
return PipeComOpenArgv( prog, args ); return PipeComOpenArgv( prog, args );
} }
PCom * PipeComOpenArgv( char *prog, char *argv[] ) PCom * PipeComOpenArgv( const char *prog, char *argv[] )
{ {
int toFils[2]; int toFils[2];
int toPere[2]; int toPere[2];

View file

@ -23,8 +23,8 @@ typedef struct PipeCommunication {
} PCom; } PCom;
extern PCom *PipeComOpen( char *prog ); extern PCom *PipeComOpen( const char *prog );
extern PCom *PipeComOpenArgv( char *prog, char *argv[] ); extern PCom *PipeComOpenArgv( const char *prog, char *argv[] );
extern int PipeComSend( PCom *to, const char *line ); extern int PipeComSend( PCom *to, const char *line );
extern int PipeComSendn( PCom *to, const char *data, int n ); extern int PipeComSendn( PCom *to, const char *data, int n );

View file

@ -89,7 +89,8 @@ class boolean_generator
either between [0, _max) if only one value (_max) is given to the ctor either between [0, _max) if only one value (_max) is given to the ctor
or in [_min,_max) if 2 values are given (_min, _max) or in [_min,_max) if 2 values are given (_min, _max)
*/ */
template <class T = uint32_t> class random_generator template <class T = uint32_t>
class random_generator
{ {
public : public :
// added new ctor with 2 params, and modified the data to minim and range // added new ctor with 2 params, and modified the data to minim and range
@ -123,16 +124,26 @@ inline bool random_generator<bool>::operator()(void)
function (see eoPop::shuffle): its operator() takes an unsigned argument m function (see eoPop::shuffle): its operator() takes an unsigned argument m
and must return an unsigned uniformly distributed in [0,m} and must return an unsigned uniformly distributed in [0,m}
*/ */
template <class T = uint32_t> class UF_random_generator // FIXME this is probably deprecated by the new STL way of managing random generators.
template <class T = uint32_t>
class UF_random_generator
{ {
public : public :
UF_random_generator(eoRng& _rng = rng) : using result_type = T;
random(_rng) {}
T operator()(T _t) { return (T) (random.random(_t)); } UF_random_generator(T max, eoRng& _rng = rng)
: _max(max), _random(_rng)
{}
private : T operator()() const { return _random.random(_max); }
eoRng& random; T operator()(T m) const { return _random.random(m); }
T min() const { return 0; }
T max() const { return _max; }
private :
T _max;
eoRng& _random;
}; };

View file

@ -179,7 +179,8 @@ double sum_fitness(const eoPop<EOT>& _pop)
template <class EOT> template <class EOT>
double sum_fitness(const eoPop<EOT>& _pop, std::pair<double, double>& _minmax) double sum_fitness(const eoPop<EOT>& _pop, std::pair<double, double>& _minmax)
{ {
double rawTotal, scaledTotal; // double rawTotal = 0;
double scaledTotal;
typename eoPop<EOT>::const_iterator it = _pop.begin(); typename eoPop<EOT>::const_iterator it = _pop.begin();
@ -193,7 +194,7 @@ double sum_fitness(const eoPop<EOT>& _pop, std::pair<double, double>& _minmax)
_minmax.first = std::min(_minmax.first, v); _minmax.first = std::min(_minmax.first, v);
_minmax.second = std::max(_minmax.second, v); _minmax.second = std::max(_minmax.second, v);
rawTotal += v; // rawTotal += v;
} }
if (minimizing_fitness<EOT>()) if (minimizing_fitness<EOT>())

View file

@ -80,6 +80,9 @@ set (TEST_LIST
t-forge-FastGA t-forge-FastGA
t-eoFoundryFastGA t-eoFoundryFastGA
t-eoAlgoFoundryFastGA t-eoAlgoFoundryFastGA
t-eoRealToIntMonOp
t-eoRealToIntQuadOp
t-eoRankingCached
) )

View file

@ -382,7 +382,7 @@ class Experiment : public eoserial::Persistent
void run() void run()
{ {
mpi::communicator& comm = eo::mpi::Node::comm(); communicator& comm = eo::mpi::Node::comm();
// reinits every objects // reinits every objects
eo::rng.reseed( _seed ); eo::rng.reseed( _seed );
eo::rng.clearCache(); // trick for repeatable sequences of normal numbers, cf eo::rng eo::rng.clearCache(); // trick for repeatable sequences of normal numbers, cf eo::rng

View file

@ -77,14 +77,13 @@ int main(int /*argc*/, char** /*argv*/)
pop.append(pop_size, init); pop.append(pop_size, init);
eval(pop,pop); eval(pop,pop);
foundry.at(foundry.continuators.index()) = i_cont; foundry.select({
foundry.at(foundry.crossovers.index()) = i_cross; size_t{i_cont},
foundry.at(foundry.mutations.index()) = i_mut; size_t{i_cross},
foundry.at(foundry.selectors.index()) = i_sel; size_t{i_mut},
foundry.at(foundry.replacements.index()) = i_rep; size_t{i_sel},
size_t{i_rep}
// Or, if you know the order. });
foundry.select({i_cont, i_cross, i_mut, i_sel, i_rep});
// Actually perform a search // Actually perform a search
foundry(pop); foundry(pop);

View file

@ -16,21 +16,16 @@ int main(int /*argc*/, char** /*argv*/)
using EOT = eoBit<double>; using EOT = eoBit<double>;
oneMaxEval<EOT> eval; oneMaxEval<EOT> eval;
eoPopLoopEval<EOT> popeval(eval);
eoBooleanGenerator gen(0.5); eoBooleanGenerator gen(0.5);
eoInitFixedLength<EOT> init(dim, gen); eoInitFixedLength<EOT> init(dim, gen);
eoAlgoFoundryFastGA<EOT> foundry(init, eval, pop_size*10); eoAlgoFoundryFastGA<EOT> foundry(init, eval, pop_size*10);
/***** Variation rates *****/
for(double r = 0.0; r < 1.0; r+=0.1) {
foundry.crossover_rates.add<double>(r);
foundry. mutation_rates.add<double>(r);
}
/***** Crossovers ****/ /***** Crossovers ****/
foundry.crossovers.add< eo1PtBitXover<EOT> >(); foundry.crossovers.add< eo1PtBitXover<EOT> >();
foundry.crossovers.add< eoUBitXover<EOT> >(0.5); // preference over 1 // foundry.crossovers.add< eoUBitXover<EOT> >(0.5); // preference over 1
for(size_t i=1; i < 11; i+=4) { for(size_t i=1; i < 11; i+=4) {
foundry.crossovers.add< eoNPtsBitXover<EOT> >(i); // nb of points foundry.crossovers.add< eoNPtsBitXover<EOT> >(i); // nb of points
} }
@ -48,9 +43,9 @@ int main(int /*argc*/, char** /*argv*/)
std::ref(foundry.mutation_selectors) }) { std::ref(foundry.mutation_selectors) }) {
ops.add< eoRandomSelect<EOT> >(); ops.add< eoRandomSelect<EOT> >();
ops.add< eoStochTournamentSelect<EOT> >(0.5); // ops.add< eoStochTournamentSelect<EOT> >(0.5);
ops.add< eoSequentialSelect<EOT> >(); // ops.add< eoSequentialSelect<EOT> >();
ops.add< eoProportionalSelect<EOT> >(); // ops.add< eoProportionalSelect<EOT> >();
for(size_t i=2; i < 10; i+=4) { for(size_t i=2; i < 10; i+=4) {
ops.add< eoDetTournamentSelect<EOT> >(i); ops.add< eoDetTournamentSelect<EOT> >(i);
} }
@ -58,68 +53,61 @@ int main(int /*argc*/, char** /*argv*/)
/***** Replacements ****/ /***** Replacements ****/
foundry.replacements.add< eoCommaReplacement<EOT> >(); foundry.replacements.add< eoCommaReplacement<EOT> >();
foundry.replacements.add< eoPlusReplacement<EOT> >(); // foundry.replacements.add< eoPlusReplacement<EOT> >();
foundry.replacements.add< eoSSGAWorseReplacement<EOT> >(); // foundry.replacements.add< eoSSGAWorseReplacement<EOT> >();
foundry.replacements.add< eoSSGAStochTournamentReplacement<EOT> >(0.51); // foundry.replacements.add< eoSSGAStochTournamentReplacement<EOT> >(0.51);
for(size_t i=2; i < 10; i+=4) { for(size_t i=2; i < 10; i+=4) {
foundry.replacements.add< eoSSGADetTournamentReplacement<EOT> >(i); foundry.replacements.add< eoSSGADetTournamentReplacement<EOT> >(i);
} }
/***** Continuators ****/ /***** Continuators ****/
for(size_t i=10; i < 30; i+=10 ) { for(size_t i=3; i < 5; i+=1 ) {
foundry.continuators.add< eoSteadyFitContinue<EOT> >(10,i); foundry.continuators.add< eoGenContinue<EOT> >(i);
} }
/***** Offspring population size *****/
foundry.offspring_sizes.add<size_t>(0); // 0 = same as parent pop
// for(size_t s = pop_size; s < 2*pop_size; s+=pop_size/10) {
// foundry.offspring_sizes.add<size_t>(s);
// }
size_t n = size_t n =
foundry.crossover_rates.size() foundry.crossover_selectors.size()
* foundry.crossover_selectors.size()
* foundry.crossovers.size() * foundry.crossovers.size()
* foundry.aftercross_selectors.size() * foundry.aftercross_selectors.size()
* foundry.mutation_rates.size()
* foundry.mutation_selectors.size() * foundry.mutation_selectors.size()
* foundry.mutations.size() * foundry.mutations.size()
* foundry.replacements.size() * foundry.replacements.size()
* foundry.continuators.size() * foundry.continuators.size()
* foundry.offspring_sizes.size(); ;
std::clog << n << " possible algorithms instances." << std::endl; std::clog << n << " possible algorithms instances." << std::endl;
std::clog << "Running everything (this may take time)..." << std::endl;
EOT best_sol; EOT best_sol;
std::string best_algo = ""; std::string best_algo = "";
size_t i=0; size_t i=0;
for(size_t i_crossrate = 0; i_crossrate < foundry.crossover_rates.size(); ++i_crossrate ) {
for(size_t i_crossselect = 0; i_crossselect < foundry.crossover_selectors.size(); ++i_crossselect ) { for(size_t i_crossselect = 0; i_crossselect < foundry.crossover_selectors.size(); ++i_crossselect ) {
for(size_t i_cross = 0; i_cross < foundry.crossovers.size(); ++i_cross ) { for(size_t i_cross = 0; i_cross < foundry.crossovers.size(); ++i_cross ) {
for(size_t i_aftercrosel = 0; i_aftercrosel < foundry.aftercross_selectors.size(); ++i_aftercrosel ) { for(size_t i_aftercrosel = 0; i_aftercrosel < foundry.aftercross_selectors.size(); ++i_aftercrosel ) {
for(size_t i_mutrate = 0; i_mutrate < foundry.mutation_rates.size(); ++i_mutrate ) {
for(size_t i_mutselect = 0; i_mutselect < foundry.mutation_selectors.size(); ++i_mutselect ) { for(size_t i_mutselect = 0; i_mutselect < foundry.mutation_selectors.size(); ++i_mutselect ) {
for(size_t i_mut = 0; i_mut < foundry.mutations.size(); ++i_mut ) { for(size_t i_mut = 0; i_mut < foundry.mutations.size(); ++i_mut ) {
for(size_t i_rep = 0; i_rep < foundry.replacements.size(); ++i_rep ) { for(size_t i_rep = 0; i_rep < foundry.replacements.size(); ++i_rep ) {
for(size_t i_cont = 0; i_cont < foundry.continuators.size(); ++i_cont ) { for(size_t i_cont = 0; i_cont < foundry.continuators.size(); ++i_cont ) {
for(size_t i_pop = 0; i_pop < foundry.offspring_sizes.size(); ++i_pop ) {
std::clog << "\r" << i++ << "/" << n-1; std::clog.flush(); std::clog << "\r" << i++ << "/" << n-1; std::clog.flush();
eoPop<EOT> pop; eoPop<EOT> pop;
pop.append(pop_size, init); pop.append(pop_size, init);
popeval(pop,pop);
// FIXME put the parameters in the test?
foundry.select({ foundry.select({
i_crossrate, double{0.5}, // crossover_rate
i_crossselect, size_t{i_crossselect},
i_cross, size_t{i_cross},
i_aftercrosel, size_t{i_aftercrosel},
i_mutrate, double{0.5}, // mutation_rate
i_mutselect, size_t{i_mutselect},
i_mut, size_t{i_mut},
i_rep, size_t{i_rep},
i_cont, size_t{i_cont},
i_pop size_t{pop_size} // offspring_size
}); });
// Actually perform a search // Actually perform a search
@ -132,16 +120,13 @@ int main(int /*argc*/, char** /*argv*/)
best_sol = pop.best_element(); best_sol = pop.best_element();
best_algo = foundry.name(); best_algo = foundry.name();
} }
}
} }
} }
} }
} }
}
} }
} }
} }
}
std::cout << std::endl << "Best algo: " << best_algo << ", with " << best_sol << std::endl; std::cout << std::endl << "Best algo: " << best_algo << ", with " << best_sol << std::endl;
} }

View file

@ -31,8 +31,6 @@ public :
int the_main(int argc, char **argv) int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state { // ok, we have a command line parser and a state
typedef eoBit<float> Chrom;
eoParser parser(argc, argv); eoParser parser(argc, argv);
// Define Parameters // Define Parameters

View file

@ -101,7 +101,7 @@ in test dir)
template <class EOT> template <class EOT>
void runAlgorithm(EOT, eoParser& _parser, eoState& _state) void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
{ {
typedef typename EOT::Fitness FitT; // typedef typename EOT::Fitness FitT;
///// FIRST, problem or representation dependent stuff ///// FIRST, problem or representation dependent stuff
////////////////////////////////////////////////////// //////////////////////////////////////////////////////

View file

@ -20,15 +20,6 @@ eoAlgoFoundryFastGA<Bits>& make_foundry(eoFunctorStore& store, eoInit<Bits>& ini
foundry.continuators.add< eoSteadyFitContinue<Bits> >(10,i); foundry.continuators.add< eoSteadyFitContinue<Bits> >(10,i);
} }
for(double i=0.1; i<1.0; i+=0.1) {
foundry.crossover_rates.add<double>(i);
foundry.mutation_rates.add<double>(i);
}
for(size_t i=5; i<100; i+=10) {
foundry.offspring_sizes.add<size_t>(i);
}
/***** Crossovers ****/ /***** Crossovers ****/
for(double i=0.1; i<0.9; i+=0.1) { for(double i=0.1; i<0.9; i+=0.1) {
foundry.crossovers.add< eoUBitXover<Bits> >(i); // preference over 1 foundry.crossovers.add< eoUBitXover<Bits> >(i); // preference over 1
@ -39,13 +30,13 @@ eoAlgoFoundryFastGA<Bits>& make_foundry(eoFunctorStore& store, eoInit<Bits>& ini
foundry.crossovers.add< eo1PtBitXover<Bits> >(); foundry.crossovers.add< eo1PtBitXover<Bits> >();
/***** Mutations ****/ /***** Mutations ****/
double p = 1.0; // Probability of flipping eath bit. // Use defaults for all operators (usually falls back to p=1/chrom.size()).
foundry.mutations.add< eoUniformBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in uniform distrib foundry.mutations.add< eoUniformBitMutation<Bits> >(); // proba of flipping k bits, k drawn in uniform distrib
foundry.mutations.add< eoStandardBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in binomial distrib foundry.mutations.add< eoStandardBitMutation<Bits> >(); // proba of flipping k bits, k drawn in binomial distrib
foundry.mutations.add< eoConditionalBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in binomial distrib, minus zero foundry.mutations.add< eoConditionalBitMutation<Bits> >(); // proba of flipping k bits, k drawn in binomial distrib, minus zero
foundry.mutations.add< eoShiftedBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one foundry.mutations.add< eoShiftedBitMutation<Bits> >(); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one
foundry.mutations.add< eoNormalBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in normal distrib foundry.mutations.add< eoNormalBitMutation<Bits> >(); // proba of flipping k bits, k drawn in normal distrib
foundry.mutations.add< eoFastBitMutation<Bits> >(p); // proba of flipping k bits, k drawn in powerlaw distrib foundry.mutations.add< eoFastBitMutation<Bits> >(); // proba of flipping k bits, k drawn in powerlaw distrib
for(size_t i=1; i < 11; i+=1) { for(size_t i=1; i < 11; i+=1) {
foundry.mutations.add< eoDetSingleBitFlip<Bits> >(i); // mutate k bits without duplicates foundry.mutations.add< eoDetSingleBitFlip<Bits> >(i); // mutate k bits without duplicates
} }
@ -65,12 +56,6 @@ eoAlgoFoundryFastGA<Bits>& make_foundry(eoFunctorStore& store, eoInit<Bits>& ini
} }
} }
/***** Variation rates *****/
for(double r = 0.0; r < 1.0; r+=0.1) {
foundry.crossover_rates.add<double>(r);
foundry. mutation_rates.add<double>(r);
}
/***** Replacements ****/ /***** Replacements ****/
foundry.replacements.add< eoPlusReplacement<Bits> >(); foundry.replacements.add< eoPlusReplacement<Bits> >();
foundry.replacements.add< eoCommaReplacement<Bits> >(); foundry.replacements.add< eoCommaReplacement<Bits> >();
@ -100,16 +85,13 @@ int main(int /*argc*/, char** /*argv*/)
size_t n = size_t n =
foundry.crossover_rates.size() foundry.crossover_selectors.size()
* foundry.crossover_selectors.size()
* foundry.crossovers.size()
* foundry.aftercross_selectors.size() * foundry.aftercross_selectors.size()
* foundry.mutation_rates.size()
* foundry.mutation_selectors.size() * foundry.mutation_selectors.size()
* foundry.mutations.size() * foundry.mutations.size()
* foundry.replacements.size() * foundry.replacements.size()
* foundry.continuators.size() * foundry.continuators.size()
* foundry.offspring_sizes.size(); ;
std::clog << n << " possible algorithms instances." << std::endl; std::clog << n << " possible algorithms instances." << std::endl;
@ -117,7 +99,18 @@ int main(int /*argc*/, char** /*argv*/)
pop.append(5,init); pop.append(5,init);
::apply(onemax_eval,pop); ::apply(onemax_eval,pop);
foundry.select({0,0,0,0,0,0,0,0}); foundry.select({
/*crossover_rates */ double{0.8},
/*crossover_selectors */ size_t{0},
/*crossovers */ size_t{0},
/*aftercross_selectors*/ size_t{0},
/*mutation_rates */ double{0.9},
/*mutation_selectors */ size_t{0},
/*mutations */ size_t{0},
/*replacements */ size_t{0},
/*continuators */ size_t{0},
/*offspring_sizes */ size_t{1},
});
foundry(pop); foundry(pop);
std::cout << "Done" << std::endl; std::cout << "Done" << std::endl;

View file

@ -43,7 +43,7 @@ int main()
unsigned i; unsigned i;
// a chromosome randomizer // a chromosome randomizer
eoInitPermutation <Chrom> random(CHROM_SIZE); eoInitPermutation <Chrom> randomize(CHROM_SIZE);
// the population: // the population:
eoPop<Chrom> pop; eoPop<Chrom> pop;
@ -55,7 +55,7 @@ int main()
{ {
Chrom chrom(CHROM_SIZE); Chrom chrom(CHROM_SIZE);
std::cout << " Initial chromosome n°" << i << " : " << chrom << "..." << std::endl; std::cout << " Initial chromosome n°" << i << " : " << chrom << "..." << std::endl;
random(chrom); randomize(chrom);
eval(chrom); eval(chrom);
std::cout << " ... becomes : " << chrom << " after initialization" << std::endl; std::cout << " ... becomes : " << chrom << " after initialization" << std::endl;
check_permutation(chrom); check_permutation(chrom);

View file

@ -0,0 +1,219 @@
#include <apply.h>
#include <eo>
#include <eoRanking.h>
#include <eoRankingCached.h>
#include <es/eoReal.h>
#include <utils/eoRNG.h>
#include "real_value.h"
class RankingTest
{
public:
RankingTest(eoParser &parser, eoEvalFuncCounter<eoReal<double>> &_eval, unsigned size = 100)
: rng(0),
popSize(size),
seedParam(parser.createParam(uint32_t(time(0)), "seed", "Random seed", 'S')),
pressureParam(parser.createParam(1.5, "pressure", "Selective pressure", 'p')),
exponentParam(parser.createParam(1.0, "exponent", "Ranking exponent", 'e')),
eval(_eval)
{
rng.reseed(seedParam.value());
initPopulation();
}
void initPopulation()
{
pop.clear();
for (unsigned i = 0; i < popSize; ++i)
{
eoReal<double> ind;
ind.resize(1);
ind[0] = rng.uniform();
pop.push_back(ind);
}
apply<eoReal<double>>(eval, pop);
}
const unsigned popSize;
eoPop<eoReal<double>> pop;
eoRng rng;
double pressure() const { return pressureParam.value(); }
double exponent() const { return exponentParam.value(); }
private:
eoValueParam<uint32_t> &seedParam;
eoValueParam<double> &pressureParam;
eoValueParam<double> &exponentParam;
eoEvalFuncCounter<eoReal<double>> eval;
};
// Test case 1: Verify both implementations produce identical results
void test_Consistency(eoParser &parser)
{
eoEvalFuncPtr<eoReal<double>, double, const std::vector<double> &> mainEval(real_value);
eoEvalFuncCounter<eoReal<double>> eval(mainEval);
RankingTest fixture(parser, eval);
eoRanking<eoReal<double>> ranking(fixture.pressure(), fixture.exponent());
eoRankingCached<eoReal<double>> rankingCached(fixture.pressure(), fixture.exponent());
ranking(fixture.pop);
rankingCached(fixture.pop);
const std::vector<double> &values = ranking.value();
const std::vector<double> &cachedValues = rankingCached.value();
for (unsigned i = 0; i < fixture.pop.size(); ++i)
{
if (abs(values[i] - cachedValues[i]) > 1e-9)
{
throw std::runtime_error("Inconsistent ranking values between implementations");
}
}
std::clog << "Test 1 passed: Both implementations produce identical results" << std::endl;
}
// Test case 2: Test edge case with minimum population size
void test_MinPopulationSize(eoParser &parser)
{
eoPop<eoReal<double>> smallPop;
eoReal<double> ind1, ind2;
ind1.resize(1);
ind1[0] = 0.5;
ind2.resize(1);
ind2[0] = 1.0;
smallPop.push_back(ind1);
smallPop.push_back(ind2);
eoEvalFuncPtr<eoReal<double>, double, const std::vector<double> &> mainEval(real_value);
eoEvalFuncCounter<eoReal<double>> eval(mainEval);
RankingTest fixture(parser, eval, 2); // Use fixture to get parameters
eoRanking<eoReal<double>> ranking(fixture.pressure(), fixture.exponent());
eoRankingCached<eoReal<double>> rankingCached(fixture.pressure(), fixture.exponent());
apply<eoReal<double>>(eval, smallPop);
ranking(smallPop);
rankingCached(smallPop);
if (ranking.value()[0] >= ranking.value()[1] ||
rankingCached.value()[0] >= rankingCached.value()[1])
{
throw std::runtime_error("Invalid ranking for population size 2");
}
std::clog << "Test 2 passed: Minimum population size handled correctly" << std::endl;
}
// Test case 3: Verify caching actually works
void test_CachingEffectiveness(eoParser &parser)
{
eoEvalFuncPtr<eoReal<double>, double, const std::vector<double> &> mainEval(real_value);
eoEvalFuncCounter<eoReal<double>> eval(mainEval);
RankingTest fixture(parser, eval, 50); // Fixed size for cache test
eoRankingCached<eoReal<double>> rankingCached(fixture.pressure(), fixture.exponent());
// First run - should compute all values
rankingCached(fixture.pop);
const auto firstValues = rankingCached.value();
// Modify fitness values but keep same population size
for (auto &ind : fixture.pop)
{
ind[0] = fixture.rng.uniform();
}
apply<eoReal<double>>(eval, fixture.pop);
// Second run - should use cached coefficients
rankingCached(fixture.pop);
// Add one individual to invalidate cache
eoReal<double> newInd;
newInd.resize(1);
newInd[0] = fixture.rng.uniform();
fixture.pop.push_back(newInd);
apply<eoReal<double>>(eval, fixture.pop);
// Third run - should recompute coefficients
rankingCached(fixture.pop);
std::clog << "Test 3 passed: Caching mechanism properly invalidated" << std::endl;
}
// Helper function to test constructor assertions
bool testRankingConstructor(double pressure, double exponent)
{
try
{
eoRanking<eoReal<double>> ranking(pressure, exponent);
return true; // Constructor succeeded
}
catch (...)
{
return false; // Assertion failed
}
}
// Helper function to test constructor assertions
bool testRankingCachedConstructor(double pressure, double exponent)
{
try
{
eoRankingCached<eoReal<double>> ranking(pressure, exponent);
return true;
}
catch (...)
{
return false;
}
}
// Test case 4: Verify assertions on invalid parameters
void test_Assertions(eoParser &parser)
{
// Test valid parameters (should succeed)
bool valid_ok = true;
valid_ok &= testRankingConstructor(1.1, 1.0); // Valid pressure
valid_ok &= testRankingCachedConstructor(1.1, 1.0); // Valid pressure
// Test invalid parameters (should fail)
bool invalid_ok = true;
invalid_ok &= !testRankingConstructor(1.0, 1.0); // pressure = 1 (invalid)
invalid_ok &= !testRankingConstructor(0.5, 1.0); // pressure < 1 (invalid)
invalid_ok &= !testRankingConstructor(2.1, 1.0); // pressure > 2 (invalid)
invalid_ok &= !testRankingCachedConstructor(1.0, 1.0); // pressure = 1 (invalid)
invalid_ok &= !testRankingCachedConstructor(0.5, 1.0); // pressure < 1 (invalid)
invalid_ok &= !testRankingCachedConstructor(2.1, 1.0); // pressure > 2 (invalid)
if (!valid_ok)
{
throw std::runtime_error("Valid parameter tests failed");
}
if (!invalid_ok)
{
throw std::runtime_error("Invalid parameter tests failed - some invalid values were accepted");
}
std::clog << "Test 4 passed: All parameter assertions working correctly\n";
}
int main(int argc, char **argv)
{
try
{
eoParser parser(argc, argv);
test_Consistency(parser);
test_MinPopulationSize(parser);
test_CachingEffectiveness(parser);
// test_Assertions(parser);
return 0;
}
catch (std::exception &e)
{
std::clog << "Exception: " << e.what() << std::endl;
return 1;
}
}

View file

@ -0,0 +1,28 @@
#include <iostream>
#include <eo>
#include <es.h>
using namespace std;
int main(int, char**)
{
eoIntInterval bounds(1,5);
using Chrom = eoInt<double>;
using MutWrapper = eoRealToIntMonOp<Chrom>;
eoDetUniformMutation< typename MutWrapper::EOTreal > mutreal(/*range*/6, /*nb*/5);
MutWrapper mutint(mutreal, bounds);
Chrom sol({1,2,3,4,5});
bool changed = mutint(sol);
assert(changed);
for(auto& x : sol) {
assert(bounds.isInBounds(x));
}
}

View file

@ -0,0 +1,35 @@
#include <iostream>
#include <eo>
#include <es.h>
using namespace std;
int main(int, char**)
{
eoIntInterval intbounds(1,5);
eoRealInterval rb(1,5);
eoRealVectorBounds realbounds(5, rb);
using Chrom = eoInt<double>;
using CrossWrapper = eoRealToIntQuadOp<Chrom>;
eoSegmentCrossover< typename CrossWrapper::EOTreal > crossreal(realbounds, /*alpha*/0);
CrossWrapper crossint(crossreal, intbounds);
Chrom sol1({1,2,3,4,5});
Chrom sol2({1,2,3,4,5});
bool changed = crossint(sol1, sol2);
assert(changed);
for(auto& x : sol1) {
assert(intbounds.isInBounds(x));
}
for(auto& x : sol2) {
assert(intbounds.isInBounds(x));
}
}

View file

@ -126,7 +126,7 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
} }
// hard-coded directory name ... // hard-coded directory name ...
system("mkdir ResSelect"); (void) system("mkdir ResSelect");
std::cout << "Testing the Selections\nParents size = " << pSize std::cout << "Testing the Selections\nParents size = " << pSize
<< ", offspring rate = " << oRate; << ", offspring rate = " << oRate;
std::cout << " and putting rsulting files in dir ResSelect" << std::endl; std::cout << " and putting rsulting files in dir ResSelect" << std::endl;

View file

@ -193,7 +193,7 @@ int the_main(int argc, char **argv)
std::cout << "The resulting file (in dir ResSelect), contains \n"; std::cout << "The resulting file (in dir ResSelect), contains \n";
std::cout << " the empirical proba. for each indi to be selected." << std::endl; std::cout << " the empirical proba. for each indi to be selected." << std::endl;
system("mkdir ResSelect"); (void) system("mkdir ResSelect");
// initialize parent population // initialize parent population
parentsOrg.resize(pSize); parentsOrg.resize(pSize);

View file

@ -37,8 +37,6 @@ struct Dummy : public EO<double>
int the_main(int argc, char **argv) int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state { // ok, we have a command line parser and a state
typedef eoBit<float> Chrom;
eoParser parser(argc, argv); eoParser parser(argc, argv);
// Define Parameters // Define Parameters

View file

@ -123,17 +123,17 @@ void main_function()
<< chrom << " " << chrom2 << std::endl; << chrom << " " << chrom2 << std::endl;
} }
for (i = 1; i < SIZE / 2; i++) for (i = 1; i < SIZE / 2; i++) {
for (j = 1; j < SIZE / 2; j++) for (j = 1; j < SIZE / 2; j++) {
{ eoBitGxOver<Chrom> gxover(i, j);
eoBitGxOver<Chrom> gxover(i, j); std::fill(chrom.begin(), chrom.end(), false);
std::fill(chrom.begin(), chrom.end(), false); std::fill(chrom2.begin(), chrom2.end(), true);
std::fill(chrom2.begin(), chrom2.end(), true); gxover(chrom, chrom2);
gxover(chrom, chrom2); chrom.fitness(binary_value(chrom)); chrom2.fitness(binary_value(chrom2));
chrom.fitness(binary_value(chrom)); chrom2.fitness(binary_value(chrom2)); std::cout << "eoBinGxOver(" << i << ", " << j << ") ..... "
std::cout << "eoBinGxOver(" << i << ", " << j << ") ..... " << chrom << " " << chrom2 << std::endl;
<< chrom << " " << chrom2 << std::endl;
} }
}
// test SGA algorithm // test SGA algorithm
eoGenContinue<Chrom> continuator1(50); eoGenContinue<Chrom> continuator1(50);

View file

@ -19,7 +19,7 @@ int main(int /*argc*/, char** /*argv*/)
eoBooleanGenerator gen(0.5); eoBooleanGenerator gen(0.5);
eoInitFixedLength<EOT> init(dim, gen); eoInitFixedLength<EOT> init(dim, gen);
eoGenContinue<EOT> common_cont(100); eoGenContinue<EOT> common_cont(5);
eoForgeVector< eoContinue<EOT> > continuators; eoForgeVector< eoContinue<EOT> > continuators;
continuators.add< eoSteadyFitContinue<EOT> >(10,10); continuators.add< eoSteadyFitContinue<EOT> >(10,10);

View file

@ -87,7 +87,7 @@ int main(int argc, char **argv)
template <class EOT> template <class EOT>
void runAlgorithm(EOT, eoParser& _parser, eoState& _state) void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
{ {
typedef typename EOT::Fitness FitT; // typedef typename EOT::Fitness FitT;
///// FIRST, problem or representation dependent stuff ///// FIRST, problem or representation dependent stuff
////////////////////////////////////////////////////// //////////////////////////////////////////////////////

View file

@ -0,0 +1,54 @@
Bootstrap: docker
From: ubuntu:24.04
%post
# Update the available packages list.
apt -y update
# And add the "universe" repository (allow to install many more software).
apt -y install software-properties-common
add-apt-repository universe
apt -y update
# Update the operating systems (install last versions with bugfixes).
apt -y dist-upgrade
# Install dependencies for your project.
apt -y install git g++ cmake ccache make libeigen3-dev libopenmpi-dev doxygen graphviz libgnuplot-iostream-dev
# Download sources.
git clone --branch master --single-branch --recurse-submodules https://github.com/nojhan/paradiseo
cd paradiseo
# Build directory that holds built binaries and cache.
mkdir -p build
cd build
# Example of minimum build:
# Use that if you want the minimal set of libraries needed to build a simple solver.
# cmake -DCMAKE_BUILD_TYPE=Release -DEDO=ON .. && make
# Example of trying to build everything:
# Use that to test if everything can be built with your setup,
# or if you modified something in Paradiseo and want to test it.
cmake -DCMAKE_BUILD_TYPE=Release -DEDO=ON -DENABLE_CMAKE_EXAMPLE=ON -DENABLE_CMAKE_TESTING=ON -DENABLE_GNUPLOT=ON -DENABLE_OPENMP=ON -DMPI=ON -DSMP=ON .. && make
# You may run the tests, to check if everything works:
ctest
# Make the documentation:
make doc
# Clean-up of the APT cache (will lighten the container).
apt -y purge software-properties-common git g++ cmake ccache make libeigen3-dev libopenmpi-dev doxygen graphviz libgnuplot-iostream-dev
apt -y --purge autoremove
apt -y autoclean
apt clean
%environment
%runscript
# When executing the container, this will be called,
# and pass all the command line arguments.
./paradiseo/build/edo/application/cmaes/cmaes $*
%labels
Author Johann Dreo

View file

@ -19,7 +19,8 @@ if(DOXYGEN_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
endif(DOXYGEN_EXECUTABLE) endif(DOXYGEN_EXECUTABLE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake" # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake"
configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
"${MO_DOC_DIR}/${MO_DOC_CONFIG_FILE}") "${MO_DOC_DIR}/${MO_DOC_CONFIG_FILE}")
install( install(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

View file

@ -31,7 +31,7 @@ PROJECT_NAME = @MO_MODULE_NAME@
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = @PACKAGE_VERSION@ PROJECT_NUMBER = @PROJECT_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
@ -987,7 +987,7 @@ FORMULA_FONTSIZE = 10
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output. # generate Latex output.
GENERATE_LATEX = YES GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be # If a relative path is entered the value of OUTPUT_DIRECTORY will be

View file

@ -48,7 +48,7 @@ public:
* @param _sol2 the new solution after local search * @param _sol2 the new solution after local search
* @return always true * @return always true
*/ */
bool operator()(EOT& _sol1, EOT& _sol2) { bool operator()(EOT& /*_sol1*/, EOT& /*_sol2*/) {
return true; return true;
} }

View file

@ -47,7 +47,7 @@ public:
* Do nothing on the solution * Do nothing on the solution
* @param _solution the related solution * @param _solution the related solution
*/ */
virtual bool operator()(EOT & _solution) { virtual bool operator()(EOT & /*_solution*/) {
return true; return true;
} }
}; };

View file

@ -79,6 +79,20 @@ public:
explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool) explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool)
{} {}
/**
* Constructor without cooling schedule, but with a continuator.
*
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
*/
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
defaultCool(0, 0, 0, 0),
explorer(_neighborhood, _eval, defaultSolNeighborComp, defaultCool)
{}
/** /**
* General constructor for a simulated annealing * General constructor for a simulated annealing
* @param _neighborhood the neighborhood * @param _neighborhood the neighborhood

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