From 707b754dbf4a9de18b795a823cb5d021d5c147ad Mon Sep 17 00:00:00 2001
From: GMYS Jan
Date: Tue, 24 Nov 2020 16:01:30 +0100
Subject: [PATCH 001/134] formatting
---
README | 89 ++++++++++++++++++++++++----------------------------------
1 file changed, 36 insertions(+), 53 deletions(-)
diff --git a/README b/README
index c989a97b5..7a91504ff 100644
--- a/README
+++ b/README
@@ -1,73 +1,58 @@
-==========================================================================================
- RELEASE
+RELEASE
==========================================================================================
The current release is paradisEO-2.0
-==========================================================================================
- INSTALLATION
+INSTALLATION
==========================================================================================
The basic installation procedure must be done in a separatly folder in order to keep
your file tree clean.
-1) mkdir build
-2) cd build
-3) cmake ..
-4) make
-5) Take a cofee.
-6) Congratulation, ParadiseEO is installed !
+1. mkdir build
+2. cd build
+3. cmake ..
+4. make
+5. Take a cofee.
+6. Congratulation, ParadiseEO is installed !
Please refer to paradisEO website or INSTALL file for further information about
installation types and options.
-==========================================================================================
- DIRECTORY STRUCTURE
+DIRECTORY STRUCTURE
==========================================================================================
After unpacking the archive file, you should end up with the following
structure:
-.../
- |
- |
- +-- AUTHORS Author list
- |
- |
- +-- cmake/ CMake dir
- |
- |
- +-- CMakeLists.txt For building process
- |
- |
- +-- CTestConfig.cmake For testing process
- |
- |
- +-- INSTALL INSTALL file
- |
- |
- +-- LICENCE Licence contents
- |
- |
- +-- paradiseo-eo paradiseo-eo dir
- |
- |
- +-- paradiseo-mo paradiseo-mo dir
- |
- |
- +-- paradiseo-moeo paradiseo-moeo dir
- |
- |
- +-- problems classical problems evaluation functions
- |
- |
- +-- README README file
+.\
++-- AUTHORS Author list\
+|\
++-- cmake CMake dir\
+|\
++-- CMakeLists.txt For building process\
+|\
++-- CTestConfig.cmake For testing process\
+|\
++-- INSTALL INSTALL file\
+|\
++-- LICENCE Licence contents\
+|\
++-- paradiseo-eo paradiseo-eo dir\
+|\
++-- paradiseo-mo paradiseo-mo dir\
+|\
++-- paradiseo-moeo paradiseo-moeo dir\
+|\
++-- problems classical problems evaluation functions\
+|\
++-- README README file\
-==========================================================================================
- NOTES
+
+NOTES
==========================================================================================
-ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library.
-It contains classes for almost any kind of evolutionary computation you might come up to - at
+ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library.
+It contains classes for almost any kind of evolutionary computation you might come up to - at
least for the ones we could think of.
EO Website: http://eodev.sourceforge.net/.
EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
@@ -75,9 +60,7 @@ EO is distributed under the GNU Lesser General Public License: http://www.gnu.or
Please read README file of each extracted directory if you have
problems for the installation.
-==========================================================================================
- CONTACT
+CONTACT
==========================================================================================
For further information about ParadisEO, help or to report any
problem : paradiseo-help@lists.gforge.inria.fr
-
From 3396ef08147ceddb78f3b29e7f75ffed559da7ba Mon Sep 17 00:00:00 2001
From: GMYS Jan
Date: Tue, 24 Nov 2020 16:03:45 +0100
Subject: [PATCH 002/134] markdown formatting
---
README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..7a91504ff
--- /dev/null
+++ b/README.md
@@ -0,0 +1,66 @@
+
+RELEASE
+==========================================================================================
+
+The current release is paradisEO-2.0
+
+INSTALLATION
+==========================================================================================
+The basic installation procedure must be done in a separatly folder in order to keep
+your file tree clean.
+
+1. mkdir build
+2. cd build
+3. cmake ..
+4. make
+5. Take a cofee.
+6. Congratulation, ParadiseEO is installed !
+
+Please refer to paradisEO website or INSTALL file for further information about
+installation types and options.
+
+DIRECTORY STRUCTURE
+==========================================================================================
+After unpacking the archive file, you should end up with the following
+structure:
+
+.\
++-- AUTHORS Author list\
+|\
++-- cmake CMake dir\
+|\
++-- CMakeLists.txt For building process\
+|\
++-- CTestConfig.cmake For testing process\
+|\
++-- INSTALL INSTALL file\
+|\
++-- LICENCE Licence contents\
+|\
++-- paradiseo-eo paradiseo-eo dir\
+|\
++-- paradiseo-mo paradiseo-mo dir\
+|\
++-- paradiseo-moeo paradiseo-moeo dir\
+|\
++-- problems classical problems evaluation functions\
+|\
++-- README README file\
+
+
+NOTES
+==========================================================================================
+
+ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library.
+It contains classes for almost any kind of evolutionary computation you might come up to - at
+least for the ones we could think of.
+EO Website: http://eodev.sourceforge.net/.
+EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
+
+Please read README file of each extracted directory if you have
+problems for the installation.
+
+CONTACT
+==========================================================================================
+For further information about ParadisEO, help or to report any
+problem : paradiseo-help@lists.gforge.inria.fr
From 6c482dd3bce429719066b0a6903f974607402d66 Mon Sep 17 00:00:00 2001
From: GMYS Jan
Date: Tue, 24 Nov 2020 16:07:11 +0100
Subject: [PATCH 003/134] README.md replaced README
---
README | 66 -------------------------------------------------------
README.md | 6 ++---
2 files changed, 3 insertions(+), 69 deletions(-)
delete mode 100644 README
diff --git a/README b/README
deleted file mode 100644
index 7a91504ff..000000000
--- a/README
+++ /dev/null
@@ -1,66 +0,0 @@
-
-RELEASE
-==========================================================================================
-
-The current release is paradisEO-2.0
-
-INSTALLATION
-==========================================================================================
-The basic installation procedure must be done in a separatly folder in order to keep
-your file tree clean.
-
-1. mkdir build
-2. cd build
-3. cmake ..
-4. make
-5. Take a cofee.
-6. Congratulation, ParadiseEO is installed !
-
-Please refer to paradisEO website or INSTALL file for further information about
-installation types and options.
-
-DIRECTORY STRUCTURE
-==========================================================================================
-After unpacking the archive file, you should end up with the following
-structure:
-
-.\
-+-- AUTHORS Author list\
-|\
-+-- cmake CMake dir\
-|\
-+-- CMakeLists.txt For building process\
-|\
-+-- CTestConfig.cmake For testing process\
-|\
-+-- INSTALL INSTALL file\
-|\
-+-- LICENCE Licence contents\
-|\
-+-- paradiseo-eo paradiseo-eo dir\
-|\
-+-- paradiseo-mo paradiseo-mo dir\
-|\
-+-- paradiseo-moeo paradiseo-moeo dir\
-|\
-+-- problems classical problems evaluation functions\
-|\
-+-- README README file\
-
-
-NOTES
-==========================================================================================
-
-ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library.
-It contains classes for almost any kind of evolutionary computation you might come up to - at
-least for the ones we could think of.
-EO Website: http://eodev.sourceforge.net/.
-EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
-
-Please read README file of each extracted directory if you have
-problems for the installation.
-
-CONTACT
-==========================================================================================
-For further information about ParadisEO, help or to report any
-problem : paradiseo-help@lists.gforge.inria.fr
diff --git a/README.md b/README.md
index 7a91504ff..2579a0134 100644
--- a/README.md
+++ b/README.md
@@ -13,10 +13,10 @@ your file tree clean.
2. cd build
3. cmake ..
4. make
-5. Take a cofee.
-6. Congratulation, ParadiseEO is installed !
+5. Take a coffee.
+6. Congratulation, ParadisEO is installed !
-Please refer to paradisEO website or INSTALL file for further information about
+Please refer to ParadisEO website or INSTALL file for further information about
installation types and options.
DIRECTORY STRUCTURE
From f8347f9bf936ea0d877aad1ce13b15965f21cb34 Mon Sep 17 00:00:00 2001
From: GMYS Jan
Date: Thu, 17 Dec 2020 14:01:37 +0100
Subject: [PATCH 004/134] Update README.md
---
README.md | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 2579a0134..2f0f09b01 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
-
RELEASE
==========================================================================================
-
The current release is paradisEO-2.0
+DOCUMENTATION
+==========================================================================================
+[https://gitlab.inria.fr/paradiseo/paradiseo/-/wikis/home](https://gitlab.inria.fr/paradiseo/paradiseo/-/wikis/home)
+
INSTALLATION
==========================================================================================
The basic installation procedure must be done in a separatly folder in order to keep
From 25f4592826b319f464f3d5a755a61da46893cdd7 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Thu, 21 Jan 2021 20:19:32 +0100
Subject: [PATCH 005/134] [irace] feat: print class names of configured
operators
---
eo/contrib/irace/fastga.cpp | 71 ++++++++++++++++++++++++++++---------
1 file changed, 54 insertions(+), 17 deletions(-)
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index 7af376916..da3355264 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -111,7 +111,7 @@ eoAlgoFoundryFastGA& make_foundry(
Bits::Fitness fake_func(const Bits&) { return 0; }
-void print_param_full(const eoParam& param, const size_t slot_size, std::string type="i", std::ostream& out = std::cout)
+void print_irace_full(const eoParam& param, const size_t slot_size, std::string type="i", std::ostream& out = std::cout)
{
assert(type == "i" or type =="c");
@@ -145,23 +145,48 @@ void print_param_full(const eoParam& param, const size_t slot_size, std::string
}
template
-void print_param_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out = std::cout)
+void print_irace_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out = std::cout)
{
- print_param_full(param, op_foundry.size(), "c", out);
+ print_irace_full(param, op_foundry.size(), "c", out);
}
template<>
-void print_param_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out)
+void print_irace_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out)
{
- print_param_full(param, op_foundry.size(), "i", out);
+ print_irace_full(param, op_foundry.size(), "i", out);
}
template
-void print_param(const eoParam& param, const OPF& op_foundry, std::ostream& out = std::cout)
+void print_irace(const eoParam& param, const OPF& op_foundry, std::ostream& out = std::cout)
{
- print_param_typed(param, op_foundry, out);
+ print_irace_typed(param, op_foundry, 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
+void print_operators(const eoParam& param, OPF& 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;
+ }
+}
+
+
// Problem configuration.
struct Problem {
double dummy;
@@ -332,6 +357,18 @@ int main(int argc, char* argv[])
eoInitFixedLength fake_init(/*bitstring size=*/1, fake_gen);
auto fake_foundry = make_foundry(store, fake_init, fake_eval, max_evals, /*generations=*/ 1);
+ 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);
+
size_t n =
fake_foundry.crossover_rates.size()
* fake_foundry.crossover_selectors.size()
@@ -350,16 +387,16 @@ int main(int argc, char* argv[])
// Do not print problem and instances, as they are managed separately by irace.
std::cout << "# name\tswitch\ttype\trange" << std::endl;
- print_param( continuator_p, fake_foundry.continuators , std::cout);
- print_param( crossover_rate_p, fake_foundry.crossover_rates , std::cout);
- print_param( crossover_selector_p, fake_foundry.crossover_selectors , std::cout);
- print_param(aftercross_selector_p, fake_foundry.aftercross_selectors, std::cout);
- print_param( crossover_p, fake_foundry.crossovers , std::cout);
- print_param( mutation_rate_p, fake_foundry.mutation_rates , std::cout);
- print_param( mutation_selector_p, fake_foundry.mutation_selectors , std::cout);
- print_param( mutation_p, fake_foundry.mutations , std::cout);
- print_param( replacement_p, fake_foundry.replacements , std::cout);
- print_param( offspring_size_p, fake_foundry.offspring_sizes , std::cout);
+ 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);
// std::ofstream irace_param("fastga.params");
// irace_param << "# name\tswitch\ttype\tvalues" << std::endl;
From 82af0ed674327e80637628434a1fbdc4e5833999 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Sat, 23 Jan 2021 16:33:44 +0100
Subject: [PATCH 006/134] fix a filesystem bug of IOH by pre-creating
directories
---
eo/contrib/irace/CMakeLists.txt | 2 +-
eo/contrib/irace/fastga.cpp | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt
index 37c82187e..58cc86136 100644
--- a/eo/contrib/irace/CMakeLists.txt
+++ b/eo/contrib/irace/CMakeLists.txt
@@ -93,5 +93,5 @@ endif()
######################################################################################
add_executable(fastga fastga.cpp)
-target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY})
+target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs)
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index da3355264..12380030b 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -1,3 +1,4 @@
+#include
#include
#include
#include
@@ -451,7 +452,15 @@ int main(int argc, char* argv[])
std::clog << desc.str() << std::endl;
std::string dir(name.str());
+ std::filesystem::path d = name.str();
+ std::filesystem::create_directory(d);
+
std::string folder(desc.str());
+ std::filesystem::path f = desc.str();
+
+ std::filesystem::create_directory(d);
+ std::filesystem::create_directory(d/f);
+
csv_logger = std::make_shared>(dir, folder, name.str(), desc.str());
loggers.add(*csv_logger);
}
From 2fe6d03c8a3c5fbc7c42cea4cf6b68ee51e7f5f6 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Sat, 23 Jan 2021 16:34:28 +0100
Subject: [PATCH 007/134] update the experiments config
- feat add a template in target-runner to change the problem
- loop over irace runs for each problem
---
eo/contrib/irace/irace-config/example.scen | 2 +-
eo/contrib/irace/irace-config/target-runner | 2 +-
eo/contrib/irace/run_algo.sh | 8 ++---
eo/contrib/irace/run_expe.sh | 22 -------------
eo/contrib/irace/run_irace.sh | 34 +++++++++++++--------
5 files changed, 26 insertions(+), 42 deletions(-)
delete mode 100755 eo/contrib/irace/run_expe.sh
diff --git a/eo/contrib/irace/irace-config/example.scen b/eo/contrib/irace/irace-config/example.scen
index 6c7abb972..4a407e06a 100644
--- a/eo/contrib/irace/irace-config/example.scen
+++ b/eo/contrib/irace/irace-config/example.scen
@@ -63,7 +63,7 @@ targetRunner = "./target-runner"
## Maximum number of runs (invocations of targetRunner) that will be
## performed. It determines the maximum budget of experiments for the
## tuning.
-maxExperiments = 2000
+maxExperiments = 100000
## Maximum total execution time in seconds for the executions of
## targetRunner. targetRunner must return two values: cost and time.
diff --git a/eo/contrib/irace/irace-config/target-runner b/eo/contrib/irace/irace-config/target-runner
index 6d6e39dd7..87cf07e91 100755
--- a/eo/contrib/irace/irace-config/target-runner
+++ b/eo/contrib/irace/irace-config/target-runner
@@ -25,7 +25,7 @@ error() {
EXE="./fastga"
LOG_DIR="irace_logs"
-FIXED_PARAMS="--problem=0"
+FIXED_PARAMS="--problem={{PROBLEM}}"
CONFIG_ID=$1
INSTANCE_ID=$2
diff --git a/eo/contrib/irace/run_algo.sh b/eo/contrib/irace/run_algo.sh
index 32e8f9218..3dcd0da07 100755
--- a/eo/contrib/irace/run_algo.sh
+++ b/eo/contrib/irace/run_algo.sh
@@ -8,14 +8,12 @@ runs=50
problems=($(seq 0 18))
# Capture anything passed to the script
-algo="$@"
+outdir="$1"
+algo="${@:2}"
# You most probably want to run on release builds.
exe="./release/fastga"
-outdir="results"
-mkdir -p ${outdir}
-
i=1 # Loop counter.
for pb in "${problems[@]}" ; do # Iterate over the problems array.
for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
@@ -25,7 +23,7 @@ for pb in "${problems[@]}" ; do # Iterate over the problems array.
# This is the command to be ran.
cmd="${exe} --problem=${pb} --seed=${seed} ${algo}"
- # echo ${cmd} # Print the command.
+ echo ${cmd} # Print the command.
# Progress print.
echo -n "problem ${pb}, run ${seed}"
diff --git a/eo/contrib/irace/run_expe.sh b/eo/contrib/irace/run_expe.sh
deleted file mode 100755
index b864cf36e..000000000
--- a/eo/contrib/irace/run_expe.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-algos=(
-"--crossover-rate=0 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
-"--crossover-rate=1 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
-"--crossover-rate=2 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
-)
-
-
-i=1 # Loop counter.
-for algo in "${algos[@]}" ; do
- echo "${algo}"
-
- name="$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
- ./run_algo.sh ${algo} &> "expe_${name}.log"
-
- perc=$(echo "scale=2;${i}/${#algos[@]}*100" | bc)
- echo -e "${perc}%\n"
- i=$((i+1))
-done
-
-echo "Done"
diff --git a/eo/contrib/irace/run_irace.sh b/eo/contrib/irace/run_irace.sh
index 17c79e88d..1e0cd7a1d 100755
--- a/eo/contrib/irace/run_irace.sh
+++ b/eo/contrib/irace/run_irace.sh
@@ -1,19 +1,27 @@
#!/bin/bash
-if [[ $# != 1 ]] ; then
- echo "ERROR: build dir not indicated"
- exit 1
-fi
+outdir="$(date --iso-8601=minutes)_results_irace"
+mkdir ${outdir}
+cd ${outdir}
-cd $1
-pwd
+for p in $(seq 0 18) ; do
+ echo -n "Problem ${p}... "
+ res="results_problem_${p}"
+ mkdir ${res}
+ cd ${res}
-# Fore some reason, irace absolutely need those files...
-cp ../irace-config/example.scen .
-cp ../irace-config/target-runner .
-cp ../irace-config/default.instances .
+ # Fore some reason, irace absolutely need those files...
+ cp ../../irace-config/example.scen .
+ cp ../../irace-config/default.instances .
+ cp ../../release/fastga .
+ cat ../../irace-config/target-runner | sed "s/{{PROBLEM}}/${p}/" > ./target-runner
+ chmod u+x target-runner
-# Generate the parameter list file.
-./fastga -h > fastga.param 2>/dev/null
-/usr/lib/R/site-library/irace/bin/irace --scenario example.scen 2>&1 | tee irace.log
+ # Generate the parameter list file.
+ ./fastga -h > fastga.param 2>/dev/null
+ # /usr/lib/R/site-library/irace/bin/irace --scenario example.scen 2>&1 | tee irace.log
+ /usr/lib/R/site-library/irace/bin/irace --scenario example.scen &> irace.log
+ cd ..
+ echo " done"
+done
From 222c86143f7410ac4031fcc9b0937b5991803be1 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Sat, 23 Jan 2021 20:54:24 +0100
Subject: [PATCH 008/134] irace feat: add a way to print attainment histograms
---
eo/contrib/irace/fastga.cpp | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index 12380030b..d2f084f22 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -283,6 +283,11 @@ int main(int argc, char* argv[])
"full-log", "Log the full search in CSV files (using the IOH profiler format)",
'F').value();
+ bool output_mat =
+ parser.getORcreateParam(0,
+ "output-mat", "Output the aggregated attainment matrix instead of its scalar sum.",
+ 'A').value();
+
auto pop_size_p = parser.getORcreateParam(1,
"pop-size", "Population size",
@@ -558,7 +563,22 @@ int main(int argc, char* argv[])
// std::clog << "After " << eval_count.getValue() << " / " << max_evals << " evaluations" << std::endl;
- // Output
- std::cout << -1 * perf << std::endl;
+ if(output_mat) {
+ IOHprofiler_ecdf_aggregate agg;
+ IOHprofiler_ecdf_aggregate::Mat mat = agg(ecdf_logger.data());
+ std::clog << "Attainment matrix sum: " << std::endl;
+ assert(mat.size() > 0);
+ assert(mat[0].size() > 1);
+ for(int i = mat.size()-1; i >= 0; --i) {
+ std::cout << mat[i][0];
+ for(int j = 1; j < mat[i].size(); ++j) {
+ std::cout << "," << mat[i][j];
+ }
+ std::cout << std::endl;
+ }
+
+ } else {
+ std::cout << -1 * perf << std::endl;
+ }
}
From 1b4f9447f2bf6ced777a950afe8f656332c8ae54 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Sat, 23 Jan 2021 20:55:13 +0100
Subject: [PATCH 009/134] irace feat: scripts to run baseline and plot ECDF
histograms
---
eo/contrib/irace/plot_attain_mat.py | 44 +++++++++++++++++++++++++++++
eo/contrib/irace/run_baseline.sh | 30 ++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100755 eo/contrib/irace/plot_attain_mat.py
create mode 100755 eo/contrib/irace/run_baseline.sh
diff --git a/eo/contrib/irace/plot_attain_mat.py b/eo/contrib/irace/plot_attain_mat.py
new file mode 100755
index 000000000..8a0b45bde
--- /dev/null
+++ b/eo/contrib/irace/plot_attain_mat.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+import os
+import numpy as np
+import matplotlib.pyplot as plt
+
+for p in range(18):
+
+ print("Pb",p,end=": ")
+ datadir="attain_mat_{pb}".format(pb=p)
+
+ try:
+ os.mkdir(datadir)
+ except FileExistsError:
+ pass
+
+ for i in range(50):
+ cmd="./release/fastga --seed={i} \
+ --crossover-rate=2 --cross-selector=2 --crossover=5 --mutation-rate=2 --mut-selector=2 --mutation=1 --replacement=0 \
+ --problem={pb} --buckets=20 --output-mat 2>/dev/null > {dir}/output_mat_{i}.csv"\
+ .format(dir=datadir, i=i, pb=p)
+ # print(cmd)
+ print(i,end=" ",flush=True)
+ os.system(cmd)
+
+
+ matrices=[]
+ for root, dirs, files in os.walk(datadir):
+ for filename in files:
+ matrices.append( np.genfromtxt(datadir+"/"+filename,delimiter=',') )
+
+ agg = matrices[0]
+ for mat in matrices[1:]:
+ agg += mat
+
+ # print(agg)
+
+ plt.rcParams["figure.figsize"] = (3,3)
+ plt.gca().pcolor(agg, edgecolors='grey', cmap="Blues")
+ plt.gca().set_xlabel("Time budget")
+ plt.gca().set_ylabel("Target")
+ plt.savefig("aittain_map_{pb}.png".format(pb=p), bbox_inches='tight')
+
+ print(".")
diff --git a/eo/contrib/irace/run_baseline.sh b/eo/contrib/irace/run_baseline.sh
new file mode 100755
index 000000000..5ff274181
--- /dev/null
+++ b/eo/contrib/irace/run_baseline.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+outdir="$(date --iso-8601=minutes)_results_baselines"
+mkdir ${outdir}
+
+algos=(
+# (λ+λ)EA
+"--full-log=1 --crossover-rate=0 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=1 --replacement=0"
+# (λ+λ)fEA
+"--full-log=1 --crossover-rate=0 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=5 --replacement=0"
+# (λ+λ)xGA
+"--full-log=1 --crossover-rate=2 --cross-selector=2 --crossover=2 --mutation-rate=2 --mut-selector=2 --mutation=1 --replacement=0"
+# (λ+λ)1ptGA
+"--full-log=1 --crossover-rate=2 --cross-selector=2 --crossover=5 --mutation-rate=2 --mut-selector=2 --mutation=1 --replacement=0"
+)
+
+
+i=1 # Loop counter.
+for algo in "${algos[@]}" ; do
+ echo "${algo}"
+
+ name="$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
+ ./run_algo.sh ${outdir} ${algo} &> "expe_${name}.log"
+
+ perc=$(echo "scale=2;${i}/${#algos[@]}*100" | bc)
+ echo -e "${perc}%\n"
+ i=$((i+1))
+done
+
+echo "Done"
From e617916e98903a6982d7dc7d2ed6ce17d0b47804 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Mon, 25 Jan 2021 13:48:52 +0100
Subject: [PATCH 010/134] feat irace add script to parse irace to csv
---
eo/contrib/irace/irace-config/example.scen | 4 ++--
eo/contrib/irace/parse_irace_bests.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
create mode 100755 eo/contrib/irace/parse_irace_bests.py
diff --git a/eo/contrib/irace/irace-config/example.scen b/eo/contrib/irace/irace-config/example.scen
index 4a407e06a..3c7e9beed 100644
--- a/eo/contrib/irace/irace-config/example.scen
+++ b/eo/contrib/irace/irace-config/example.scen
@@ -62,8 +62,8 @@ targetRunner = "./target-runner"
## Maximum number of runs (invocations of targetRunner) that will be
## performed. It determines the maximum budget of experiments for the
-## tuning.
-maxExperiments = 100000
+## tuning. (minimum: 180)
+maxExperiments = 20000 # 100000
## Maximum total execution time in seconds for the executions of
## targetRunner. targetRunner must return two values: cost and time.
diff --git a/eo/contrib/irace/parse_irace_bests.py b/eo/contrib/irace/parse_irace_bests.py
new file mode 100755
index 000000000..3ee600352
--- /dev/null
+++ b/eo/contrib/irace/parse_irace_bests.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import os
+import re
+import sys
+
+print("pb,ecdf,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement")
+for datadir in sys.argv[1:]:
+
+ for pb_dir in os.listdir(datadir):
+ if "results_problem" in pb_dir:
+ pb_id=pb_dir.replace("results_problem_","")
+ with open(os.path.join("./",datadir,pb_dir,"irace.log")) as fd:
+ data = [line.strip() for line in fd.readlines() if "--crossover-rate=" in line]
+ for line in data:
+ algo=re.sub("\-\-\S*=", ",", line)
+ csv_line=pb_id+","+algo
+ print(csv_line.replace(" ",""))
From 2326fd8c8b5efa03a12677ce6650e1f6071fc064 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Thu, 28 Jan 2021 19:10:09 +0100
Subject: [PATCH 011/134] fix irace.log parser
Was parsing the ID as the performance.
---
eo/contrib/irace/parse_irace_bests.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/eo/contrib/irace/parse_irace_bests.py b/eo/contrib/irace/parse_irace_bests.py
index 3ee600352..d7bce959d 100755
--- a/eo/contrib/irace/parse_irace_bests.py
+++ b/eo/contrib/irace/parse_irace_bests.py
@@ -4,15 +4,27 @@ import os
import re
import sys
-print("pb,ecdf,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement")
+print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement")
for datadir in sys.argv[1:]:
for pb_dir in os.listdir(datadir):
if "results_problem" in pb_dir:
pb_id=pb_dir.replace("results_problem_","")
with open(os.path.join("./",datadir,pb_dir,"irace.log")) as fd:
- data = [line.strip() for line in fd.readlines() if "--crossover-rate=" in line]
- for line in data:
- algo=re.sub("\-\-\S*=", ",", line)
- csv_line=pb_id+","+algo
+ data = fd.readlines()
+
+ # Find the last best configuration
+ bests = [line.strip() for line in data if "Best-so-far" in line]
+ best = bests[-1].split()
+ best_id, best_perf = best[2], best[5]
+ # print(best_id,best_perf)
+
+ # Filter the config detail
+ configs = [line.strip() for line in data if "--crossover-rate=" in line and best_id in line]
+ # print(configs)
+
+ # Format as CSV
+ for config in configs:
+ algo = re.sub("\-\-\S*=", ",", config)
+ csv_line = pb_id + "," + best_perf + "," + algo
print(csv_line.replace(" ",""))
From a959a3b57e4bfbb72f9fdce08555d42334255bc3 Mon Sep 17 00:00:00 2001
From: Amine Aziz-Alaoui
Date: Wed, 3 Feb 2021 10:00:04 +0100
Subject: [PATCH 012/134] [irace] add expe run scripts
---
eo/contrib/irace/run_elite.sh | 67 ++++++++++++++++++++
eo/contrib/irace/run_irace_all.sh | 14 ++++
eo/contrib/irace/run_irace_parallel-batch.sh | 38 +++++++++++
3 files changed, 119 insertions(+)
create mode 100755 eo/contrib/irace/run_elite.sh
create mode 100755 eo/contrib/irace/run_irace_all.sh
create mode 100755 eo/contrib/irace/run_irace_parallel-batch.sh
diff --git a/eo/contrib/irace/run_elite.sh b/eo/contrib/irace/run_elite.sh
new file mode 100755
index 000000000..61a074640
--- /dev/null
+++ b/eo/contrib/irace/run_elite.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Number of runs (=seeds).
+runs=50
+
+# You most probably want to run on release builds.
+exe="./release/fastga"
+
+outdir="$(date --iso-8601=minutes)_results_elites"
+mkdir ${outdir}
+
+# FIXME
+algos=(
+"--crossover-rate=1 --cross-selector=2 --crossover=1 --mutation-rate=2 --mut-selector=2 --mutation=8 --replacement=8"
+"--crossover-rate=4 --cross-selector=5 --crossover=2 --mutation-rate=3 --mut-selector=4 --mutation=9 --replacement=9"
+"--crossover-rate=1 --cross-selector=3 --crossover=8 --mutation-rate=2 --mut-selector=6 --mutation=3 --replacement=2"
+"--crossover-rate=2 --cross-selector=1 --crossover=1 --mutation-rate=2 --mut-selector=6 --mutation=9 --replacement=0"
+"--crossover-rate=4 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=3 --mutation=7 --replacement=0"
+"--crossover-rate=0 --cross-selector=3 --crossover=2 --mutation-rate=4 --mut-selector=2 --mutation=6 --replacement=0"
+"--crossover-rate=3 --cross-selector=0 --crossover=3 --mutation-rate=4 --mut-selector=3 --mutation=10 --replacement=0"
+"--crossover-rate=0 --cross-selector=1 --crossover=0 --mutation-rate=3 --mut-selector=2 --mutation=10 --replacement=0"
+"--crossover-rate=2 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=5 --mutation=10 --replacement=0"
+"--crossover-rate=4 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=5 --mutation=9 --replacement=0"
+"--crossover-rate=3 --cross-selector=2 --crossover=10 --mutation-rate=4 --mut-selector=2 --mutation=10 --replacement=0"
+"--crossover-rate=2 --cross-selector=2 --crossover=5 --mutation-rate=4 --mut-selector=3 --mutation=9 --replacement=0"
+"--crossover-rate=3 --cross-selector=6 --crossover=2 --mutation-rate=4 --mut-selector=1 --mutation=10 --replacement=0"
+"--crossover-rate=1 --cross-selector=5 --crossover=9 --mutation-rate=4 --mut-selector=2 --mutation=8 --replacement=0"
+"--crossover-rate=2 --cross-selector=5 --crossover=2 --mutation-rate=4 --mut-selector=6 --mutation=8 --replacement=0"
+"--crossover-rate=2 --cross-selector=2 --crossover=10 --mutation-rate=4 --mut-selector=6 --mutation=10 --replacement=0"
+"--crossover-rate=3 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=5 --mutation=10 --replacement=0"
+"--crossover-rate=4 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=1 --mutation=8 --replacement=0"
+"--crossover-rate=4 --cross-selector=2 --crossover=2 --mutation-rate=4 --mut-selector=6 --mutation=9 --replacement=0"
+)
+
+pb=0 # Loop counter.
+for algo in "${algos[@]}" ; do
+ echo "Problem ${pb}"
+ echo -n "Runs: "
+
+ for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
+ # This is the command to be ran.
+ cmd="${exe} --full-log=1 --problem=${pb} --seed=${seed} ${algo}"
+ # echo ${cmd} # Print the command.
+
+ # Forge a directory/log file name
+ # (remove double dashs and replace spaces with underscore).
+ name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
+ # echo $name_run
+
+ # Progress print.
+ echo -n "${seed} "
+
+ # Actually start the command.
+ ${cmd} > "${outdir}/${name_run}.dat" 2> "${outdir}/${name_run}.log"
+
+ # Check for the most common problem in the log file.
+ cat "${outdir}/${name_run}.log" | grep "illogical performance"
+ done
+
+ echo ""
+ perc=$(echo "scale=2;${pb}/${#algos[@]}*100" | bc)
+ echo -e "${perc}%\n"
+ pb=$((pb+1))
+
+done
+
+echo "Done"
diff --git a/eo/contrib/irace/run_irace_all.sh b/eo/contrib/irace/run_irace_all.sh
new file mode 100755
index 000000000..eff27d2d6
--- /dev/null
+++ b/eo/contrib/irace/run_irace_all.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+date -Iseconds
+echo "STARTS"
+
+for r in $(seq 15); do
+ echo "Run $r/15";
+ date -Iseconds
+ ./run_irace_parallel-batch.sh
+ date -Iseconds
+done
+
+echo "DONE"
+date -Iseconds
diff --git a/eo/contrib/irace/run_irace_parallel-batch.sh b/eo/contrib/irace/run_irace_parallel-batch.sh
new file mode 100755
index 000000000..91b73d7c3
--- /dev/null
+++ b/eo/contrib/irace/run_irace_parallel-batch.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+outdir="$(date --iso-8601=ns)_results_irace"
+mkdir ${outdir}
+cd ${outdir}
+
+run(){
+ p="$1"
+
+ echo "Problem ${p}"
+ res="results_problem_${p}"
+ mkdir ${res}
+ cd ${res}
+
+ # Fore some reason, irace absolutely need those files...
+ cp ../../irace-config/example.scen .
+ cp ../../irace-config/default.instances .
+ cp ../../release/fastga .
+ cat ../../irace-config/target-runner | sed "s/{{PROBLEM}}/${p}/" > ./target-runner
+ chmod u+x target-runner
+
+ # Generate the parameter list file.
+ ./fastga -h > fastga.param 2>/dev/null
+ # /usr/lib/R/site-library/irace/bin/irace --scenario example.scen 2>&1 | tee irace.log
+ /usr/lib/R/site-library/irace/bin/irace --scenario example.scen &> irace.log
+
+ cd ..
+ echo "Done problem ${p}"
+}
+
+N=5 # Somehow 5 is the fastest on my 4-cores machine.
+(
+for pb in $(seq 0 18); do
+ ((i=i%N)); ((i++==0)) && wait
+ run "$pb" &
+done
+wait
+)
From 2da4a0209240dae7bbe9c4a604050e16a40f315e Mon Sep 17 00:00:00 2001
From: Amine Aziz-Alaoui
Date: Wed, 3 Feb 2021 10:00:32 +0100
Subject: [PATCH 013/134] [irace] fix default configuration
---
eo/contrib/irace/fastga.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index d2f084f22..f884d6813 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -260,7 +260,7 @@ int main(int argc, char* argv[])
// 'd', "Problem").value();
const size_t dimension = problem_config_mapping[problem].dimension;
- const size_t max_evals = parser.getORcreateParam(2 * dimension,
+ const size_t max_evals = parser.getORcreateParam(5 * dimension,
"max-evals", "Maximum number of evaluations",
'e', "Stopping criterion").value();
@@ -289,7 +289,7 @@ int main(int argc, char* argv[])
'A').value();
- auto pop_size_p = parser.getORcreateParam(1,
+ auto pop_size_p = parser.getORcreateParam(5,
"pop-size", "Population size",
'P', "Operator Choice", /*required=*/false);
const size_t pop_size = pop_size_p.value();
@@ -466,7 +466,7 @@ int main(int argc, char* argv[])
std::filesystem::create_directory(d);
std::filesystem::create_directory(d/f);
- csv_logger = std::make_shared>(dir, folder, name.str(), desc.str());
+ csv_logger = std::make_shared>(dir, folder, d, f);
loggers.add(*csv_logger);
}
From 1c940d6ec4f448a3b21c2cedd7ecb6987411a2c9 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 3 Feb 2021 10:01:17 +0100
Subject: [PATCH 014/134] [irace]_add architecture diagram
---
eo/contrib/irace/architecture.dia | Bin 0 -> 4977 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 eo/contrib/irace/architecture.dia
diff --git a/eo/contrib/irace/architecture.dia b/eo/contrib/irace/architecture.dia
new file mode 100644
index 0000000000000000000000000000000000000000..64143969ae0756a6dc3e09d6744d154a6e9538ed
GIT binary patch
literal 4977
zcmZ{mbyySbyN5{`NW|KuSWTMvhQqlz=pXv?v`z
zq#c8!-*e9I)OFtHy6)@#Jnw(cAMg8cBLD<{4-xUcqhH1krL3!0P7_-M2*;1^h=a9L
z6Q*ok_eSuIY$Ja-H`QFlQv0VYn=FrtKr~MMOcR^IDca$5$!Gsur*+9O_Vc~@+l@LY
zePS9`CqJd5@G6Kp4WvZIIeVdQfN!q?g8k|L3s;z!=2
zkOs|@h&RT7ZjF$xm&vs3x*f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*RRfwK|MO;%ng93dP`CYDE{C9E+
z(T1!h5=NrleKPgxXT8wIoUxL(^$#h|6q>VnPf98Z$bMH~+-
zxv4R{)@*%C%aLJPQOnUHF$jvkQZw2w2|DHLgW|CKaWNH*5}qn2JI0$4Vbw~~4Qhqo
z2&-YXB{=J?zY9Iym*(wElze>}hEIJ~cYX}&tEZda%@?m5I;tvKZE9QOfz}vyX4!jP
zZ$1`TKFXwiN{c=_W<)vgf15G
z1S}fW7R4hzw~+(w#UnkgR@SR+uX|GX1d7+2S5tNuH2RZk?gsV3LxD#
z+yQ>fRp76FW|X3%ZKjRRg3p{qMZaCPn2PfG^XD4eC3GDo&UwqMB2;^8s?sWt_*ZjINB~cJ@HgZk;1IGPcXqS-S-vCIR
BeL?^L
literal 0
HcmV?d00001
From 202246be0215518cc9b680e0c20a0f401da37e93 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 3 Feb 2021 10:05:07 +0100
Subject: [PATCH 015/134] [irace] add FastGA grammar diagram
---
eo/contrib/irace/fastga_grammar.dia | Bin 0 -> 5657 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 eo/contrib/irace/fastga_grammar.dia
diff --git a/eo/contrib/irace/fastga_grammar.dia b/eo/contrib/irace/fastga_grammar.dia
new file mode 100644
index 0000000000000000000000000000000000000000..ac10761281f285d6058d41b33da394bf41b1dbb0
GIT binary patch
literal 5657
zcmaji2T+sEx(9F-lq$VS6;SCN=^#y7XwoGVDbjoIA|M?^AoL(02_%GG1SB9G0)!4q
ziS#BQ-B7QdGv~~A?mgabf3rK!?(Dqt&d$!x{8O#iJ9w%fT>3Tlu`
zf8(+0yNhJ39zT2czLAArj5h{OoOg`#0+y!5)9J)znN!l#>2xeH7iXvxoV_(2cjWmp
z2k{l_6=2+IfwCZ01UtW-YYG;)@(4aZ-ZrL~w^smv;2_N8SZ=(gRMzw0A)H_MgsqsK
zEw`driMaT(1yuk;7ag(>Ef@!}+qrszSD`r%Q2}21pywG3kM!Q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h*^pR{uX6SV=xcT(wTv3UZ;tF9InsjWryOY$XEG&rIylO$0>JL4T%OJ0U%QRkn4}z%ewMqHrLDh+
z)%IR7%ig96TEc6r_XXV|@$FQn57HTESD=^R#KE)s_CC=*NcWBiT9UI<*f06Z$C*Mm
z(6~xA4=Dpkpj^;0YJhLp32r)EDv=)m#U=5H1VsM@;%%7$Cc=$ccygx#P=8C{4IZNXbw-d
z2A9v4h2(Rl6KL$YQki1elp!o#5iWNd;iLpt{Kdi&{v7ta{z8s$H}Gt&<$z(|KIhJ%
RIObCRhxSXes=iw{{s(r+5Jvz2
literal 0
HcmV?d00001
From 58e206cb408d540c514ad904c3af0bdbda373183 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 3 Feb 2021 16:58:26 +0100
Subject: [PATCH 016/134] [irace] feat more parse scripts
---
eo/contrib/irace/irace-config/example.scen | 8 ++--
eo/contrib/irace/parse_baseline.py | 28 +++++++++++++
eo/contrib/irace/parse_baseline_average.py | 49 ++++++++++++++++++++++
eo/contrib/irace/parse_elites.py | 21 ++++++++++
4 files changed, 102 insertions(+), 4 deletions(-)
create mode 100755 eo/contrib/irace/parse_baseline.py
create mode 100755 eo/contrib/irace/parse_baseline_average.py
create mode 100755 eo/contrib/irace/parse_elites.py
diff --git a/eo/contrib/irace/irace-config/example.scen b/eo/contrib/irace/irace-config/example.scen
index 3c7e9beed..5f9fafe15 100644
--- a/eo/contrib/irace/irace-config/example.scen
+++ b/eo/contrib/irace/irace-config/example.scen
@@ -15,7 +15,7 @@ execDir = "."
## File to save tuning results as an R dataset, either absolute path or
## relative to execDir.
-# logFile = "./irace.Rdata"
+logFile = "" # "./irace.Rdata"
## Previously saved log file to recover the execution of irace, either
## absolute path or relative to the current directory. If empty or NULL,
@@ -63,7 +63,7 @@ targetRunner = "./target-runner"
## Maximum number of runs (invocations of targetRunner) that will be
## performed. It determines the maximum budget of experiments for the
## tuning. (minimum: 180)
-maxExperiments = 20000 # 100000
+maxExperiments = 100000
## Maximum total execution time in seconds for the executions of
## targetRunner. targetRunner must return two values: cost and time.
@@ -129,13 +129,13 @@ digits = 2
## Number of calls to targetRunner to execute in parallel. Values 0 or 1
## mean no parallelization.
-# parallel = 0
+parallel = 0
## Enable/disable load-balancing when executing experiments in parallel.
## Load-balancing makes better use of computing resources, but increases
## communication overhead. If this overhead is large, disabling
## load-balancing may be faster.
-# loadBalancing = 1
+loadBalancing = 0
## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel
## (parameter parallel is the number of slaves).
diff --git a/eo/contrib/irace/parse_baseline.py b/eo/contrib/irace/parse_baseline.py
new file mode 100755
index 000000000..8f0193910
--- /dev/null
+++ b/eo/contrib/irace/parse_baseline.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import sys
+
+print("algo,problem,seed,ECDF_AUC")
+
+algos_names = {
+ str({"crossover-rate":0, "cross-selector":0, "crossover":0, "mutation-rate":0, "mut-selector":0, "mutation":1, "replacement":0}) : "EA",
+ str({"crossover-rate":0, "cross-selector":0, "crossover":0, "mutation-rate":0, "mut-selector":0, "mutation":5, "replacement":0}) : "fEA",
+ str({"crossover-rate":2, "cross-selector":2, "crossover":2, "mutation-rate":2, "mut-selector":2, "mutation":1, "replacement":0}) : "xGA",
+ str({"crossover-rate":2, "cross-selector":2, "crossover":5, "mutation-rate":2, "mut-selector":2, "mutation":1, "replacement":0}) : "1ptGA",
+}
+
+for fname in sys.argv[1:]:
+
+ run = {}
+ for f in fname.strip(".dat").split("_"):
+ kv = f.split("=")
+ assert(len(kv)==2),str(kv)+" "+str(len(kv))
+ key,idx = kv[0], int(kv[1])
+ run[key] = idx
+
+ with open(fname) as fd:
+ auc = int(fd.readlines()[0]) * -1
+
+ algo = str({"crossover-rate":run["crossover-rate"], "cross-selector":run["cross-selector"], "crossover":run["crossover"], "mutation-rate":run["mutation-rate"], "mut-selector":run["mut-selector"], "mutation":run["mutation"], "replacement":run["replacement"]})
+
+ print(algos_names[algo], run["pb"], run["seed"], auc, sep=",")
diff --git a/eo/contrib/irace/parse_baseline_average.py b/eo/contrib/irace/parse_baseline_average.py
new file mode 100755
index 000000000..2b71f7c4a
--- /dev/null
+++ b/eo/contrib/irace/parse_baseline_average.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+
+import sys
+
+print("problem,EA,fEA,xGA,1ptGA")
+
+algos_names = {
+ str({"crossover-rate":0, "cross-selector":0, "crossover":0, "mutation-rate":0, "mut-selector":0, "mutation":1, "replacement":0}) : "EA",
+ str({"crossover-rate":0, "cross-selector":0, "crossover":0, "mutation-rate":0, "mut-selector":0, "mutation":5, "replacement":0}) : "fEA",
+ str({"crossover-rate":2, "cross-selector":2, "crossover":2, "mutation-rate":2, "mut-selector":2, "mutation":1, "replacement":0}) : "xGA",
+ str({"crossover-rate":2, "cross-selector":2, "crossover":5, "mutation-rate":2, "mut-selector":2, "mutation":1, "replacement":0}) : "1ptGA",
+}
+
+data = {}
+
+# Parse
+for fname in sys.argv[1:]:
+
+ run = {}
+ for f in fname.strip(".dat").split("_"):
+ kv = f.split("=")
+ assert(len(kv)==2),str(kv)+" "+str(len(kv))
+ key,idx = kv[0], int(kv[1])
+ run[key] = idx
+
+ with open(fname) as fd:
+ auc = int(fd.readlines()[0]) * -1
+
+ algo = str({"crossover-rate":run["crossover-rate"], "cross-selector":run["cross-selector"], "crossover":run["crossover"], "mutation-rate":run["mutation-rate"], "mut-selector":run["mut-selector"], "mutation":run["mutation"], "replacement":run["replacement"]})
+
+ if run["pb"] in data:
+ data[run["pb"]][algos_names[algo]].append(auc)
+ else:
+ data[run["pb"]] = {
+ "EA" : [],
+ "fEA" : [],
+ "xGA" : [],
+ "1ptGA": [],
+ }
+ data[run["pb"]][algos_names[algo]].append(auc)
+
+
+# Print CSV
+for pb in sorted(data.keys()):
+ print(pb, end="")
+ for algo in ["EA","fEA","xGA","1ptGA"]:
+ res = data[pb][algo]
+ print(",", sum(res)/len(res), end="", sep="")
+ print()
diff --git a/eo/contrib/irace/parse_elites.py b/eo/contrib/irace/parse_elites.py
new file mode 100755
index 000000000..518bc7245
--- /dev/null
+++ b/eo/contrib/irace/parse_elites.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import sys
+
+print("algo,problem,seed,ECDF_AUC")
+
+for fname in sys.argv[1:]:
+
+ run = {}
+ for f in fname.strip(".dat").split("_"):
+ kv = f.split("=")
+ assert(len(kv)==2),str(kv)+" "+str(len(kv))
+ key,idx = kv[0], int(kv[1])
+ run[key] = idx
+
+ with open(fname) as fd:
+ auc = int(fd.readlines()[0]) * -1
+
+ algo = "pc={}_c={}_C={}_pm={}_m={}_M={}_R={}".format(run["crossover-rate"],run["cross-selector"],run["crossover"],run["mutation-rate"],run["mut-selector"],run["mutation"],run["replacement"])
+
+ print(algo, run["pb"], run["seed"], auc, sep=",")
From 425a71d6a646b4df2aaa336d27bdaa137f382a18 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Tue, 16 Feb 2021 09:04:56 +0100
Subject: [PATCH 017/134] [irace] script to run all elites on all problems
---
eo/contrib/irace/run_elites_all.sh | 61 ++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100755 eo/contrib/irace/run_elites_all.sh
diff --git a/eo/contrib/irace/run_elites_all.sh b/eo/contrib/irace/run_elites_all.sh
new file mode 100755
index 000000000..1423239d1
--- /dev/null
+++ b/eo/contrib/irace/run_elites_all.sh
@@ -0,0 +1,61 @@
+
+#!/bin/bash
+
+# Number of runs (=seeds).
+runs=50
+
+# You most probably want to run on release builds.
+exe="./release/fastga"
+
+outdir="$(date --iso-8601=minutes)_results_elites_all"
+mkdir -p ${outdir}
+mkdir -p ${outdir}/raw
+mkdir -p ${outdir}/raw/data
+mkdir -p ${outdir}/raw/logs
+
+n=0
+algoid=0
+for line in $(cat results_irace_100k.csv|cut -s -d"," -f4-10); do
+ echo ""
+ date
+
+ a=($(echo $line | sed "s/,/ /g"))
+ algo="--crossover-rate=${a[0]} --cross-selector=${a[1]} --crossover=${a[2]} --mutation-rate=${a[3]} --mut-selector=${a[4]} --mutation=${a[5]} --replacement=${a[6]}"
+
+ for pb in $(seq 0 18) ; do
+ perc=$(echo "scale=3;${n}/(285*18)*100.0" | bc)
+ echo "${perc}% : algo ${algoid}/285, problem ${pb}/18"
+ # echo -n "Runs: "
+
+ for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
+ # This is the command to be ran.
+ cmd="${exe} --full-log=1 --problem=${pb} --seed=${seed} ${algo}"
+ # echo ${cmd} # Print the command.
+
+ # Forge a directory/log file name
+ # (remove double dashs and replace spaces with underscore).
+ name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
+ # echo $name_run
+
+ # Progress print.
+ # echo -n "${seed} "
+
+ # Actually start the command.
+ ${cmd} > "${outdir}/raw/data/${name_run}.dat" 2> "${outdir}/raw/logs/${name_run}.log"
+
+ # Check for the most common problem in the log file.
+ cat "${outdir}/raw/logs/${name_run}.log" | grep "illogical performance"
+ done # seed
+ # echo ""
+
+ n=$(($n+1))
+ done # pb
+
+ algoid=$(($algoid+1))
+done
+
+# Move IOH logs in the results directory.
+mv ./FastGA_* ${outdir}
+
+echo "Done"
+date
From 1e93e8d3c2592e56c314330a8e8af107b4036ef9 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Tue, 16 Feb 2021 15:25:21 +0100
Subject: [PATCH 018/134] [irace] add script to run random algorithms
---
eo/contrib/irace/run_randoms.sh | 61 +++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100755 eo/contrib/irace/run_randoms.sh
diff --git a/eo/contrib/irace/run_randoms.sh b/eo/contrib/irace/run_randoms.sh
new file mode 100755
index 000000000..2b4c65ade
--- /dev/null
+++ b/eo/contrib/irace/run_randoms.sh
@@ -0,0 +1,61 @@
+
+#!/bin/bash
+
+# Number of runs (=seeds).
+runs=50
+
+# You most probably want to run on release builds.
+exe="./release/fastga"
+
+outdir="$(date --iso-8601=minutes)_results_randoms"
+mkdir -p ${outdir}
+mkdir -p ${outdir}/raw
+mkdir -p ${outdir}/raw/data
+mkdir -p ${outdir}/raw/logs
+
+n=1
+algoid=0
+for algoid in $(seq 0 100); do
+ echo ""
+ date
+
+ a=( $((RANDOM%5)) $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%5)) $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%11)) )
+ algo="--crossover-rate=${a[0]} --cross-selector=${a[1]} --crossover=${a[2]} --mutation-rate=${a[3]} --mut-selector=${a[4]} --mutation=${a[5]} --replacement=${a[6]}"
+
+ for pb in $(seq 0 18) ; do
+ perc=$(echo "scale=3;${n}/(100*18)*100.0" | bc)
+ echo "${perc}% : algo ${algoid}/100, problem ${pb}/18"
+ # echo -n "Runs: "
+
+ for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
+ # This is the command to be ran.
+ cmd="${exe} --full-log=1 --problem=${pb} --seed=${seed} ${algo}"
+ # echo ${cmd} # Print the command.
+
+ # Forge a directory/log file name
+ # (remove double dashs and replace spaces with underscore).
+ name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
+ # echo $name_run
+
+ # Progress print.
+ # echo -n "${seed} "
+
+ # Actually start the command.
+ ${cmd} > "${outdir}/raw/data/${name_run}.dat" 2> "${outdir}/raw/logs/${name_run}.log"
+
+ # Check for the most common problem in the log file.
+ cat "${outdir}/raw/logs/${name_run}.log" | grep "illogical performance"
+ done # seed
+ # echo ""
+
+ n=$(($n+1))
+ done # pb
+
+ algoid=$(($algoid+1))
+done
+
+# Move IOH logs in the results directory.
+mv ./FastGA_* ${outdir}
+
+echo "Done"
+date
From da44681fd7141cf692a0b82dbc3c30942a59026a Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 7 Jul 2021 12:59:16 +0200
Subject: [PATCH 019/134] redact name in doc
---
docs/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/index.html b/docs/index.html
index b067bfa26..e93e5ee19 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1284,7 +1284,7 @@ undiscovered knowledge.
worked a lot on the multi-objective module and
on the local-search one along with Sébastien Verel
and Jeremy Humeau.
- In the same team, Clive Canape and J. Boisson made significant contributions.
+ In the same team, C. C. and J. Boisson made significant contributions.
Karima Boufaras specifically worked on (now deprecated) GPU tools.
The (then) EO project was then taken over by Johann Dreo,
From 8e960b23f322c4124252019889b54bbdb07cedb0 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 7 Jul 2021 12:59:41 +0200
Subject: [PATCH 020/134] update irace/fastga to follow recent IOH refactoring
---
CMakeLists.txt | 1 +
eo/contrib/irace/CMakeLists.txt | 50 +--
eo/contrib/irace/architecture.dia | Bin 4977 -> 0 bytes
eo/contrib/irace/fastga.cpp | 193 +++++-----
eo/contrib/irace/fastga_grammar.dia | Bin 5657 -> 0 bytes
problems/eval/eoEvalIOH.h | 553 ++++++++++++++--------------
6 files changed, 393 insertions(+), 404 deletions(-)
delete mode 100644 eo/contrib/irace/architecture.dia
delete mode 100644 eo/contrib/irace/fastga_grammar.dia
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 835847770..814feac2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
# ParadiseO
+
######################################################################################
### 0) Check the CMake version
######################################################################################
diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt
index 58cc86136..a77849b15 100644
--- a/eo/contrib/irace/CMakeLists.txt
+++ b/eo/contrib/irace/CMakeLists.txt
@@ -45,46 +45,23 @@ set(PARADISEO_LIBRARIES ga eoutils eo)
# IOH
set(IOH_ROOT "~/code/IOHexperimenter/" CACHE PATH "Where to find IOHexperimenter")
-find_path(IOH_PROBLEM_H "IOHprofiler_problem.h" PATHS ${IOH_ROOT}/src/Template/)
-find_library(IOH_LIBRARY "IOH" PATHS ${IOH_ROOT} PATH_SUFFIXES release Release debug Debug build Build)
+find_path(IOH_HPP "ioh.hpp" PATHS ${IOH_ROOT}/include/)
+# find_library(IOH_LIBRARY "IOH" PATHS ${IOH_ROOT} PATH_SUFFIXES release Release debug Debug build Build)
-if(EXISTS ${IOH_PROBLEM_H} AND EXISTS ${IOH_LIBRARY})
+if(EXISTS ${IOH_HPP}) # AND EXISTS ${IOH_LIBRARY})
message(STATUS "Found IOH in ${IOH_ROOT}")
- include_directories(${IOH_ROOT}/build/Cpp/src/)
- link_directories(${IOH_ROOT}/build/Cpp/bin/)
-
- # Workaround IOH's poorly designed headers inclusion scheme.
- SET(PROBLEMS_BBOB_DIR "src/Problems/BBOB")
- SET(PROBLEMS_BBOB_COMMON_DIR "src/Problems/BBOB/bbob_common_used_functions")
- SET(PROBLEMS_COMMON_DIR "src/Problems/common_used_functions")
- SET(PROBLEMS_PBO_DIR "src/Problems/PBO")
- SET(PROBLEMS_WMODEL_DIR "src/Problems/WModel")
- SET(PROBLEMS_PYTHON_DIR "src/Problems/Python")
- SET(SUITES_DIR "src/Suites")
- SET(TEMPLATE_DIR "src/Template")
- SET(TEMPLATE_EXPERIMENTS_DIR "src/Template/Experiments")
- SET(TEMPLATE_LOGGERS_DIR "src/Template/Loggers")
- SET(IOHEXPERIMENTER_DIR
- "${IOH_ROOT}/${PROBLEMS_COMMON_DIR}"
- "${IOH_ROOT}/${PROBLEMS_BBOB_DIR}"
- "${IOH_ROOT}/${PROBLEMS_BBOB_COMMON_DIR}"
- "${IOH_ROOT}/${PROBLEMS_PBO_DIR}"
- "${IOH_ROOT}/${PROBLEMS_WMODEL_DIR}"
- "${IOH_ROOT}/${PROBLEMS_PYTHON_DIR}"
- "${IOH_ROOT}/${SUITES_DIR}"
- "${IOH_ROOT}/${TEMPLATE_DIR}"
- "${IOH_ROOT}/${TEMPLATE_EXPERIMENTS_DIR}"
- "${IOH_ROOT}/${TEMPLATE_LOGGERS_DIR}"
- )
- include_directories(${IOHEXPERIMENTER_DIR})
+ include_directories(${IOH_ROOT}/include/)
+ include_directories(${IOH_ROOT}/external/fmt/include/)
+ include_directories(${IOH_ROOT}/external/clutchlog/)
+ link_directories(${IOH_ROOT}/release/external/fmt/)
else()
- if(NOT EXISTS ${IOH_PROBLEM_H})
- message(FATAL_ERROR "Could not find `IOHprofiler_problem.h` in: ${IOH_ROOT}/src/Template/ (did you forget to compile it?)")
- endif()
- if(NOT EXISTS ${IOH_LIBRARIES})
- message(FATAL_ERROR "Could not find `libIOH` in: ${IOH_ROOT}/[release|debug|build] (did you forget to compile it?)")
+ if(NOT EXISTS ${IOH_HPP})
+ message(FATAL_ERROR "Could not find `ioh.hpp` in: ${IOH_ROOT}/include/")
endif()
+ # if(NOT EXISTS ${IOH_LIBRARIES})
+ # message(FATAL_ERROR "Could not find `libIOH` in: ${IOH_ROOT}/[release|debug|build] (did you forget to compile it?)")
+ # endif()
endif()
@@ -93,5 +70,6 @@ endif()
######################################################################################
add_executable(fastga fastga.cpp)
-target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs)
+# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs)
+target_link_libraries(fastga ${PARADISEO_LIBRARIES} stdc++fs fmt)
diff --git a/eo/contrib/irace/architecture.dia b/eo/contrib/irace/architecture.dia
deleted file mode 100644
index 64143969ae0756a6dc3e09d6744d154a6e9538ed..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 4977
zcmZ{mbyySbyN5{`NW|KuSWTMvhQqlz=pXv?v`z
zq#c8!-*e9I)OFtHy6)@#Jnw(cAMg8cBLD<{4-xUcqhH1krL3!0P7_-M2*;1^h=a9L
z6Q*ok_eSuIY$Ja-H`QFlQv0VYn=FrtKr~MMOcR^IDca$5$!Gsur*+9O_Vc~@+l@LY
zePS9`CqJd5@G6Kp4WvZIIeVdQfN!q?g8k|L3s;z!=2
zkOs|@h&RT7ZjF$xm&vs3x*f=5S{l=t02ypW(t-X`0rWuKP-g?(7MU7>@Z|o!rIt()
z(dR_->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UxL(^$#h|6q>VnPf98Z$bMH~+-
zxv4R{)@*%C%aLJPQOnUHF$jvkQZw2w2|DHLgW|CKaWNH*5}qn2JI0$4Vbw~~4Qhqo
z2&-YXB{=J?zY9Iym*(wElze>}hEIJ~cYX}&tEZda%@?m5I;tvKZE9QOfz}vyX4!jP
zZ$1`TKFXwiN{c=_W<)vgf15G
z1S}fW7R4hzw~+(w#UnkgR@SR+uX|GX1d7+2S5tNuH2RZk?gsV3LxD#
z+yQ>fRp76FW|X3%ZKjRRg3p{qMZaCPn2PfG^XD4eC3GDo&UwqMB2;^8s?sWt_*ZjINB~cJ@HgZk;1IGPcXqS-S-vCIR
BeL?^L
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index f884d6813..3334974f5 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -2,16 +2,19 @@
#include
#include
#include
+#include
+
#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
+#include
+
+/*****************************************************************************
+ * ParadisEO algorithmic grammar definition.
+ *****************************************************************************/
// using Particle = eoRealParticle;
using Ints = eoInt, size_t>;
@@ -110,6 +113,10 @@ eoAlgoFoundryFastGA& make_foundry(
return foundry;
}
+/*****************************************************************************
+ * irace helper functions.
+ *****************************************************************************/
+
Bits::Fitness fake_func(const Bits&) { return 0; }
void print_irace_full(const eoParam& param, const size_t slot_size, std::string type="i", std::ostream& out = std::cout)
@@ -210,12 +217,16 @@ std::ostream& operator<<(std::ostream& os, const Problem& pb)
return os;
}
+/*****************************************************************************
+ * Command line interface.
+ *****************************************************************************/
+
int main(int argc, char* argv[])
{
/***** Global parameters. *****/
enum { NO_ERROR = 0, ERROR_USAGE = 100 };
- std::map problem_config_mapping {
+ std::map benchmark {
/* ┌ problem index in the map
* │ ┌ problem ID in IOH experimenter
* │ │ ┌ dummy
@@ -249,16 +260,22 @@ int main(int argc, char* argv[])
eoParser parser(argc, argv, "FastGA interface for iRace");
+ /***** Problem parameters *****/
auto problem_p = parser.getORcreateParam(0,
"problem", "Problem ID",
'p', "Problem", /*required=*/true);
const size_t problem = problem_p.value();
- assert(0 <= problem and problem < problem_config_mapping.size());
+ assert(0 <= problem and problem < benchmark.size());
// const size_t dimension = parser.getORcreateParam(1000,
// "dimension", "Dimension size",
// 'd', "Problem").value();
- const size_t dimension = problem_config_mapping[problem].dimension;
+ const size_t dimension = benchmark[problem].dimension;
+
+ auto instance_p = parser.getORcreateParam(0,
+ "instance", "Instance ID",
+ 'i', "Instance", /*required=*/false);
+ const size_t instance = instance_p.value();
const size_t max_evals = parser.getORcreateParam(5 * dimension,
"max-evals", "Maximum number of evaluations",
@@ -268,6 +285,7 @@ int main(int argc, char* argv[])
"buckets", "Number of buckets for discretizing the ECDF",
'b', "Performance estimation").value();
+ /***** Generic options *****/
uint32_t seed =
parser.getORcreateParam(0,
"seed", "Random number seed (0 = epoch)",
@@ -280,25 +298,31 @@ int main(int argc, char* argv[])
bool full_log =
parser.getORcreateParam(0,
- "full-log", "Log the full search in CSV files (using the IOH profiler format)",
+ "full-log", "Log the full search in CSV files"/* (using the IOH profiler format)"*/,
'F').value();
bool output_mat =
parser.getORcreateParam(0,
- "output-mat", "Output the aggregated attainment matrix instead of its scalar sum.",
+ "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(5,
"pop-size", "Population size",
'P', "Operator Choice", /*required=*/false);
const size_t pop_size = pop_size_p.value();
- auto instance_p = parser.getORcreateParam(0,
- "instance", "Instance ID",
- 'i', "Instance", /*required=*/false);
- const size_t instance = instance_p.value();
+ auto offspring_size_p = parser.getORcreateParam(0,
+ "offspring-size", "Offsprings size (0 = same size than the parents pop, see --pop-size)",
+ 'O', "Operator Choice", /*required=*/false); // Single alternative, not required.
+ const size_t offspring_size = offspring_size_p.value();
+ const size_t generations = static_cast(std::floor(
+ static_cast(max_evals) / static_cast(pop_size)));
+ // const size_t generations = std::numeric_limits::max();
+ eo::log << eo::debug << "Number of generations: " << generations << std::endl;
+
+ /***** operators / parameters *****/
auto continuator_p = parser.getORcreateParam(0,
"continuator", "Stopping criterion",
'o', "Operator Choice", /*required=*/false); // Single alternative, not required.
@@ -344,12 +368,6 @@ int main(int argc, char* argv[])
'r', "Operator Choice", /*required=*/true);
const size_t replacement = replacement_p.value();
- auto offspring_size_p = parser.getORcreateParam(0,
- "offspring-size", "Offsprings size (0 = same size than the parents pop, see --pop-size)",
- 'O', "Operator Choice", /*required=*/false); // Single alternative, not required.
- const size_t offspring_size = offspring_size_p.value();
-
-
// Help + Verbose routines
make_verbose(parser);
make_help(parser, /*exit_after*/false, std::clog);
@@ -410,28 +428,19 @@ int main(int argc, char* argv[])
exit(NO_ERROR);
}
- const size_t generations = static_cast(std::floor(
- static_cast(max_evals) / static_cast(pop_size)));
- // const size_t generations = std::numeric_limits::max();
- 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 target_range(0, max_target, buckets);
+ ioh::logger::eah::Log10Scale budget_range(0, max_evals, buckets);
+ ioh::logger::EAH eah_logger(target_range, budget_range);
+ ioh::logger::Combine loggers(eah_logger);
- auto max_target_para = problem_config_mapping[problem].max_target;
- IOHprofiler_RangeLinear target_range(0, max_target_para, buckets);
- IOHprofiler_RangeLinear budget_range(0, max_evals, buckets);
- IOHprofiler_ecdf_logger ecdf_logger(
- target_range, budget_range,
- /*use_known_optimum*/false);
-
- // ecdf_logger.set_complete_flag(true);
- // ecdf_logger.set_interval(0);
- ecdf_logger.activate_logger();
-
- IOHprofiler_observer_combine loggers(ecdf_logger);
-
- std::shared_ptr> csv_logger;
+ std::shared_ptr csv_logger = nullptr;
if(full_log) {
// Build up an algorithm name from main parameters.
std::ostringstream name;
@@ -453,57 +462,54 @@ int main(int argc, char* argv[])
// Build up a problem description.
std::ostringstream desc;
desc << "pb=" << problem << "_";
- desc << problem_config_mapping[problem]; // Use the `operator<<` above.
+ desc << benchmark[problem]; // Use the `operator<<` above.
std::clog << desc.str() << std::endl;
- std::string dir(name.str());
- std::filesystem::path d = name.str();
- std::filesystem::create_directory(d);
+ std::filesystem::path folder = desc.str();
+ std::filesystem::create_directories(folder);
- std::string folder(desc.str());
- std::filesystem::path f = desc.str();
-
- std::filesystem::create_directory(d);
- std::filesystem::create_directory(d/f);
-
- csv_logger = std::make_shared>(dir, folder, d, f);
- loggers.add(*csv_logger);
+ ioh::trigger::OnImprovement on_improvement;
+ ioh::watch::Evaluations evaluations;
+ ioh::watch::TransformedYBest transformed_y_best;
+ std::vector> t = {std::ref(on_improvement)};
+ std::vector> w = {std::ref(evaluations),std::ref(transformed_y_best)};
+ csv_logger = std::make_shared(
+ // {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_model_suite_dummy_para = problem_config_mapping[problem].dummy;
- int w_model_suite_epitasis_para = problem_config_mapping[problem].epistasis;
- int w_model_suite_neutrality_para = problem_config_mapping[problem].neutrality;
- int w_model_suite_ruggedness_para = problem_config_mapping[problem].ruggedness;
+ double w_dummy = benchmark[problem].dummy;
+ int w_epitasis = benchmark[problem].epistasis;
+ int w_neutrality = benchmark[problem].neutrality;
+ int w_ruggedness = benchmark[problem].ruggedness;
- W_Model_OneMax w_model_om;
- std::string problem_name = "OneMax";
- problem_name = problem_name
- + "_D" + std::to_string((int)(w_model_suite_dummy_para * dimension))
- + "_E" + std::to_string(w_model_suite_epitasis_para)
- + "_N" + std::to_string(w_model_suite_neutrality_para)
- + "_R" + std::to_string(w_model_suite_ruggedness_para);
+ // 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);
-
- /// This must be called to configure the w-model to be tested.
- w_model_om.set_w_setting(w_model_suite_dummy_para,w_model_suite_epitasis_para,
- w_model_suite_neutrality_para,w_model_suite_ruggedness_para);
-
- /// Set problem_name based on the configuration.
- w_model_om.IOHprofiler_set_problem_name(problem_name);
-
- /// Set problem_id as 1
- w_model_om.IOHprofiler_set_problem_id(problem); // FIXME check what that means
- // w_model_om.IOHprofiler_set_instance_id(instance); // FIXME changing the instance seems to change the target upper bound.
-
- /// Set dimension.
- w_model_om.IOHprofiler_set_number_of_variables(dimension);
+ ioh::problem::wmodel::WModelOneMax w_model_om(
+ instance,
+ dimension,
+ w_dummy,
+ w_epitasis,
+ w_neutrality,
+ w_ruggedness);
/***** Bindings *****/
- ecdf_logger.track_problem(w_model_om);
- if(full_log) {
- csv_logger->track_problem(w_model_om);
- }
+ w_model_om.attach_logger(loggers);
+
+ /*****************************************************************************
+ * Binding everything together.
+ *****************************************************************************/
eoEvalIOHproblem onemax_pb(w_model_om, loggers);
@@ -545,40 +551,45 @@ int main(int argc, char* argv[])
// // Actually instanciate and run the algorithm.
// eval_foundry(encoded_algo);
+ /*****************************************************************************
+ * Run and output results.
+ *****************************************************************************/
+
eoPop pop;
pop.append(pop_size, onemax_init);
onemax_eval(pop,pop);
foundry(pop); // Actually run the selected algorithm.
/***** IOH perf stats *****/
- IOHprofiler_ecdf_sum ecdf_sum;
- // iRace expects minimization
- long perf = ecdf_sum(ecdf_logger.data());
+ double perf = ioh::logger::eah::stat::under_curve::volume(eah_logger);
- // assert(0 < perf and perf <= buckets*buckets);
- if(perf <= 0 or buckets*buckets < perf) {
- std::cerr << "WARNING: illogical performance: " << perf
- << ", check the bounds or the algorithm." << std::endl;
+ 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> mat = ioh::logger::eah::stat::distribution(eah_logger);
- IOHprofiler_ecdf_aggregate agg;
- IOHprofiler_ecdf_aggregate::Mat mat = agg(ecdf_logger.data());
- std::clog << "Attainment matrix sum: " << std::endl;
+ // 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(int i = mat.size()-1; i >= 0; --i) {
+ for(size_t i = mat.size()-1; i >= 0; --i) {
std::cout << mat[i][0];
- for(int j = 1; j < mat[i].size(); ++j) {
+ 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;
}
}
diff --git a/eo/contrib/irace/fastga_grammar.dia b/eo/contrib/irace/fastga_grammar.dia
deleted file mode 100644
index ac10761281f285d6058d41b33da394bf41b1dbb0..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 5657
zcmaji2T+sEx(9F-lq$VS6;SCN=^#y7XwoGVDbjoIA|M?^AoL(02_%GG1SB9G0)!4q
ziS#BQ-B7QdGv~~A?mgabf3rK!?(Dqt&d$!x{8O#iJ9w%fT>3Tlu`
zf8(+0yNhJ39zT2czLAArj5h{OoOg`#0+y!5)9J)znN!l#>2xeH7iXvxoV_(2cjWmp
z2k{l_6=2+IfwCZ01UtW-YYG;)@(4aZ-ZrL~w^smv;2_N8SZ=(gRMzw0A)H_MgsqsK
zEw`driMaT(1yuk;7ag(>Ef@!}+qrszSD`r%Q2}21pywG3kM!Q1AaO^xbNBX)EX5n)
z@otSyQhMiXSqFLpk(d-?w^#v;yAk#^w1pZ?t4`M(=!7$hvl?dx`f|1xO
zB?`RFfRoTbb9jNAQNV^%%JYGB1*yBsp*BScMK$t?zVdmN=W5P7sZ(F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f06Z$C*Mm
z(6~xA4=Dpkpj^;0YJhLp32r)EDv=)m#U=5H1VsM@;%%7$Cc=$ccygx#P=8C{4IZNXbw-d
z2A9v4h2(Rl6KL$YQki1elp!o#5iWNd;iLpt{Kdi&{v7ta{z8s$H}Gt&<$z(|KIhJ%
RIObCRhxSXes=iw{{s(r+5Jvz2
diff --git a/problems/eval/eoEvalIOH.h b/problems/eval/eoEvalIOH.h
index 9da86bdfc..2e19f35ef 100644
--- a/problems/eval/eoEvalIOH.h
+++ b/problems/eval/eoEvalIOH.h
@@ -2,10 +2,7 @@
#ifndef _eoEvalIOH_h
#define _eoEvalIOH_h
-#include
-#include
-#include
-#include
+#include
/** Wrap an IOHexperimenter's problem class within an eoEvalFunc.
*
@@ -25,18 +22,19 @@ class eoEvalIOHproblem : public eoEvalFunc
using Fitness = typename EOT::Fitness;
using ScalarType = typename Fitness::ScalarType;
- eoEvalIOHproblem(IOHprofiler_problem & pb) :
+ eoEvalIOHproblem(ioh::problem::Problem & pb) :
_ioh_pb(&pb),
_has_log(false),
_ioh_log(nullptr)
{ }
- eoEvalIOHproblem(IOHprofiler_problem & pb, IOHprofiler_observer & log ) :
+ eoEvalIOHproblem(ioh::problem::Problem & pb, ioh::Logger & log ) :
_ioh_pb(&pb),
_has_log(true),
_ioh_log(&log)
{
- _ioh_log->track_problem(*_ioh_pb);
+ // _ioh_log->track_problem(*_ioh_pb);
+ pb.attach_logger(log);
}
virtual void operator()(EOT& sol)
@@ -55,322 +53,323 @@ class eoEvalIOHproblem : public eoEvalFunc
* Instead of re-assembling your algorithm,
* just update the problem pointer.
*/
- void problem(IOHprofiler_problem & pb )
+ void problem(ioh::problem::Problem & pb )
{
_ioh_pb = &pb;
- _ioh_log->track_problem(pb);
+ // _ioh_log->track_problem(pb);
+ _ioh_pb->attach_logger(_ioh_log);
}
bool has_logger() const {return _has_log;}
- IOHprofiler_observer & observer() {return *_ioh_log;}
+ ioh::Logger & logger() {return *_ioh_log;}
protected:
- IOHprofiler_problem * _ioh_pb;
+ ioh::problem::Problem * _ioh_pb;
bool _has_log;
- IOHprofiler_observer * _ioh_log;
+ ioh::Logger * _ioh_log;
virtual Fitness call(EOT& sol)
{
- Fitness f = _ioh_pb->evaluate(sol);
+ Fitness f = (*_ioh_pb)(sol);
if(_has_log) {
- _ioh_log->do_log(_ioh_pb->loggerInfo());
+ _ioh_log->log(_ioh_pb->log_info());
}
return f;
}
};
-/** Wrap an IOHexperimenter's suite class within an eoEvalFunc. Useful for algorithm selection.
- *
- * WARNING: only handle a suite of problems of A UNIQUE, SINGLE DIMENSION.
- * Because a given eoAlgo is bond to a instanciated eoInit (most probably an eoInitWithDim)
- * which is parametrized with a given dimension.
- *
- * The idea is to run the given algorithm on a whole suite of problems
- * and output its aggregated performance.
- *
- * See https://github.com/IOHprofiler/IOHexperimenter
- *
- * The main template EOT defines the interface of this functor,
- * that is how the algorithm instance is encoded
- * (e.g. an eoAlgoFoundry's integer vector).
- * The SUBEOT template defines the encoding of the sub-problem,
- * which the encoded algorithm have to solve
- * (e.g. a OneMax problem).
- *
- * @note: This will not reset the given pop between two calls
- * of the given algorithm on new problems.
- * You most probably want to wrap your algorithm
- * in an eoAlgoRestart to do that for you.
- *
- * Handle only IOHprofiler `stat` classes which template type STAT
- * is explicitely convertible to the given fitness.
- * Any scalar is most probably already convertible, but compound classes
- * (i.e. for multi-objective problems) are most probàbly not.
- *
- * @note: You're responsible of adding a conversion operator
- * to the given STAT type, if necessary
- * (this is checked by a static assert in the constructor).
- *
- * @note: You're also responsible of matching the fitness' encoding scalar type
- * (IOH handle double and int, as of 2020-03-09).
- *
- * You will need to pass the IOH include directory to your compiler
- * (e.g. IOHexperimenter/build/Cpp/src/).
- */
-template
-class eoEvalIOHsuiteSingleDim : public eoEvalFunc
-{
- public:
- using EOType = EOT;
- using Fitness = typename EOType::Fitness;
- using ScalarType = typename Fitness::ScalarType;
+// /** Wrap an IOHexperimenter's suite class within an eoEvalFunc. Useful for algorithm selection.
+// *
+// * WARNING: only handle a suite of problems of A UNIQUE, SINGLE DIMENSION.
+// * Because a given eoAlgo is bond to a instanciated eoInit (most probably an eoInitWithDim)
+// * which is parametrized with a given dimension.
+// *
+// * The idea is to run the given algorithm on a whole suite of problems
+// * and output its aggregated performance.
+// *
+// * See https://github.com/IOHprofiler/IOHexperimenter
+// *
+// * The main template EOT defines the interface of this functor,
+// * that is how the algorithm instance is encoded
+// * (e.g. an eoAlgoFoundry's integer vector).
+// * The SUBEOT template defines the encoding of the sub-problem,
+// * which the encoded algorithm have to solve
+// * (e.g. a OneMax problem).
+// *
+// * @note: This will not reset the given pop between two calls
+// * of the given algorithm on new problems.
+// * You most probably want to wrap your algorithm
+// * in an eoAlgoRestart to do that for you.
+// *
+// * Handle only IOH experimeneter `stat` classes which template type STAT
+// * is explicitely convertible to the given fitness.
+// * Any scalar is most probably already convertible, but compound classes
+// * (i.e. for multi-objective problems) are most probàbly not.
+// *
+// * @note: You're responsible of adding a conversion operator
+// * to the given STAT type, if necessary
+// * (this is checked by a static assert in the constructor).
+// *
+// * @note: You're also responsible of matching the fitness' encoding scalar type
+// * (IOH handle double and int, as of 2020-03-09).
+// *
+// * You will need to pass the IOH include directory to your compiler
+// * (e.g. IOHexperimenter/build/Cpp/src/).
+// */
+// template
+// class eoEvalIOHsuiteSingleDim : public eoEvalFunc
+// {
+// public:
+// using EOType = EOT;
+// using Fitness = typename EOType::Fitness;
+// using ScalarType = typename Fitness::ScalarType;
- /** Takes an ecdf_logger that computes the base data structure
- * on which a ecdf_stat will be called to compute an
- * aggregated performance measure, which will be the evaluated fitness.
- *
- * As such, the logger and the stat are mandatory.
- *
- * @note: The given logger should be at least embedded
- * in the logger bound with the given eval.
- */
- eoEvalIOHsuiteSingleDim(
- eoEvalIOHproblem& eval,
- eoAlgoFoundry& algo,
- eoPop& pop,
- IOHprofiler_suite& suite,
- IOHprofiler_ecdf_logger& log,
- IOHprofiler_ecdf_stat& stat
- ) :
- _eval(eval),
- _algo(algo),
- _pop(pop),
- _ioh_suite(&suite),
- _ioh_log(log),
- _ioh_stat(stat)
- {
- static_assert(std::is_convertible::value);
- assert(eval.has_log());
- _ioh_log.target_suite(suite);
- }
+// /** Takes an ecdf_logger that computes the base data structure
+// * on which a ecdf_stat will be called to compute an
+// * aggregated performance measure, which will be the evaluated fitness.
+// *
+// * As such, the logger and the stat are mandatory.
+// *
+// * @note: The given logger should be at least embedded
+// * in the logger bound with the given eval.
+// */
+// eoEvalIOHsuiteSingleDim(
+// eoEvalIOHproblem& eval,
+// eoAlgoFoundry& algo,
+// eoPop& pop,
+// ioh::suite::Suite& suite,
+// ioh::logger::ECDF& log,
+// ioh::logger::ECDFStat& stat
+// ) :
+// _eval(eval),
+// _algo(algo),
+// _pop(pop),
+// _ioh_suite(&suite),
+// _ioh_log(log),
+// _ioh_stat(stat)
+// {
+// static_assert(std::is_convertible::value);
+// assert(eval.has_log());
+// _ioh_log.target_suite(suite);
+// }
- virtual void operator()(EOType& sol)
- {
- if(not sol.invalid()) {
- return;
- }
+// virtual void operator()(EOType& sol)
+// {
+// if(not sol.invalid()) {
+// return;
+// }
- sol.fitness( call( sol ) );
- }
+// sol.fitness( call( sol ) );
+// }
- /** Update the suite pointer for a new one.
- *
- * This is useful if you assembled a ParadisEO algorithm
- * and call it several time in an IOHexperimenter's loop across several suites.
- * Instead of re-assembling your algorithm,
- * just update the suite pointer.
- */
- void suite( IOHprofiler_suite & suite )
- {
- _ioh_suite = &suite;
- _ioh_log.target_suite(suite);
- }
+// /** Update the suite pointer for a new one.
+// *
+// * This is useful if you assembled a ParadisEO algorithm
+// * and call it several time in an IOHexperimenter's loop across several suites.
+// * Instead of re-assembling your algorithm,
+// * just update the suite pointer.
+// */
+// void suite( ioh::suite::Suite & suite )
+// {
+// _ioh_suite = &suite;
+// _ioh_log.target_suite(suite);
+// }
- protected:
- //! Sub-problem @{
- eoEvalIOHproblem& _eval;
- eoAlgoFoundry& _algo;
- eoPop& _pop;
- //! @}
+// protected:
+// //! Sub-problem @{
+// eoEvalIOHproblem& _eval;
+// eoAlgoFoundry& _algo;
+// eoPop& _pop;
+// //! @}
- //! IOH @{
- IOHprofiler_suite * _ioh_suite;
- IOHprofiler_observer & _ioh_log;
- IOHprofiler_ecdf_stat& _ioh_stat;
- //! @}
+// //! IOH @{
+// ioh::suite::Suite * _ioh_suite;
+// ioh::logger::Observer & _ioh_log;
+// ioh::logger::ECDFStat& _ioh_stat;
+// //! @}
- virtual Fitness call(EOType& sol)
- {
- // Decode the algorithm encoded in sol.
- _algo = sol;
+// virtual Fitness call(EOType& sol)
+// {
+// // Decode the algorithm encoded in sol.
+// _algo = sol;
- // Evaluate the performance of the encoded algo instance
- // on a whole IOH suite benchmark.
- typename IOHprofiler_suite::Problem_ptr pb;
- while( (pb = _ioh_suite->get_next_problem()) ) {
+// // Evaluate the performance of the encoded algo instance
+// // on a whole IOH suite benchmark.
+// typename ioh::suite::Suite::Problem_ptr pb;
+// while( (pb = _ioh_suite->get_next_problem()) ) {
- // Consider a new problem.
- _eval.problem(*pb); // Will call logger's target_problem.
+// // Consider a new problem.
+// _eval.problem(*pb); // Will call logger's target_problem.
- // Actually solve it.
- _algo(_pop); // Will call the logger's write_line.
- // There's no need to get back the best fitness from ParadisEO,
- // because everything is captured on-the-fly by IOHprofiler.
- }
+// // Actually solve it.
+// _algo(_pop); // Will call the logger's write_line.
+// // There's no need to get back the best fitness from ParadisEO,
+// // because everything is captured on-the-fly by IOH experimenter.
+// }
- // Get back the evaluated performance.
- // The explicit cast from STAT to Fitness which should exists.
- return static_cast(_ioh_stat(_ioh_log.data()));
- }
-};
+// // Get back the evaluated performance.
+// // The explicit cast from STAT to Fitness which should exists.
+// return static_cast(_ioh_stat(_ioh_log.data()));
+// }
+// };
-/** Operator that is called before search for each problem within an IOH suite.
- *
- * You most probably need to reinstanciate some operators within your algorithm:
- * at least the operators depending on the dimension,
- * as it will change between two calls.
- *
- * By providing an operator using this interface,
- * you can have access to all the information needed to do so.
- */
-template
-class eoIOHSetup : public eoFunctorBase
-{
- public:
- using AtomType = typename EOT::AtomType;
- virtual void operator()(eoPop& pop, typename IOHprofiler_suite::Problem_ptr pb) = 0;
-};
+// /** Operator that is called before search for each problem within an IOH suite.
+// *
+// * You most probably need to reinstanciate some operators within your algorithm:
+// * at least the operators depending on the dimension,
+// * as it will change between two calls.
+// *
+// * By providing an operator using this interface,
+// * you can have access to all the information needed to do so.
+// */
+// template
+// class eoIOHSetup : public eoFunctorBase
+// {
+// public:
+// using AtomType = typename EOT::AtomType;
+// virtual void operator()(eoPop& pop, typename ioh::suite::Suite::Problem_ptr pb) = 0;
+// };
-/** Wrap an IOHexperimenter's suite class within an eoEvalFunc. Useful for algorithm selection.
- *
- * The idea is to run the given algorithm on a whole suite of problems
- * and output its aggregated performance.
- *
- * See https://github.com/IOHprofiler/IOHexperimenter
- *
- * The main template EOT defines the interface of this functor,
- * that is how the algorithm instance is encoded
- * (e.g. an eoAlgoFoundry's integer vector).
- * The SUBEOT template defines the encoding of the sub-problem,
- * which the encoded algorithm have to solve
- * (e.g. a OneMax problem).
- *
- * @note: This will not reset the given pop between two calls
- * of the given algorithm on new problems.
- * You most probably want to wrap your algorithm
- * in an eoAlgoRestart to do that for you.
- *
- * Handle only IOHprofiler `stat` classes which template type STAT
- * is explicitely convertible to the given fitness.
- * Any scalar is most probably already convertible, but compound classes
- * (i.e. for multi-objective problems) are most probàbly not.
- *
- * @note: You're responsible of adding a conversion operator
- * to the given STAT type, if necessary
- * (this is checked by a static assert in the constructor).
- *
- * @note: You're also responsible of matching the fitness' encoding scalar type
- * (IOH handle double and int, as of 2020-03-09).
- *
- * You will need to pass the IOH include directory to your compiler
- * (e.g. IOHexperimenter/build/Cpp/src/).
- */
-template
-class eoEvalIOHsuite : public eoEvalFunc
-{
- public:
- using Fitness = typename EOT::Fitness;
- using ScalarType = typename Fitness::ScalarType;
- using SubAtomType = typename SUBEOT::AtomType;
+// /** Wrap an IOHexperimenter's suite class within an eoEvalFunc. Useful for algorithm selection.
+// *
+// * The idea is to run the given algorithm on a whole suite of problems
+// * and output its aggregated performance.
+// *
+// * See https://github.com/IOHprofiler/IOHexperimenter
+// *
+// * The main template EOT defines the interface of this functor,
+// * that is how the algorithm instance is encoded
+// * (e.g. an eoAlgoFoundry's integer vector).
+// * The SUBEOT template defines the encoding of the sub-problem,
+// * which the encoded algorithm have to solve
+// * (e.g. a OneMax problem).
+// *
+// * @note: This will not reset the given pop between two calls
+// * of the given algorithm on new problems.
+// * You most probably want to wrap your algorithm
+// * in an eoAlgoRestart to do that for you.
+// *
+// * Handle only IOHprofiler `stat` classes which template type STAT
+// * is explicitely convertible to the given fitness.
+// * Any scalar is most probably already convertible, but compound classes
+// * (i.e. for multi-objective problems) are most probàbly not.
+// *
+// * @note: You're responsible of adding a conversion operator
+// * to the given STAT type, if necessary
+// * (this is checked by a static assert in the constructor).
+// *
+// * @note: You're also responsible of matching the fitness' encoding scalar type
+// * (IOH handle double and int, as of 2020-03-09).
+// *
+// * You will need to pass the IOH include directory to your compiler
+// * (e.g. IOHexperimenter/build/Cpp/src/).
+// */
+// template
+// class eoEvalIOHsuite : public eoEvalFunc
+// {
+// public:
+// using Fitness = typename EOT::Fitness;
+// using ScalarType = typename Fitness::ScalarType;
+// using SubAtomType = typename SUBEOT::AtomType;
- /** Takes an ecdf_logger that computes the base data structure
- * on which a ecdf_stat will be called to compute an
- * aggregated performance measure, which will be the evaluated fitness.
- *
- * As such, the logger and the stat are mandatory.
- *
- * @note: The given logger should be at least embedded
- * in the logger thas is bound with the given eval.
- */
- eoEvalIOHsuite(
- eoEvalIOHproblem& eval,
- eoAlgoFoundry& foundry,
- eoPop& pop,
- eoIOHSetup& setup,
- IOHprofiler_suite& suite,
- IOHprofiler_ecdf_logger& log,
- IOHprofiler_ecdf_stat& stat
- ) :
- _eval(eval),
- _foundry(foundry),
- _pop(pop),
- _setup(setup),
- _ioh_suite(&suite),
- _ioh_log(log),
- _ioh_stat(stat)
- {
- static_assert(std::is_convertible::value);
- assert(_eval.has_logger());
- _ioh_log.track_suite(suite);
- }
+// /** Takes an ecdf_logger that computes the base data structure
+// * on which a ecdf_stat will be called to compute an
+// * aggregated performance measure, which will be the evaluated fitness.
+// *
+// * As such, the logger and the stat are mandatory.
+// *
+// * @note: The given logger should be at least embedded
+// * in the logger thas is bound with the given eval.
+// */
+// eoEvalIOHsuite(
+// eoEvalIOHproblem& eval,
+// eoAlgoFoundry& foundry,
+// eoPop& pop,
+// eoIOHSetup& setup,
+// ioh::suite::Suite& suite,
+// ioh::logger::ECDF& log,
+// ioh::logger::ECDFStat& stat
+// ) :
+// _eval(eval),
+// _foundry(foundry),
+// _pop(pop),
+// _setup(setup),
+// _ioh_suite(&suite),
+// _ioh_log(log),
+// _ioh_stat(stat)
+// {
+// static_assert(std::is_convertible::value);
+// assert(_eval.has_logger());
+// _ioh_log.track_suite(suite);
+// }
- virtual void operator()(EOT& sol)
- {
- if(not sol.invalid()) {
- return;
- }
+// virtual void operator()(EOT& sol)
+// {
+// if(not sol.invalid()) {
+// return;
+// }
- sol.fitness( call( sol ) );
- }
+// sol.fitness( call( sol ) );
+// }
- /** Update the suite pointer for a new one.
- *
- * This is useful if you assembled a ParadisEO algorithm
- * and call it several time in an IOHexperimenter's loop across several suites.
- * Instead of re-assembling your algorithm,
- * just update the suite pointer.
- */
- void suite( IOHprofiler_suite & suite )
- {
- _ioh_suite = &suite;
- _ioh_log.target_suite(suite);
- }
+// /** Update the suite pointer for a new one.
+// *
+// * This is useful if you assembled a ParadisEO algorithm
+// * and call it several time in an IOHexperimenter's loop across several suites.
+// * Instead of re-assembling your algorithm,
+// * just update the suite pointer.
+// */
+// void suite( ioh::suite::Suite & suite )
+// {
+// _ioh_suite = &suite;
+// _ioh_log.target_suite(suite);
+// }
- protected:
- eoEvalIOHproblem& _eval;
- eoAlgoFoundry& _foundry;
- eoPop& _pop;
- eoIOHSetup& _setup;
+// protected:
+// eoEvalIOHproblem& _eval;
+// eoAlgoFoundry& _foundry;
+// eoPop& _pop;
+// eoIOHSetup& _setup;
- IOHprofiler_suite * _ioh_suite;
- IOHprofiler_ecdf_logger & _ioh_log;
- IOHprofiler_ecdf_stat& _ioh_stat;
+// ioh::suite::Suite * _ioh_suite;
+// ioh::logger::ECDF & _ioh_log;
+// ioh::logger::ECDFStat& _ioh_stat;
- virtual Fitness call(EOT& sol)
- {
- // Select an algorithm in the foundry
- // from the given encoded solution.
- std::vector encoding;
- std::transform(std::begin(sol), std::end(sol), std::back_inserter(encoding),
- [](const SubAtomType& v) -> size_t {return static_cast(std::floor(v));} );
- _foundry.select(encoding);
+// virtual Fitness call(EOT& sol)
+// {
+// // Select an algorithm in the foundry
+// // from the given encoded solution.
+// std::vector encoding;
+// std::transform(std::begin(sol), std::end(sol), std::back_inserter(encoding),
+// [](const SubAtomType& v) -> size_t {return static_cast(std::floor(v));} );
+// _foundry.select(encoding);
- // Evaluate the performance of the encoded algo instance
- // on a whole IOH suite benchmark.
- typename IOHprofiler_suite::Problem_ptr pb;
- while( (pb = _ioh_suite->get_next_problem()) ) {
+// // Evaluate the performance of the encoded algo instance
+// // on a whole IOH suite benchmark.
+// typename ioh::suite::Suite::Problem_ptr pb;
+// while( (pb = _ioh_suite->get_next_problem()) ) {
- // Setup selected operators.
- _setup(_pop, pb);
+// // Setup selected operators.
+// _setup(_pop, pb);
- // Consider a new problem.
- _eval.problem(*pb); // Will call logger's target_problem.
+// // Consider a new problem.
+// _eval.problem(*pb); // Will call logger's target_problem.
- // Actually solve it.
- _foundry(_pop); // Will call the logger's write_line.
- // There's no need to get back the best fitness from ParadisEO,
- // because everything is captured on-the-fly by IOHprofiler.
- }
+// // Actually solve it.
+// _foundry(_pop); // Will call the logger's write_line.
+// // There's no need to get back the best fitness from ParadisEO,
+// // because everything is captured on-the-fly by IOH experimenter.
+// }
- // Get back the evaluated performance.
- // The explicit cast from STAT to Fitness which should exists.
- return static_cast(_ioh_stat(_ioh_log.data()));
- }
-};
+// // Get back the evaluated performance.
+// // The explicit cast from STAT to Fitness which should exists.
+// return static_cast(_ioh_stat(_ioh_log.data()));
+// }
+// };
#endif // _eoEvalIOH_h
From cd7787bbab55983fd05d970af2a3aea1f2dcea10 Mon Sep 17 00:00:00 2001
From: nojhan
Date: Wed, 7 Jul 2021 21:00:13 +0200
Subject: [PATCH 021/134] feat: adds eoForgeScalar and eoParameterFoundry
- Get arithmetic types out of eoOperatorFoundry in eoParameterFoundry.
- Allow for metric space variables management within irace.
---
eo/contrib/irace/fastga.cpp | 155 +++++++++++++++++++++++------------
eo/src/eoAlgoFoundry.h | 19 +++++
eo/src/eoAlgoFoundryFastGA.h | 18 ++--
eo/src/eoForge.h | 83 +++++++++++++++++--
4 files changed, 202 insertions(+), 73 deletions(-)
diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp
index 3334974f5..9c8c94088 100644
--- a/eo/contrib/irace/fastga.cpp
+++ b/eo/contrib/irace/fastga.cpp
@@ -41,17 +41,17 @@ eoAlgoFoundryFastGA& make_foundry(
// foundry.continuators.add< eoSteadyFitContinue >(10,i);
// }
- for(double i=0.0; i<1.0; i+=0.2) {
- foundry.crossover_rates.add(i);
- foundry.mutation_rates.add(i);
- }
+ // for(double i=0.0; i<1.0; i+=0.2) {
+ // foundry.crossover_rates.add(i);
+ // foundry.mutation_rates.add(i);
+ // }
/***** Offsprings size *****/
// for(size_t i=5; i<100; i+=10) {
// foundry.offspring_sizes.add(i);
// }
- foundry.offspring_sizes.add(0); // 0 = use parents fixed pop size.
+ foundry.offspring_sizes.setup(0,100); // 0 = use parents fixed pop size.
/***** Crossovers ****/
for(double i=0.1; i<1.0; i+=0.2) {
@@ -61,7 +61,7 @@ eoAlgoFoundryFastGA& make_foundry(
foundry.crossovers.add< eoNPtsBitXover >(i); // nb of points
}
- foundry.crossovers.add< eo1PtBitXover >();
+ // foundry.crossovers.add< eo1PtBitXover >(); // Same as NPts=1
/***** Mutations ****/
double p = 1.0; // Probability of flipping each bit.
@@ -119,10 +119,8 @@ eoAlgoFoundryFastGA& make_foundry(
Bits::Fitness fake_func(const Bits&) { return 0; }
-void print_irace_full(const eoParam& param, const size_t slot_size, std::string type="i", std::ostream& out = std::cout)
+void print_irace_categorical(const eoParam& param, const size_t slot_size, std::string type="c", std::ostream& out = std::cout)
{
- assert(type == "i" or type =="c");
-
// If there is no choice to be made on this operator, comment it out.
if(slot_size - 1 <= 0) {
out << "# ";
@@ -136,41 +134,77 @@ void print_irace_full(const eoParam& param, const size_t slot_size, std::string
<< "\t\"--" << param.longName() << "=\""
<< "\t" << type;
- if(type == "i") {
- if(slot_size -1 <= 0) {
- out << "\t(0)";
- } else {
- out << "\t(0," << slot_size-1 << ")";
- }
- out << std::endl;
- } else if(type == "c") {
- out << "\t(0";
- for(size_t i=1; i
+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
-void print_irace_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out = std::cout)
+void print_irace_oper(const eoParam& param, const eoOperatorFoundry& op_foundry, std::ostream& out = std::cout)
{
- print_irace_full(param, op_foundry.size(), "c", out);
+ print_irace_categorical(param, op_foundry.size(), "c", out);
}
-template<>
-void print_irace_typed(const eoParam& param, const eoForgeVector& op_foundry, std::ostream& out)
+// FIXME generalize to any scalar type with enable_if
+// template
+void print_irace_param(
+ const eoParam& param,
+ // const eoParameterFoundry::value >::type>& op_foundry,
+ const eoParameterFoundry& op_foundry,
+ std::ostream& out)
{
- print_irace_full(param, op_foundry.size(), "i", out);
+ print_irace_ranged(param, op_foundry.min(), op_foundry.max(), "r", out);
}
-template
-void print_irace(const eoParam& param, const OPF& op_foundry, std::ostream& out = std::cout)
+// template
+void print_irace_param(
+ const eoParam& param,
+ // const eoParameterFoundry::value >::type>& op_foundry,
+ const eoParameterFoundry& op_foundry,
+ std::ostream& out)
{
- print_irace_typed(param, op_foundry, out);
+ print_irace_ranged(param, op_foundry.min(), op_foundry.max(), "i", out);
}
+template
+void print_irace(const eoParam& param, const eoOperatorFoundry& op_foundry, std::ostream& out = std::cout)
+{
+ print_irace_oper(param, op_foundry, out);
+}
+template
+void print_irace(const eoParam& param, const eoParameterFoundry& op_foundry, std::ostream& out = std::cout)
+{
+ print_irace_param/**/(param, op_foundry, out);
+}
+
void print_operator_typed(const eoFunctorBase& op, std::ostream& out)
{
@@ -182,8 +216,8 @@ void print_operator_typed(const double& op, std::ostream& out)
out << op;
}
-template
-void print_operators(const eoParam& param, OPF& op_foundry, std::ostream& out = std::cout, std::string indent=" ")
+template
+void print_operators(const eoParam& param, eoOperatorFoundry& 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) {
@@ -194,6 +228,11 @@ void print_operators(const eoParam& param, OPF& op_foundry, std::ostream& out =
}
}
+template
+void print_operators(const eoParam& param, eoParameterFoundry& op_foundry, std::ostream& out = std::cout, std::string indent=" ")
+{
+ out << indent << "[" << op_foundry.min() << "," << op_foundry.max() << "] " << param.longName() << "." << std::endl;
+}
// Problem configuration.
struct Problem {
@@ -322,17 +361,23 @@ int main(int argc, char* argv[])
// const size_t generations = std::numeric_limits