Compare commits

..

No commits in common. "master" and "v3.0.0-beta" have entirely different histories.

274 changed files with 1264 additions and 6817 deletions

View file

@ -1,5 +1,10 @@
name: Build Debug (Ubuntu)
on: [push, pull_request]
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@ -16,15 +21,8 @@ jobs:
compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- 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
shell: bash
run: |

14
.gitignore vendored
View file

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

33
AUTHORS
View file

@ -1,52 +1,41 @@
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
==================
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
=================
atantar
Alesandro Sidero
Alexandre Quemy
Alix Zheng
Amine Aziz-Alaoui
Arnaud Liefooghe
Benjamin Bouvier
Bahri
Caner Candan
Clive Canape
fatene
Gustavo Romero Lopez
jboisson
Jeroen Eggermont
Jochen Küpper
Joost
Joost <joost@dsj.nl>
Juan Julian Merelo Guervos
Jérémie Humeau
Jxtopher
Karima Boufaras
legillono
Leo Bertheas
legillon
Louis Da Costa
Loïc Jean David Arjanen
Maarten Keijzer
Mammar Amara
Manu
Marc Schoenauer
Marie-Éleonore
Mostepha Khouadjia
Olivier König
Pierre Savéant
Pedro Angel Castillo Valdivieso
Potalas
Ronald Pinho
Steve Madere
Sébastien Cahon
Sébastien Verel
Thomas Legrand
Thibault Lasnier
Victor Manuel Rivas Santos
wcancino
xohm

View file

@ -13,24 +13,13 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
## Name
project("ParadisEO"
VERSION 3.1.3
VERSION 3.0.0
DESCRIPTION "Evolutionary optimization framework"
LANGUAGES C CXX)
## Language
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
@ -92,34 +81,31 @@ set(SMP "false" CACHE BOOL "Build the SMP module")
set(MPI "false" CACHE BOOL "Build the MPI module")
## EO Module
set(MODULE_NAME "Paradiseo")
set(DOXYGEN_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doxygen)
# set(EO_MODULE_NAME "Evolving Objects")
set(EO_MODULE_NAME "Evolving Object")
set(CMAKE_SOURCE_DIR ${EO_SRC_DIR})
add_subdirectory(${EO_SRC_DIR})
if(NOT EO_ONLY)
## MO Module
# set(MO_MODULE_NAME "Moving Objects")
# set(MODULE_NAME "Moving Objects")
set(MO_MODULE_NAME "Moving objects")
set(CMAKE_SOURCE_DIR ${MO_SRC_DIR})
add_subdirectory(${MO_SRC_DIR})
## EDO Module
if(EDO)
# set(EDO_MODULE_NAME "Evolving Distribution Objects")
set(EDO_MODULE_NAME "Evolving Distribution Objects")
set(CMAKE_SOURCE_DIR ${EDO_SRC_DIR})
add_subdirectory(${EDO_SRC_DIR})
endif()
## MOEO Module
# set(MOEO_MODULE_NAME "Multi-Objectives EO")
set(MOEO_MODULE_NAME "Multi-Objectives EO")
set(CMAKE_SOURCE_DIR ${MOEO_SRC_DIR})
add_subdirectory(${MOEO_SRC_DIR})
## SMP Module
if(SMP)
# set(SMP_MODULE_NAME "Symmetric Multi-Processing")
set(SMP_MODULE_NAME "Symmetric Multi-Processing")
set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR})
add_subdirectory(${SMP_SRC_DIR})
endif()

View file

@ -2,8 +2,7 @@
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
@ -19,11 +18,6 @@ Paradiseo use the CMake build system, so building it should be as simple as:
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
-------
@ -193,13 +187,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`.
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 ?
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.
To enable testing, define `ENABLE_CMAKE_TESTING` when you run cmake.

View file

@ -8,9 +8,7 @@ It focus on the efficiency of the implementation of solvers, by providing:
- tools for ***automated design and selection*** of algorithms,
- a focus on ***speed*** and several ***parallelization*** options.
<div align="center">
<img width="640" alt="Paradiseo logo" src="https://raw.githubusercontent.com/nojhan/paradiseo/master/docs/img/paradiseo_logo_dark.svg"/>
</div>
![Paradiseo logo](https://github.com/nojhan/paradiseo/blob/master/website/paradiseo_logo_200px_dark.png)
# Quick Start
@ -168,7 +166,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.
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
@ -195,7 +193,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`.
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).**
@ -208,13 +206,6 @@ 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 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
Paradiseo is distributed under the GNU Lesser General Public License and the CeCILL license (depending on the modules).
@ -239,35 +230,11 @@ For academic articles, books, more tutorials, presentations slides,
real life example of solvers and contact information,
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
For further information about ParadisEO, help or to report any
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
problem, you can send an e-mail to: `paradiseo-help@lists.gforge.inria.fr`

View file

@ -27,7 +27,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
# set(DOC_SMP "")
# endif()
# if(MPI)
# set(DOC_MPI "make doc-mpi")
# set(DOC_MPI "make doc-mpi")
# else()
# set(DOC_MPI "")
# endif()
@ -78,7 +78,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-eo
COMMAND make doc-mo
COMMAND make doc-moeo
# COMMAND make doc-mpi
COMMAND make doc-mpi
)
endif()
@ -89,7 +89,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-mo
COMMAND make doc-moeo
COMMAND make doc-smp
# COMMAND make doc-mpi
COMMAND make doc-mpi
)
endif()
if(EDO AND NOT SMP AND MPI)
@ -98,7 +98,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-mo
COMMAND make doc-moeo
COMMAND make doc-edo
# COMMAND make doc-mpi
COMMAND make doc-mpi
)
endif()
if(EDO AND SMP AND NOT MPI)
@ -119,7 +119,7 @@ if(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
COMMAND make doc-moeo
COMMAND make doc-edo
COMMAND make doc-smp
# COMMAND make doc-mpi
COMMAND make doc-mpi
)
endif()
@ -131,7 +131,7 @@ endif(DOXYGEN_FOUND AND DOXYGEN_EXECUTABLE)
######################################################################################
if(PROFILING)
find_program(LCOV
find_program(LCOV
NAMES lcov
PATHS
"/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>
<ul>
<li><a href="#Why">Why choosing <em class="logo">Paradis<span class="logo_eo">eo</span></em>?</a></li>
<li><a href="https://github.com/nojhan/paradiseo/releases">Downloads</a></li>
<li><a href="https://github.com/nojhan/paradiseo">Git repository</a></li>
<li><a href="https://gforge.inria.fr/frs/?group_id=145">Downloads</a></li>
<li><a href="https://gforge.inria.fr/scm/?group_id=145">Git repository</a></li>
<li><a href="https://app.element.io/#/room/#paradiseo:matrix.org">Chat with us</a></li>
</ul>
</div>
@ -125,9 +125,9 @@
<div id="Download">
<h2><a name="Download"></a>Download</h2>
Download the <a href="https://github.com/nojhan/paradiseo/releases">latest stable release</a>.
Download the <a href="https://gforge.inria.fr/frs/download.php/31733/Paradiseo-2.0.1.zip">latest stable release</a>.
<p>Or clone the latest version: <code class="command">git clone https://github.com/nojhan/paradiseo.git</code></p>
<p>Or clone the latest version: <code class="command">git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git</code></p>
</div>
<div id="Build">
@ -147,9 +147,7 @@
<div id="Develop">
<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>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>
@ -302,7 +300,7 @@
<div id="Why_efficiency">
<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> (especially on combinatorial problems).</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>.</p>
</div>
<div id="Why_efficiency_details">
@ -311,7 +309,6 @@
<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:
<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>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>
@ -811,32 +808,18 @@
<ul>
<li>
<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>Johann Dreo, Arnaud Liefooghe, Sébastien Verel, Marc Schoenauer, Juan J. Merelo, Alexandre Quemy, Benjamin Bouvier, and Jan Gmys,
<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>
<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>
<button class="collapsible">BiBTeX entry for citing <em class="logo">Paradis<span class="logo_eo">eo</span></em></button>
<button class="collapsible">BiBTeX entry for citing EO</button>
<div class="details">
<p>If you used <em class="logo">Paradis<span class="logo_eo">eo</span></em> in a study, please cite the publication above:</p>
<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>
<figure style="text-align:left;">
<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 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/>
@ -848,25 +831,21 @@
&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="#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/>
</font>
-->
</p>
<figcaption></figcaption>
</figure>
</div>
</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> -->
<!-- <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> -->
@ -927,31 +906,10 @@ ISBN: 978-0-470-27858-1</blockquote>
<ul class="publications">
</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>
<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="">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>
@ -1015,6 +973,11 @@ undiscovered knowledge.
physics/0603108 (2006)</a>.</li>
</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>
@ -1169,17 +1132,16 @@ undiscovered knowledge.
<div id="Downloads">
<h2><a name="Downloads"></a>Downloads</h2>
<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>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> You can obtain the latest stable and beta version directly via the Git repository:
<code class="command">git clone https://github.com/jdreo/paradiseo.git</code>.
<p> You can obtain the latest stable and beta version directly via the official Git repository:
<code class="command">git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git</code>.
The release are on the "master" branch.
</p>
<p>Or you can use (at your own risks) the development repositories of the developers:
<ul>
<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>
<li>Johann Dreo's: <a href="https://github.com/nojhan/paradiseo">on GitHub</b>.</li>
</ul>
</p>
</div>
@ -1221,7 +1183,7 @@ undiscovered knowledge.
</p>
<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> (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>.
To see them, we recommend the use of a CMake gui, like <code>ccmake</code> or <code>cmake-gui</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.
</p>
@ -1252,7 +1214,7 @@ undiscovered knowledge.
<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>The official bug tracker is available on the <a href="https://github.com/nojhan/paradiseo/issues">project page</a>.</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>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>
@ -1269,8 +1231,7 @@ undiscovered knowledge.
<ul>
<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.pasteur.fr/">Institut Pasteur</a> (current maintainer)</li>
<li><a href="https://thalesgroup.com">Thales group</a></li>
<li><a href="https://thalesgroup.com">Thales</a> (current maintainer)</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.vu.nl">Vrije Universiteit Amsterdam</a></li>

View file

@ -1,226 +0,0 @@
<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

@ -1,791 +0,0 @@
/* 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,8 +22,7 @@ if(DOXYGEN_FOUND)
)
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
endif(DOXYGEN_EXECUTABLE)
# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake"
configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake"
"${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}")
install(
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
# by quotes) that should identify the project.
PROJECT_NAME = @EDO_MODULE_NAME@
PROJECT_NAME = @PACKAGE_NAME@
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = @PROJECT_VERSION@
PROJECT_NUMBER = @PACKAGE_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# 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
# generate Latex output.
GENERATE_LATEX = NO
GENERATE_LATEX = YES
# 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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -108,12 +108,7 @@ public:
if (is) {
virus.resize(bits.size());
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'));
#endif
}
}

View file

@ -70,9 +70,6 @@ endif()
######################################################################################
add_executable(fastga fastga.cpp)
# 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 stdc++fs)
add_executable(onlymutga onlymutga.cpp)
target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} fmt)
# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs)
target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt)

View file

@ -1,119 +0,0 @@
#!/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

@ -1,267 +0,0 @@
{
"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

@ -1,12 +0,0 @@
#!/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

@ -1,119 +0,0 @@
#!/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,6 +16,8 @@
* 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.
@ -339,7 +341,7 @@ int main(int argc, char* argv[])
"problem", "Problem ID",
'p', "Problem", /*required=*/true);
const size_t problem = problem_p.value();
assert(problem < benchmark.size());
assert(0 <= problem and problem < benchmark.size());
// const size_t dimension = parser.getORcreateParam<size_t>(1000,
// "dimension", "Dimension size",
@ -622,7 +624,7 @@ int main(int argc, char* argv[])
eoInitFixedLength<Bits> onemax_init(/*bitstring size=*/dimension, bgen);
auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target);
eoAlgoFoundry<Bits>::Encodings encoded_algo(foundry.size());
Ints encoded_algo(foundry.size());
encoded_algo[foundry.crossover_rates .index()] = crossover_rate;
encoded_algo[foundry.crossover_selectors .index()] = crossover_selector;
@ -639,6 +641,16 @@ int main(int argc, char* argv[])
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.
*****************************************************************************/
@ -649,7 +661,7 @@ int main(int argc, char* argv[])
onemax_eval(pop,pop);
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;
}

View file

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

View file

@ -1,770 +0,0 @@
#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,9 +32,8 @@ IF (DOXYGEN_FOUND)
ENDIF (DOXYGEN_EXECUTABLE)
# configure cfg file
# "${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake"
CONFIGURE_FILE(
"${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${EO_DOC_CONFIG_FILE}"
)

View file

@ -25,21 +25,13 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
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
PROJECT_NAME = @PACKAGE_NAME@
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = @PROJECT_VERSION@
PROJECT_NUMBER = @PACKAGE_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@ -280,6 +272,22 @@ SUBGROUPING = YES
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
#---------------------------------------------------------------------------
@ -492,7 +500,7 @@ FILE_VERSION_FILTER =
# file name after the option, if omitted DoxygenLayout.xml will be used as the name
# of the layout file.
LAYOUT_FILE = @CMAKE_SOURCE_DIR@/doxygen/DoxygenLayout.xml
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
@ -586,7 +594,7 @@ RECURSIVE = YES
# 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.
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
EXCLUDE = @CMAKE_SOURCE_DIR@/src/obsolete @CMAKE_SOURCE_DIR@/test @CMAKE_SOURCE_DIR@/tutorial @CMAKE_SOURCE_DIR@/contrib @CMAKE_SOURCE_DIR@/app
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
@ -600,7 +608,7 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS = *.sif/*
EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -614,7 +622,7 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).
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
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/test
# 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
@ -776,14 +784,14 @@ HTML_HEADER =
HTML_FOOTER =
# The HTML_EXTRA_STYLESHEET tag can be used to specify a user-defined cascading
# The HTML_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
# 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
# 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!
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen/doxygen-style.css
HTML_STYLESHEET =
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
@ -792,7 +800,7 @@ HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen/doxygen-style.css
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = YES
HTML_DYNAMIC_SECTIONS = NO
# 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
@ -962,7 +970,7 @@ SEARCHENGINE = YES
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
GENERATE_LATEX = YES
# 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
@ -1121,6 +1129,18 @@ GENERATE_XML = NO
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
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
@ -1281,6 +1301,11 @@ ALLEXTERNALS = NO
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
#---------------------------------------------------------------------------
@ -1294,6 +1319,15 @@ EXTERNAL_GROUPS = 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
# inheritance and usage relations if the target is undocumented
# or is not a class.
@ -1316,7 +1350,7 @@ HAVE_DOT = YES
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME =
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
@ -1358,7 +1392,7 @@ UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = YES
TEMPLATE_RELATIONS = NO
# 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
@ -1406,18 +1440,7 @@ DIRECTORY_GRAPH = YES
# generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used.
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
DOT_IMAGE_FORMAT = png
# 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.
@ -1463,7 +1486,7 @@ DOT_TRANSPARENT = NO
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = YES
DOT_MULTI_TARGETS = NO
# 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

View file

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

View file

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

View file

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

View file

@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group
© 2022 Institut Pasteur
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
@ -25,7 +24,6 @@
#define _eoAlgoFoundry_H_
#include <vector>
#include <variant>
/** A vector of eoForge which hold an index.
*
@ -38,13 +36,13 @@
* which takes the class name as template and its constructor's parameters
* as arguments. For example:
* @code
* eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* selectors.add< eoStochTournamentSelect<EOT> >( 0.5 );
* eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* selectors.add< eoStochTournamentSelect<EOT> >( 0.5 );
* @endcode
*
* @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,
* which would effectively disable any link between operators.
* 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.
*
* @ingroup Core
* @ingroup Foundry
@ -53,18 +51,11 @@ template<class Itf>
class eoOperatorFoundry : public eoForgeVector< Itf >
{
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 ) :
eoForgeVector<Itf>(always_reinstantiate),
_index(encoding_index)
{ }
/** Returns the slot index at which this is registered.
*/
size_t index() const { return _index; }
protected:
@ -72,24 +63,6 @@ class eoOperatorFoundry : public eoForgeVector< Itf >
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>
class eoParameterFoundry : public eoForgeScalar< Itf >
{
@ -97,26 +70,11 @@ class eoParameterFoundry : public eoForgeScalar< Itf >
"eoParameterFoundry should only be used on arithmetic types (i.e. integer or floating point types)");
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) :
eoForgeScalar<Itf>(min, max),
_index(encoding_index)
{ }
/** Returns the slot index at which this is registered.
*/
size_t index() const { return _index; }
protected:
@ -126,55 +84,48 @@ class eoParameterFoundry : public eoForgeScalar< Itf >
/** 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 numbers.
* The chosen operators are encoded in a vector of indices.
*
* The foundry subclass should first be set up with sets of operators of the same interface,
* held within an eoOperatorFoundry member.
* @code
* eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* eoOperatorFoundry< eoSelectOne<EOT> > selectors;
* @endcode
*
* In a second step, the operators to be used should be selected
* by indicating their index, just like if the foundry was an array:
* @code
* foundry.select({size_t{0}, size_t{1}, size_t{2}});
* // ^ ^ ^
* // | | |
* // | | + 3d operator
* // | + 2d operator
* // + 1st operator
* foundry.select({0, 1, 2});
* // ^ ^ ^
* // | | |
* // | | + 3d operator
* // | + 2d operator
* // + 1st operator
* @endcode
*
* 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:
* @code
* foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator
* foundry.at(foundry.continuators.index()) = 2; // select the third continuator
* @endcode
*
* Now, you must implement the foundry just like any eoAlgo, by using the eoPop interface:
* @code
* foundry(pop);
* @endcode
*
* foundry(pop);
* @encode
* It will instantiate the needed operators (only) and the algorithm itself on-the-fly,
* 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.
* Every instantiation is deferred upon actual use. That way, you can still reconfigure them
* at any time with `eoForgeOperator::setup`, for example:
* @code
* foundry.selector.at(0).setup(0.5); // using constructor's arguments
* @endcode
* @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
* at any time with `eoForgeOperator::setup`, for example:
* @code
* foundry.selector.at(0).setup(0.5); // using constructor's arguments
* @endcode
*
* @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,
* which would effectively disable any link between operators.
* @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,
* which would effectively disable any link between operators.
*
* @ingroup Core
* @ingroup Foundry
@ -184,104 +135,30 @@ template<class EOT>
class eoAlgoFoundry : public eoAlgo<EOT>
{
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.
/**
*/
using Encoding = std::variant<size_t, double>;
/** 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)
eoAlgoFoundry( size_t nb_operators ) :
_size(nb_operators),
_encoding(_size,0)
{ }
/** Select indices of all the operators.
*
* 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( Encodings encodings )
void select( std::vector<size_t> encoding )
{
assert(encodings.size() == _size);
_encodings = encodings;
assert(encoding.size() == _encoding.size());
_encoding = encoding;
}
/** 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.
/** Access to the index of the currently selected operator.
*/
Encoding & at(size_t i)
size_t& at(size_t i)
{
return _encodings.at(i);
return _encoding.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
{
return _size;
@ -289,14 +166,14 @@ class eoAlgoFoundry : public eoAlgo<EOT>
/** Return the underlying encoding vector.
*/
Encodings encodings() const
std::vector<size_t> encoding() const
{
return _encodings;
return _encoding;
}
protected:
const size_t _size;
std::vector<Encoding> _encodings;
std::vector<size_t> _encoding;
};

View file

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

View file

@ -29,61 +29,48 @@
/** 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/parameters
* The foundry should first be set up with sets of operators
* for the main modules of a FastGA:
* continuators, crossovers (and rate of call), mutations (and rate of call),
* selections, replacement operators, offspring size, etc.
* continuators, crossovers, mutations, selections, replacement operators, etc.
*
* This is done through public member variable's `add` method,
* which takes the class name as template and its constructor's parameters
* as arguments. For example:
* @code
* foundry.selectors.add< eoRandomSelect<EOT> >();
* foundry.selectors.add< eoRandomSelect<EOT> >();
* @endcode
*
* @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,
* which would effectively disable any link with other operator(s).
* in a `std::ref`, or it will silently be passed as a copy,
* which would effectively disable any link with other operator(s).
*
* In a second step, the operators to be used should be selected
* by indicating their wanted index or value, passing an array of 10 elements:
* by indicating their index, passing an array of 10 elements:
* @code
* 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
* });
* foundry.select({0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
* @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,
* you can use the `index()` member, for example:
* @code
* foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator
* foundry.at(foundry.continuators.index()) = 2; // select the third continuator
* @endcode
*
* Now, you can call the foundry just like any eoAlgo, by passing it an eoPop:
* @code
* foundry(pop);
* @endcode
*
* foundry(pop);
* @encode
* It will instantiate the needed operators (only) and the algorithm itself on-the-fly,
* and then run it.
*
* @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
* at any time with `eoForgeOperator::setup`, for example:
* @code
* foundry.selector.at(0).setup(0.5); // Will call constructor's arguments
* @endcode
* @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
* at any time with `eoForgeOperator::setup`, for example:
* @code
* foundry.selector.at(0).setup(0.5); // Will call constructor's arguments
* @endcode
*
* @ingroup Foundry
* @ingroup Algorithms
@ -124,31 +111,31 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
public:
/* Operators containers @{ */
eoParameterFoundry< double > crossover_rates;
eoParameterFoundry< double > crossover_rates;
eoOperatorFoundry< eoSelectOne<EOT> > crossover_selectors;
eoOperatorFoundry< eoQuadOp<EOT> > crossovers;
eoOperatorFoundry< eoSelectOne<EOT> > aftercross_selectors;
eoParameterFoundry< double > mutation_rates;
eoParameterFoundry< double > mutation_rates;
eoOperatorFoundry< eoSelectOne<EOT> > mutation_selectors;
eoOperatorFoundry< eoMonOp<EOT> > mutations;
eoOperatorFoundry< eoReplacement<EOT> > replacements;
eoOperatorFoundry< eoContinue<EOT> > continuators;
eoParameterFoundry< size_t > offspring_sizes;
eoParameterFoundry< size_t > offspring_sizes;
/* @} */
/** instantiate and call the pre-selected algorithm.
*/
void operator()(eoPop<EOT>& pop)
{
assert( crossover_selectors.size() > 0); assert(this->rank( crossover_selectors) < crossover_selectors.size());
assert( crossovers.size() > 0); assert(this->rank( crossovers) < crossovers.size());
assert(aftercross_selectors.size() > 0); assert(this->rank(aftercross_selectors) < aftercross_selectors.size());
assert( mutation_selectors.size() > 0); assert(this->rank( mutation_selectors) < mutation_selectors.size());
assert( mutations.size() > 0); assert(this->rank( mutations) < mutations.size());
assert( replacements.size() > 0); assert(this->rank( replacements) < replacements.size());
assert( continuators.size() > 0); assert(this->rank( continuators) < continuators.size());
assert( crossover_selectors.size() > 0); assert(this->at( crossover_selectors.index()) < crossover_selectors.size());
assert( crossovers.size() > 0); assert(this->at( crossovers.index()) < crossovers.size());
assert(aftercross_selectors.size() > 0); assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size());
assert( mutation_selectors.size() > 0); assert(this->at( mutation_selectors.index()) < mutation_selectors.size());
assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size());
assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size());
assert( continuators.size() > 0); assert(this->at( continuators.index()) < continuators.size());
// Objective function calls counter
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
@ -178,7 +165,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
try {
// restart(pop);
algo(pop);
} catch(eoMaxEvalException & e) {
} catch(eoMaxEvalException e) {
#ifndef NDEBUG
eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl;
#endif
@ -194,18 +181,17 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
std::string name()
{
std::ostringstream name;
name << "crossover_rate: " << this-> crossover_rate() << " + ";
name << "crossover_selector: " << this-> crossover_selector().className() << " [" << this->rank( crossover_selectors) << "] + ";
name << "aftercross_selector: " << this->aftercross_selector().className() << " [" << this->rank(aftercross_selectors) << "] + ";
name << "crossover: " << this-> crossover().className() << " [" << this->rank( crossovers) << "] + ";
name << "mutation_rate: " << this-> mutation_rate() << " + ";
name << "mutation_selector: " << this-> mutation_selector().className() << " [" << this->rank( mutation_selectors) << "] + ";
name << "mutation: " << this-> mutation().className() << " [" << this->rank( mutations) << "] + ";
name << "replacement: " << this-> replacement().className() << " [" << this->rank( replacements) << "] + ";
name << "continuator: " << this-> continuator().className() << " [" << this->rank( continuators) << "] + ";
name << "offspring_size: " << this-> offspring_size() << "";
return name.str();
name << "crossover_rates: " << this->at( crossover_rates.index()) << " (" << this-> crossover_rate() << ") + ";
name << "crossover_selectors: " << this->at( crossover_selectors.index()) << " (" << this-> crossover_selector().className() << ") + ";
name << "aftercross_selector: " << this->at(aftercross_selectors.index()) << " (" << this->aftercross_selector().className() << ") + ";
name << "crossovers: " << this->at( crossovers.index()) << " (" << this-> crossover().className() << ") + ";
name << "mutation_rates: " << this->at( mutation_rates.index()) << " (" << this-> mutation_rate() << ") + ";
name << "mutation_selectors: " << this->at( mutation_selectors.index()) << " (" << this-> mutation_selector().className() << ") + ";
name << "mutations: " << this->at( mutations.index()) << " (" << this-> mutation().className() << ") + ";
name << "replacements: " << this->at( replacements.index()) << " (" << this-> replacement().className() << ") + ";
name << "continuators: " << this->at( continuators.index()) << " (" << this-> continuator().className() << ") + ";
name << "offspring_sizes: " << this->at( offspring_sizes.index()) << " (" << this-> offspring_size() << ")";
return name.str();
}
protected:
@ -215,97 +201,61 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
const size_t _max_restarts;
public:
/** Currently selected continuator.
*/
eoContinue<EOT>& continuator()
{
const size_t r = this->rank(continuators);
assert(r < continuators.size());
return continuators.instantiate(r);
assert(this->at(continuators.index()) < continuators.size());
return continuators.instantiate(this->at(continuators.index()));
}
/** Currently selected crossover_rate.
*/
double& crossover_rate()
{
// 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);
return crossover_rates.instantiate(this->at(crossover_rates.index()));
}
/** Currently selected crossover.
*/
eoQuadOp<EOT>& crossover()
{
const size_t r = this->rank(crossovers);
assert(r < crossovers.size());
return crossovers.instantiate(r);
assert(this->at(crossovers.index()) < crossovers.size());
return crossovers.instantiate(this->at(crossovers.index()));
}
/** Currently selected mutation_rate.
*/
double& mutation_rate()
{
const double val = this->value(mutation_rates);
assert(mutation_rates.min() <= val and val <= mutation_rates.max());
return mutation_rates.instantiate(val);
return mutation_rates.instantiate(this->at(mutation_rates.index()));
}
/** Currently selected mutation.
*/
eoMonOp<EOT>& mutation()
{
const size_t r = this->rank(mutations);
assert(r < mutations.size());
return mutations.instantiate(r);
assert(this->at(mutations.index()) < mutations.size());
return mutations.instantiate(this->at(mutations.index()));
}
/** Currently selected crossover_selector.
*/
eoSelectOne<EOT>& crossover_selector()
{
const size_t r = this->rank(crossover_selectors);
assert(r < crossover_selectors.size());
return crossover_selectors.instantiate(r);
assert(this->at(crossover_selectors.index()) < crossover_selectors.size());
return crossover_selectors.instantiate(this->at(crossover_selectors.index()));
}
/** Currently selected aftercross_selector.
*/
eoSelectOne<EOT>& aftercross_selector()
{
const size_t r = this->rank(aftercross_selectors);
assert(r < aftercross_selectors.size());
return aftercross_selectors.instantiate(r);
assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size());
return aftercross_selectors.instantiate(this->at(aftercross_selectors.index()));
}
/** Currently selected mutation_selector.
*/
eoSelectOne<EOT>& mutation_selector()
{
const size_t r = this->rank(mutation_selectors);
assert(r < mutation_selectors.size());
return mutation_selectors.instantiate(r);
assert(this->at(mutation_selectors.index()) < mutation_selectors.size());
return mutation_selectors.instantiate(this->at(mutation_selectors.index()));
}
/** Currently selected offspring_size.
*/
size_t& offspring_size()
{
const size_t val = this->len(offspring_sizes);
assert(offspring_sizes.min() <= val and val <= offspring_sizes.max());
return offspring_sizes.instantiate(val);
return offspring_sizes.instantiate(this->at(offspring_sizes.index()));
}
/** Currently selected replacement.
*/
eoReplacement<EOT>& replacement()
{
const size_t r = this->rank(replacements);
assert(r < replacements.size());
return replacements.instantiate(r);
assert(this->at(replacements.index()) < replacements.size());
return replacements.instantiate(this->at(replacements.index()));
}
};

View file

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

View file

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

View file

@ -21,9 +21,9 @@ Authors:
Johann Dréo <johann.dreo@thalesgroup.com>
*/
#if !defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS)
#if !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."
#else // defined(_POSIX_VERSION) || defined(__unix__) || defined(_WINDOWS)
#else //!defined(__unix__) && !defined(_WINDOWS)
#ifndef __EOEVALUSERTIMETHROWEXCEPTION_H__
#define __EOEVALUSERTIMETHROWEXCEPTION_H__
@ -40,7 +40,7 @@ Johann Dréo <johann.dreo@thalesgroup.com>
#include "eoExceptions.h"
#if defined(_POSIX_VERSION) || defined(__unix__)
#ifdef __unix__
#include <sys/time.h>
#include <sys/resource.h>
@ -106,6 +106,6 @@ protected:
};
#endif // _WINDOWS
#endif // defined(_POSIX_VERSION) || defined(__unix__)
#endif //__unix__
#endif // __EOEVALUSERTIMETHROWEXCEPTION_H__
#endif //!defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS)
#endif //!defined(__unix__) && !defined(_WINDOWS)

View file

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

View file

@ -13,11 +13,6 @@
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
© 2022 Institut Pasteur
Authors:
Johann Dreo <johann@dreo.fr>
*/
#ifndef _eoFastGA_H_
@ -121,11 +116,6 @@ public:
eoPop<EOT> crossed;
crossed.push_back(sol1);
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);
EOT sol3 = _select_aftercross(crossed);

View file

@ -15,10 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
© 2020 Thales group
© 2022 Institut Pasteur
Authors:
Johann Dreo <johann@dreo.fr>
Johann Dreo <johann.dreo@thalesgroup.com>
*/
#ifndef _eoForge_H_
@ -27,7 +26,6 @@
#include <string>
#include <tuple>
#include <utility>
#include <memory>
// In case you want to debug arguments captured in tuples:
// template<typename Type, unsigned N, unsigned Last>
@ -75,7 +73,6 @@ class eoForgeInterface
{
public:
virtual Itf& instantiate(bool no_cache = true) = 0;
virtual std::shared_ptr<Itf> instantiate_ptr(bool no_cache = true) = 0;
virtual ~eoForgeInterface() {}
};
@ -114,7 +111,6 @@ class eoForgeOperator : public eoForgeInterface<Itf>
template<class ...Args2>
eoForgeOperator(Args2... args) :
_args(std::forward<Args2>(args)...),
_instantiated_ptr(nullptr),
_instantiated(nullptr)
{ }
@ -126,9 +122,9 @@ class eoForgeOperator : public eoForgeInterface<Itf>
*
* @param no_cache If false, will enable caching previous instances.
*/
Itf& instantiate(bool no_cache = true) override
Itf& instantiate(bool no_cache = true)
{
if(no_cache or _instantiated == nullptr) {
if(no_cache or not _instantiated) {
if(_instantiated) {
delete _instantiated;
}
@ -137,19 +133,7 @@ class eoForgeOperator : public eoForgeInterface<Itf>
return *_instantiated;
}
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
virtual ~eoForgeOperator()
{
delete _instantiated;
}
@ -165,16 +149,9 @@ class eoForgeOperator : public eoForgeInterface<Itf>
// 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));
}
template<class T>
std::shared_ptr<Op> op_constructor_ptr(T& args)
{
return std::make_shared<Op>( std::make_from_tuple<Op>(args) );
}
/** @} */
protected:
std::shared_ptr<Itf> _instantiated_ptr;
Itf* _instantiated;
};
@ -185,13 +162,12 @@ class eoForgeOperator<Itf,Op> : public eoForgeInterface<Itf>
{
public:
eoForgeOperator() :
_instantiated_ptr(nullptr),
_instantiated(nullptr)
{ }
Itf& instantiate( bool no_cache = true ) override
Itf& instantiate( bool no_cache = true )
{
if(no_cache or _instantiated == nullptr) {
if(no_cache or not _instantiated) {
if(_instantiated) {
delete _instantiated;
}
@ -200,37 +176,28 @@ class eoForgeOperator<Itf,Op> : public eoForgeInterface<Itf>
return *_instantiated;
}
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
virtual ~eoForgeOperator()
{
delete _instantiated;
}
protected:
std::shared_ptr<Itf> _instantiated_ptr;
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,
* 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.
* 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 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.
* The default is set to disable the cache, because its use with operators
* which hold a state will lead to unwanted behaviour.
*
* @code
eoForgeVector<eoSelect<EOT>> factories(false);
@ -273,7 +240,7 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
/** instantiate the operator managed at the given index.
*/
Itf& instantiate_from(double index)
Itf& instantiate(double index)
{
double frac_part, int_part;
frac_part = std::modf(index, &int_part);
@ -281,33 +248,9 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl;
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);
}
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.
*
* @warning When passing a reference (as it is often the case within ParadisEO),
@ -376,169 +319,18 @@ class eoForgeVector : public std::vector<eoForgeInterface<Itf>*>
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>
class eoForgeScalar
{
public:
using Interface = Itf;
/** Constructor
*
* @param min Minimum possible value.
* @param may Maximum possible value.
*/
eoForgeScalar(Itf min, Itf max) :
_min(min),
_max(max)
{ }
/** Just return the same value, without managing any instantiation.
*
* Actually checks if value is in range.
*/
Itf& instantiate(double value)
{
@ -561,24 +353,18 @@ class eoForgeScalar
Itf min() const { return _min; }
Itf max() const { return _max; }
/** Set the minimum possible value.
*/
void min(Itf min)
{
assert(_min <= _max);
_min = min;
}
/** Set the maximum possible value.
*/
void max(Itf max)
{
assert(_max >= _min);
_max = max;
}
/** Set the possible range of values.
*/
void setup(Itf min, Itf max)
{
_min = min;

View file

@ -114,12 +114,7 @@ eoFunctorBase::procedure_tag functor_category(const eoF<R>&)
result_type
**/
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>
#endif
{
public :
@ -156,12 +151,7 @@ eoFunctorBase::unary_function_tag functor_category(const eoUF<A1, R>&)
result_type
**/
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>
#endif
{
public :
/// virtual dtor here so there is no need to define it in derived classes

View file

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

View file

@ -36,12 +36,9 @@
*
* @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:
using AtomType = size_t;
using FitnessType = FitT;
/**
* (Default) Constructor.

View file

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

View file

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

View file

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

View file

@ -40,73 +40,73 @@ template <class EOT>
class eoRanking : public eoPerf2Worth<EOT> // false: do not cache fitness
{
public:
using eoPerf2Worth<EOT>::value;
/* Ctor:
@param _p selective pressure (in (1,2]
@param _e exponent (1 == linear)
*/
eoRanking(double _p = 2.0, double _e = 1.0) : pressure(_p), exponent(_e)
{
assert(1 < pressure and pressure <= 2);
}
/* Ctor:
@param _p selective pressure (in (1,2]
@param _e exponent (1 == linear)
*/
eoRanking(double _p=2.0, double _e=1.0):
pressure(_p), exponent(_e) {}
/* helper function: finds index in _pop of _eo, an EOT * */
int lookfor(const EOT *_eo, const eoPop<EOT> &_pop)
/* 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;
for (it = _pop.begin(); it < _pop.end(); it++)
typename eoPop<EOT>::const_iterator it;
for (it=_pop.begin(); it<_pop.end(); it++)
{
if (_eo == &(*it))
return it - _pop.begin();
if (_eo == &(*it))
return it-_pop.begin();
}
throw eoException("Not found in eoLinearRanking");
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)
/* 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;
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");
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);
// 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 beta = (2-pressure)/pSize;
if (exponent == 1.0) // no need for exponetial then
{
double alpha = (2 * pressure - 2) / (pSize * pSizeMinusOne);
for (unsigned i = 0; i < pSize; i++)
double alpha = (2*pressure-2)/(pSize*pSizeMinusOne);
for (unsigned i=0; i<pSize; i++)
{
int which = lookfor(rank[i], _pop);
value()[which] = alpha * (pSize - i) + beta; // worst -> 1/[P(P-1)/2]
int which = lookfor(rank[i], _pop);
value()[which] = alpha*(pSize-i)+beta; // worst -> 1/[P(P-1)/2]
}
}
else // exponent != 1
else // exponent != 1
{
double gamma = (2 * pressure - 2) / pSize;
for (unsigned i = 0; i < pSize; i++)
double gamma = (2*pressure-2)/pSize;
for (unsigned i=0; i<pSize; i++)
{
int which = lookfor(rank[i], _pop);
// value is in [0,1]
double tmp = ((double)(pSize - i)) / pSize;
// to the exponent, and back to [m,M]
value()[which] = gamma * pow(tmp, exponent) + beta;
int which = lookfor(rank[i], _pop);
// value in in [0,1]
double tmp = ((double)(pSize-i))/pSize;
// to the exponent, and back to [m,M]
value()[which] = gamma*pow(tmp, exponent)+beta;
}
}
}
private:
double pressure; // selective pressure
double exponent;
private:
double pressure; // selective pressure
double exponent;
};
#endif

View file

@ -1,139 +0,0 @@
/** -*- 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

View file

@ -1,74 +0,0 @@
#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

View file

@ -1,73 +0,0 @@
#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

@ -1,94 +0,0 @@
#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,8 +35,6 @@
#include <csignal>
#include "eoContinue.h"
typedef void (*sighandler_t)(int);
/** @addtogroup Continuators
* @{
*/

View file

@ -79,12 +79,7 @@ void eoSTLF<void>::operator()(void)
respectively
*/
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>
#endif
{
public:
eoSTLUF(eoUF<A1,R>& _f) : f(_f) {}
@ -107,12 +102,7 @@ class eoSTLUF : public std::unary_function<A1, R>
respectively
*/
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>
#endif
{
public:
eoSTLBF(eoUF<A1,R>& _f) : f(_f) {}

View file

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

View file

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

View file

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

View file

@ -39,7 +39,6 @@
template <class FitT> class eoReal: public eoVector<FitT, double>
{
public:
using AtomType = double;
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))
{
bool tmp = chrom1[i];
chrom1[i]=chrom2[i];
chrom2[i] = tmp;
// std::swap(chrom1[i], chrom2[i]);
// bool tmp = chrom1[i];
// chrom1[i]=chrom2[i];
// chrom2[i] = tmp;
std::swap(chrom1[i], chrom2[i]);
changed = true;
}
}

View file

@ -7,8 +7,6 @@
/** Standard bit mutation with mutation rate p:
* 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 Variators
*/
@ -16,11 +14,7 @@ template<class EOT>
class eoStandardBitMutation : public eoMonOp<EOT>
{
public:
/** Constructor.
*
* @param rate mutation rate, 1/chrom.size() if ignored or zero (the default)
*/
eoStandardBitMutation(double rate = 0) :
eoStandardBitMutation(double rate = 0.5) :
_rate(rate),
_nb(1),
_bitflip(_nb)
@ -28,12 +22,9 @@ class eoStandardBitMutation : public eoMonOp<EOT>
virtual bool operator()(EOT& chrom)
{
assert(chrom.size()>0);
if(_rate == 0) {
_rate = (double) 1/chrom.size();
}
_nb = eo::rng.binomial(chrom.size(),_rate);
_bitflip.number_bits(_nb);
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return _bitflip(chrom);
}
@ -55,7 +46,8 @@ template<class EOT>
class eoUniformBitMutation : public eoMonOp<EOT>
{
public:
eoUniformBitMutation() :
eoUniformBitMutation(double rate = 0.5) :
_rate(rate),
_nb(1),
_bitflip(_nb)
{}
@ -63,13 +55,15 @@ class eoUniformBitMutation : public eoMonOp<EOT>
virtual bool operator()(EOT& chrom)
{
_nb = eo::rng.random(chrom.size());
_bitflip.number_bits(_nb);
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return _bitflip(chrom);
}
virtual std::string className() const {return "eoUniformBitMutation";}
protected:
double _rate;
unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip;
};
@ -90,21 +84,17 @@ template<class EOT>
class eoConditionalBitMutation : public eoStandardBitMutation<EOT>
{
public:
eoConditionalBitMutation(double rate = 0) :
eoConditionalBitMutation(double rate = 0.5) :
eoStandardBitMutation<EOT>(rate)
{}
virtual bool operator()(EOT& chrom)
{
assert(chrom.size()>0);
if(this->_rate == 0) {
this->_rate = (double) 1/chrom.size();
}
this->_nb = 0;
while(this->_nb < 1) {
this->_nb = eo::rng.binomial(chrom.size(),this->_rate);
}
this->_bitflip.number_bits(this->_nb);
this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate);
this->_nb++;
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return this->_bitflip(chrom);
}
@ -133,14 +123,12 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
virtual bool operator()(EOT& chrom)
{
assert(chrom.size()>0);
if(this->_rate == 0) {
this->_rate = (double) 1/chrom.size();
}
this->_nb = eo::rng.binomial(chrom.size(),this->_rate);
this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate);
if(this->_nb == 0) {
this->_nb = 1;
}
this->_bitflip.number_bits(this->_nb);
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return this->_bitflip(chrom);
}
@ -154,7 +142,7 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
*
* From:
* Furong Ye, Carola Doerr, and Thomas Back.
* Interpolating local and global search by controlling the variance of standard bit mutation.
* Interpolating local and global search by controllingthe variance of standard bit mutation.
* In 2019 IEEE Congress on Evolutionary Computation(CEC), pages 22922299.
*
* In contrast to standard bit mutation, this operators allows to scale
@ -164,40 +152,29 @@ class eoShiftedBitMutation : public eoStandardBitMutation<EOT>
* @ingroup Variators
*/
template<class EOT>
class eoNormalBitMutation : public eoMonOp<EOT>
class eoNormalBitMutation : public eoStandardBitMutation<EOT>
{
public:
eoNormalBitMutation(double mean = 0, double variance = 0) :
_mean(mean),
_variance(variance),
_nb(1),
_bitflip(_nb)
eoNormalBitMutation(double rate = 0.5, double variance = 1) :
eoStandardBitMutation<EOT>(rate),
_variance(variance)
{}
virtual bool operator()(EOT& chrom)
{
assert(chrom.size() > 0);
if(_mean == 0) {
_mean = (double) 1/chrom.size();
this->_nb = eo::rng.normal(this->_rate * chrom.size(), _variance);
if(this->_nb >= chrom.size()) {
this->_nb = eo::rng.random(chrom.size());
}
if(_variance == 0) {
_variance = std::log(chrom.size());
}
_nb = eo::rng.normal(_mean, _variance);
if(_nb >= chrom.size()) {
_nb = eo::rng.random(chrom.size());
}
_bitflip.number_bits(_nb);
return _bitflip(chrom);
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return this->_bitflip(chrom);
}
virtual std::string className() const {return "eoNormalBitMutation";}
protected:
double _mean;
double _variance;
unsigned _nb;
eoDetSingleBitFlip<EOT> _bitflip;
};
/** Fast mutation which size is sampled from an adaptive power law.
@ -211,10 +188,11 @@ class eoNormalBitMutation : public eoMonOp<EOT>
* @ingroup Variators
*/
template<class EOT>
class eoFastBitMutation : public eoMonOp<EOT>
class eoFastBitMutation : public eoStandardBitMutation<EOT>
{
public:
eoFastBitMutation(double beta = 1.5) :
eoFastBitMutation(double rate = 0.5, double beta = 1.5) :
eoStandardBitMutation<EOT>(rate),
_beta(beta)
{
assert(beta > 1);
@ -222,96 +200,26 @@ class eoFastBitMutation : public eoMonOp<EOT>
virtual bool operator()(EOT& chrom)
{
_nb = powerlaw(chrom.size(),_beta);
_bitflip.number_bits(_nb);
return _bitflip(chrom);
this->_nb = powerlaw(chrom.size(),_beta);
// BitFlip operator is bound to the _nb reference,
// thus one don't need to re-instantiate.
return this->_bitflip(chrom);
}
virtual std::string className() const {return "eoFastBitMutation";}
protected:
double powerlaw(unsigned int n, double beta)
double powerlaw(unsigned n, double beta)
{
double cnb = 0;
for(unsigned int i=1; i<=n/2; ++i) {
for(unsigned i=1; i<n; ++i) {
cnb += std::pow(i,-beta);
}
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);
return eo::rng.powerlaw(0,n,beta) / cnb;
}
// 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;
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_

View file

@ -50,11 +50,7 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree<FType, Node> >
protected:
// a binary predicate for sorting
// 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>
#endif
{
bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());};
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,8 +21,6 @@ Authors:
*/
#include "implMpi.h"
namespace eo
{
namespace mpi
{
const int any_source = MPI_ANY_SOURCE;
@ -161,9 +159,8 @@ namespace mpi
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 );
}
} // namespace mpi
} // namespace eo
}

View file

@ -22,7 +22,7 @@ Authors:
#ifndef __EO_IMPL_MPI_HPP__
#define __EO_IMPL_MPI_HPP__
#include <mpi.h>
#include "eoMpi.h"
#include "../serial/eoSerial.h"
/**
@ -41,290 +41,282 @@ Authors:
* The entities are here shortly described, if you need further details, don't hesitate
* 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
{
/**
* @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:
/**
* @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 Wrapper class for MPI_Status
* @brief Inits MPI context.
*
* Consists only in a C++ wrapper class, giving getters on status attributes.
* @param argc Number of params in command line (same as one in main)
* @param argv Strings containing params (same as one in main)
*/
class status
{
environment(int argc, char**argv);
/**
* @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:
/**
* @brief Converts a MPI_Status into a status.
*/
status(const MPI_Status &s);
/**
* @brief Returns the tag of the associated communication.
*/
int tag() { return _tag; }
/**
* @brief Converts a MPI_Status into a status.
*/
status( const MPI_Status & s );
/**
* @brief Indicates which error number we obtained in the associated communication.
*/
int error() { return _error; }
/**
* @brief Returns the tag of the associated communication.
*/
int tag() { return _tag; }
/**
* @brief Returns the MPI rank of the source of the associated communication.
*/
int source() { return _source; }
/**
* @brief Indicates which error number we obtained in the associated communication.
*/
int error() { return _error; }
/**
* @brief Returns the MPI rank of the source of the associated communication.
*/
int source() { return _source; }
private:
int _source;
int _tag;
int _error;
};
};
/**
* @brief Main object, used to send / receive messages, get informations about the rank and the size of the world,
* etc.
*/
class communicator
{
public:
/**
* @brief Main object, used to send / receive messages, get informations about the rank and the size of the world,
* etc.
* Creates the communicator, using the whole world as a MPI_Comm.
*
* @todo Allow the user to precise which MPI_Comm to use
*/
class communicator
communicator( );
~communicator();
/**
* @brief Returns the MPI rank of the current process.
*/
int rank();
/**
* @brief Returns the size of the MPI cluster.
*/
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 Receives an integer from src on channel "tag".
*
* @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 Receives a string from src on channel "tag".
*
* @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 array of eoserial::Persistent to dest on channel "tag".
*
* @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 )
{
public:
/**
* Creates the communicator, using the whole world as a MPI_Comm.
*
* @todo Allow the user to precise which MPI_Comm to use
*/
communicator();
// Puts all the values into an array
eoserial::Array* array = new eoserial::Array;
~communicator();
/**
* @brief Returns the MPI rank of the current process.
*/
int rank();
/**
* @brief Returns the size of the MPI cluster.
*/
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 Receives an integer from src on channel "tag".
*
* @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 Receives a string from src on channel "tag".
*
* @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 array of eoserial::Persistent to dest on channel "tag".
*
* @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)
for( int i = 0; i < size; ++i )
{
// 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());
array->push_back( table[i].pack() );
}
/*
* @brief Receives an eoserial::Persistent object from src on channel "tag".
*
* @param src MPI rank of the sender
* @param tag MPI tag of message
* @param persistent Where to unpack the serialized object?
*/
void recv(int src, int tag, eoserial::Persistent &persistent);
// Encapsulates the array into an object
eoserial::Object* obj = new eoserial::Object;
obj->add( "array", array );
std::stringstream ss;
obj->print( ss );
delete obj;
/*
* @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)
// Sends the object as a string
send( dest, tag, ss.str() );
}
/*
* @brief Receives an eoserial::Persistent object from src on channel "tag".
*
* @param src MPI rank of the sender
* @param tag MPI tag of message
* @param persistent Where to unpack the serialized object?
*/
void recv( int src, int tag, eoserial::Persistent & persistent );
/*
* @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 )
{
// 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;
eoserial::unpackObject( *array, i, table[i] );
}
delete obj;
}
/*
* Other methods
*/
/*
* Other methods
*/
/**
* @brief Wrapper for MPI_Probe
*
* Waits for a message to come from process having rank src, on the channel
* tag.
*
* @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)
*/
status probe(int src = any_source, int tag = any_tag);
/**
* @brief Wrapper for MPI_Probe
*
* Waits for a message to come from process having rank src, on the channel
* tag.
*
* @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)
*/
status probe( int src = any_source, int tag = any_tag );
/**
* @brief Wrapper for MPI_Barrier
*
*
*/
void barrier();
/**
* @brief Wrapper for MPI_Barrier
*
*
*/
void barrier();
private:
int _rank;
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
};
};
/**
* @brief Wrapper for MPI_Bcast
*
* 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 value The integer value to send
* @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
*/
void broadcast(communicator &comm, int value, int root);
/**
* @brief Wrapper for MPI_Bcast
*
* 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 value The integer value to send
* @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
*/
void broadcast( communicator & comm, int value, int root );
/**
* @}
*/
} // namespace mpi
} // namespace eo
/**
* @}
*/
} // namespace mpi
#endif //__EO_IMPL_MPI_HPP__
# endif //__EO_IMPL_MPI_HPP__

View file

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

View file

@ -39,10 +39,8 @@ 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' ),
_enableResults( false, "parallelize-enable-results", "Enable the generation of results", '\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')
#ifdef _OPENMP
, _t_start(0)
#endif
_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)
{
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,219 +0,0 @@
#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

@ -1,28 +0,0 @@
#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

@ -1,35 +0,0 @@
#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 ...
(void) system("mkdir ResSelect");
system("mkdir ResSelect");
std::cout << "Testing the Selections\nParents size = " << pSize
<< ", offspring rate = " << oRate;
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 empirical proba. for each indi to be selected." << std::endl;
(void) system("mkdir ResSelect");
system("mkdir ResSelect");
// initialize parent population
parentsOrg.resize(pSize);

View file

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

View file

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

View file

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

View file

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

View file

@ -1,54 +0,0 @@
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,8 +19,7 @@ if(DOXYGEN_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE})
endif(DOXYGEN_EXECUTABLE)
# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake"
configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake"
"${MO_DOC_DIR}/${MO_DOC_CONFIG_FILE}")
install(
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
# if some version control system is used.
PROJECT_NUMBER = @PROJECT_VERSION@
PROJECT_NUMBER = @PACKAGE_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# 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
# generate Latex output.
GENERATE_LATEX = NO
GENERATE_LATEX = YES
# 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

View file

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

View file

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

View file

@ -79,20 +79,6 @@ public:
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
* @param _neighborhood the neighborhood

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