From 949b5818a25c4f1a1ce16372b781cc6f44c7b2a5 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 8 Jul 2021 12:19:10 +0200 Subject: [PATCH 001/113] adds a definition file for building fastga as a Singularity container --- eo/contrib/irace/fastga.sindef | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 eo/contrib/irace/fastga.sindef diff --git a/eo/contrib/irace/fastga.sindef b/eo/contrib/irace/fastga.sindef new file mode 100644 index 000000000..86fa3e7cd --- /dev/null +++ b/eo/contrib/irace/fastga.sindef @@ -0,0 +1,63 @@ +Bootstrap: library +From: ubuntu:20.04 + +%post + + # Dependencies + apt -y install software-properties-common + add-apt-repository universe + apt -y update + apt -y dist-upgrade + apt -y install git clang-9 cmake make libeigen3-dev + apt clean + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-9 90 + update-alternatives --set c++ /usr/bin/clang++-9 + + # Temporary directory where we are going to build everything. + tmpdir=$(mktemp -d) + mkdir -p ${tmpdir}/fastga/ + + # Build IOH + cd ${tmpdir}/fastga/ + git clone --branch feat+EAF --single-branch --recurse-submodules https://github.com/jdreo/IOHexperimenter.git + cd IOHexperimenter + mkdir -p release + cd release + cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=OFF -D BUILD_EXAMPLE=OFF -D BUILD_GMOCK=OFF .. + make + + # Build Paradiseo + cd ${tmpdir}/fastga/ + git clone --branch feat+num_foundry --single-branch https://github.com/jdreo/paradiseo.git + cd paradiseo + touch LICENSE + mkdir -p release + cd release + cmake -D CMAKE_BUILD_TYPE=Release -EDO=ON -EDO_USE_LIB=Eigen3 .. + make + + # Build FastGA + cd ${tmpdir}/fastga/paradiseo/eo/contrib/irace/ + mkdir -p release + cd release + cmake -D CMAKE_BUILD_TYPE=Release -D IOH_ROOT=${tmpdir}/fastga/IOHexperimenter/ -D PARADISEO_ROOT=${tmpdir}/fastga/paradiseo/ -D PARADISEO_BUILD=${tmpdir}/fastga/paradiseo/release/ .. + make + + # Install FastGA + cp fastga /usr/local/bin/ + + # Clean-up + rm -rf ${tmpdir} + apt -y purge software-properties-common git clang-9 cmake make libeigen3-dev + apt -y --purge autoremove + apt -y autoclean + apt clean + +%environment + +%runscript + /usr/local/bin/fastga $* + +%labels + Author Quentin Renau + Author Johann Dreo From 18fec047ad179bce0756400619cfb6ad84510ba4 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 15 Jul 2021 18:52:21 +0200 Subject: [PATCH 002/113] fix clang 10 compatibility - random_shuffle is replaced by shuffle - get rid of EO stuff in eoPop, superseeded by stdlib random - get rid of bind2nd and use lambdas --- eo/contrib/irace/CMakeLists.txt | 2 +- eo/contrib/irace/fastga.cpp | 4 ++-- eo/src/eoInit.h | 2 +- eo/src/eoPop.h | 13 +++++++++---- eo/src/ga/eoBit.h | 3 ++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt index a77849b15..1e968d817 100644 --- a/eo/contrib/irace/CMakeLists.txt +++ b/eo/contrib/irace/CMakeLists.txt @@ -71,5 +71,5 @@ endif() add_executable(fastga fastga.cpp) # target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) -target_link_libraries(fastga ${PARADISEO_LIBRARIES} stdc++fs fmt) +target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 9c8c94088..ba55a22f8 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -519,8 +519,8 @@ int main(int argc, char* argv[]) 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)}; + std::vector> t = {on_improvement}; + std::vector> w = {evaluations,transformed_y_best}; csv_logger = std::make_shared( // {std::ref(on_improvement)}, // {std::ref(evaluations),std::ref(transformed_y_best)}, diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 9146311fa..a73310778 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -196,7 +196,7 @@ class eoInitPermutation: public eoInit // FIXME inherit from eoInitWithDim for(unsigned idx=0;idx #include #include #include // needed for GCC 3.2 @@ -182,8 +183,10 @@ class eoPop: public std::vector, public eoObject, public eoPersistent */ void shuffle(void) { - UF_random_generator gen; - std::random_shuffle(begin(), end(), gen); + std::random_device rd; + std::mt19937 gen(rd()); + //UF_random_generator gen; // FIXME refactor + std::shuffle(begin(), end(), gen); } @@ -194,8 +197,10 @@ class eoPop: public std::vector, public eoObject, public eoPersistent std::transform(begin(), end(), result.begin(), Ref()); - UF_random_generator gen; - std::random_shuffle(result.begin(), result.end(), gen); + std::random_device rd; + std::mt19937 gen(rd()); + //UF_random_generator gen; // FIXME refactor + std::shuffle(result.begin(), result.end(), gen); } diff --git a/eo/src/ga/eoBit.h b/eo/src/ga/eoBit.h index 71c6aa62b..320a5b7d1 100644 --- a/eo/src/ga/eoBit.h +++ b/eo/src/ga/eoBit.h @@ -114,7 +114,8 @@ public: { resize(bits.size()); std::transform(bits.begin(), bits.end(), begin(), - std::bind2nd(std::equal_to(), '1')); + //std::bind2nd(std::equal_to(), '1')); + [](char bit){return bit == '1';} ); } } }; From f4a8f97f70ea339f7c7e40391099eb6387ee4bd5 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 15 Jul 2021 19:20:04 +0200 Subject: [PATCH 003/113] add an example of complex build script for fastga --- eo/contrib/irace/build_fastga.sh | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100755 eo/contrib/irace/build_fastga.sh diff --git a/eo/contrib/irace/build_fastga.sh b/eo/contrib/irace/build_fastga.sh new file mode 100755 index 000000000..abaac4a20 --- /dev/null +++ b/eo/contrib/irace/build_fastga.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +######################################################################## +# This is an example of how to deal with complex builds, +# for instance on clusters with compilers provided as side modules. +######################################################################## + +# Run this script in a separate dir, e.g. +# mkdir -p code ; cd code ; ../build_fastga.sh + +# exit when any command fails +set -e + +# We need recent clang and cmake +module load LLVM/clang-llvm-10.0 +module load cmake/3.18 + +# We are going to use a specific compiler, different from the system's one. +# Path toward the compiler: +C="/opt/dev/Compilers/LLVM/10.0.1/bin" +# Path toward the include for the std lib: +I="/opt/dev/Compilers/LLVM/10.0.1/include/c++/v1/" +# Path toward the compiled std lib: +L="/opt/dev/Compilers/LLVM/10.0.1/lib" + +# As we use clang, we use its std lib (instead of gcc's "libstdc++") +S="libc++" + +# Gather all those into a set of flags: +flags="-I${I} -stdlib=${S} -L${L}" + +# Current dir, for further reference. +here=$(pwd) + +# Compiler selection +export CC=${C}/clang +export CXX=${C}/clang++ + +# If the dir already exists +if cd IOHexperimenter ; then + # Just update the code + git pull +else + # Clone the repo + git clone --branch feat+EAF --single-branch --recurse-submodules https://github.com/jdreo/IOHexperimenter.git + cd IOHexperimenter +fi +# Clean build from scratch +rm -rf release +mkdir -p release +cd release +cmake -DCMAKE_CXX_FLAGS="${flags}" -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=OFF -D BUILD_EXAMPLE=OFF .. +make -j +# Get back to the root dir +cd ${here} + + +if cd paradiseo ; then + git pull +else + git clone --branch feat+num_foundry --single-branch --recurse-submodules https://github.com/jdreo/paradiseo.git + cd paradiseo + touch LICENSE +fi +rm -rf release +mkdir -p release +cd release +cmake -DCMAKE_CXX_FLAGS="${flags}" -D CMAKE_BUILD_TYPE=Release .. +make -j +cd ${here} + + +cd paradiseo/eo/contrib/irace +rm -rf release +mkdir -p release +cd release +cmake -DCMAKE_CXX_FLAGS="${flags}" -D CMAKE_BUILD_TYPE=Release -D IOH_ROOT=${here}/IOHexperimenter/ -D PARADISEO_ROOT=${here}/paradiseo/ -D PARADISEO_BUILD=${here}/paradiseo/release/ .. +make -j +cd ${here} + From b7542ef73bb3b0adba3632eb29c2f2f5b2cebeba Mon Sep 17 00:00:00 2001 From: Ronaldd Pinho Date: Fri, 16 Jul 2021 10:15:41 -0300 Subject: [PATCH 004/113] replace base directory references in main CMakeLists.txt --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 835847770..750342c43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,16 +51,16 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Target.cmake) ###################################################################################### ## Paths to sources of modules -set( EO_SRC_DIR "${CMAKE_SOURCE_DIR}/eo" CACHE INTERNAL "ParadisEO-EO source directory" FORCE) -set( EDO_SRC_DIR "${CMAKE_SOURCE_DIR}/edo" CACHE INTERNAL "ParadisEO-EDO source directory" FORCE) -set( MO_SRC_DIR "${CMAKE_SOURCE_DIR}/mo" CACHE INTERNAL "ParadisEO-MO source directory" FORCE) -set(MOEO_SRC_DIR "${CMAKE_SOURCE_DIR}/moeo" CACHE INTERNAL "ParadisEO-MOEO source directory" FORCE) -set( SMP_SRC_DIR "${CMAKE_SOURCE_DIR}/smp" CACHE INTERNAL "ParadisEO-SMP source directory" FORCE) -set( MPI_SRC_DIR "${CMAKE_SOURCE_DIR}/eo/src/mpi" CACHE INTERNAL "ParadisEO-MPI source directory" FORCE) +set( EO_SRC_DIR "${PROJECT_SOURCE_DIR}/eo" CACHE INTERNAL "ParadisEO-EO source directory" FORCE) +set( EDO_SRC_DIR "${PROJECT_SOURCE_DIR}/edo" CACHE INTERNAL "ParadisEO-EDO source directory" FORCE) +set( MO_SRC_DIR "${PROJECT_SOURCE_DIR}/mo" CACHE INTERNAL "ParadisEO-MO source directory" FORCE) +set(MOEO_SRC_DIR "${PROJECT_SOURCE_DIR}/moeo" CACHE INTERNAL "ParadisEO-MOEO source directory" FORCE) +set( SMP_SRC_DIR "${PROJECT_SOURCE_DIR}/smp" CACHE INTERNAL "ParadisEO-SMP source directory" FORCE) +set( MPI_SRC_DIR "${PROJECT_SOURCE_DIR}/eo/src/mpi" CACHE INTERNAL "ParadisEO-MPI source directory" FORCE) -set(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/problems" CACHE INTERNAL "Problems dependant source directory" FORCE) +set(PROBLEMS_SRC_DIR "${PROJECT_SOURCE_DIR}/problems" CACHE INTERNAL "Problems dependant source directory" FORCE) -set(CMAKE_BASE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) +set(CMAKE_BASE_SOURCE_DIR ${PROJECT_SOURCE_DIR}) # All libraries are built in /lib/ set( EO_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-EO binary directory" FORCE) From 864bbf697dcf912e164396bc1b7e00d6b4aa1082 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 19 Jul 2021 12:08:04 +0200 Subject: [PATCH 005/113] adds the pop_size parameters as managed by fastga --- eo/contrib/irace/fastga.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index ba55a22f8..170f69877 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -199,12 +199,17 @@ void print_irace(const eoParam& param, const eoOperatorFoundry& op_foundry, { 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_irace(const eoParam& param, const size_t min, const size_t max, std::ostream& out = std::cout) +{ + print_irace_ranged(param, min, max, "i", out); +} void print_operator_typed(const eoFunctorBase& op, std::ostream& out) { @@ -228,10 +233,16 @@ void print_operators(const eoParam& param, eoOperatorFoundry& op_foundry, s } } +template +void print_operators(const eoParam& param, T min, T max, std::ostream& out = std::cout, std::string indent=" ") +{ + out << indent << "[" << min << "," << max << "] " << param.longName() << "." << std::endl; +} + template 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; + print_operators(param, op_foundry.min(), op_foundry.max(), out, indent); } // Problem configuration. @@ -350,6 +361,7 @@ int main(int argc, char* argv[]) "pop-size", "Population size", 'P', "Operator Choice", /*required=*/false); const size_t pop_size = pop_size_p.value(); + const size_t pop_size_max = 200; auto offspring_size_p = parser.getORcreateParam(0, "offspring-size", "Offsprings size (0 = same size than the parents pop, see --pop-size)", @@ -432,8 +444,13 @@ int main(int argc, char* argv[]) print_operators( mutation_p, fake_foundry.mutations , std::clog); print_operators( replacement_p, fake_foundry.replacements , std::clog); print_operators( offspring_size_p, fake_foundry.offspring_sizes , std::clog); + print_operators( pop_size_p, (size_t)1, pop_size_max , std::clog); + std::clog << std::endl; + // If we were to make a DoE sampling numeric parameters, + // we would use that many samples: size_t fake_sample_size = 10; + std::clog << "With " << fake_sample_size << " samples for numeric parameters..." << std::endl; size_t n = fake_sample_size //crossover_rates * fake_foundry.crossover_selectors.size() @@ -445,8 +462,8 @@ int main(int argc, char* argv[]) * fake_foundry.replacements.size() * fake_foundry.continuators.size() * fake_sample_size //offspring_sizes + * fake_sample_size //pop_size ; - std::clog << std::endl; std::clog << "~" << n << " possible algorithms configurations." << std::endl; std::clog << "Ranges of configurable parameters (redirect the stdout in a file to use it with iRace): " << std::endl; @@ -463,6 +480,7 @@ int main(int argc, char* argv[]) print_irace( mutation_p, fake_foundry.mutations , std::cout); print_irace( replacement_p, fake_foundry.replacements , std::cout); print_irace( offspring_size_p, fake_foundry.offspring_sizes , std::cout); + print_irace( pop_size_p, 1, pop_size_max , std::cout); // std::ofstream irace_param("fastga.params"); // irace_param << "# name\tswitch\ttype\tvalues" << std::endl; From 648357de642e62ea2a7e864bf6ae89e29f78f437 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 19 Jul 2021 16:34:25 +0200 Subject: [PATCH 006/113] disable objective transformation in W-Model of fastga --- eo/contrib/irace/fastga.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 170f69877..0455f07c1 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -267,6 +267,26 @@ std::ostream& operator<<(std::ostream& os, const Problem& pb) return os; } +/***************************************************************************** + * IOH problem adaptation. + *****************************************************************************/ + +class WModelFlat : public ioh::problem::wmodel::WModelOneMax +{ + public: + WModelFlat(const int instance, const int n_variables, + const double dummy_para, const int epistasis_para, const int neutrality_para, + const int ruggedness_para) + : WModelOneMax(instance, n_variables, dummy_para, epistasis_para, neutrality_para, ruggedness_para) + { } + + protected: + double transform_objectives(const double y) override + { // Disable objective function shift & scaling. + return y; + } +}; + /***************************************************************************** * Command line interface. *****************************************************************************/ @@ -562,7 +582,8 @@ int main(int argc, char* argv[]) // + "_N" + std::to_string(w_neutrality) // + "_R" + std::to_string(w_ruggedness); - ioh::problem::wmodel::WModelOneMax w_model_om( + // ioh::problem::wmodel::WModelOneMax w_model_om( + WModelFlat w_model_om( instance, dimension, w_dummy, From 6c3bffd8c26a70b38171ec79faf4a1cab6d15000 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 30 Jul 2021 10:29:03 +0200 Subject: [PATCH 007/113] [fastga] fix budget-related issues Was overridding the max-evals budget in certain cases. --- eo/contrib/irace/fastga.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 0455f07c1..9dd0c0d47 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -24,13 +24,13 @@ using Bits = eoBit, int>; eoAlgoFoundryFastGA& make_foundry( eoFunctorStore& store, eoInit& init, - eoEvalFunc& eval_onemax, + eoEvalFunc& eval, const size_t max_evals, const size_t generations ) { // FIXME using max_restarts>1 does not allow to honor max evals. - auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval_onemax, max_evals, /*max_restarts=*/1); + auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval, max_evals, /*max_restarts=*/1); /***** Continuators ****/ foundry.continuators.add< eoGenContinue >(generations); @@ -348,7 +348,7 @@ int main(int argc, char* argv[]) const size_t instance = instance_p.value(); const size_t max_evals = parser.getORcreateParam(5 * dimension, - "max-evals", "Maximum number of evaluations", + "max-evals", "Maximum number of evaluations (default: 5*dim, else the given value)", 'e', "Stopping criterion").value(); const size_t buckets = parser.getORcreateParam(100, @@ -388,10 +388,12 @@ int main(int argc, char* argv[]) '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( + 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; + if(generations < 1) { + generations = 1; + } /***** metric parameters *****/ auto crossover_rate_p = parser.getORcreateParam(0.5, @@ -508,6 +510,10 @@ int main(int argc, char* argv[]) exit(NO_ERROR); } + eo::log << eo::debug << "Maximum number of evaluations: " << max_evals << std::endl; + eo::log << eo::debug << "Number of generations: " << generations << std::endl; + + /***************************************************************************** * IOH stuff. *****************************************************************************/ @@ -601,7 +607,8 @@ int main(int argc, char* argv[]) eoEvalIOHproblem onemax_pb(w_model_om, loggers); // eoEvalPrint eval_print(onemax_pb, std::clog, "\n"); - eoEvalFuncCounter eval_count(onemax_pb); + // eoEvalFuncCounter eval_count(onemax_pb); + eoEvalCounterThrowException eval_count(onemax_pb, max_evals); eoPopLoopEval onemax_eval(eval_count); @@ -609,7 +616,7 @@ int main(int argc, char* argv[]) eoBooleanGenerator bgen; eoInitFixedLength onemax_init(/*bitstring size=*/dimension, bgen); - auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals - pop_size, generations); + auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations); Ints encoded_algo(foundry.size()); @@ -644,8 +651,13 @@ int main(int argc, char* argv[]) eoPop pop; pop.append(pop_size, onemax_init); - onemax_eval(pop,pop); - foundry(pop); // Actually run the selected algorithm. + try { + onemax_eval(pop,pop); + foundry(pop); // Actually run the selected algorithm. + + } catch(eoMaxEvalException e) { + eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl; + } /***** IOH perf stats *****/ double perf = ioh::logger::eah::stat::under_curve::volume(eah_logger); From eb9bd4a4053d1443a9bdefa16054f12f453b6dea Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 30 Jul 2021 10:30:37 +0200 Subject: [PATCH 008/113] make some eoAlgoFoundryFastGA's parameters const --- eo/src/eoAlgoFoundryFastGA.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eo/src/eoAlgoFoundryFastGA.h b/eo/src/eoAlgoFoundryFastGA.h index 59f7dcfb2..0417511cb 100644 --- a/eo/src/eoAlgoFoundryFastGA.h +++ b/eo/src/eoAlgoFoundryFastGA.h @@ -85,8 +85,8 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry eoAlgoFoundryFastGA( eoInit & init, eoEvalFunc& eval, - size_t max_evals = 10000, - size_t max_restarts = std::numeric_limits::max() + const size_t max_evals = 10000, + const size_t max_restarts = std::numeric_limits::max() ) : eoAlgoFoundry(10), From 558d476ef34b0e5fc32b0f3b64f13b2bddf55b4c Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 30 Jul 2021 11:15:59 +0200 Subject: [PATCH 009/113] feat: adds a constructor taking a vector to eoCombinedContinue --- eo/src/eoCombinedContinue.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eo/src/eoCombinedContinue.h b/eo/src/eoCombinedContinue.h index 756a44a89..a3b3dcbca 100644 --- a/eo/src/eoCombinedContinue.h +++ b/eo/src/eoCombinedContinue.h @@ -54,8 +54,11 @@ public: /// Ctor, make sure that at least on continuator is present eoCombinedContinue( eoContinue& _cont) : eoContinue(), std::vector* >(1, &_cont) - { - } + { } + + eoCombinedContinue( std::vector*> _conts ) + : eoContinue(), std::vector* >(_conts) + { } /* FIXME remove in next release /// Ctor - for historical reasons ... should disspear some day From e2b74349e153d759c1da1aca9f4e0256ae7a9832 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 30 Jul 2021 11:16:30 +0200 Subject: [PATCH 010/113] [fastga] adds a fitness stoping criterion --- eo/contrib/irace/fastga.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 9dd0c0d47..73f0e5388 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -26,14 +26,20 @@ eoAlgoFoundryFastGA& make_foundry( eoInit& init, eoEvalFunc& eval, const size_t max_evals, - const size_t generations + const size_t generations, + const double optimum ) { // FIXME using max_restarts>1 does not allow to honor max evals. auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval, max_evals, /*max_restarts=*/1); /***** Continuators ****/ - foundry.continuators.add< eoGenContinue >(generations); + auto& fitcont = store.pack< eoFitContinue >(optimum); + auto& gencont = store.pack< eoGenContinue >(generations); + auto combconts = std::make_shared< std::vector*> >(); + combconts->push_back( &fitcont ); + combconts->push_back( &gencont ); + foundry.continuators.add< eoCombinedContinue >( *combconts ); // for(size_t i=1; i<10; i++) { // foundry.continuators.add< eoGenContinue >(i); // } @@ -453,7 +459,7 @@ int main(int argc, char* argv[]) eoEvalFuncPtr fake_eval(fake_func); eoUniformGenerator fake_gen(0, 1); eoInitFixedLength fake_init(/*bitstring size=*/1, fake_gen); - auto fake_foundry = make_foundry(store, fake_init, fake_eval, max_evals, /*generations=*/ 1); + auto fake_foundry = make_foundry(store, fake_init, fake_eval, max_evals, /*generations=*/ 1, 0); std::clog << std::endl << "Available operators:" << std::endl; print_operators( continuator_p, fake_foundry.continuators , std::clog); @@ -616,7 +622,7 @@ int main(int argc, char* argv[]) eoBooleanGenerator bgen; eoInitFixedLength onemax_init(/*bitstring size=*/dimension, bgen); - auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations); + auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target); Ints encoded_algo(foundry.size()); From c9cbd4ee146a82784e75cf76d87e84df5f82e20c Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 25 Aug 2021 09:18:20 +0200 Subject: [PATCH 011/113] move scripts in irace/expe/alpha/ --- eo/contrib/irace/{ => expe/alpha}/parse_baseline.py | 0 eo/contrib/irace/{ => expe/alpha}/parse_baseline_average.py | 0 eo/contrib/irace/{ => expe/alpha}/parse_elites.py | 0 eo/contrib/irace/{ => expe/alpha}/parse_irace_bests.py | 0 eo/contrib/irace/{ => expe/alpha}/plot_attain_mat.py | 0 eo/contrib/irace/{ => expe/alpha}/run_algo.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_baseline.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_elite.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_elites_all.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_irace.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_irace_all.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_irace_parallel-batch.sh | 0 eo/contrib/irace/{ => expe/alpha}/run_randoms.sh | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename eo/contrib/irace/{ => expe/alpha}/parse_baseline.py (100%) rename eo/contrib/irace/{ => expe/alpha}/parse_baseline_average.py (100%) rename eo/contrib/irace/{ => expe/alpha}/parse_elites.py (100%) rename eo/contrib/irace/{ => expe/alpha}/parse_irace_bests.py (100%) rename eo/contrib/irace/{ => expe/alpha}/plot_attain_mat.py (100%) rename eo/contrib/irace/{ => expe/alpha}/run_algo.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_baseline.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_elite.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_elites_all.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_irace.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_irace_all.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_irace_parallel-batch.sh (100%) rename eo/contrib/irace/{ => expe/alpha}/run_randoms.sh (100%) diff --git a/eo/contrib/irace/parse_baseline.py b/eo/contrib/irace/expe/alpha/parse_baseline.py similarity index 100% rename from eo/contrib/irace/parse_baseline.py rename to eo/contrib/irace/expe/alpha/parse_baseline.py diff --git a/eo/contrib/irace/parse_baseline_average.py b/eo/contrib/irace/expe/alpha/parse_baseline_average.py similarity index 100% rename from eo/contrib/irace/parse_baseline_average.py rename to eo/contrib/irace/expe/alpha/parse_baseline_average.py diff --git a/eo/contrib/irace/parse_elites.py b/eo/contrib/irace/expe/alpha/parse_elites.py similarity index 100% rename from eo/contrib/irace/parse_elites.py rename to eo/contrib/irace/expe/alpha/parse_elites.py diff --git a/eo/contrib/irace/parse_irace_bests.py b/eo/contrib/irace/expe/alpha/parse_irace_bests.py similarity index 100% rename from eo/contrib/irace/parse_irace_bests.py rename to eo/contrib/irace/expe/alpha/parse_irace_bests.py diff --git a/eo/contrib/irace/plot_attain_mat.py b/eo/contrib/irace/expe/alpha/plot_attain_mat.py similarity index 100% rename from eo/contrib/irace/plot_attain_mat.py rename to eo/contrib/irace/expe/alpha/plot_attain_mat.py diff --git a/eo/contrib/irace/run_algo.sh b/eo/contrib/irace/expe/alpha/run_algo.sh similarity index 100% rename from eo/contrib/irace/run_algo.sh rename to eo/contrib/irace/expe/alpha/run_algo.sh diff --git a/eo/contrib/irace/run_baseline.sh b/eo/contrib/irace/expe/alpha/run_baseline.sh similarity index 100% rename from eo/contrib/irace/run_baseline.sh rename to eo/contrib/irace/expe/alpha/run_baseline.sh diff --git a/eo/contrib/irace/run_elite.sh b/eo/contrib/irace/expe/alpha/run_elite.sh similarity index 100% rename from eo/contrib/irace/run_elite.sh rename to eo/contrib/irace/expe/alpha/run_elite.sh diff --git a/eo/contrib/irace/run_elites_all.sh b/eo/contrib/irace/expe/alpha/run_elites_all.sh similarity index 100% rename from eo/contrib/irace/run_elites_all.sh rename to eo/contrib/irace/expe/alpha/run_elites_all.sh diff --git a/eo/contrib/irace/run_irace.sh b/eo/contrib/irace/expe/alpha/run_irace.sh similarity index 100% rename from eo/contrib/irace/run_irace.sh rename to eo/contrib/irace/expe/alpha/run_irace.sh diff --git a/eo/contrib/irace/run_irace_all.sh b/eo/contrib/irace/expe/alpha/run_irace_all.sh similarity index 100% rename from eo/contrib/irace/run_irace_all.sh rename to eo/contrib/irace/expe/alpha/run_irace_all.sh diff --git a/eo/contrib/irace/run_irace_parallel-batch.sh b/eo/contrib/irace/expe/alpha/run_irace_parallel-batch.sh similarity index 100% rename from eo/contrib/irace/run_irace_parallel-batch.sh rename to eo/contrib/irace/expe/alpha/run_irace_parallel-batch.sh diff --git a/eo/contrib/irace/run_randoms.sh b/eo/contrib/irace/expe/alpha/run_randoms.sh similarity index 100% rename from eo/contrib/irace/run_randoms.sh rename to eo/contrib/irace/expe/alpha/run_randoms.sh From 6febf4ccebfc41a2878e88e26b74f7f525ac7a8c Mon Sep 17 00:00:00 2001 From: Alix ZHENG Date: Mon, 30 Aug 2021 09:44:06 +0200 Subject: [PATCH 012/113] Add experimental scripts for irace/fastga --- eo/contrib/irace/expe/beta/csv_all_bests.sh | 16 ++ .../irace/expe/beta/fastga_elites_all.sh | 22 ++ .../beta/irace_files_pA/default.instances | 27 +++ .../expe/beta/irace_files_pA/example.scen | 227 ++++++++++++++++++ .../expe/beta/irace_files_pA/fastga.param | 12 + .../expe/beta/irace_files_pA/target-runner | 89 +++++++ .../beta/irace_files_pF/default.instances | 48 ++++ .../expe/beta/irace_files_pF/example.scen | 227 ++++++++++++++++++ .../expe/beta/irace_files_pF/fastga.param | 12 + .../expe/beta/irace_files_pF/target-runner | 96 ++++++++ .../irace/expe/beta/parseA_irace_bests.py | 31 +++ .../irace/expe/beta/parseF_irace_bests.py | 35 +++ eo/contrib/irace/expe/beta/planA/r_iA.sh | 34 +++ eo/contrib/irace/expe/beta/planA/riaA.sh | 25 ++ eo/contrib/irace/expe/beta/planF/r_iF.sh | 37 +++ eo/contrib/irace/expe/beta/planF/riaF.sh | 28 +++ .../irace/expe/beta/run_elites_planA.sh | 61 +++++ .../irace/expe/beta/run_elites_planF.sh | 59 +++++ eo/contrib/irace/expe/beta/run_exp.sh | 12 + eo/contrib/irace/expe/beta/run_random.sh | 67 ++++++ eo/contrib/irace/expe/beta/run_res.sh | 26 ++ eo/contrib/irace/expe/beta/testrandom.sh | 18 ++ 22 files changed, 1209 insertions(+) create mode 100755 eo/contrib/irace/expe/beta/csv_all_bests.sh create mode 100644 eo/contrib/irace/expe/beta/fastga_elites_all.sh create mode 100755 eo/contrib/irace/expe/beta/irace_files_pA/default.instances create mode 100755 eo/contrib/irace/expe/beta/irace_files_pA/example.scen create mode 100755 eo/contrib/irace/expe/beta/irace_files_pA/fastga.param create mode 100755 eo/contrib/irace/expe/beta/irace_files_pA/target-runner create mode 100755 eo/contrib/irace/expe/beta/irace_files_pF/default.instances create mode 100755 eo/contrib/irace/expe/beta/irace_files_pF/example.scen create mode 100755 eo/contrib/irace/expe/beta/irace_files_pF/fastga.param create mode 100755 eo/contrib/irace/expe/beta/irace_files_pF/target-runner create mode 100755 eo/contrib/irace/expe/beta/parseA_irace_bests.py create mode 100755 eo/contrib/irace/expe/beta/parseF_irace_bests.py create mode 100755 eo/contrib/irace/expe/beta/planA/r_iA.sh create mode 100755 eo/contrib/irace/expe/beta/planA/riaA.sh create mode 100755 eo/contrib/irace/expe/beta/planF/r_iF.sh create mode 100755 eo/contrib/irace/expe/beta/planF/riaF.sh create mode 100755 eo/contrib/irace/expe/beta/run_elites_planA.sh create mode 100755 eo/contrib/irace/expe/beta/run_elites_planF.sh create mode 100644 eo/contrib/irace/expe/beta/run_exp.sh create mode 100755 eo/contrib/irace/expe/beta/run_random.sh create mode 100644 eo/contrib/irace/expe/beta/run_res.sh create mode 100644 eo/contrib/irace/expe/beta/testrandom.sh diff --git a/eo/contrib/irace/expe/beta/csv_all_bests.sh b/eo/contrib/irace/expe/beta/csv_all_bests.sh new file mode 100755 index 000000000..3f0fb3652 --- /dev/null +++ b/eo/contrib/irace/expe/beta/csv_all_bests.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ldata=$1 +file_py=$2 +csvdir="csv_FA" +ldir=$(echo $(ls ${ldata})) +for data in ${ldir[@]} ; do + path="${ldata}/${data}" + cmd="python3 ${file_py} ${path}" + plan_name=$(echo ${data} | sed "s/data//") + mexp=$(echo ${data[@]} | cut -d _ -f2) + mevals=$(echo ${data[@]} | cut -d _ -f3) + ddate=$(echo ${data[@]} | cut -d _ -f4) + name="results_irace_plan${plan_name[@]:0:1}_${mexp}_${mevals}_${ddate}" + mkdir -p "${csvdir}/csv_plan${plan_name[@]:0:1}" + ${cmd} > "${csvdir}/csv_plan${plan_name[@]:0:1}/${name}.csv" +done diff --git a/eo/contrib/irace/expe/beta/fastga_elites_all.sh b/eo/contrib/irace/expe/beta/fastga_elites_all.sh new file mode 100644 index 000000000..998cd22ab --- /dev/null +++ b/eo/contrib/irace/expe/beta/fastga_elites_all.sh @@ -0,0 +1,22 @@ +#!/bin/bash +ldata=$1 # eg : ./csv_plan2/ don t forget to end the path with / +file_py=$2 +ldir=$(echo $(ls ${ldata})) +fastga_dir="fastga_results_all" +mkdir -p /scratchbeta/${USER}/${fatga_dir} +#mkdir -p "/home/${USER}/${fastga_dir}/fastga_results_plan1" +mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planF" +mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planA" + +for data in ${ldir[@]} ; do + path_csv="${ldata}${data}" + plan_name=$(echo ${data} | sed "s/results_irace_plan//") + mexp=$(echo ${data[@]} | cut -d _ -f4) + mexp_id=$(echo ${mexp} | cut -d = -f2) + mevals=$(echo ${data[@]} | cut -d _ -f5) + mevals_id=$(echo ${mevals} | cut -d = -f2) + path="/scratchbeta/${USER}/${fastga_dir}/fastga_results_plan${plan_name[@]:0:1}" + cmd="bash ${file_py} ${path_csv} ${mexp_id} ${mevals_id} ${path}" + name="fastga${plan_name[@]:0:1}_${mexp}_${mevals}_$(date -Iseconds)_results_elites_all" + ${cmd} &> "${path}/output${plan_name[@]:0:1}_fastga_${mexp}_${mevals}_$(date -Iseconds).txt" +done diff --git a/eo/contrib/irace/expe/beta/irace_files_pA/default.instances b/eo/contrib/irace/expe/beta/irace_files_pA/default.instances new file mode 100755 index 000000000..4934f7988 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pA/default.instances @@ -0,0 +1,27 @@ +## This is an example of specifying instances with a file. + +# Each line is an instance relative to trainInstancesDir +# (see scenario.txt.tmpl) and an optional sequence of instance-specific +# parameters that will be passed to target-runnerx when invoked on that +# instance. + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 + diff --git a/eo/contrib/irace/expe/beta/irace_files_pA/example.scen b/eo/contrib/irace/expe/beta/irace_files_pA/example.scen new file mode 100755 index 000000000..abebcbb6d --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pA/example.scen @@ -0,0 +1,227 @@ +###################################################### -*- mode: r -*- ##### +## Scenario setup for Iterated Race (irace). +############################################################################ + +## To use the default value of a parameter of iRace, simply do not set +## the parameter (comment it out in this file, and do not give any +## value on the command line). + +## File that contains the description of the parameters of the target +## algorithm. +parameterFile = "./fastga.param" + +## Directory where the programs will be run. +execDir = "." + +## File to save tuning results as an R dataset, either absolute path or +## relative to execDir. +# 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, +## recovery is not performed. +# recoveryFile = "" + +## Directory where training instances are located; either absolute path or +## relative to current directory. If no trainInstancesFiles is provided, +## all the files in trainInstancesDir will be listed as instances. +trainInstancesDir = "." + +## File that contains a list of training instances and optionally +## additional parameters for them. If trainInstancesDir is provided, irace +## will search for the files in this folder. +trainInstancesFile = "./default.instances" + +## File that contains a table of initial configurations. If empty or NULL, +## all initial configurations are randomly generated. +# configurationsFile = "" + +## File that contains a list of logical expressions that cannot be TRUE +## for any evaluated configuration. If empty or NULL, do not use forbidden +## expressions. +forbiddenFile = "./forbidden.txt" + +## Script called for each configuration that executes the target algorithm +## to be tuned. See templates. +targetRunner = "./target-runner" + +## Number of times to retry a call to targetRunner if the call failed. +# targetRunnerRetries = 0 + +## Optional data passed to targetRunner. This is ignored by the default +## targetRunner function, but it may be used by custom targetRunner +## functions to pass persistent data around. +# targetRunnerData = "" + +## Optional R function to provide custom parallelization of targetRunner. +# targetRunnerParallel = "" + +## Optional script or R function that provides a numeric value for each +## configuration. See templates/target-evaluator.tmpl +# targetEvaluator = "" + +## Maximum number of runs (invocations of targetRunner) that will be +## performed. It determines the maximum budget of experiments for the +## tuning. +maxExperiments = 0 #100000 + +## Maximum total execution time in seconds for the executions of +## targetRunner. targetRunner must return two values: cost and time. +# maxTime = 60 + +## Fraction (smaller than 1) of the budget used to estimate the mean +## computation time of a configuration. Only used when maxTime > 0 +# budgetEstimation = 0.02 + +## Maximum number of decimal places that are significant for numerical +## (real) parameters. +digits = 2 + +## Debug level of the output of irace. Set this to 0 to silence all debug +## messages. Higher values provide more verbose debug messages. +# debugLevel = 0 + +## Number of iterations. +# nbIterations = 0 + +## Number of runs of the target algorithm per iteration. +# nbExperimentsPerIteration = 0 + +## Randomly sample the training instances or use them in the order given. +# sampleInstances = 1 + +## Statistical test used for elimination. Default test is always F-test +## unless capping is enabled, in which case the default test is t-test. +## Valid values are: F-test (Friedman test), t-test (pairwise t-tests with +## no correction), t-test-bonferroni (t-test with Bonferroni's correction +## for multiple comparisons), t-test-holm (t-test with Holm's correction +## for multiple comparisons). +# testType = "F-test" + +## Number of instances evaluated before the first elimination test. It +## must be a multiple of eachTest. +# firstTest = 5 + +## Number of instances evaluated between elimination tests. +# eachTest = 1 + +## Minimum number of configurations needed to continue the execution of +## each race (iteration). +# minNbSurvival = 0 + +## Number of configurations to be sampled and evaluated at each iteration. +# nbConfigurations = 0 + +## Parameter used to define the number of configurations sampled and +## evaluated at each iteration. +# mu = 5 + +## Confidence level for the elimination test. +# confidence = 0.95 + +## If the target algorithm is deterministic, configurations will be +## evaluated only once per instance. +# deterministic = 0 + +## Seed of the random number generator (by default, generate a random +## seed). +# seed = NA + +## Number of calls to targetRunner to execute in parallel. Values 0 or 1 +## mean no parallelization. +# 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 + +## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel +## (parameter parallel is the number of slaves). +# mpi = 0 + +## Specify how irace waits for jobs to finish when targetRunner submits +## jobs to a batch cluster: sge, pbs, torque or slurm. targetRunner must +## submit jobs to the cluster using, for example, qsub. +# batchmode = 0 + +## Enable/disable the soft restart strategy that avoids premature +## convergence of the probabilistic model. +# softRestart = 1 + +## Soft restart threshold value for numerical parameters. If NA, NULL or +## "", it is computed as 10^-digits. +# softRestartThreshold = "" + +## Directory where testing instances are located, either absolute or +## relative to current directory. +# testInstancesDir = "" + +## File containing a list of test instances and optionally additional +## parameters for them. +# testInstancesFile = "" + +## Number of elite configurations returned by irace that will be tested if +## test instances are provided. +# testNbElites = 1 + +## Enable/disable testing the elite configurations found at each +## iteration. +# testIterationElites = 0 + +## Enable/disable elitist irace. +# elitist = 1 + +## Number of instances added to the execution list before previous +## instances in elitist irace. +# elitistNewInstances = 1 + +## In elitist irace, maximum number per race of elimination tests that do +## not eliminate a configuration. Use 0 for no limit. +# elitistLimit = 2 + +## User-defined R function that takes a configuration generated by irace +## and repairs it. +# repairConfiguration = "" + +## Enable the use of adaptive capping, a technique designed for minimizing +## the computation time of configurations. This is only available when +## elitist is active. +# capping = 0 + +## Measure used to obtain the execution bound from the performance of the +## elite configurations: median, mean, worst, best. +# cappingType = "median" + +## Method to calculate the mean performance of elite configurations: +## candidate or instance. +# boundType = "candidate" + +## Maximum execution bound for targetRunner. It must be specified when +## capping is enabled. +# boundMax = 0 + +## Precision used for calculating the execution time. It must be specified +## when capping is enabled. +# boundDigits = 0 + +## Penalization constant for timed out executions (executions that reach +## boundMax execution time). +# boundPar = 1 + +## Replace the configuration cost of bounded executions with boundMax. +# boundAsTimeout = 1 + +## Percentage of the configuration budget used to perform a postselection +## race of the best configurations of each iteration after the execution +## of irace. +# postselection = 0 + +## Enable/disable AClib mode. This option enables compatibility with +## GenericWrapper4AC as targetRunner script. +# aclib = 0 + +## END of scenario file +############################################################################ + diff --git a/eo/contrib/irace/expe/beta/irace_files_pA/fastga.param b/eo/contrib/irace/expe/beta/irace_files_pA/fastga.param new file mode 100755 index 000000000..2b5779f64 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pA/fastga.param @@ -0,0 +1,12 @@ +# name switch type range +# continuator "--continuator=" c (0) +crossoverrate "--crossover-rate=" r (0,1) +crossselector "--cross-selector=" c (0,1,2,3,4,5,6) +# aftercrossselector "--aftercross-selector=" c (0) +crossover "--crossover=" c (0,1,2,3,4,5,6,7,8,9) +mutationrate "--mutation-rate=" r (0,1) +mutselector "--mut-selector=" c (0,1,2,3,4,5,6) +mutation "--mutation=" c (0,1,2,3,4,5,6,7,8,9,10) +replacement "--replacement=" c (0,1,2,3,4,5,6,7,8,9,10) +popsize "--pop-size=" i (1,50) +offspringsize "--offspring-size=" i (1,50) diff --git a/eo/contrib/irace/expe/beta/irace_files_pA/target-runner b/eo/contrib/irace/expe/beta/irace_files_pA/target-runner new file mode 100755 index 000000000..54c47ecd2 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pA/target-runner @@ -0,0 +1,89 @@ +#!/bin/bash +############################################################################### +# This script is the command that is executed every run. +# Check the examples in examples/ +# +# This script is run in the execution directory (execDir, --exec-dir). +# +# PARAMETERS: +# $1 is the candidate configuration number +# $2 is the instance ID +# $3 is the seed +# $4 is the instance name +# The rest ($* after `shift 4') are parameters to the run +# +# RETURN VALUE: +# This script should print one numerical value: the cost that must be minimized. +# Exit with 0 if no error, with 1 in case of error +############################################################################### +error() { + echo "`TZ=UTC date`: $0: error: $@" + exit 1 +} + + +EXE="./fastga" +LOG_DIR="irace_logs" + +#FIXED_PARAMS="--problem=0" +# +CONFIG_ID=$1 +INSTANCE_ID=$2 +SEED=$3 +INSTANCE=$(echo $4 | sed 's/\//\n/g'|tail -n 1) +CROSSOVER_RATE=$5 +CROSSOVER_SELECTOR=$6 +CROSSOVER=$7 +MUTATION_RATE=$8 +MUT_SELECTOR=$9 +MUTATION=${10} +REPLACEMENT=${11} +POPSIZE=${12} +OFFSPRINGSIZE=${13} +shift 13 || error "Not enough parameters" + +INSTANCE_PARAMS=$* +buckets=0 +# STDOUT=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stdout +# STDERR=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stderr +STDOUT="/dev/null" +STDERR="/dev/null" + +if [ ! -x "${EXE}" ]; then + error "${EXE}: not found or not executable (pwd: $(pwd))" +fi + +# If the program just prints a number, we can use 'exec' to avoid +# creating another process, but there can be no other commands after exec. +#exec $EXE ${FIXED_PARAMS} -i $INSTANCE ${INSTANCE_PARAMS} +# exit 1 +# +# Otherwise, save the output to a file, and parse the result from it. +# (If you wish to ignore segmentation faults you can use '{}' around +# the command.) +cmd="$EXE --problem=${INSTANCE} --instance=${INSTANCE} --seed=${SEED} ${CROSSOVER_RATE} ${CROSSOVER_SELECTOR} ${CROSSOVER} ${MUTATION_RATE} ${MUT_SELECTOR} ${MUTATION} ${REPLACEMENT} ${POPSIZE} ${OFFSPRINGSIZE} --max-evals=${buckets}" +# NOTE: irace seems to capture both stderr and stdout, so you should not output to stderr +echo ${cmd} > ${STDERR} +$cmd 2> ${STDERR} | tee ${STDOUT} + +# The following code is useless if the binary only output a single number on stdout. + +# This may be used to introduce a delay if there are filesystem +# issues. +# SLEEPTIME=1 +# while [ ! -s "${STDOUT}" ]; do +# sleep $SLEEPTIME +# let "SLEEPTIME += 1" +# done + +# This is an example of reading a number from the output. +# It assumes that the objective value is the first number in +# the first column of the last line of the output. +# if [ -s "${STDOUT}" ]; then +# COST=$(tail -n 1 ${STDOUT} | grep -e '^[[:space:]]*[+-]\?[0-9]' | cut -f1) +# echo "$COST" +# rm -f "${STDOUT}" "${STDERR}" +# exit 0 +# else +# error "${STDOUT}: No such file or directory" +# fi diff --git a/eo/contrib/irace/expe/beta/irace_files_pF/default.instances b/eo/contrib/irace/expe/beta/irace_files_pF/default.instances new file mode 100755 index 000000000..a0a1adfc3 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pF/default.instances @@ -0,0 +1,48 @@ +## This is an example of specifying instances with a file. + +# Each line is an instance relative to trainInstancesDir +# (see scenario.txt.tmpl) and an optional sequence of instance-specific +# parameters that will be passed to target-runnerx when invoked on that +# instance. + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 diff --git a/eo/contrib/irace/expe/beta/irace_files_pF/example.scen b/eo/contrib/irace/expe/beta/irace_files_pF/example.scen new file mode 100755 index 000000000..abebcbb6d --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pF/example.scen @@ -0,0 +1,227 @@ +###################################################### -*- mode: r -*- ##### +## Scenario setup for Iterated Race (irace). +############################################################################ + +## To use the default value of a parameter of iRace, simply do not set +## the parameter (comment it out in this file, and do not give any +## value on the command line). + +## File that contains the description of the parameters of the target +## algorithm. +parameterFile = "./fastga.param" + +## Directory where the programs will be run. +execDir = "." + +## File to save tuning results as an R dataset, either absolute path or +## relative to execDir. +# 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, +## recovery is not performed. +# recoveryFile = "" + +## Directory where training instances are located; either absolute path or +## relative to current directory. If no trainInstancesFiles is provided, +## all the files in trainInstancesDir will be listed as instances. +trainInstancesDir = "." + +## File that contains a list of training instances and optionally +## additional parameters for them. If trainInstancesDir is provided, irace +## will search for the files in this folder. +trainInstancesFile = "./default.instances" + +## File that contains a table of initial configurations. If empty or NULL, +## all initial configurations are randomly generated. +# configurationsFile = "" + +## File that contains a list of logical expressions that cannot be TRUE +## for any evaluated configuration. If empty or NULL, do not use forbidden +## expressions. +forbiddenFile = "./forbidden.txt" + +## Script called for each configuration that executes the target algorithm +## to be tuned. See templates. +targetRunner = "./target-runner" + +## Number of times to retry a call to targetRunner if the call failed. +# targetRunnerRetries = 0 + +## Optional data passed to targetRunner. This is ignored by the default +## targetRunner function, but it may be used by custom targetRunner +## functions to pass persistent data around. +# targetRunnerData = "" + +## Optional R function to provide custom parallelization of targetRunner. +# targetRunnerParallel = "" + +## Optional script or R function that provides a numeric value for each +## configuration. See templates/target-evaluator.tmpl +# targetEvaluator = "" + +## Maximum number of runs (invocations of targetRunner) that will be +## performed. It determines the maximum budget of experiments for the +## tuning. +maxExperiments = 0 #100000 + +## Maximum total execution time in seconds for the executions of +## targetRunner. targetRunner must return two values: cost and time. +# maxTime = 60 + +## Fraction (smaller than 1) of the budget used to estimate the mean +## computation time of a configuration. Only used when maxTime > 0 +# budgetEstimation = 0.02 + +## Maximum number of decimal places that are significant for numerical +## (real) parameters. +digits = 2 + +## Debug level of the output of irace. Set this to 0 to silence all debug +## messages. Higher values provide more verbose debug messages. +# debugLevel = 0 + +## Number of iterations. +# nbIterations = 0 + +## Number of runs of the target algorithm per iteration. +# nbExperimentsPerIteration = 0 + +## Randomly sample the training instances or use them in the order given. +# sampleInstances = 1 + +## Statistical test used for elimination. Default test is always F-test +## unless capping is enabled, in which case the default test is t-test. +## Valid values are: F-test (Friedman test), t-test (pairwise t-tests with +## no correction), t-test-bonferroni (t-test with Bonferroni's correction +## for multiple comparisons), t-test-holm (t-test with Holm's correction +## for multiple comparisons). +# testType = "F-test" + +## Number of instances evaluated before the first elimination test. It +## must be a multiple of eachTest. +# firstTest = 5 + +## Number of instances evaluated between elimination tests. +# eachTest = 1 + +## Minimum number of configurations needed to continue the execution of +## each race (iteration). +# minNbSurvival = 0 + +## Number of configurations to be sampled and evaluated at each iteration. +# nbConfigurations = 0 + +## Parameter used to define the number of configurations sampled and +## evaluated at each iteration. +# mu = 5 + +## Confidence level for the elimination test. +# confidence = 0.95 + +## If the target algorithm is deterministic, configurations will be +## evaluated only once per instance. +# deterministic = 0 + +## Seed of the random number generator (by default, generate a random +## seed). +# seed = NA + +## Number of calls to targetRunner to execute in parallel. Values 0 or 1 +## mean no parallelization. +# 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 + +## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel +## (parameter parallel is the number of slaves). +# mpi = 0 + +## Specify how irace waits for jobs to finish when targetRunner submits +## jobs to a batch cluster: sge, pbs, torque or slurm. targetRunner must +## submit jobs to the cluster using, for example, qsub. +# batchmode = 0 + +## Enable/disable the soft restart strategy that avoids premature +## convergence of the probabilistic model. +# softRestart = 1 + +## Soft restart threshold value for numerical parameters. If NA, NULL or +## "", it is computed as 10^-digits. +# softRestartThreshold = "" + +## Directory where testing instances are located, either absolute or +## relative to current directory. +# testInstancesDir = "" + +## File containing a list of test instances and optionally additional +## parameters for them. +# testInstancesFile = "" + +## Number of elite configurations returned by irace that will be tested if +## test instances are provided. +# testNbElites = 1 + +## Enable/disable testing the elite configurations found at each +## iteration. +# testIterationElites = 0 + +## Enable/disable elitist irace. +# elitist = 1 + +## Number of instances added to the execution list before previous +## instances in elitist irace. +# elitistNewInstances = 1 + +## In elitist irace, maximum number per race of elimination tests that do +## not eliminate a configuration. Use 0 for no limit. +# elitistLimit = 2 + +## User-defined R function that takes a configuration generated by irace +## and repairs it. +# repairConfiguration = "" + +## Enable the use of adaptive capping, a technique designed for minimizing +## the computation time of configurations. This is only available when +## elitist is active. +# capping = 0 + +## Measure used to obtain the execution bound from the performance of the +## elite configurations: median, mean, worst, best. +# cappingType = "median" + +## Method to calculate the mean performance of elite configurations: +## candidate or instance. +# boundType = "candidate" + +## Maximum execution bound for targetRunner. It must be specified when +## capping is enabled. +# boundMax = 0 + +## Precision used for calculating the execution time. It must be specified +## when capping is enabled. +# boundDigits = 0 + +## Penalization constant for timed out executions (executions that reach +## boundMax execution time). +# boundPar = 1 + +## Replace the configuration cost of bounded executions with boundMax. +# boundAsTimeout = 1 + +## Percentage of the configuration budget used to perform a postselection +## race of the best configurations of each iteration after the execution +## of irace. +# postselection = 0 + +## Enable/disable AClib mode. This option enables compatibility with +## GenericWrapper4AC as targetRunner script. +# aclib = 0 + +## END of scenario file +############################################################################ + diff --git a/eo/contrib/irace/expe/beta/irace_files_pF/fastga.param b/eo/contrib/irace/expe/beta/irace_files_pF/fastga.param new file mode 100755 index 000000000..2e1d9fe1c --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pF/fastga.param @@ -0,0 +1,12 @@ +# name switch type range +# continuator "--continuator=" c (0) +crossoverrate "--crossover-rate=" r (0,1) +crossselector "--cross-selector=" c (0,1,2,3,4,5,6) +# aftercrossselector "--aftercross-selector=" c (0) +crossover "--crossover=" c (0,1,2,3,4,5,6,7,8,9) +mutationrate "--mutation-rate=" r (0,1) +mutselector "--mut-selector=" c (0,1,2,3,4,5,6) +mutation "--mutation=" c (0,1,2,3,4,5,6,7,8,9,10) +replacement "--replacement=" c (0,1,2,3,4,5,6,7,8,9,10) +popsize "--pop-size=" i (1,50) +offspringsize "--offspring-size=" i (1,50) diff --git a/eo/contrib/irace/expe/beta/irace_files_pF/target-runner b/eo/contrib/irace/expe/beta/irace_files_pF/target-runner new file mode 100755 index 000000000..7a990a8ec --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pF/target-runner @@ -0,0 +1,96 @@ +#!/bin/bash +############################################################################### +# This script is the command that is executed every run. +# Check the examples in examples/ +# +# This script is run in the execution directory (execDir, --exec-dir). +# +# PARAMETERS: +# $1 is the candidate configuration number +# $2 is the instance ID +# $3 is the seed +# $4 is the instance name +# The rest ($* after `shift 4') are parameters to the run +# +# RETURN VALUE: +# This script should print one numerical value: the cost that must be minimized. +# Exit with 0 if no error, with 1 in case of error +############################################################################### +error() { + echo "`TZ=UTC date`: $0: error: $@" + exit 1 +} + + +EXE="./fastga" +LOG_DIR="irace_logs" + +FIXED_PARAMS="--problem=0" +#MAX_EVALS=2 +# +CONFIG_ID=$1 +INSTANCE_ID=$2 +SEED=$3 +INSTANCE=$(echo $4 | sed 's/\//\n/g'|tail -n 1) +CROSSOVER_RATE=$5 +CROSSOVER_SELECTOR=$6 +CROSSOVER=$7 +MUTATION_RATE=$8 +MUT_SELECTOR=$9 +MUTATION=${10} +REPLACEMENT=${11} +POPSIZE=${12} +OFFSPRINGSIZE=${13} +shift 13 || error "Not enough parameters" + +INSTANCE_PARAMS=$* + +buckets=0 +#dim=(20 20 16 48 25 32 128 128 128 50 100 150 128 192 192 192 256 75 150) +#size= $( echo $(echo $13 | cut -d'=' -f2)) +#pb=$(echo $(echo $13 | cut -d'=' -f2)) +#maxevals=$( echo ${dim[$pb]}) +# STDOUT=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stdout +# STDERR=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stderr +STDOUT="/dev/null" +STDERR="/dev/null" + +if [ ! -x "${EXE}" ]; then + error "${EXE}: not found or not executable (pwd: $(pwd))" +fi + +# If the program just prints a number, we can use 'exec' to avoid +# creating another process, but there can be no other commands after exec. +#exec $EXE ${FIXED_PARAMS} -i $INSTANCE ${INSTANCE_PARAMS} +# exit 1 +# +# Otherwise, save the output to a file, and parse the result from it. +# (If you wish to ignore segmentation faults you can use '{}' around +# the command.) + +cmd="$EXE ${FIXED_PARAMS} --instance=${INSTANCE} --seed=${SEED} ${CROSSOVER_RATE} ${CROSSOVER_SELECTOR} ${CROSSOVER} ${MUTATION_RATE} ${MUT_SELECTOR} ${MUTATION} ${REPLACEMENT} ${POPSIZE} ${OFFSPRINGSIZE} --max-evals=${buckets}" +# NOTE: irace seems to capture both stderr and stdout, so you should not output to stderr +echo ${cmd} > ${STDERR} +$cmd 2> ${STDERR} | tee ${STDOUT} + +# The following code is useless if the binary only output a single number on stdout. + +# This may be used to introduce a delay if there are filesystem +# issues. +# SLEEPTIME=1 +# while [ ! -s "${STDOUT}" ]; do +# sleep $SLEEPTIME +# let "SLEEPTIME += 1" +# done + +# This is an example of reading a number from the output. +# It assumes that the objective value is the first number in +# the first column of the last line of the output. +# if [ -s "${STDOUT}" ]; then +# COST=$(tail -n 1 ${STDOUT} | grep -e '^[[:space:]]*[+-]\?[0-9]' | cut -f1) +# echo "$COST" +# rm -f "${STDOUT}" "${STDERR}" +# exit 0 +# else +# error "${STDOUT}: No such file or directory" +# fi diff --git a/eo/contrib/irace/expe/beta/parseA_irace_bests.py b/eo/contrib/irace/expe/beta/parseA_irace_bests.py new file mode 100755 index 000000000..7c48f8049 --- /dev/null +++ b/eo/contrib/irace/expe/beta/parseA_irace_bests.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +#parse data1 +import os +import re +import sys + +print("ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement,pop-size,offspring-size") + + +#give the path of one experiment +argv=sys.argv[1] +for datadir in os.listdir(argv): + #if(os.path.isdir(os.path.join(argv,datadir))): check if argv/datadir is a directory + if(datadir.find("results_irace")>=0): #check if the directory is one JOB + with open(os.path.join("./",argv,datadir,"irace.log")) as fd: + data = fd.readlines() + + # Find the last best configuration + bests = [line.strip() for line in data if "Best-so-far" in line] + #print(datadir,bests) + 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 + algo = re.sub("\-\-\S*=", ",", configs[0]) + csv_line = best_perf + "," + algo + print(csv_line.replace(" ","")) \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/parseF_irace_bests.py b/eo/contrib/irace/expe/beta/parseF_irace_bests.py new file mode 100755 index 000000000..39c3d44cc --- /dev/null +++ b/eo/contrib/irace/expe/beta/parseF_irace_bests.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +#parse data1 +import os +import re +import sys +#print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement") #plan1 +print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement,pop-size,offspring-size") + + +#give the path of one experiment +argv=sys.argv[1] +for datadir in os.listdir(argv): + #if(os.path.isdir(os.path.join(argv,datadir))): check if argv/datadir is a directory + if(datadir.find("results_irace")>=0): #check if the directory is one JOB + for pb_dir in os.listdir(os.path.join(argv,datadir)): + if "results_problem" in pb_dir: + pb_id=pb_dir.replace("results_problem_","") + with open(os.path.join("./",argv,datadir,pb_dir,"irace.log")) as fd: + data = fd.readlines() + + # Find the last best configuration + bests = [line.strip() for line in data if "Best-so-far" in line] + #print(datadir,bests) + 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 + algo = re.sub("\-\-\S*=", ",", configs[0]) + csv_line = pb_id + "," + best_perf + "," + algo + print(csv_line.replace(" ","")) diff --git a/eo/contrib/irace/expe/beta/planA/r_iA.sh b/eo/contrib/irace/expe/beta/planA/r_iA.sh new file mode 100755 index 000000000..b9ca24be8 --- /dev/null +++ b/eo/contrib/irace/expe/beta/planA/r_iA.sh @@ -0,0 +1,34 @@ +#!/bin/bash +#run once each problem + +echo "-------------------------Start the JOB : $(date --iso-8601=seconds)" +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 +module load R + +dir=$1 +run=$2 +budget_irace=$3 +buckets=$4 +myhome=$5 +cp -r ${myhome}/R . +cp -r ${myhome}/irace_files_pA . +#cp -r /scratchbeta/zhenga/irace_files . +#chmod u+x ./fastga +outdir="${run}_$(date --iso-8601=seconds)_results_irace" +rundir=${dir}/${outdir} +mkdir -p ${rundir} +# Fore some reason, irace absolutely need those files... +cp ${myhome}/code/paradiseo/eo/contrib/irace/release/fastga ${rundir} +cat ./irace_files_pA/example.scen | sed "s%\".%\"${rundir}%g" | sed "s/maxExperiments = 0/maxExperiments=${budget_irace}/" > ${rundir}/example.scen +cp ./irace_files_pA/default.instances ${rundir} +cp ./irace_files_pA/fastga.param ${rundir} +cp ./irace_files_pA/forbidden.txt ${rundir} +cat ./irace_files_pA/target-runner | sed "s/buckets=0/buckets=${buckets}/" > ${rundir}/target-runner +chmod u+x ${rundir}/target-runner + +echo "---start $(date)" +time -p ./R/x86_64-pc-linux-gnu-library/3.6/irace/bin/irace --scenario ${rundir}/example.scen > ${rundir}/irace.log +echo "---end $(date)" +echo "End the JOB : $(date --iso-8601=seconds)------------------------------" diff --git a/eo/contrib/irace/expe/beta/planA/riaA.sh b/eo/contrib/irace/expe/beta/planA/riaA.sh new file mode 100755 index 000000000..c28359626 --- /dev/null +++ b/eo/contrib/irace/expe/beta/planA/riaA.sh @@ -0,0 +1,25 @@ +#!/bin/bashi +myhome=$1 +scratchpath=$2 +mexp=$3 +mevals=$4 +date -Iseconds +echo "STARTS" +dir=${scratchpath}/dataFAR/dataA +#dir=${HOME}/plan4/${name} +#cat ${HOME}/irace_files_pA/example.scen |sed "s/maxExperiments = 0/maxExperiments = ${mexp}/" > ${HOME}/irace_files_pA/example.scen + +mkdir -p ${dir} +outdir="${dir}/dataA_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)" +mkdir -p ${outdir} +for r in $(seq 2); do + echo "Run $r/15"; + cmd="qsub -N iraceA_maxEv_${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planA/r_iA.sh ${outdir} ${r} ${mexp} ${mevals} ${myhome}" + #cmd="bash ./r_iA_buckets.sh ${outdir} ${r} ${mexp} ${mevals}" + echo $cmd + time -p $cmd +done +echo "DONE" +#cat ${HOME}/irace_files_pA/example.scen |sed "s/maxExperiments = ${mexp}/maxExperiments = 0/" > ${HOME}/irace_files_pA/example.scen +date -Iseconds + diff --git a/eo/contrib/irace/expe/beta/planF/r_iF.sh b/eo/contrib/irace/expe/beta/planF/r_iF.sh new file mode 100755 index 000000000..fb9246746 --- /dev/null +++ b/eo/contrib/irace/expe/beta/planF/r_iF.sh @@ -0,0 +1,37 @@ +#!/bin/bash +#run once each problem +dir=$1 +run=$2 +budget_irace=$3 +buckets=$4 +myhome=$5 + +echo "---------------start JOB ${run} $(date --iso-8601=seconds)" +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 +module load R + +cp -r ${myhome}/R . +cp -r ${myhome}/irace_files_pF . +#cp -r /scratchbeta/zhenga/irace_files . +#chmod u+x ./fastga +outdir="${run}_$(date --iso-8601=seconds)_results_irace" +for pb in $(seq 0 18) ; do + echo "Problem ${pb}... " + res="results_problem_${pb}" + mkdir -p ${dir}/${outdir}/${res} + # Fore some reason, irace absolutely need those files... + cp ${myhome}/code/paradiseo/eo/contrib/irace/release/fastga ${dir}/${outdir}/${res} + cat ./irace_files_pF/example.scen | sed "s%\".%\"${dir}/${outdir}/${res}%g" | sed "s/maxExperiments = 0/maxExperiments=${budget_irace}/" > ${dir}/${outdir}/${res}/example.scen + cp ./irace_files_pF/default.instances ${dir}/${outdir}/${res} + cp ./irace_files_pF/fastga.param ${dir}/${outdir}/${res} + cp ./irace_files_pF/forbidden.txt ${dir}/${outdir}/${res} + cat ./irace_files_pF/target-runner | sed "s/--problem=0/--problem=${p}/" | sed "s/buckets=0/buckets=${buckets}/" > ${dir}/${outdir}/${res}/target-runner + chmod u+x ${dir}/${outdir}/${res}/target-runner + + echo "---start $(date)" + time -p ./R/x86_64-pc-linux-gnu-library/3.6/irace/bin/irace --scenario ${dir}/${outdir}/${res}/example.scen > ${dir}/${outdir}/${res}/irace.log + echo "---end $(date)" +done +echo "end JOB ${run} $(date --iso-8601=seconds)---------------" diff --git a/eo/contrib/irace/expe/beta/planF/riaF.sh b/eo/contrib/irace/expe/beta/planF/riaF.sh new file mode 100755 index 000000000..5791a1a1d --- /dev/null +++ b/eo/contrib/irace/expe/beta/planF/riaF.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +date -Iseconds +echo "STARTS" +myhome=$1 +scratchpath=$2 +#dir=${HOME}/plan2/${name} +mexp=$3 #budget irace +mevals=$4 #budget fastga +name="dataF_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)" +dir=${scratchpath}/dataFAR/dataF/${name} +mkdir -p ${dir} + +for r in $(seq 2); do + echo "Run $r/15"; + #date -Iseconds + #cmd="qsub -N irace_${runs}_${buckets}" -q beta -l select=1:ncpus=1 -l walltime=00:04:00 --${HOME}/run_irace.sh ${dir} + cmd="qsub -N iraceF_${mevals}_run=${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planF/r_iF.sh ${dir} ${r} ${mexp} ${mevals} ${myhome}" + #time -p bash ${HOME}/plan2/run_irace2.sh ${dir} ${r} &> ${dir}/erreur_${r}.txt + #bash ${HOME}/test/r_i.sh + echo $cmd + $cmd + #date -Iseconds +done + +#echo "DONE" +#date -Iseconds +#echo $(pwd) diff --git a/eo/contrib/irace/expe/beta/run_elites_planA.sh b/eo/contrib/irace/expe/beta/run_elites_planA.sh new file mode 100755 index 000000000..8cc3b146a --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_elites_planA.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#instance = seed +echo "-----------------Start $(date)" +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 + +csv_file=$1 #contains all the configs of all the problems of one experiments +mexp=$2 +mevals=$3 +path=$4 +# Number of runs (=seeds). +runs=50 + +# You most probably want to run on release builds. +exe="/home/zhenga/fastga" +plan=$(echo ${csv_file} | sed "s/results_irace_plan//") +outdir="${path}/plan4_maxExp=${mexp}_maxEv=${mevals}_$(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 ${csv_file}| sed 1,1d | cut -s -d"," -f3-11 ); do + 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]} --pop-size=${a[7]} --offspring-size=${a[8]}" + + #perc=$(echo "scale=3;${n}/(285)*100.0" | bc) + #echo "${perc}% : algo ${algoid}/285" + # echo -n "Runs: " + for pb in $(seq 0 18) ; do + name_dir="pb=${pb}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + mkdir -p ${outdir}/raw/data/${name_dir} + mkdir -p ${outdir}/raw/logs/${name_dir} + 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}" + cmd="${exe} --problem=${pb} --seed=${seed} --instance=${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 + # Actually start the command. + + ${cmd} > "${outdir}/raw/data/${name_dir}/${name_run}.dat" 2> "${outdir}/raw/logs/${name_dir}/${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 + n=$(($n+1)) + done + algoid=$(($algoid+1)) +done + +# Move IOH logs in the results directory. +#mv ./FastGA_* ${outdir} + +echo "Done $(date) -----------------------" +#date diff --git a/eo/contrib/irace/expe/beta/run_elites_planF.sh b/eo/contrib/irace/expe/beta/run_elites_planF.sh new file mode 100755 index 000000000..1c8b20a0a --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_elites_planF.sh @@ -0,0 +1,59 @@ +#!/bin/bash +#instance = seed +echo "-----------------Start $(date)" +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 + +csv_file=$1 #contains all the configs of all the problems of one experiments +mexp=$2 +mevals=$3 +path=$4 +# Number of runs (=seeds). +runs=50 + +# You most probably want to run on release builds. +exe="/home/${USER}/fastga" +plan=$(echo ${csv_file} | cut -d / -f3 | sed "s/results_irace_plan//") +outdir="${path}/plan${plan[@]:0:1}_maxExp=${mexp}_maxEv=${mevals}_$(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 ${csv_file}| sed 1,1d ); do + a=($(echo $line | sed "s/,/ /g")) + algo="--crossover-rate=${a[3]} --cross-selector=${a[4]} --crossover=${a[5]} --mutation-rate=${a[6]} --mut-selector=${a[7]} --mutation=${a[8]} --replacement=${a[9]} --pop-size=${a[10]} --offspring-size=${a[11]}" + + #perc=$(echo "scale=3;${n}/(285)*100.0" | bc) + #echo "${perc}% : algo ${algoid}/285" + # echo -n "Runs: " + name_dir="pb=${a[0]}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + mkdir -p ${outdir}/raw/logs/${name_dir} + mkdir -p ${outdir}/raw/data/${name_dir} + 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}" + cmd="${exe} --problem=${a[0]} --seed=${seed} --instance=${seed} ${algo}" + #echo ${cmd} # Print the command. + # Forge a directory/log file name + # (remove double dashs and replace spaces with underscore). + name_run="pb=${a[0]}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + # echo $name_run + # Actually start the command. + ${cmd} > "${outdir}/raw/data/${name_dir}/${name_run}.dat" 2> "${outdir}/raw/logs/${name_dir}/${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 + + n=$(($n+1)) + algoid=$(($algoid+1)) +done + +# Move IOH logs in the results directory. +#mv ./FastGA_* ${outdir} + +echo "Done $(date) -----------------------" +#date diff --git a/eo/contrib/irace/expe/beta/run_exp.sh b/eo/contrib/irace/expe/beta/run_exp.sh new file mode 100644 index 000000000..2688709f8 --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_exp.sh @@ -0,0 +1,12 @@ +#!/bin/bash +lexp=(300 600 1000 10000) +levals=(100 500 1000) +myscratchpath=/scratchbeta/$USER +myhome=${HOME} +for exp in ${lexp[@]} ; do + for evals in ${levals[@]} ; do + bash ./planF/riaF.sh ${myhome} ${myscratchpath} ${exp} ${evals} + bash ./planA/riaA.sh ${myhome} ${scratchpath} ${exp} ${evals} + done +done +bash testrandom.sh ${myhome} ${scratchpath} ${levals[@]} diff --git a/eo/contrib/irace/expe/beta/run_random.sh b/eo/contrib/irace/expe/beta/run_random.sh new file mode 100755 index 000000000..f509e4f3a --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_random.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# Number of runs (=seeds). +runs=5 +basename=$1 +mevals=$2 +nbAlgo=2 +echo "Start JOB maxEv= $mevals $(date -Iseconds) ----------------------" +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 +cp ${HOME}/code/paradiseo/eo/contrib/irace/release/fastga . +# You most probably want to run on release builds. +exe="./fastga" + +#outdir="/scratchbeta/$USER/$(date --iso-8601=minutes)_results_randoms" +outdir="${basename}/maxEv=${mevals}_nbAlgo=${nbAlgo}_$(date --iso-8601=minutes)_results_randoms" +mkdir -p ${outdir} +n=1 +algoid=0 +for algoid in $(seq ${nbAlgo}); do + #date + r1=$(echo "scale=2 ; ${RANDOM}/32767" | bc) + r2=$(echo "scale=2 ; ${RANDOM}/32767" | bc) + a=(${r1} $((RANDOM%7)) $((RANDOM%10)) ${r2} $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%11)) $((RANDOM%50 +1)) $((RANDOM%50 +1)) ) + #condition for value of replacement, pop-size and offspringsize + while [[ (1 -lt ${a[6]} && ${a[7]} -lt ${a[8]}) || ( ${a[6]} -eq 1 && ${a[7]} -ne ${a[8]}) ]] + do + #echo "get in ------------------replacement ${a[6]} popsize ${a[7]} offspringsize ${a[8]}" + r1=$(echo "scale=2 ; ${RANDOM}/32767" | bc) + r2=$(echo "scale=2 ; ${RANDOM}/32767" | bc) + a=(${r1} $((RANDOM%7)) $((RANDOM%10)) ${r2} $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%11)) $((RANDOM%50 +1)) $((RANDOM%50 +1))) + done + 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]} --pop-size=${a[7]} --offspring-size=${a[8]}" + echo " start algo ${a}------ $(date --iso-8601=minutes)" + algodir="$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + for pb in $(seq 0 18) ; do + perc=$(echo "scale=3;${n}/(10*18)*10.0" | bc) + #echo "${perc}% : algo ${algoid}/100, problem ${pb}/18 $(date --iso-8601=minutes)" + # echo -n "Runs: " + name_dir="pb=${pb}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + + mkdir -p ${outdir}/${algodir}/data/${name_dir} + mkdir -p ${outdir}/${algodir}/logs/${name_dir} + + for seed in $(seq ${runs}) ; do # Iterates over runs/seeds. + # This is the command to be ran. + cmd="${exe} --problem=${pb} --seed=${seed} --instance=${seed} ${algo} --max-evals=${mevals}" + name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + # echo $name_run + #echo $algo + + ${cmd} > ${outdir}/${algodir}/data/${name_dir}/${name_run}.dat 2> ${outdir}/${algodir}/logs/${name_dir}/${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 + echo "end algo $(date -Iseconds) " + algoid=$(($algoid+1)) +done + + + +echo "------------------------------------Done $mevals $(date -Iseconds) " + diff --git a/eo/contrib/irace/expe/beta/run_res.sh b/eo/contrib/irace/expe/beta/run_res.sh new file mode 100644 index 000000000..de5b352ad --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_res.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +#get csv file, parse dataF in a csv file +dir=/scratchbeta/$USER/dataFAR +listdir=$(echo $(ls ${dir})) + +for data in ${listdir[@]} ; do + file_py="parse${data: -1}_irace_bests.py" + path="${dir}/${data}" + cmd="bash ./csv_all_bests.sh ${path} ${file_py}" + echo $cmd + $cmd +done + +#get validation run of each config + +dir=/scratchbeta/$USER/csv_FA +listdir=$(echo $(ls ${dir})) +echo ${listdir[@]} +for csvdir in ${listdir[@]} ; do + csvpath="${dir}/${csvdir}" + file_py="./run_elites_plan${csvdir: -1}.sh" + cmd="bash ./fastga_elites_all.sh ${csvpath} ${file_py}" + echo $cmd + $cmd +done diff --git a/eo/contrib/irace/expe/beta/testrandom.sh b/eo/contrib/irace/expe/beta/testrandom.sh new file mode 100644 index 000000000..5c6880594 --- /dev/null +++ b/eo/contrib/irace/expe/beta/testrandom.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#tab=(15000 20000 30000 40000) +#tab=(100 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 10000) +myhome=$1 +scratchpath=$2 +tab=${@:3} +#echo ${tab[@]} +outdir="/scratchbeta/$USER/fastga_results_all/fastga_results_random" +mkdir -p ${outdir} #results of random experiment +for evals in ${tab[@]}; do + #evalsdir="${name}/maxEv=${evals}" + #mkdir -p ${evalsdir} + #{ time -p bash /home/$USER/run_random.sh ${name} ${i} 50 ; } &> "${name}/sortie5_${j}_maxExp=${i}.txt" + #cmd="qsub -N iraceR_maxEv=${evals} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- /scratchbeta/$USER/run_random.sh ${outdir} ${evals}" + $cmd + +done From 6f0f2fb2e646bcdf946587bca1fcf8a07f676915 Mon Sep 17 00:00:00 2001 From: Alix ZHENG Date: Sun, 5 Sep 2021 20:49:47 +0200 Subject: [PATCH 013/113] Add the final experimental scripts --- .../irace/expe/beta/fastga_elites_all.sh | 6 +- eo/contrib/irace/expe/beta/readme.txt | 101 ++++++++++++++++++ eo/contrib/irace/expe/beta/run_exp.sh | 2 +- 3 files changed, 105 insertions(+), 4 deletions(-) create mode 100755 eo/contrib/irace/expe/beta/readme.txt diff --git a/eo/contrib/irace/expe/beta/fastga_elites_all.sh b/eo/contrib/irace/expe/beta/fastga_elites_all.sh index 998cd22ab..a53eb189d 100644 --- a/eo/contrib/irace/expe/beta/fastga_elites_all.sh +++ b/eo/contrib/irace/expe/beta/fastga_elites_all.sh @@ -1,6 +1,6 @@ #!/bin/bash -ldata=$1 # eg : ./csv_plan2/ don t forget to end the path with / -file_py=$2 +ldata=$1 # eg : ./csv_planF/ don t forget to end the path with / +file_sh=$2 #eg : ./run_elites_planF ldir=$(echo $(ls ${ldata})) fastga_dir="fastga_results_all" mkdir -p /scratchbeta/${USER}/${fatga_dir} @@ -16,7 +16,7 @@ for data in ${ldir[@]} ; do mevals=$(echo ${data[@]} | cut -d _ -f5) mevals_id=$(echo ${mevals} | cut -d = -f2) path="/scratchbeta/${USER}/${fastga_dir}/fastga_results_plan${plan_name[@]:0:1}" - cmd="bash ${file_py} ${path_csv} ${mexp_id} ${mevals_id} ${path}" + cmd="bash ${file_sh} ${path_csv} ${mexp_id} ${mevals_id} ${path}" name="fastga${plan_name[@]:0:1}_${mexp}_${mevals}_$(date -Iseconds)_results_elites_all" ${cmd} &> "${path}/output${plan_name[@]:0:1}_fastga_${mexp}_${mevals}_$(date -Iseconds).txt" done diff --git a/eo/contrib/irace/expe/beta/readme.txt b/eo/contrib/irace/expe/beta/readme.txt new file mode 100755 index 000000000..6d53b7d90 --- /dev/null +++ b/eo/contrib/irace/expe/beta/readme.txt @@ -0,0 +1,101 @@ +1. INTRODUCTION + +The aim of all the scripts is to make the experimental plans for Algorithm Configuration for Genetic Algorithms by using a fully modular benchmarking pipeline design of this article https://arxiv.org/abs/2102.06435 . + +Plan A is an experimental plan for finding an efficient algorithm for all the functions that we consider. + +Plan F is an experimental plan for finding an efficient algorithm for each function that we consider. + +Plan R is an experimental plan for getting random algorithms. + +2. VOCABULARIES + +* maxExp : means maximum Experiments, the budget for irace +* maxEv : means maximum evaluation, the budget for FastGA algorithms + +*dataFAR : directory which we store all the experiment data of Plan F and Plan A, created when you run run_exp.sh + +* dataA, dataF +dataA is a directory which we store all the runs of an experiment plan for several budgets +eg : /dataA/planA_maxExp=*_maxEv=**_$(data), * is a value of maxExp, and ** is a value of maxEv + + +*fastga_results_all : directory which we store all the data for validation runs. It constains only 3 subdirectories (fastga_results_planF, fastga_results_planA, fastga_results_random), created by running run_exp.sh + +* fastga_results_planF, fastga_results_planA, fastga_results_random +Each directory store the data for validation runs of each experiment plan. +fastga_random directory are created by running run_exp.sh +fastga_results_planF and fastag_results_planA are created only after you have data in the dataA or dataF directories. + + +* planA_*, planF_* +If the planA_* or planF_* are in the dataFAR directory, the directory contains the data of experimental plan. This means that each plan contains the result of 15 runs of irace stored in irace.log file, and the data are provided by run_exp.sh. + +If the planA_* or planF_* directories are in the fastga_results_planA or fastga_results_planF, these directories contain the data of 50 validation runs by running all the best algorithms of each plan stores in dataFAR. The data are provided by running run_res.sh + + +*fastag_all_results : contains the directories of the validation run data. + +*fastga_results_planF, fastga_results_planA and fastga_results_random contain respectively the validation run data of Plan F, Plan A and Plan R. + + +3. DESCRIPTION + +The directory which you load all the scripts contains : + + * bash files : + -run_res.sh : submit to the cluster all the experiment plan, get all the data we need for the plan F, plan A and plan R. + -run_exp.sh : submit to the cluster for getting all the data for validation runs of each data A and data F provided by running run_res.sh + -run_random.sh : script for getting random algorithms and the data for validation runs for each problem + -testrandom.sh : change the budget fastga (maxEv) in this file if you need, by running this file, you submit plan R job in the cluster + + -csv_all_bests.sh : script for getting all the best configurations of each plan in a dataF or a dataA directories + + -run_elites_planA.sh : script for validation runs of plan A by giving a csv file of each best configuration. This file is provided by running parseA_irace_bests.py. + -run_elites_planB.sh + -fastga_elites_all.sh : run this file, by giving a directory csv_plan* of csv files ( must only contains the csv file of the same plan, eg : csv_planF) and a run_elites_plan*.sh (* is the name of the plan, eg run_elites_planF.sh), by running this file you get all the validation runs of each csv file. Each csv file contains the best configuration (you get these csv files by running csv_all_bests.sh) + + * python files : + -parseA_irace_bests.py : for parsing the irace.log file of each data provided by running irace. By giving a bounch of directories of one experiment + -parseF_irace_bests.py + + * 4 directories : + -irace_files_pA : + -default.instances + -example.scen + -fastga.param + -forbidden.txt + -target-runner + + -irace_files_pF : + -default.instances : + -example.scen + -fastga.param + -forbidden.txt + -target-runner + + -planA : + -riaA.sh : for running 15 times r_iA.sh file by submitting to the mesu cluster + -r_iA.sh : for running irace for all the problems + + -planF : + -riaF.sh : for running 15 times r_iF.sh file by submitting to the mesu cluster + -r_iF.sh : for running irace for each problem we considered + + +The directories planA, planF contain the scripts to run one experiment of Plan A and Plan F. + +The directories irace_files_pA and irace_files_pA contain the scripts needing for calling irace for one experiment of Plan A and Plan F. [Look at the irace package : User Guide for more information] + + +5. CONCLUSION + +For getting all the experiment data and the validation run data run run_exp.sh file first, after run_exp.sh file finished to execute and there is all the data in the dataFAR (ie : in the cluster, all the jobs finished to execute) run_res.sh data. + +Warning : run_exp.sh may take few days or few weeks depending on the Budget you ask, do not run_res.sh if in dataFAR there are data which are not finished to execute in the cluster, or jobs killed. Do not forget to remove directories of plan which are not complete. + + + + + + diff --git a/eo/contrib/irace/expe/beta/run_exp.sh b/eo/contrib/irace/expe/beta/run_exp.sh index 2688709f8..c3669a1c7 100644 --- a/eo/contrib/irace/expe/beta/run_exp.sh +++ b/eo/contrib/irace/expe/beta/run_exp.sh @@ -6,7 +6,7 @@ myhome=${HOME} for exp in ${lexp[@]} ; do for evals in ${levals[@]} ; do bash ./planF/riaF.sh ${myhome} ${myscratchpath} ${exp} ${evals} - bash ./planA/riaA.sh ${myhome} ${scratchpath} ${exp} ${evals} + bash ./planA/riaA.sh ${myhome} ${myscratchpath} ${exp} ${evals} done done bash testrandom.sh ${myhome} ${scratchpath} ${levals[@]} From 807be1b3c2683eee8a923d12f338e0cf37d94bc1 Mon Sep 17 00:00:00 2001 From: Alix ZHENG Date: Tue, 7 Sep 2021 00:27:44 +0200 Subject: [PATCH 014/113] Add scripts for parsing and archive link --- .../irace/expe/beta/best_out_of_elites.py | 86 +++++++ eo/contrib/irace/expe/beta/csv_all.sh | 40 +++ eo/contrib/irace/expe/beta/csv_all_bests.sh | 2 +- eo/contrib/irace/expe/beta/dist_op_random.py | 78 ++++++ .../irace/expe/beta/distribution_op_all.py | 87 +++++++ .../irace/expe/beta/fastga_elites_all.sh | 7 +- eo/contrib/irace/expe/beta/hist_all.sh | 34 +++ eo/contrib/irace/expe/beta/hist_by_FARO.py | 71 ++++++ eo/contrib/irace/expe/beta/hist_by_FARO_pb.py | 88 +++++++ .../irace/expe/beta/hist_by_pb_budget_plan.py | 90 +++++++ eo/contrib/irace/expe/beta/hist_join.py | 68 ++++++ .../irace/expe/beta/hist_join_random.py | 46 ++++ .../expe/beta/irace_files_pA/forbidden.txt | 13 + .../expe/beta/irace_files_pF/forbidden.txt | 15 ++ .../beta/irace_files_pO/default.instances | 48 ++++ .../expe/beta/irace_files_pO/example.scen | 228 ++++++++++++++++++ .../expe/beta/irace_files_pO/fastga.param | 10 + .../expe/beta/irace_files_pO/target-runner | 88 +++++++ eo/contrib/irace/expe/beta/mwtestU.py | 140 +++++++++++ .../irace/expe/beta/parseO_irace_bests.py | 35 +++ .../irace/expe/beta/parse_auc_average.py | 34 +++ eo/contrib/irace/expe/beta/planA/riaA.sh | 2 +- eo/contrib/irace/expe/beta/planF/riaF.sh | 2 +- eo/contrib/irace/expe/beta/planO/r_iO.sh | 43 ++++ eo/contrib/irace/expe/beta/planO/riaO.sh | 23 ++ eo/contrib/irace/expe/beta/readme.txt | 84 ++++++- .../irace/expe/beta/rep_std_mean_selected.py | 55 +++++ .../irace/expe/beta/run_elites_planO.sh | 64 +++++ eo/contrib/irace/expe/beta/run_exp.sh | 5 +- eo/contrib/irace/expe/beta/run_res.sh | 2 +- 30 files changed, 1570 insertions(+), 18 deletions(-) create mode 100755 eo/contrib/irace/expe/beta/best_out_of_elites.py create mode 100755 eo/contrib/irace/expe/beta/csv_all.sh create mode 100755 eo/contrib/irace/expe/beta/dist_op_random.py create mode 100755 eo/contrib/irace/expe/beta/distribution_op_all.py create mode 100755 eo/contrib/irace/expe/beta/hist_all.sh create mode 100755 eo/contrib/irace/expe/beta/hist_by_FARO.py create mode 100755 eo/contrib/irace/expe/beta/hist_by_FARO_pb.py create mode 100755 eo/contrib/irace/expe/beta/hist_by_pb_budget_plan.py create mode 100755 eo/contrib/irace/expe/beta/hist_join.py create mode 100755 eo/contrib/irace/expe/beta/hist_join_random.py create mode 100755 eo/contrib/irace/expe/beta/irace_files_pA/forbidden.txt create mode 100755 eo/contrib/irace/expe/beta/irace_files_pF/forbidden.txt create mode 100755 eo/contrib/irace/expe/beta/irace_files_pO/default.instances create mode 100755 eo/contrib/irace/expe/beta/irace_files_pO/example.scen create mode 100755 eo/contrib/irace/expe/beta/irace_files_pO/fastga.param create mode 100755 eo/contrib/irace/expe/beta/irace_files_pO/target-runner create mode 100755 eo/contrib/irace/expe/beta/mwtestU.py create mode 100755 eo/contrib/irace/expe/beta/parseO_irace_bests.py create mode 100755 eo/contrib/irace/expe/beta/parse_auc_average.py create mode 100755 eo/contrib/irace/expe/beta/planO/r_iO.sh create mode 100755 eo/contrib/irace/expe/beta/planO/riaO.sh create mode 100755 eo/contrib/irace/expe/beta/rep_std_mean_selected.py create mode 100755 eo/contrib/irace/expe/beta/run_elites_planO.sh diff --git a/eo/contrib/irace/expe/beta/best_out_of_elites.py b/eo/contrib/irace/expe/beta/best_out_of_elites.py new file mode 100755 index 000000000..c6832bbe0 --- /dev/null +++ b/eo/contrib/irace/expe/beta/best_out_of_elites.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +#cmd eg : +#python3 best_out_of_elites.py ./fastga_results_all/fastga_results_planO/planO_maxExp=50000_maxEv=5n_2021-08-13T19:16+02:00_results_elites_all +#python3 best_out_of_elites.py ./fastga_results_all/fastga_results_random/maxEv=10000_nbAlgo=15_2021-08-21T20:53+02:00_results_randoms + + +#get the configuration of the best out of the elite +# recommendation suggested by 15 independant runs of irace + +figdir=sys.argv[1] # directory of a result of one experiment +#eg : ./fastga_results_all/fastga_results_plan1/plan1_maxExp\=100000_maxEv\=5n_2021-08-13T19\:04+02\:00_results_elites_all/ +#print(figdir.split('/')[-2], figdir.split('/')) +if("plan" in figdir.split('/')[-2]): + print("Operator,","op. ,",",".join(map(str,range(1,20)))) + + column={"pc" : 101, "SelectC": 7, "Crossover" : 10, "pm": 101,"SelectM" : 7, "Mutation": 11, "Replacement" : 11, "pop-size": 50, "offspring-size" : 50} + nbparam=(len(os.listdir(os.path.join(figdir,"raw/data"))[0].split("_"))-1) #-1 car il y a le pb + + if( nbparam "${myfig}/auc_average_${experiments}.csv" + #--------------distribution of operators by pb and for all pb only for plan A,F,O ------ + #myfig=${figpath}/distribution_op_${plan} + #mkdir -p ${myfig} + #cmd="python3 distribution_op_all.py ${path} ${myfig} " + #$cmd + #--------------best out csv-------- + cmd="python3 best_out_of_elites.py ${path}" + myfig=${figpath}/best_out_${plan} + mkdir -p ${myfig} + $cmd > ${myfig}/best_out_all_pb_${experiments}.csv + echo ${cmd} + + done +done + +#---------------distribution of operators of randoma algo------------------ +#rpath=${ldata}/fastga_results_random +#cmd="python3 dist_op_random.py ${rpath} ${figpath}" +#$cmd +#---------------random--------------- \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/csv_all_bests.sh b/eo/contrib/irace/expe/beta/csv_all_bests.sh index 3f0fb3652..fb7926faf 100755 --- a/eo/contrib/irace/expe/beta/csv_all_bests.sh +++ b/eo/contrib/irace/expe/beta/csv_all_bests.sh @@ -1,7 +1,7 @@ #!/bin/bash ldata=$1 file_py=$2 -csvdir="csv_FA" +csvdir="csv_FAO" ldir=$(echo $(ls ${ldata})) for data in ${ldir[@]} ; do path="${ldata}/${data}" diff --git a/eo/contrib/irace/expe/beta/dist_op_random.py b/eo/contrib/irace/expe/beta/dist_op_random.py new file mode 100755 index 000000000..b7056cbd2 --- /dev/null +++ b/eo/contrib/irace/expe/beta/dist_op_random.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +#cmd eg : python3 ./dist_op_random.py ./fastga_results_all/fastga_results_random/ ./hist_and_csv/ +#get the distribution of operators variants recommended by 15 random algo for each maxEv +#pc and pm 10 possibilities : [0-0.1[ [0.1-0.2[ [0.2-0.3[ [0.3-0.4[ [0-0.5[ [0.5-0.6[ ...[0.9-1[ +#pop-size and offspring-size 10 possibilities : 0-5 5-10, 10-15 15-20 20-25 25-30 30-35- 35-40 40-45 45-50 + +path=sys.argv[1] # directory of a result of one experiment +#eg : ./fastga_results_all/fastga_results_random/ +figdir=sys.argv[2] #directory of where you want to store the data +if("random" in path): + #column : [operator : nbpossibilities] + distdir=figdir+"/distribution_random" + try: + os.makedirs(distdir) + except FileExistsError: + pass + + nbparam=9 #-1 car il y a le pb + + res=[] + + for maxEvdir in os.listdir(path): + res.append({"crossover-rate":["pc" , np.zeros(10, dtype=int)], + "cross-selector":["SelectC", np.zeros(7, dtype=int)], + "crossover":["Crossover" , np.zeros(10, dtype=int)], + "mutation-rate":["pm",np.zeros(10, dtype=int)], + "mut-selector":["SelectM",np.zeros(10, dtype=int)], + "mutation":["Mutation", np.zeros(11, dtype=int)], + "replacement":["Replacement" , np.zeros(11, dtype=int)], + "pop-size":["pop-size", np.zeros(10, dtype=int)], + "offspring-size":["offspring-size" , np.zeros(10, dtype=int)]}) + for algodir in os.listdir(os.path.join(path,maxEvdir)): #fastgadir : directory of 50 runs of an elite configuration + algo=algodir.split("_") + for param in algo: + name,val=param.split("=")[0],float(param.split("=")[1]) + if(name in {"pop-size" ,"offspring-size"}): + if(val%5==0): + res[-1][name][1][int(val//5) -1]+=1 + else: + #print(res[-1][name][1],val//5) + res[-1][name][1][int(val//5)]+=1 + + elif(name in {"crossover-rate","mutation-rate"} ): + if(int(val*10)==10): #case of val=1 + res[-1][name][1][-1]+=1 + else : + #print(int(float(val)*10), name,pb,val) + res[-1][name][1][int(val*10)]+=1 + else : + res[-1][name][1][int(val)]+=1 + + + ind=0 + for maxEvdir in os.listdir(path): + name="distribution_random_"+maxEvdir.split("_")[0]+".csv" #the end of the path must be / + with open(os.path.join(distdir,name),"w+") as csvfile: + csvfile.write("Op index, "+",".join(map(str,range(0,11)))+"\n") + with open(os.path.join(distdir,name),"a") as csvfile: + for param_name in res[ind].keys(): + #print(map(str,res[ind]),res[ind], ",".join(map(str,res[ind]))) + csvfile.write(res[ind][param_name][0]+","+ ",".join(map(str,res[ind][param_name][1]))+",-"*(11-len(res[ind][param_name][1])) +"\n") + #print(str(i)+",",",".join(map(str,np.mean(aucs[i],1)))) + ind+=1 + #all problems + name ="distribution_all_random_"+path.split("/")[-1]+".csv" + with open(os.path.join(distdir,name),'w+') as csvfile: + csvfile.write("Op index, "+",".join(map(str,range(0,11)))+"\n") + + with open(os.path.join(distdir,name),'a') as csvfile: + for param_name in res[0].keys(): + #print(map(str,res[ind]),res[ind], ",".join(map(str,res[ind]))) + csvfile.write(res[0][param_name][0]+","+ ",".join(map(str,np.sum([res[i][param_name][1] for i in range(ind-1)],0)))+",-"*(11-len(res[0][param_name][1])) +"\n") #res[0] only for getting the name of parameters + #print(str(i)+",",",".join(map(str,np.mean(aucs[i],1)))) \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/distribution_op_all.py b/eo/contrib/irace/expe/beta/distribution_op_all.py new file mode 100755 index 000000000..b2843c68b --- /dev/null +++ b/eo/contrib/irace/expe/beta/distribution_op_all.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +#get the distribution of operators variants recommended by 15 runs of irace for all problems and each problem +#also get an csv file +#pc and pm 10 possibilities : [0-0.1[ [0.1-0.2[ [0.2-0.3[ [0.3-0.4[ [0-0.5[ [0.5-0.6[ ...[0.9-1[ +#pop-size and offspring-size 10 possibilities : 0-5 5-10, 10-15 15-20 20-25 25-30 30-35- 35-40 40-45 45-50 + +path=sys.argv[1] # directory of a result of one experiment +#eg : ./fastga_results_all/fastga_results_planO/planO_maxExp\=100000_maxEv\=5n_2021-08-13T19\:04+02\:00_results_elites_all/ + +if("fastga_results_plan" in path): + #column : [operator : nbpossibilities] + distdir=sys.argv[2] + try: + os.makedirs(distdir) + except FileExistsError: + pass + + nbparam=(len(os.listdir(os.path.join(path,"raw/data"))[0].split("_"))-1) + + if( nbparam==7): + res=[{"crossover-rate":["pc" , np.zeros(10, dtype=int)], + "cross-selector":["SelectC", np.zeros(7, dtype=int)], + "crossover":["Crossover" , np.zeros(10, dtype=int)], + "mutation-rate":["pm",np.zeros(10, dtype=int)], + "mut-selector":["SelectM",np.zeros(7, dtype=int)], + "mutation":["Mutation", np.zeros(11, dtype=int)], + "replacement":["Replacement" ,np.zeros(11, dtype=int)]} for i in range(19)] + else: + res=[{"crossover-rate":["pc" , np.zeros(10, dtype=int)], + "cross-selector":["SelectC", np.zeros(7, dtype=int)], + "crossover":["Crossover" , np.zeros(10, dtype=int)], + "mutation-rate":["pm",np.zeros(10, dtype=int)], + "mut-selector":["SelectM",np.zeros(7, dtype=int)], + "mutation":["Mutation", np.zeros(11, dtype=int)], + "replacement":["Replacement" , np.zeros(11, dtype=int)], + "pop-size":["pop-size", np.zeros(10, dtype=int)], + "offspring-size":["offspring-size" , np.zeros(10, dtype=int)]} for i in range(19)] + + + for fastgadir in os.listdir(os.path.join(path,"raw/data")): #fastgadir : directory of 50 runs of an elite configuration + algo=fastgadir.split("_") + pb=int(fastgadir.split("_")[0].split("=")[1]) + for param in algo[1:]: + name,val=param.split("=")[0],float(param.split("=")[1]) + if(name in {"pop-size" ,"offspring-size"}): + if(val%5==0): + res[pb][name][1][int(val//5) -1]+=1 + else: + #print(res[pb][name][1],val//5) + res[pb][name][1][int(val//5)]+=1 + + elif(name in {"crossover-rate","mutation-rate"} ): + if(int(val*10)==10): #case of val=1 + res[pb][name][1][-1]+=1 + else : + #print(int(float(val)*10), name,pb,val) + res[pb][name][1][int(val*10)]+=1 + else : + res[pb][name][1][int(val)]+=1 + + + + for pb in range(19): + name="distribution_pb="+str(pb)+"_"+path.split("/")[-2]+".csv" #the end of the path must be / + with open(os.path.join(distdir,name),"w+") as csvfile: + csvfile.write("Op index, "+",".join(map(str,range(0,11)))+"\n") + with open(os.path.join(distdir,name),"a") as csvfile: + for param_name in res[pb].keys(): + #print(map(str,res[ind]),res[ind], ",".join(map(str,res[ind]))) + csvfile.write(res[pb][param_name][0]+","+ ",".join(map(str,res[pb][param_name][1]))+",-"*(11-len(res[pb][param_name][1])) +"\n") + #print(str(i)+",",",".join(map(str,np.mean(aucs[i],1)))) + + #all problems + name ="distribution_all_pb_"+path.split("/")[-1]+".csv" + with open(os.path.join(path,"raw",name),'w+') as csvfile: + csvfile.write("Op index, "+",".join(map(str,range(0,11)))+"\n") + + with open(os.path.join(path,"raw",name),'a') as csvfile: + for param_name in res[0].keys(): + #print(map(str,res[ind]),res[ind], ",".join(map(str,res[ind]))) + csvfile.write(res[0][param_name][0]+","+ ",".join(map(str,np.sum([res[i][param_name][1] for i in range(19)],0)))+",-"*(11-len(res[0][param_name][1])) +"\n") #res[0] only for getting the name of parameters + #print(str(i)+",",",".join(map(str,np.mean(aucs[i],1)))) \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/fastga_elites_all.sh b/eo/contrib/irace/expe/beta/fastga_elites_all.sh index a53eb189d..42f6c0453 100644 --- a/eo/contrib/irace/expe/beta/fastga_elites_all.sh +++ b/eo/contrib/irace/expe/beta/fastga_elites_all.sh @@ -1,15 +1,16 @@ #!/bin/bash -ldata=$1 # eg : ./csv_planF/ don t forget to end the path with / -file_sh=$2 #eg : ./run_elites_planF +ldata=$1 +file_sh=$2 ldir=$(echo $(ls ${ldata})) fastga_dir="fastga_results_all" mkdir -p /scratchbeta/${USER}/${fatga_dir} #mkdir -p "/home/${USER}/${fastga_dir}/fastga_results_plan1" mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planF" mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planA" +mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planO" for data in ${ldir[@]} ; do - path_csv="${ldata}${data}" + path_csv="${ldata}/${data}" plan_name=$(echo ${data} | sed "s/results_irace_plan//") mexp=$(echo ${data[@]} | cut -d _ -f4) mexp_id=$(echo ${mexp} | cut -d = -f2) diff --git a/eo/contrib/irace/expe/beta/hist_all.sh b/eo/contrib/irace/expe/beta/hist_all.sh new file mode 100755 index 000000000..89ffe932d --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_all.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +ldata="./fastga_results_all" #fastga_results_all +figpath="./hist_and_csv" #hist_and_csv + +ldir=$(echo $(ls ${ldata})) #list of directory of each plan +for plan in ${ldir[@]} ; do #get the directory of each plan + #------------hist by budget of a Plan (O,R or F) + #path="${ldata}/${plan}" + #cmd="python3 hist_join.py ${path} ${figpath}" + #echo $cmd + #$cmd + + #---------------------------hist by pb by budget--------------- + path="${ldata}/${plan}" + cmd="python3 hist_by_pb_budget_plan.py ${path} ${figpath}" + echo $cmd + $cmd +done + +#---------------random------------------ +#rpath=${ldata}/fastga_results_random +#cmd="python3 hist_join_random.py ${rpath} ${figpath}" +#---------------random--------------- + +#--------------------Choose a Budget irace and a budget fastga +mexp=100000 +mevals=1000 +#-------------------histogram join each plan F,A,R,O and join all algorithms for the budget chosen +cmd="python3 hist_by_FARO.py ${ldata} ${figdir} ${mexp} ${mevals}" +$cmd +#-------------------histogram by pb join each plan F,A,R,O and join all algorithms for the budget chosen +cmd="python3 hist_by_FARO_pb.py ${ldata} ${figdir} ${mexp} ${mevals}" +$cmd diff --git a/eo/contrib/irace/expe/beta/hist_by_FARO.py b/eo/contrib/irace/expe/beta/hist_by_FARO.py new file mode 100755 index 000000000..bc6ae3ccc --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_by_FARO.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +from scipy.stats import mannwhitneyu + +##python3 hist_by_FARO.py ./fastga_results_all/ ./hist_and_csv/ 100000 1000 +#one plot for one experiment plan for the same budget fastga, and the same budget irace if there is a budget irace (A,F) +path=sys.argv[1] +figpath=sys.argv[2] +maxExp=sys.argv[3] +maxEv=sys.argv[4] + +indF=-1 +indFO=-1 +averageConfigs=[] +name=[] +for fastga in os.listdir(path): #ddir : directory of fastga_plan + if(fastga in {"fastga_results_planA","fastga_results_planF","fastga_results_planO"}): + for plan in os.listdir(os.path.join(path,fastga)): + print("maxExp="+str(maxExp)+"_maxEv="+str(maxEv) in plan,plan,"maxExp="+str(maxExp)+"_maxEv="+str(maxEv)) + if("maxExp="+str(maxExp)+"_maxEv="+str(maxEv) in plan): + average=[] + + for fastgadir in os.listdir(os.path.join(path,fastga,plan,"raw","data")): #fastgadir : directory of 50 runs of a configuration + for fname in os.listdir(os.path.join(path,fastga,plan,"raw","data",fastgadir)): + with open(os.path.join(path,fastga,plan,"raw","data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average.append(auc) + averageConfigs.append(average) + nameid=plan.split("_")[0][-1] + name.append("plan"+nameid+"_"+"_".join(plan.split("_")[1:3])) + if("random" in fastga): + for randir in os.listdir(os.path.join(path,fastga)): + #eg path: maxEv=100_nbAlgo=15_2021-08-20T1511+0200_results_randoms + average=[] + if("maxEv="+str(maxEv)+"_" in randir): + for ddir in os.listdir(os.path.join(path,fastga,randir)): #ddir : directory of one run_elites_all or more + if("crossover" in ddir): + #name.append("_".join(ddir.split("_")[1:3])) + for fastgadir in os.listdir(os.path.join(path,fastga,randir,ddir,"data")): #fastgadir : directory of 50 runs of a configuration + for fname in os.listdir(os.path.join(path,fastga,randir,ddir,"data",fastgadir)): + with open(os.path.join(path,fastga,randir,ddir,"data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average.append(auc) + #hist[belonging(auc,cum)]+=1 + averageConfigs.append(average) + name.append(randir.split("_")[0]+"_random") + + +figdir=os.path.join(figpath,"hist_FARO_by_budget") +try: + os.makedirs(figdir) +except FileExistsError: + pass + +#_,pv=mannwhitneyu(averageConfigs[indFO],averageConfigs[indF]) +#print(name,len(averageConfigs)) +plt.figure() +plt.hist(averageConfigs,bins=10,range=(0,1),align="mid",rwidth=0.9,label=name) #no label +plt.xlabel("performances") +plt.ylabel("Number of runs") +plt.xlim(0,1) +plt.ylim(0,8000) +plt.yticks(range(0,8000,500)) +#plt.title("pvalue="+str(pv)+"\n medianeF="+str(np.median(averageConfigs[indF]))+", medianeFO="+str(np.median(averageConfigs[indFO]))) +plt.legend() +plt.savefig(figdir+"/hist_planFARO"+"_maxExp="+str(maxExp)+"_maxEv="+str(maxEv)+".png") +plt.close() + \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/hist_by_FARO_pb.py b/eo/contrib/irace/expe/beta/hist_by_FARO_pb.py new file mode 100755 index 000000000..70eb971cf --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_by_FARO_pb.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +##python3 hist_by_FARO_pb.py ./fastga_results_all/ ./hist_and_csv/ 100000 1000 +#19 histograms by plan F,A ,R O +path=sys.argv[1] +figpath=sys.argv[2] +maxExp=sys.argv[3] +maxEv=sys.argv[4] + +hist_pb=[[] for i in range(19)] +name=[] +for fastga in os.listdir(path): #ddir : directory of fastga_plan + if(fastga in {"fastga_results_planA", "fastga_results_planF","fastga_results_planO"}): + for plan in os.listdir(os.path.join(path,fastga)): + #print("maxExp="+str(maxExp)+"_maxEv="+str(maxEv)+"_" in plan,plan,"maxExp="+str(maxExp)+"_maxEv="+str(maxEv)) + #print("maxExp="+str(maxExp)+"_maxEv="+str(maxEv) in plan,plan,"maxExp="+str(maxExp)+"_maxEv="+str(maxEv)) + if("maxExp="+str(maxExp)+"_maxEv="+str(maxEv)+"_" in plan): + nameid=fastga[-1] + name.append("plan"+nameid+"_".join(plan.split("_")[1:3])) + for fastgadir in os.listdir(os.path.join(path,fastga,plan,"raw","data")): #fastgadir : directory of 50 runs of a configuration + pb=int(fastgadir.split("_")[0].split("=")[1]) + average_pb=[] + for fname in os.listdir(os.path.join(path,fastga,plan,"raw","data",fastgadir)): + with open(os.path.join(path,fastga,plan,"raw","data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average_pb.append(auc) + if(hist_pb[pb]==[]): #first algo + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + if("random" in fastga): + for randir in os.listdir(os.path.join(path,fastga)): + #eg path: maxEv=100_nbAlgo=15_2021-08-20T1511+0200_results_randoms + if(("maxEv="+str(maxEv)+"_") in randir): + #print("maxEv="+str(maxEv) in randir,randir) + name.append(randir.split("_")[0]+"_random") + for ddir in os.listdir(os.path.join(path,fastga,randir)): #ddir : directory of one run_elites_all or more + if("crossover" in ddir): + #name.append("_".join(ddir.split("_")[1:3])) + for fastgadir in os.listdir(os.path.join(path,fastga,randir,ddir,"data")): #fastgadir : directory of 50 runs of a configuration + average_pb=[] + pb=int(fastgadir.split("_")[0].split("=")[1]) + for fname in os.listdir(os.path.join(path,fastga,randir,ddir,"data",fastgadir)): + with open(os.path.join(path,fastga,randir,ddir,"data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average_pb.append(auc) + #print(len(hist_pb[pb]),len(name), pb) + if(hist_pb[pb]==[]): #first algo + #print("entrer random vide") + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + #print("entrer random !=") + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + +figdir=os.path.join(figpath,"hist_by_FARO_pb_maxExp={}_maxEv={}".format(maxExp,maxEv)) +try: + os.makedirs(figdir) +except FileExistsError: + pass +#colors=['yellow', 'green',"blue","pink","purple","orange","magenta","gray","darkred","cyan","brown","olivedrab","thistle","stateblue"] +print(name) +for pb in range(19): + print(pb, len(hist_pb[pb])) + for i in hist_pb[pb]: + print(len(i)) + plt.figure() + plt.hist(hist_pb[pb],bins=10,range=(0,1),align="mid",rwidth=0.9,edgecolor="red",label=name) #no label color=colors[:len(name)] + #for aucs in range(len(hist_pb[pb])): + #plt.hist(hist_pb[pb][aucs],bins=10,range=(0,1),align="mid",rwidth=0.9,edgecolor="red",label=name[aucs]) #no label + plt.xlabel("performances") + plt.ylabel("Number of runs") + plt.ylim(0,800) + plt.xlim(0,1) + plt.yticks(range(0,800,50)) + #plt.xticks(np.cumsum([0.1]*10)) + plt.legend() + plt.savefig(figdir+"/hist_FARO_pb={}_maxExp={}_maxEv={}.png".format(pb,maxExp,maxEv)) + plt.close() \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/hist_by_pb_budget_plan.py b/eo/contrib/irace/expe/beta/hist_by_pb_budget_plan.py new file mode 100755 index 000000000..a91d15e87 --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_by_pb_budget_plan.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +# python3 hist_by_pb_budget_plan.py ./fastga_results_all/fastga_results_planF/ ./hist_and_csv/ +#python3 hist_by_pb_budget_plan.py ./fastga_results_all/fastga_results_planO ./hist_and_csv +#get 19 histograms with number of budget bars, same as hist_join but now is by pb + +#argv : list of elite results +path=sys.argv[1] +figpath=sys.argv[2] +#plan_name=sys.argv[3] +hist_pb=[[] for i in range(19)] +name=[] +if("random" in path): + plan_name="R" +else: + plan_name=path.strip("/").split("/")[-1][-1] + + +for plandir in os.listdir(path): #plandir: directory of an experiment of elite results + if("results_elites_all" in plandir): + #eg : plan2_maxExp=10000_maxEv=1000_2021-08-20T1347+0200_results_elites_all + budget_irace=plandir.split("_")[1].split("=")[1] + budget_fastga=plandir.split("_")[2].split("=")[1] + name.append("plan="+plan_name+"_"+"".join(plandir.split("_")[1:3])) #plan=*_maxExp=*_maxEv=* + + for algodir in os.listdir(os.path.join(path,plandir,"raw","data")): + average_pb=[] + pb=int(algodir.split("_")[0].split("=")[1]) + for algo in os.listdir(os.path.join(path,plandir,"raw","data",algodir)): + with open(os.path.join(path,plandir,"raw","data",algodir,algo)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average_pb.append(auc) + if(hist_pb[pb]==[]): #first algo + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + if("results_randoms" in plandir): + #eg : maxEv=1000_2021-08-20T1347+0200_results_random + budget_fastga=plandir.split("_")[0].split("=")[1] + name.append("plan="+plan_name+"_"+"".join(plandir.split("_")[0])) #plan=*_maxExp=*_maxEv=* + for algodir in os.listdir(os.path.join(path,plandir)): + + for algo in os.listdir(os.path.join(path,plandir,algodir,"data")): + pb=int(algo.split("_")[0].split("=")[1]) + average_pb=[] + for fname in os.listdir(os.path.join(path,plandir,algodir,"data",algo)): + with open(os.path.join(path,plandir,algodir,"data",algo,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average_pb.append(auc) + if(hist_pb[pb]==[]): #first algo + print("entrer") + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + + +print(path.split("/")[-1][-1]) + +figdir=os.path.join(figpath,"hist_by_{}_pb_budget_plan".format(plan_name)) +#figdir=os.path.join(figpath,"hist_by_{}_pb_irace_maxEv={}".format(plan_name,1000)) +try: + os.makedirs(figdir) +except FileExistsError: + pass + + +for pb in range(19): + print(pb, len(hist_pb[pb])) + plt.figure() + plt.hist(hist_pb[pb],bins=10,range=(0,1),align="mid",rwidth=0.9,edgecolor="red",label=name) #no label color=colors[:len(name)] + #for aucs in range(len(hist_pb[pb])): + #plt.hist(hist_pb[pb][aucs],bins=10,range=(0,1),align="mid",rwidth=0.9,edgecolor="red",label=name[aucs]) #no label + plt.xlabel("performances") + plt.ylabel("Number of runs") + plt.ylim(0,750) + plt.yticks(range(0,750,50)) + plt.xlim(0,1) + plt.legend() + plt.savefig(figdir+"/hist_plan={}_pb={}_budget.png".format(plan_name,pb)) + plt.close() \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/hist_join.py b/eo/contrib/irace/expe/beta/hist_join.py new file mode 100755 index 000000000..4ba2d9e13 --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_join.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +from scipy.stats import mannwhitneyu + +#cmd : python3 hist_join.py ./fastga_results_all/fastga_results_planO/ ./hist_and_csv/ +#histogram by plan for the budgets (irace and fastag) + + +path=sys.argv[1] #argv : directory of a Plan (O, A, F) +figpath=sys.argv[2] #path to store the histograms +averageConfigs=[] +name=[] +if("fastga_results_plan" in path): + for ddir in os.listdir(path): #ddir : directory of one run_elites_all or more + if("plan" in ddir): + average=[] + name.append("_".join(ddir.split("_")[1:3])) + for fastgadir in os.listdir(os.path.join(path,ddir,"raw","data")): #fastgadir : directory of 50 runs of a configuration + for fname in os.listdir(os.path.join(path,ddir,"raw","data",fastgadir)): + with open(os.path.join(path,ddir,"raw","data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average.append(auc) + #hist[belonging(auc,cum)]+=1 + averageConfigs.append(average) + #print(hist) + #print(average) + + figdir=os.path.join(figpath,"hist_join") + try: + os.makedirs(figdir) + except FileExistsError: + pass + + + print(name,len(averageConfigs)) + + """ + idd0=name[0].split("_")[0].split("=")[1][:-3]+"k" + idd1=name[1].split("_")[0].split("=")[1][:-3]+"k" + idd2=name[2].split("_")[0].split("=")[1][:-3]+"k" + + #only for Budget irace 10000, 50000, 100000 ie: only three experiment results + titlename="median"+idd0+"={:.3f}".format(np.median(averageConfigs[0]))+" , median"+idd1+"={:.3f}".format(np.median(averageConfigs[1]))+" , median"+idd2+"={:.3f}".format(np.median(averageConfigs[2])) + _,pv=mannwhitneyu(averageConfigs[0],averageConfigs[1]) + titlename+="\n pvalue{}={:.3f}".format(idd0+idd1,pv) + _,pv=mannwhitneyu(averageConfigs[0],averageConfigs[2]) + titlename+=" ,pvalue{}={:.3f}".format(idd0+idd2,pv) + _,pv=mannwhitneyu(averageConfigs[1],averageConfigs[2]) + titlename+=" ,pvalue{}={:.3f}".format(idd1+idd2,pv) + print(titlename) + """ + plt.figure() + plt.hist(averageConfigs,bins=10,range=(0,1),align="mid",rwidth=0.9,label=name) #no label + plt.xlabel("performances") + plt.ylabel("Number of runs") + plt.xlim(0,1) + plt.ylim(0,7000) + plt.yticks(range(0,7000,500)) + #plt.title(titlename) + plt.legend() + plt.savefig(figdir+"/hist_plan"+path.strip("/")[-1]+"_by_budget.png") + #plt.savefig(figpath+"/hist_plan"+path.strip("/")[-1]+"_by_budgetI.png") + plt.close() + + diff --git a/eo/contrib/irace/expe/beta/hist_join_random.py b/eo/contrib/irace/expe/beta/hist_join_random.py new file mode 100755 index 000000000..0b5d3c7d4 --- /dev/null +++ b/eo/contrib/irace/expe/beta/hist_join_random.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +##python3 hist_random.py ./dastga_results_all/fastga_results_random ./hist_and_csv/ +#argv : list of elite results +data=sys.argv[1] +figpath=sys.argv[2] +averageConfigs=[] +name=[] +for path in os.listdir(data): + #eg path: maxEv=100_nbAlgo=15_2021-08-20T1511+0200_results_randoms + average=[] + if("maxEv" in path): + for ddir in os.listdir(os.path.join(data,path)): #ddir : directory of one run_elites_all or more + if("crossover" in ddir): + #name.append("_".join(ddir.split("_")[1:3])) + for fastgadir in os.listdir(os.path.join(data,path,ddir,"data")): #fastgadir : directory of 50 runs of a configuration + for fname in os.listdir(os.path.join(data,path,ddir,"data",fastgadir)): + with open(os.path.join(data,path,ddir,"data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) *(-1) + average.append(auc) + #hist[belonging(auc,cum)]+=1 + averageConfigs.append(average) + name.append(path.split("_")[0]) + +figdir=os.path.join(figpath,"hist_join") +try: + os.makedirs(figdir) +except FileExistsError: + pass + +colors=['yellow', 'green',"blue","pink","purple","orange","magenta","gray","darkred","cyan","brown","olivedrab","thistle","stateblue"] +plt.figure() +plt.hist(averageConfigs,bins=10,range=(0,1),align="mid",rwidth=0.5,label=name) #no label +plt.xlabel("performances") +plt.ylabel("Number of runs") +plt.ylim([0,8000]) +plt.xlim(0,1) +plt.yticks(range(0,8000,500)) +#plt.xticks(np.cumsum([0.1]*10)) +plt.legend() +plt.savefig(figdir+"/hist_random_by_budget.png") +plt.close() diff --git a/eo/contrib/irace/expe/beta/irace_files_pA/forbidden.txt b/eo/contrib/irace/expe/beta/irace_files_pA/forbidden.txt new file mode 100755 index 000000000..56eb175cd --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pA/forbidden.txt @@ -0,0 +1,13 @@ +## Template for specifying forbidden parameter configurations in irace. +## +## This filename must be specified via the --forbidden-file command-line option +## (or forbiddenFile in scenario.txt). +## +## The format is one constraint per line. Each constraint is a logical +## expression (in R syntax). If a parameter configuration +## is generated that makes the logical expression evaluate to TRUE, +## then the configuration is discarded. +## +## Examples of valid logical operators are: == != >= <= > < & | ! %in% +(replacement %in% c(2,3,4,5,6,7,8,9,10)) & (offspringsize > popsize) +(replacement %in% c(1)) & (offspringsize < popsize) diff --git a/eo/contrib/irace/expe/beta/irace_files_pF/forbidden.txt b/eo/contrib/irace/expe/beta/irace_files_pF/forbidden.txt new file mode 100755 index 000000000..86c8798e4 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pF/forbidden.txt @@ -0,0 +1,15 @@ +## Template for specifying forbidden parameter configurations in irace. +## +## This filename must be specified via the --forbidden-file command-line option +## (or forbiddenFile in scenario.txt). +## +## The format is one constraint per line. Each constraint is a logical +## expression (in R syntax). If a parameter configuration +## is generated that makes the logical expression evaluate to TRUE, +## then the configuration is discarded. +## +## Examples of valid logical operators are: == != >= <= > < & | ! %in% +(replacement %in% c(2,3,4,5,6,7,8,9,10)) & (offspringsize > popsize) +(replacement %in% c(1)) & (offspringsize < popsize) +#(as.numeric(replacement) == 2) & (offspringsize > popsize) +#(as.numeric(replacement) == 3) & (offspringsize > popsize) diff --git a/eo/contrib/irace/expe/beta/irace_files_pO/default.instances b/eo/contrib/irace/expe/beta/irace_files_pO/default.instances new file mode 100755 index 000000000..a0a1adfc3 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pO/default.instances @@ -0,0 +1,48 @@ +## This is an example of specifying instances with a file. + +# Each line is an instance relative to trainInstancesDir +# (see scenario.txt.tmpl) and an optional sequence of instance-specific +# parameters that will be passed to target-runnerx when invoked on that +# instance. + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 diff --git a/eo/contrib/irace/expe/beta/irace_files_pO/example.scen b/eo/contrib/irace/expe/beta/irace_files_pO/example.scen new file mode 100755 index 000000000..8b9447333 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pO/example.scen @@ -0,0 +1,228 @@ +###################################################### -*- mode: r -*- ##### +## Scenario setup for Iterated Race (irace). +############################################################################ + +## To use the default value of a parameter of iRace, simply do not set +## the parameter (comment it out in this file, and do not give any +## value on the command line). + +## File that contains the description of the parameters of the target +## algorithm. +parameterFile = "./fastga.param" + +## Directory where the programs will be run. +execDir = "." + +## File to save tuning results as an R dataset, either absolute path or +## relative to execDir. +# 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, +## recovery is not performed. +# recoveryFile = "" + +## Directory where training instances are located; either absolute path or +## relative to current directory. If no trainInstancesFiles is provided, +## all the files in trainInstancesDir will be listed as instances. +trainInstancesDir = "." + +## File that contains a list of training instances and optionally +## additional parameters for them. If trainInstancesDir is provided, irace +## will search for the files in this folder. +trainInstancesFile = "./default.instances" + +## File that contains a table of initial configurations. If empty or NULL, +## all initial configurations are randomly generated. +# configurationsFile = "" + +## File that contains a list of logical expressions that cannot be TRUE +## for any evaluated configuration. If empty or NULL, do not use forbidden +## expressions. +# forbiddenFile = "" + +## Script called for each configuration that executes the target algorithm +## to be tuned. See templates. +targetRunner = "./target-runner" + +## Number of times to retry a call to targetRunner if the call failed. +# targetRunnerRetries = 0 + +## Optional data passed to targetRunner. This is ignored by the default +## targetRunner function, but it may be used by custom targetRunner +## functions to pass persistent data around. +# targetRunnerData = "" + +## Optional R function to provide custom parallelization of targetRunner. +# targetRunnerParallel = "" + +## Optional script or R function that provides a numeric value for each +## configuration. See templates/target-evaluator.tmpl +# targetEvaluator = "" + +## Maximum number of runs (invocations of targetRunner) that will be +## performed. It determines the maximum budget of experiments for the +## tuning. +maxExperiments = 0 #100000 + + +## Maximum total execution time in seconds for the executions of +## targetRunner. targetRunner must return two values: cost and time. +# maxTime = 60 + +## Fraction (smaller than 1) of the budget used to estimate the mean +## computation time of a configuration. Only used when maxTime > 0 +# budgetEstimation = 0.02 + +## Maximum number of decimal places that are significant for numerical +## (real) parameters. +digits = 2 + +## Debug level of the output of irace. Set this to 0 to silence all debug +## messages. Higher values provide more verbose debug messages. +# debugLevel = 0 + +## Number of iterations. +# nbIterations = 0 + +## Number of runs of the target algorithm per iteration. +# nbExperimentsPerIteration = 0 + +## Randomly sample the training instances or use them in the order given. +# sampleInstances = 1 + +## Statistical test used for elimination. Default test is always F-test +## unless capping is enabled, in which case the default test is t-test. +## Valid values are: F-test (Friedman test), t-test (pairwise t-tests with +## no correction), t-test-bonferroni (t-test with Bonferroni's correction +## for multiple comparisons), t-test-holm (t-test with Holm's correction +## for multiple comparisons). +# testType = "F-test" + +## Number of instances evaluated before the first elimination test. It +## must be a multiple of eachTest. +# firstTest = 5 + +## Number of instances evaluated between elimination tests. +# eachTest = 1 + +## Minimum number of configurations needed to continue the execution of +## each race (iteration). +# minNbSurvival = 0 + +## Number of configurations to be sampled and evaluated at each iteration. +# nbConfigurations = 0 + +## Parameter used to define the number of configurations sampled and +## evaluated at each iteration. +# mu = 5 + +## Confidence level for the elimination test. +# confidence = 0.95 + +## If the target algorithm is deterministic, configurations will be +## evaluated only once per instance. +# deterministic = 0 + +## Seed of the random number generator (by default, generate a random +## seed). +# seed = NA + +## Number of calls to targetRunner to execute in parallel. Values 0 or 1 +## mean no parallelization. +# 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 + +## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel +## (parameter parallel is the number of slaves). +# mpi = 0 + +## Specify how irace waits for jobs to finish when targetRunner submits +## jobs to a batch cluster: sge, pbs, torque or slurm. targetRunner must +## submit jobs to the cluster using, for example, qsub. +# batchmode = 0 + +## Enable/disable the soft restart strategy that avoids premature +## convergence of the probabilistic model. +# softRestart = 1 + +## Soft restart threshold value for numerical parameters. If NA, NULL or +## "", it is computed as 10^-digits. +# softRestartThreshold = "" + +## Directory where testing instances are located, either absolute or +## relative to current directory. +# testInstancesDir = "" + +## File containing a list of test instances and optionally additional +## parameters for them. +# testInstancesFile = "" + +## Number of elite configurations returned by irace that will be tested if +## test instances are provided. +# testNbElites = 1 + +## Enable/disable testing the elite configurations found at each +## iteration. +# testIterationElites = 0 + +## Enable/disable elitist irace. +# elitist = 1 + +## Number of instances added to the execution list before previous +## instances in elitist irace. +# elitistNewInstances = 1 + +## In elitist irace, maximum number per race of elimination tests that do +## not eliminate a configuration. Use 0 for no limit. +# elitistLimit = 2 + +## User-defined R function that takes a configuration generated by irace +## and repairs it. +# repairConfiguration = "" + +## Enable the use of adaptive capping, a technique designed for minimizing +## the computation time of configurations. This is only available when +## elitist is active. +# capping = 0 + +## Measure used to obtain the execution bound from the performance of the +## elite configurations: median, mean, worst, best. +# cappingType = "median" + +## Method to calculate the mean performance of elite configurations: +## candidate or instance. +# boundType = "candidate" + +## Maximum execution bound for targetRunner. It must be specified when +## capping is enabled. +# boundMax = 0 + +## Precision used for calculating the execution time. It must be specified +## when capping is enabled. +# boundDigits = 0 + +## Penalization constant for timed out executions (executions that reach +## boundMax execution time). +# boundPar = 1 + +## Replace the configuration cost of bounded executions with boundMax. +# boundAsTimeout = 1 + +## Percentage of the configuration budget used to perform a postselection +## race of the best configurations of each iteration after the execution +## of irace. +# postselection = 0 + +## Enable/disable AClib mode. This option enables compatibility with +## GenericWrapper4AC as targetRunner script. +# aclib = 0 + +## END of scenario file +############################################################################ + diff --git a/eo/contrib/irace/expe/beta/irace_files_pO/fastga.param b/eo/contrib/irace/expe/beta/irace_files_pO/fastga.param new file mode 100755 index 000000000..9f8c088f4 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pO/fastga.param @@ -0,0 +1,10 @@ +# name switch type range +# continuator "--continuator=" c (0) +crossoverrate "--crossover-rate=" r (0,1) +crossselector "--cross-selector=" c (0,1,2,3,4,5,6) +# aftercrossselector "--aftercross-selector=" c (0) +crossover "--crossover=" c (0,1,2,3,4,5,6,7,8,9) +mutationrate "--mutation-rate=" r (0,1) +mutselector "--mut-selector=" c (0,1,2,3,4,5,6) +mutation "--mutation=" c (0,1,2,3,4,5,6,7,8,9,10) +replacement "--replacement=" c (0,1,2,3,4,5,6,7,8,9,10) diff --git a/eo/contrib/irace/expe/beta/irace_files_pO/target-runner b/eo/contrib/irace/expe/beta/irace_files_pO/target-runner new file mode 100755 index 000000000..941322610 --- /dev/null +++ b/eo/contrib/irace/expe/beta/irace_files_pO/target-runner @@ -0,0 +1,88 @@ +#!/bin/bash +############################################################################### +# This script is the command that is executed every run. +# Check the examples in examples/ +# +# This script is run in the execution directory (execDir, --exec-dir). +# +# PARAMETERS: +# $1 is the candidate configuration number +# $2 is the instance ID +# $3 is the seed +# $4 is the instance name +# The rest ($* after `shift 4') are parameters to the run +# +# RETURN VALUE: +# This script should print one numerical value: the cost that must be minimized. +# Exit with 0 if no error, with 1 in case of error +############################################################################### +error() { + echo "`TZ=UTC date`: $0: error: $@" + exit 1 +} + + +EXE="./fastga" +LOG_DIR="irace_logs" + +FIXED_PARAMS="--problem=0" +MAX_EVALS=100 +# +CONFIG_ID=$1 +INSTANCE_ID=$2 +SEED=$3 +INSTANCE=$(echo $4 | sed 's/\//\n/g'|tail -n 1) +CROSSOVER_RATE=$5 +CROSSOVER_SELECTOR=$6 +CROSSOVER=$7 +MUTATION_RATE=$8 +MUT_SELECTOR=$9 +MUTATION=${10} +REPLACEMENT=${11} +shift 11 || error "Not enough parameters" + +INSTANCE_PARAMS=$* + +# STDOUT=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stdout +# STDERR=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stderr +STDOUT="/dev/null" +STDERR="/dev/null" + +if [ ! -x "${EXE}" ]; then + error "${EXE}: not found or not executable (pwd: $(pwd))" +fi + +# If the program just prints a number, we can use 'exec' to avoid +# creating another process, but there can be no other commands after exec. +#exec $EXE ${FIXED_PARAMS} -i $INSTANCE ${INSTANCE_PARAMS} +# exit 1 +# +# Otherwise, save the output to a file, and parse the result from it. +# (If you wish to ignore segmentation faults you can use '{}' around +# the command.) +cmd="$EXE ${FIXED_PARAMS} --instance=${INSTANCE} --seed=${SEED} ${CROSSOVER_RATE} ${CROSSOVER_SELECTOR} ${CROSSOVER} ${MUTATION_RATE} ${MUT_SELECTOR} ${MUTATION} ${REPLACEMENT}" +# NOTE: irace seems to capture both stderr and stdout, so you should not output to stderr +echo ${cmd} > ${STDERR} +$cmd 2> ${STDERR} | tee ${STDOUT} + +# The following code is useless if the binary only output a single number on stdout. + +# This may be used to introduce a delay if there are filesystem +# issues. +# SLEEPTIME=1 +# while [ ! -s "${STDOUT}" ]; do +# sleep $SLEEPTIME +# let "SLEEPTIME += 1" +# done + +# This is an example of reading a number from the output. +# It assumes that the objective value is the first number in +# the first column of the last line of the output. +# if [ -s "${STDOUT}" ]; then +# COST=$(tail -n 1 ${STDOUT} | grep -e '^[[:space:]]*[+-]\?[0-9]' | cut -f1) +# echo "$COST" +# rm -f "${STDOUT}" "${STDERR}" +# exit 0 +# else +# error "${STDOUT}: No such file or directory" +# fi diff --git a/eo/contrib/irace/expe/beta/mwtestU.py b/eo/contrib/irace/expe/beta/mwtestU.py new file mode 100755 index 000000000..00b06ead6 --- /dev/null +++ b/eo/contrib/irace/expe/beta/mwtestU.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +from scipy.stats import mannwhitneyu + +##cmd eg : +# python3 hist_by_2_4_5.py ./fastga_results_all/ ./hist_and_csv/ 100000 1000 + +#get the Mann Whitney test U results between the plan F and plan R +# (change ligne 23 and 44 for other plan, and the maxExp, maxEv for other budget) + +path=sys.argv[1] +figpath=sys.argv[2] #directory to store the data +maxExp=sys.argv[3] +maxEv=sys.argv[4] + +hist_pb=[[] for i in range(19)] +name=[] +randind=-1 +for fastga in os.listdir(path): #ddir : directory of fastga_plan + if(fastga in {"fastga_results_planF"}): + for plan in os.listdir(os.path.join(path,fastga)): + print("maxExp="+str(maxExp)+"_maxEv="+str(maxEv)+"_" in plan,plan,"maxExp="+str(maxExp)+"_maxEv="+str(maxEv)) + #print("maxExp="+str(maxExp)+"_maxEv="+str(maxEv) in plan,plan,"maxExp="+str(maxExp)+"_maxEv="+str(maxEv)) + if("maxExp="+str(maxExp)+"_maxEv="+str(maxEv)+"_" in plan): + name.append("_".join(plan.split("_")[:3])) + for fastgadir in os.listdir(os.path.join(path,fastga,plan,"raw","data")): #fastgadir : directory of 50 runs of a configuration + pb=int(fastgadir.split("_")[0].split("=")[1]) + average_pb=[] + for fname in os.listdir(os.path.join(path,fastga,plan,"raw","data",fastgadir)): + with open(os.path.join(path,fastga,plan,"raw","data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) + average_pb.append(auc) + if(hist_pb[pb]==[]): #first algo + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + + if("random" in fastga): + for randir in os.listdir(os.path.join(path,fastga)): + #eg path: maxEv=100_nbAlgo=15_2021-08-20T1511+0200_results_randoms + if(("maxEv="+str(maxEv)+"_") in randir): + print("maxEv="+str(maxEv) in randir,randir) + name.append(randir.split("_")[0]+"_random") + randind=len(name)-1 + print(randind,name) + for ddir in os.listdir(os.path.join(path,fastga,randir)): #ddir : directory of one run_elites_all or more + if("crossover" in ddir): + for fastgadir in os.listdir(os.path.join(path,fastga,randir,ddir,"data")): #fastgadir : directory of 50 runs of a configuration + average_pb=[] + pb=int(fastgadir.split("_")[0].split("=")[1]) + for fname in os.listdir(os.path.join(path,fastga,randir,ddir,"data",fastgadir)): + with open(os.path.join(path,fastga,randir,ddir,"data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) + average_pb.append(auc) + #print(len(hist_pb[pb]),len(name), pb) + if(hist_pb[pb]==[]): #first algo + #print("entrer random vide") + hist_pb[pb].append(average_pb) + elif(len(hist_pb[pb])!=len(name)): + #print("entrer random !=") + hist_pb[pb].append(average_pb) + else: + hist_pb[pb][len(name)-1]+=average_pb #another algo for the same plan + + +figdir=os.path.join(figpath,"mwtestU_FR") +try: + os.makedirs(figdir) +except FileExistsError: + pass +#colors=['yellow', 'green',"blue","pink","purple","orange","magenta","gray","darkred","cyan","brown","olivedrab","thistle","stateblue"] +print(name) + +filename="mwtestU_maxExp={}_maxEv={}_FR.csv".format(maxExp,maxEv) +with open(os.path.join(figdir,filename),'w+') as csvfile: + csvfile.write(" ,"+",".join(map(str,range(0,19)))+"\n") +meanvalue=[] +pvalue=[] +meanR=[] +meanF=[] +mdianR=[] +mdianF=[] +mdianvalue=[] +iqrR=[] +iqrF=[] +stdR=[] +stdF=[] +iqrvalue=[] +pstd=[] + +for pb in range(19): + #hR,lR,_=plt.hist(hist_pb[pb][randind],bins=10,range=(-1,0),align="mid",label=name) #no label color=colors[:len(name)] + #hF,lF,_=plt.hist(hist_pb[pb][np.abs(1-randind)],bins=10,range=(-1,0),align="mid",label=name) #no label color=colors[:len(name)] + _,pv=mannwhitneyu(hist_pb[pb][np.abs(1-randind)],hist_pb[pb][randind]) + print(_,pv) + #meanvalue.append(np.mean(np.array(hF)*np.array(lF[:len(lF)-1]))-np.mean(np.array(hR)*np.array(lR[:len(lR)-1]))) + pstd.append(np.std(hist_pb[pb][np.abs(1-randind)])-np.std(hist_pb[pb][randind])) + stdF.append(np.std(hist_pb[pb][np.abs(1-randind)])) + stdR.append(np.std(hist_pb[pb][randind])) + meanF.append(np.mean(hist_pb[pb][np.abs(1-randind)])) + meanR.append(np.mean(hist_pb[pb][randind])) + mdianF.append(np.median(hist_pb[pb][np.abs(1-randind)])) + mdianR.append(np.median(hist_pb[pb][randind])) + mdianvalue.append(np.median(hist_pb[pb][np.abs(1-randind)])-np.median(hist_pb[pb][randind])) + meanvalue.append(np.mean(hist_pb[pb][np.abs(1-randind)])-np.mean(hist_pb[pb][randind])) + pvalue.append(pv) + Q1 = np.percentile(hist_pb[pb][np.abs(1-randind)], 25, interpolation = 'midpoint') + # Third quartile (Q3) + Q3 = np.percentile(hist_pb[pb][np.abs(1-randind)], 75, interpolation = 'midpoint') + # Interquaritle range (IQR) + iqrF.append( Q3 - Q1) + Q1 = np.percentile(hist_pb[pb][randind], 25, interpolation = 'midpoint') + # Third quartile (Q3) + Q3 = np.percentile(hist_pb[pb][randind], 75, interpolation = 'midpoint') + # Interquaritle range (IQR) + iqrR.append( Q3 - Q1) + print(_,pv) +iqrvalue=np.array(iqrF)-np.array(iqrR) +with open(os.path.join(figdir,filename),'a') as csvfile: + csvfile.write("mF-mR,"+",".join(map(str,meanvalue))+"\n") + csvfile.write("p_value,"+",".join(map(str,pvalue))+"\n") + csvfile.write("mF,"+",".join(map(str,meanF))+"\n") + csvfile.write("mR,"+",".join(map(str,meanR))+"\n") + csvfile.write("medianF-medianR,"+",".join(map(str,mdianvalue))+"\n") + csvfile.write("medianF,"+",".join(map(str,mdianF))+"\n") + csvfile.write("medianR,"+",".join(map(str,mdianR))+"\n") + csvfile.write("stdF-stdR,"+",".join(map(str,mdianvalue))+"\n") + csvfile.write("stdF,"+",".join(map(str,stdF))+"\n") + csvfile.write("stdR,"+",".join(map(str,stdR))+"\n") + csvfile.write("iqrF,"+",".join(map(str,iqrF))+"\n") + csvfile.write("iqrR,"+",".join(map(str,iqrR))+"\n") + csvfile.write("iqrF-iqrR,"+",".join(map(str,iqrvalue))+"\n") + + \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/parseO_irace_bests.py b/eo/contrib/irace/expe/beta/parseO_irace_bests.py new file mode 100755 index 000000000..c1811acdf --- /dev/null +++ b/eo/contrib/irace/expe/beta/parseO_irace_bests.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +#parse data1 +import os +import re +import sys +#print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement") #plan1 +print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement") + + +#give the path of one experiment +argv=sys.argv[1] +for datadir in os.listdir(argv): + #if(os.path.isdir(os.path.join(argv,datadir))): check if argv/datadir is a directory + if(datadir.find("results_irace")>=0): #check if the directory is one JOB + for pb_dir in os.listdir(os.path.join(argv,datadir)): + if "results_problem" in pb_dir: + pb_id=pb_dir.replace("results_problem_","") + with open(os.path.join("./",argv,datadir,pb_dir,"irace.log")) as fd: + data = fd.readlines() + + # Find the last best configuration + bests = [line.strip() for line in data if "Best-so-far" in line] + #print(datadir,bests) + 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 + algo = re.sub("\-\-\S*=", ",", configs[0]) + csv_line = pb_id + "," + best_perf + "," + algo + print(csv_line.replace(" ","")) diff --git a/eo/contrib/irace/expe/beta/parse_auc_average.py b/eo/contrib/irace/expe/beta/parse_auc_average.py new file mode 100755 index 000000000..b2d20dbd3 --- /dev/null +++ b/eo/contrib/irace/expe/beta/parse_auc_average.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt + +#get the auc average values of one experiment +figdir=sys.argv[1] # directory of a result of one experiment +#eg : ./fastga_results_all/fastga_results_planO/planO_maxExp\=100000_maxEv\=5n_2021-08-13T19\:04+02\:00_results_elites_all/raw + +if("fastga_results_plan" in figdir): + print("FID,",",".join(map(str,range(1,16)))) + aucs=[[] for i in range(19)] + for fastgadir in os.listdir(os.path.join(figdir,"raw/data")): #fastgadir : directory of 50 runs of an elite configuration + #cum=np.cumsum([0.1]*10) + average=[] + for fname in os.listdir(os.path.join(figdir,"raw/data",fastgadir)): + with open(os.path.join(figdir,"raw/data",fastgadir,fname)) as fd: + auc = float(fd.readlines()[0]) * -1 + average.append(auc) + aucs[int(fastgadir.split("_")[0].split("=")[1])].append(average) + #print(np.shape(aucs)) + + + + for i in range(19): + print(str(i)+",",",".join(map(str,np.mean(aucs[i],1)))) + + + + + + + diff --git a/eo/contrib/irace/expe/beta/planA/riaA.sh b/eo/contrib/irace/expe/beta/planA/riaA.sh index c28359626..0653a3358 100755 --- a/eo/contrib/irace/expe/beta/planA/riaA.sh +++ b/eo/contrib/irace/expe/beta/planA/riaA.sh @@ -14,7 +14,7 @@ outdir="${dir}/dataA_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)" mkdir -p ${outdir} for r in $(seq 2); do echo "Run $r/15"; - cmd="qsub -N iraceA_maxEv_${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planA/r_iA.sh ${outdir} ${r} ${mexp} ${mevals} ${myhome}" + cmd="qsub -N iraceA_maxEv_${r} -q beta -l select=1:ncpus=1 -l walltime=00:25:00 -- ${scratchpath}/planA/r_iA.sh ${outdir} ${r} ${mexp} ${mevals} ${myhome}" #cmd="bash ./r_iA_buckets.sh ${outdir} ${r} ${mexp} ${mevals}" echo $cmd time -p $cmd diff --git a/eo/contrib/irace/expe/beta/planF/riaF.sh b/eo/contrib/irace/expe/beta/planF/riaF.sh index 5791a1a1d..e400f152a 100755 --- a/eo/contrib/irace/expe/beta/planF/riaF.sh +++ b/eo/contrib/irace/expe/beta/planF/riaF.sh @@ -15,7 +15,7 @@ for r in $(seq 2); do echo "Run $r/15"; #date -Iseconds #cmd="qsub -N irace_${runs}_${buckets}" -q beta -l select=1:ncpus=1 -l walltime=00:04:00 --${HOME}/run_irace.sh ${dir} - cmd="qsub -N iraceF_${mevals}_run=${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planF/r_iF.sh ${dir} ${r} ${mexp} ${mevals} ${myhome}" + cmd="qsub -N iraceF_${mevals}_run=${r} -q beta -l select=1:ncpus=1 -l walltime=00:25:00 -- ${scratchpath}/planF/r_iF.sh ${dir} ${r} ${mexp} ${mevals} ${myhome}" #time -p bash ${HOME}/plan2/run_irace2.sh ${dir} ${r} &> ${dir}/erreur_${r}.txt #bash ${HOME}/test/r_i.sh echo $cmd diff --git a/eo/contrib/irace/expe/beta/planO/r_iO.sh b/eo/contrib/irace/expe/beta/planO/r_iO.sh new file mode 100755 index 000000000..b69a18941 --- /dev/null +++ b/eo/contrib/irace/expe/beta/planO/r_iO.sh @@ -0,0 +1,43 @@ +#!/bin/bash +#run once each problem + +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 +module load R + +dir=$1 +run=$2 +budget_irace=$3 +buckets=$4 +myhome=$5 + +cp -r ${myhome}/R . +cp -r ${myhome}/irace_files_pO . + +outdir="${run}_$(date --iso-8601=seconds)_results_irace" +echo "start a job $(date -Iseconds)" + +for pb in $(seq 0 18) ; do + echo "Problem ${pb}... " + res="results_problem_${pb}" + mkdir -p ${dir}/${outdir}/${res} + # Fore some reason, irace absolutely need those files... + cp ${myhome}/code/paradiseo/eo/contrib/irace/release/fastga ${dir}/${outdir}/${res} + + cat ./irace_files_pO/example.scen | sed "s%\".%\"${dir}/${outdir}/${res}%g" | sed "s/maxExperiments = 0/maxExperiments=${budget_irace}/" > ${dir}/${outdir}/${res}/example.scen + cp ./irace_files_pO/default.instances ${dir}/${outdir}/${res} + cp ./irace_files_pO/fastga.param ${dir}/${outdir}/${res} + cat ./irace_files_pO/target-runner | sed "s/--problem=0/--problem=${pb}/" > ${dir}/${outdir}/${res}/target-runner + chmod u+x ${dir}/${outdir}/${res}/target-runner + + echo "---start $(date)" + time -p ./R/x86_64-pc-linux-gnu-library/3.6/irace/bin/irace --scenario ${dir}/${outdir}/${res}/example.scen > ${dir}/${outdir}/${res}/irace.log + echo "---end $(date)" + + echo "done run : ${run} pb : ${pb}" + date -Iseconds +done + +echo "end a job $(date -Iseconds)---------------------" + diff --git a/eo/contrib/irace/expe/beta/planO/riaO.sh b/eo/contrib/irace/expe/beta/planO/riaO.sh new file mode 100755 index 000000000..76e7d822e --- /dev/null +++ b/eo/contrib/irace/expe/beta/planO/riaO.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +date -Iseconds +echo "STARTS" +myhome=$1 +scratchpath=$2 +mexp=$3 +mevals=$4 +name="dataO_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)" +dir=${scratchpath}/dataFAR/dataO/${name} +mkdir -p ${dir} + +for r in $(seq 2); do + echo "Run $r/15"; + cmd="qsub -N iraceO_maxExp=${exp}_maxEv=${evals}_${r} -q beta -l select=1:ncpus=1 -l walltime=00:10:00 -- ${scratchpath}/planO/r_iO.sh ${dir} ${r} ${mexp} ${mevals} ${myhome}" + echo $cmd + $cmd + #time (p=2; while [[ ${p} > 1 ]] ; do p=$(qqueue -u $USER | wc -l); echo "$r: $p"; sleep 300; done) +done + +#echo "DONE" +#date -Iseconds + diff --git a/eo/contrib/irace/expe/beta/readme.txt b/eo/contrib/irace/expe/beta/readme.txt index 6d53b7d90..85e30d5af 100755 --- a/eo/contrib/irace/expe/beta/readme.txt +++ b/eo/contrib/irace/expe/beta/readme.txt @@ -1,13 +1,21 @@ +############################################ +#Explanation of the experimental plans and the validation runs + +############################################ 1. INTRODUCTION The aim of all the scripts is to make the experimental plans for Algorithm Configuration for Genetic Algorithms by using a fully modular benchmarking pipeline design of this article https://arxiv.org/abs/2102.06435 . +You can upload the data in : https://zenodo.org/record/5479538#.YTaT0Bnis2w + Plan A is an experimental plan for finding an efficient algorithm for all the functions that we consider. Plan F is an experimental plan for finding an efficient algorithm for each function that we consider. Plan R is an experimental plan for getting random algorithms. +Plan O is the reproduction of the experimental plan of the article. + 2. VOCABULARIES * maxExp : means maximum Experiments, the budget for irace @@ -20,18 +28,18 @@ dataA is a directory which we store all the runs of an experiment plan for sever eg : /dataA/planA_maxExp=*_maxEv=**_$(data), * is a value of maxExp, and ** is a value of maxEv -*fastga_results_all : directory which we store all the data for validation runs. It constains only 3 subdirectories (fastga_results_planF, fastga_results_planA, fastga_results_random), created by running run_exp.sh +*fastga_results_all : directory which we store all the data for validation runs. It constains only 3 subdirectories (fastga_results_planF, fastga_results_planA, fastga_results_planO, fastga_results_random), created by running run_exp.sh -* fastga_results_planF, fastga_results_planA, fastga_results_random +* fastga_results_planF, fastga_results_planA, fastga_results_random, fastga_results_planO Each directory store the data for validation runs of each experiment plan. fastga_random directory are created by running run_exp.sh -fastga_results_planF and fastag_results_planA are created only after you have data in the dataA or dataF directories. +fastga_results_planF, fastag_results_planO and fastag_results_planA are created only after you have data in the dataA or dataF or dataO directories. -* planA_*, planF_* -If the planA_* or planF_* are in the dataFAR directory, the directory contains the data of experimental plan. This means that each plan contains the result of 15 runs of irace stored in irace.log file, and the data are provided by run_exp.sh. +* planA_*, planF_*, planO_* +If the planA_* or planF_* or planO_* are in the dataFAR directory, the directory contains the data of experimental plan. This means that each plan contains the result of 15 runs of irace stored in irace.log file, and the data are provided by run_exp.sh. -If the planA_* or planF_* directories are in the fastga_results_planA or fastga_results_planF, these directories contain the data of 50 validation runs by running all the best algorithms of each plan stores in dataFAR. The data are provided by running run_res.sh +If the planA_* or planF_* or planO_* directories are in the fastga_results_planA or fastga_results_planF, these directories contain the data of 50 validation runs by running all the best algorithms of each plan stores in dataFAR. The data are provided by running run_res.sh *fastag_all_results : contains the directories of the validation run data. @@ -57,9 +65,9 @@ The directory which you load all the scripts contains : * python files : -parseA_irace_bests.py : for parsing the irace.log file of each data provided by running irace. By giving a bounch of directories of one experiment - -parseF_irace_bests.py + -parseF_irace_bests.py : for the plan plan F and plan O(in the plan O csv, there are label offspringsize and popsize, but there are not values) - * 4 directories : + * 6 directories : -irace_files_pA : -default.instances -example.scen @@ -74,6 +82,12 @@ The directory which you load all the scripts contains : -forbidden.txt -target-runner + -irace_files_pO : + -default.instances : + -example.scen + -fastga.param + -target-runner + -planA : -riaA.sh : for running 15 times r_iA.sh file by submitting to the mesu cluster -r_iA.sh : for running irace for all the problems @@ -81,11 +95,14 @@ The directory which you load all the scripts contains : -planF : -riaF.sh : for running 15 times r_iF.sh file by submitting to the mesu cluster -r_iF.sh : for running irace for each problem we considered + -planO : + -riaO.sh : for running 15 times r_iO.sh file by submitting to the mesu cluster + -r_iO.sh : for running irace for each problem we considered The directories planA, planF contain the scripts to run one experiment of Plan A and Plan F. -The directories irace_files_pA and irace_files_pA contain the scripts needing for calling irace for one experiment of Plan A and Plan F. [Look at the irace package : User Guide for more information] +The directories irace_files_pA, irace_files_pO and irace_files_pF contain the scripts needing for calling irace for one experiment of Plan A, Plan O and Plan F. [Look at the irace package : User Guide for more information] 5. CONCLUSION @@ -97,5 +114,54 @@ Warning : run_exp.sh may take few days or few weeks depending on the Budget you +############################################ +#Scripts for getting histograms and csv files of validation runs results. + +############################################ + +get histograms or csv files for random data : +-hist_join_random.py : get one histogram for a plan by budget +-dist_op_random.py : get csv files of the distribution of operators by problems + +get histograms or csv files for plan O,F,A : +-hist_join.py +-dist_op_all.py +-parse_auc_average # get the mean auc value of each problem and each irace run + +get histograms for plan F, A , R, O +-hist_by_pb_budget_plan.py : get histograms by problem +-hist_by_FARO_pb.py : +-hist_by_FARO.py +-best_out_of_elites.py : get the best algorithm found among 15 runs of irace, for a plan +files to call all these files : +-csv_all.sh : get all the csv files (average of auc, best out ..), call best_out_of_elites.py, parse_auc_average.py, dist_op_*.py +-hist_all.sh : get all the histograms, call each hist_*.py file + +file for other goal : +-mwtestU.py ; csv file for selected problems which irace algorithms gave better performances than random algorithms +-rep_std_mean_selected.py : to get the std, mean and the distribution of operators of the selected problems + + + + + +############################################ +#Summary + +############################################ + +Get the experiment data : +run : bash run_exp.sh + +-----------Only after you have the experiment data: +Get the validation run data : +run : bash run_res.sh + +Get histograms : +run : bash hist_all.sh + +Get csv files of validation run data : +run : bash csv_all.sh + diff --git a/eo/contrib/irace/expe/beta/rep_std_mean_selected.py b/eo/contrib/irace/expe/beta/rep_std_mean_selected.py new file mode 100755 index 000000000..1add3e9ab --- /dev/null +++ b/eo/contrib/irace/expe/beta/rep_std_mean_selected.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +import sys +import os +import numpy as np +import matplotlib.pyplot as plt +import pandas + +#eg : python3 ./rep_std_mean_selected.py ./hist_and_csv/distribution_op_fastga_results_planF +#get the std of the selected problem +path=sys.argv[1] # directory of each distribution by pb +lpb={13,14,15,16,18} #set of pb selected +#column : [operator : nbpossibilities] +distdir=path+"/rep_std_mean" +try: + os.makedirs(distdir) +except FileExistsError: + pass + +res=[] +for csvfile in os.listdir(os.path.join(path)): + if(int(csvfile.split("_")[1].split("=")[1]) in lpb): + print(csvfile) + res.append(pandas.read_csv(os.path.join(path,csvfile))) + +#assert(len(res[0])==len(res[1]) , "each csv file does not have the same line " #check if the number of param is eq in each csv file + + +name ="std_rep_pb={}".format(str(lpb))+"".join(map(str,path.split("/")[-3].split("_")[:3]))+".csv" +with open(os.path.join(distdir,name),'w+') as fd: + fd.write("Op index, "+",".join(map(str,range(0,11)))+"\n") +globalname="rep_all_pb={}".format(str(lpb))+"".join(map(str,path.split("/")[-3].split("_")[:3]))+".csv" +with open(os.path.join(distdir,globalname),'w+') as fd: + fd.write("Op index, "+",".join(map(str,range(0,11)))+"\n") +meanname="mean_rep_pb={}".format(str(lpb))+"".join(map(str,path.split("/")[-3].split("_")[:3]))+".csv" +with open(os.path.join(distdir,meanname),'w+') as fd: + fd.write("Op index, "+",".join(map(str,range(0,11)))+"\n") +#print(res) +limparam=[10,7,10,10,7,11,11,10,10] +for i in range(1,10): #9 nb parameters + npval=np.zeros((len(res),limparam[i-1]),dtype=int) + for pb in range(len(res)): + print(i,np.array(np.array(res[pb][i-1:i])[0]),np.array(np.array(res[pb][i-1:i])[0][1:limparam[i-1]+1])) + npval[pb,:]=np.array(np.array(res[pb][i-1:i])[0][1:limparam[i-1]+1],dtype=int) + nameparam=np.array(res[pb][i-1:i])[0][0] + line= ",".join(map(str,np.std(npval,0)))+",-"*(11-limparam[i-1]) + print("ligne ",line) + + with open(os.path.join(distdir,name),'a') as fd: + fd.write(nameparam+","+line+"\n") + line= ",".join(map(str,np.sum(npval,0)))+",-"*(11-limparam[i-1]) + with open(os.path.join(distdir,globalname),'a') as fd: + fd.write(nameparam+","+line+"\n") + line= ",".join(map(str,np.mean(npval,0)))+",-"*(11-limparam[i-1]) + with open(os.path.join(distdir,meanname),'a') as fd: + fd.write(nameparam+","+line+"\n") \ No newline at end of file diff --git a/eo/contrib/irace/expe/beta/run_elites_planO.sh b/eo/contrib/irace/expe/beta/run_elites_planO.sh new file mode 100755 index 000000000..8f93293c4 --- /dev/null +++ b/eo/contrib/irace/expe/beta/run_elites_planO.sh @@ -0,0 +1,64 @@ +#!/bin/bash +#instance = seed + +. /etc/profile.d/modules.sh +export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI +module load LLVM/clang-llvm-10.0 + + + + +csv_file=$1 #contains all the configs of all the problems of one experiments +mexp=$2 +mevals=$3 +path=$4 + +echo "-----------------Start $(date -Iseconds) " +# Number of runs (=seeds). +runs=50 + +# You most probably want to run on release builds. +exe="/home/${USER}/fastga" + +outdir="${path}/planO_maxExp=${mexp}_maxEv=${mevals}_$(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 ${csv_file}| sed 1,1d ); do + a=($(echo $line | sed "s/,/ /g")) + algo="--crossover-rate=${a[3]} --cross-selector=${a[4]} --crossover=${a[5]} --mutation-rate=${a[6]} --mut-selector=${a[7]} --mutation=${a[8]} --replacement=${a[9]}" + + #perc=$(echo "scale=3;${n}/(285)*100.0" | bc) + #echo "${perc}% : algo ${algoid}/285" + # echo -n "Runs: " + name_dir="pb=${a[0]}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + mkdir -p ${outdir}/raw/data/${name_dir} + mkdir -p ${outdir}/raw/logs/${name_dir} + 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}" + cmd="${exe} --problem=${a[0]} --seed=${seed} --instance=${seed} ${algo}" + #echo ${cmd} # Print the command. + # Forge a directory/log file name + # (remove double dashs and replace spaces with underscore). + name_run="pb=${a[0]}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')" + # echo $name_run + # Actually start the command. + ${cmd} > "${outdir}/raw/data/${name_dir}/${name_run}.dat" 2> "${outdir}/raw/logs/${name_dir}/${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 + + n=$(($n+1)) + algoid=$(($algoid+1)) +done + +# Move IOH logs in the results directory. +#mv ./FastGA_* ${outdir} + +echo "Done $(date) -----------------------" +date diff --git a/eo/contrib/irace/expe/beta/run_exp.sh b/eo/contrib/irace/expe/beta/run_exp.sh index c3669a1c7..44630176c 100644 --- a/eo/contrib/irace/expe/beta/run_exp.sh +++ b/eo/contrib/irace/expe/beta/run_exp.sh @@ -1,11 +1,12 @@ #!/bin/bash -lexp=(300 600 1000 10000) -levals=(100 500 1000) +lexp=(300 600) +levals=(100 500) myscratchpath=/scratchbeta/$USER myhome=${HOME} for exp in ${lexp[@]} ; do for evals in ${levals[@]} ; do bash ./planF/riaF.sh ${myhome} ${myscratchpath} ${exp} ${evals} + bash ./planO/riaO.sh ${myhome} ${myscratchpath} ${exp} ${evals} bash ./planA/riaA.sh ${myhome} ${myscratchpath} ${exp} ${evals} done done diff --git a/eo/contrib/irace/expe/beta/run_res.sh b/eo/contrib/irace/expe/beta/run_res.sh index de5b352ad..b3579863a 100644 --- a/eo/contrib/irace/expe/beta/run_res.sh +++ b/eo/contrib/irace/expe/beta/run_res.sh @@ -14,7 +14,7 @@ done #get validation run of each config -dir=/scratchbeta/$USER/csv_FA +dir=/scratchbeta/$USER/csv_FAO listdir=$(echo $(ls ${dir})) echo ${listdir[@]} for csvdir in ${listdir[@]} ; do From f89bad4aec673a798194d99517fe5ea48ae625c6 Mon Sep 17 00:00:00 2001 From: GMYS Jan Date: Wed, 29 Sep 2021 08:39:18 +0000 Subject: [PATCH 015/113] Add LICENSE --- LICENSE | 1018 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1018 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..b7f1e4658 --- /dev/null +++ b/LICENSE @@ -0,0 +1,1018 @@ +CeCILL FREE SOFTWARE LICENSE AGREEMENT + + Notice + +This Agreement is a Free Software license agreement that is the result +of discussions between its authors in order to ensure compliance with +the two main principles guiding its drafting: + + * firstly, compliance with the principles governing the distribution + of Free Software: access to source code, broad rights granted to + users, + * secondly, the election of a governing law, French law, with which + it is conformant, both as regards the law of torts and + intellectual property law, and the protection that it offers to + both authors and holders of the economic rights over software. + +The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) +license are: + +Commissariat à l'Energie Atomique - CEA, a public scientific, technical +and industrial research establishment, having its principal place of +business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. + +Centre National de la Recherche Scientifique - CNRS, a public scientific +and technological establishment, having its principal place of business +at 3 rue Michel-Ange, 75794 Paris cedex 16, France. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, a public scientific and technological establishment, having its +principal place of business at Domaine de Voluceau, Rocquencourt, BP +105, 78153 Le Chesnay cedex, France. + + + Preamble + +The purpose of this Free Software license agreement is to grant users +the right to modify and redistribute the software governed by this +license within the framework of an open source distribution model. + +The exercising of these rights is conditional upon certain obligations +for users so as to preserve this status for all subsequent redistributions. + +In consideration of access to the source code and the rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors only have limited liability. + +In this respect, the risks associated with loading, using, modifying +and/or developing or reproducing the software by the user are brought to +the user's attention, given its Free Software status, which may make it +complicated to use, with the result that its use is reserved for +developers and experienced professionals having in-depth computer +knowledge. Users are therefore encouraged to load and test the +suitability of the software as regards their requirements in conditions +enabling the security of their systems and/or data to be ensured and, +more generally, to use and operate it in the same conditions of +security. This Agreement may be freely reproduced and published, +provided it is not altered, and that no provisions are either added or +removed herefrom. + +This Agreement may apply to any or all software for which the holder of +the economic rights decides to submit the use thereof to its provisions. + + + Article 1 - DEFINITIONS + +For the purpose of this Agreement, when the following expressions +commence with a capital letter, they shall have the following meaning: + +Agreement: means this license agreement, and its possible subsequent +versions and annexes. + +Software: means the software in its Object Code and/or Source Code form +and, where applicable, its documentation, "as is" when the Licensee +accepts the Agreement. + +Initial Software: means the Software in its Source Code and possibly its +Object Code form and, where applicable, its documentation, "as is" when +it is first distributed under the terms and conditions of the Agreement. + +Modified Software: means the Software modified by at least one +Contribution. + +Source Code: means all the Software's instructions and program lines to +which access is required so as to modify the Software. + +Object Code: means the binary files originating from the compilation of +the Source Code. + +Holder: means the holder(s) of the economic rights over the Initial +Software. + +Licensee: means the Software user(s) having accepted the Agreement. + +Contributor: means a Licensee having made at least one Contribution. + +Licensor: means the Holder, or any other individual or legal entity, who +distributes the Software under the Agreement. + +Contribution: means any or all modifications, corrections, translations, +adaptations and/or new functions integrated into the Software by any or +all Contributors, as well as any or all Internal Modules. + +Module: means a set of sources files including their documentation that +enables supplementary functions or services in addition to those offered +by the Software. + +External Module: means any or all Modules, not derived from the +Software, so that this Module and the Software run in separate address +spaces, with one calling the other when they are run. + +Internal Module: means any or all Module, connected to the Software so +that they both execute in the same address space. + +GNU GPL: means the GNU General Public License version 2 or any +subsequent version, as published by the Free Software Foundation Inc. + +Parties: mean both the Licensee and the Licensor. + +These expressions may be used both in singular and plural form. + + + Article 2 - PURPOSE + +The purpose of the Agreement is the grant by the Licensor to the +Licensee of a non-exclusive, transferable and worldwide license for the +Software as set forth in Article 5 hereinafter for the whole term of the +protection granted by the rights over said Software. + + + Article 3 - ACCEPTANCE + +3.1 The Licensee shall be deemed as having accepted the terms and +conditions of this Agreement upon the occurrence of the first of the +following events: + + * (i) loading the Software by any or all means, notably, by + downloading from a remote server, or by loading from a physical + medium; + * (ii) the first time the Licensee exercises any of the rights + granted hereunder. + +3.2 One copy of the Agreement, containing a notice relating to the +characteristics of the Software, to the limited warranty, and to the +fact that its use is restricted to experienced users has been provided +to the Licensee prior to its acceptance as set forth in Article 3.1 +hereinabove, and the Licensee hereby acknowledges that it has read and +understood it. + + + Article 4 - EFFECTIVE DATE AND TERM + + + 4.1 EFFECTIVE DATE + +The Agreement shall become effective on the date when it is accepted by +the Licensee as set forth in Article 3.1. + + + 4.2 TERM + +The Agreement shall remain in force for the entire legal term of +protection of the economic rights over the Software. + + + Article 5 - SCOPE OF RIGHTS GRANTED + +The Licensor hereby grants to the Licensee, who accepts, the following +rights over the Software for any or all use, and for the term of the +Agreement, on the basis of the terms and conditions set forth hereinafter. + +Besides, if the Licensor owns or comes to own one or more patents +protecting all or part of the functions of the Software or of its +components, the Licensor undertakes not to enforce the rights granted by +these patents against successive Licensees using, exploiting or +modifying the Software. If these patents are transferred, the Licensor +undertakes to have the transferees subscribe to the obligations set +forth in this paragraph. + + + 5.1 RIGHT OF USE + +The Licensee is authorized to use the Software, without any limitation +as to its fields of application, with it being hereinafter specified +that this comprises: + + 1. permanent or temporary reproduction of all or part of the Software + by any or all means and in any or all form. + + 2. loading, displaying, running, or storing the Software on any or + all medium. + + 3. entitlement to observe, study or test its operation so as to + determine the ideas and principles behind any or all constituent + elements of said Software. This shall apply when the Licensee + carries out any or all loading, displaying, running, transmission + or storage operation as regards the Software, that it is entitled + to carry out hereunder. + + + 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS + +The right to make Contributions includes the right to translate, adapt, +arrange, or make any or all modifications to the Software, and the right +to reproduce the resulting software. + +The Licensee is authorized to make any or all Contributions to the +Software provided that it includes an explicit notice that it is the +author of said Contribution and indicates the date of the creation thereof. + + + 5.3 RIGHT OF DISTRIBUTION + +In particular, the right of distribution includes the right to publish, +transmit and communicate the Software to the general public on any or +all medium, and by any or all means, and the right to market, either in +consideration of a fee, or free of charge, one or more copies of the +Software by any means. + +The Licensee is further authorized to distribute copies of the modified +or unmodified Software to third parties according to the terms and +conditions set forth hereinafter. + + + 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION + +The Licensee is authorized to distribute true copies of the Software in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Software is +redistributed, the Licensee allows future Licensees unhindered access to +the full Source Code of the Software by indicating how to access it, it +being understood that the additional cost of acquiring the Source Code +shall not exceed the cost of transferring the data. + + + 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE + +When the Licensee makes a Contribution to the Software, the terms and +conditions for the distribution of the resulting Modified Software +become subject to all the provisions of this Agreement. + +The Licensee is authorized to distribute the Modified Software, in +source code or object code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the object code of the Modified +Software is redistributed, the Licensee allows future Licensees +unhindered access to the full source code of the Modified Software by +indicating how to access it, it being understood that the additional +cost of acquiring the source code shall not exceed the cost of +transferring the data. + + + 5.3.3 DISTRIBUTION OF EXTERNAL MODULES + +When the Licensee has developed an External Module, the terms and +conditions of this Agreement do not apply to said External Module, that +may be distributed under a separate license agreement. + + + 5.3.4 COMPATIBILITY WITH THE GNU GPL + +The Licensee can include a code that is subject to the provisions of one +of the versions of the GNU GPL in the Modified or unmodified Software, +and distribute that entire code under the terms of the same version of +the GNU GPL. + +The Licensee can include the Modified or unmodified Software in a code +that is subject to the provisions of one of the versions of the GNU GPL, +and distribute that entire code under the terms of the same version of +the GNU GPL. + + + Article 6 - INTELLECTUAL PROPERTY + + + 6.1 OVER THE INITIAL SOFTWARE + +The Holder owns the economic rights over the Initial Software. Any or +all use of the Initial Software is subject to compliance with the terms +and conditions under which the Holder has elected to distribute its work +and no one shall be entitled to modify the terms and conditions for the +distribution of said Initial Software. + +The Holder undertakes that the Initial Software will remain ruled at +least by this Agreement, for the duration set forth in Article 4.2. + + + 6.2 OVER THE CONTRIBUTIONS + +The Licensee who develops a Contribution is the owner of the +intellectual property rights over this Contribution as defined by +applicable law. + + + 6.3 OVER THE EXTERNAL MODULES + +The Licensee who develops an External Module is the owner of the +intellectual property rights over this External Module as defined by +applicable law and is free to choose the type of agreement that shall +govern its distribution. + + + 6.4 JOINT PROVISIONS + +The Licensee expressly undertakes: + + 1. not to remove, or modify, in any manner, the intellectual property + notices attached to the Software; + + 2. to reproduce said notices, in an identical manner, in the copies + of the Software modified or not. + +The Licensee undertakes not to directly or indirectly infringe the +intellectual property rights of the Holder and/or Contributors on the +Software and to take, where applicable, vis-à-vis its staff, any and all +measures required to ensure respect of said intellectual property rights +of the Holder and/or Contributors. + + + Article 7 - RELATED SERVICES + +7.1 Under no circumstances shall the Agreement oblige the Licensor to +provide technical assistance or maintenance services for the Software. + +However, the Licensor is entitled to offer this type of services. The +terms and conditions of such technical assistance, and/or such +maintenance, shall be set forth in a separate instrument. Only the +Licensor offering said maintenance and/or technical assistance services +shall incur liability therefor. + +7.2 Similarly, any Licensor is entitled to offer to its licensees, under +its sole responsibility, a warranty, that shall only be binding upon +itself, for the redistribution of the Software and/or the Modified +Software, under terms and conditions that it is free to decide. Said +warranty, and the financial terms and conditions of its application, +shall be subject of a separate instrument executed between the Licensor +and the Licensee. + + + Article 8 - LIABILITY + +8.1 Subject to the provisions of Article 8.2, the Licensee shall be +entitled to claim compensation for any direct loss it may have suffered +from the Software as a result of a fault on the part of the relevant +Licensor, subject to providing evidence thereof. + +8.2 The Licensor's liability is limited to the commitments made under +this Agreement and shall not be incurred as a result of in particular: +(i) loss due the Licensee's total or partial failure to fulfill its +obligations, (ii) direct or consequential loss that is suffered by the +Licensee due to the use or performance of the Software, and (iii) more +generally, any consequential loss. In particular the Parties expressly +agree that any or all pecuniary or business loss (i.e. loss of data, +loss of profits, operating loss, loss of customers or orders, +opportunity cost, any disturbance to business activities) or any or all +legal proceedings instituted against the Licensee by a third party, +shall constitute consequential loss and shall not provide entitlement to +any or all compensation from the Licensor. + + + Article 9 - WARRANTY + +9.1 The Licensee acknowledges that the scientific and technical +state-of-the-art when the Software was distributed did not enable all +possible uses to be tested and verified, nor for the presence of +possible defects to be detected. In this respect, the Licensee's +attention has been drawn to the risks associated with loading, using, +modifying and/or developing and reproducing the Software which are +reserved for experienced users. + +The Licensee shall be responsible for verifying, by any or all means, +the suitability of the product for its requirements, its good working +order, and for ensuring that it shall not cause damage to either persons +or properties. + +9.2 The Licensor hereby represents, in good faith, that it is entitled +to grant all the rights over the Software (including in particular the +rights set forth in Article 5). + +9.3 The Licensee acknowledges that the Software is supplied "as is" by +the Licensor without any other express or tacit warranty, other than +that provided for in Article 9.2 and, in particular, without any warranty +as to its commercial value, its secured, safe, innovative or relevant +nature. + +Specifically, the Licensor does not warrant that the Software is free +from any error, that it will operate without interruption, that it will +be compatible with the Licensee's own equipment and software +configuration, nor that it will meet the Licensee's requirements. + +9.4 The Licensor does not either expressly or tacitly warrant that the +Software does not infringe any third party intellectual property right +relating to a patent, software or any other property right. Therefore, +the Licensor disclaims any and all liability towards the Licensee +arising out of any or all proceedings for infringement that may be +instituted in respect of the use, modification and redistribution of the +Software. Nevertheless, should such proceedings be instituted against +the Licensee, the Licensor shall provide it with technical and legal +assistance for its defense. Such technical and legal assistance shall be +decided on a case-by-case basis between the relevant Licensor and the +Licensee pursuant to a memorandum of understanding. The Licensor +disclaims any and all liability as regards the Licensee's use of the +name of the Software. No warranty is given as regards the existence of +prior rights over the name of the Software or as regards the existence +of a trademark. + + + Article 10 - TERMINATION + +10.1 In the event of a breach by the Licensee of its obligations +hereunder, the Licensor may automatically terminate this Agreement +thirty (30) days after notice has been sent to the Licensee and has +remained ineffective. + +10.2 A Licensee whose Agreement is terminated shall no longer be +authorized to use, modify or distribute the Software. However, any +licenses that it may have granted prior to termination of the Agreement +shall remain valid subject to their having been granted in compliance +with the terms and conditions hereof. + + + Article 11 - MISCELLANEOUS + + + 11.1 EXCUSABLE EVENTS + +Neither Party shall be liable for any or all delay, or failure to +perform the Agreement, that may be attributable to an event of force +majeure, an act of God or an outside cause, such as defective +functioning or interruptions of the electricity or telecommunications +networks, network paralysis following a virus attack, intervention by +government authorities, natural disasters, water damage, earthquakes, +fire, explosions, strikes and labor unrest, war, etc. + +11.2 Any failure by either Party, on one or more occasions, to invoke +one or more of the provisions hereof, shall under no circumstances be +interpreted as being a waiver by the interested Party of its right to +invoke said provision(s) subsequently. + +11.3 The Agreement cancels and replaces any or all previous agreements, +whether written or oral, between the Parties and having the same +purpose, and constitutes the entirety of the agreement between said +Parties concerning said purpose. No supplement or modification to the +terms and conditions hereof shall be effective as between the Parties +unless it is made in writing and signed by their duly authorized +representatives. + +11.4 In the event that one or more of the provisions hereof were to +conflict with a current or future applicable act or legislative text, +said act or legislative text shall prevail, and the Parties shall make +the necessary amendments so as to comply with said act or legislative +text. All other provisions shall remain effective. Similarly, invalidity +of a provision of the Agreement, for any reason whatsoever, shall not +cause the Agreement as a whole to be invalid. + + + 11.5 LANGUAGE + +The Agreement is drafted in both French and English and both versions +are deemed authentic. + + + Article 12 - NEW VERSIONS OF THE AGREEMENT + +12.1 Any person is authorized to duplicate and distribute copies of this +Agreement. + +12.2 So as to ensure coherence, the wording of this Agreement is +protected and may only be modified by the authors of the License, who +reserve the right to periodically publish updates or new versions of the +Agreement, each with a separate number. These subsequent versions may +address new issues encountered by Free Software. + +12.3 Any Software distributed under a given version of the Agreement may +only be subsequently distributed under the same version of the Agreement +or a subsequent version, subject to the provisions of Article 5.3.4. + + + Article 13 - GOVERNING LAW AND JURISDICTION + +13.1 The Agreement is governed by French law. The Parties agree to +endeavor to seek an amicable solution to any disagreements or disputes +that may arise during the performance of the Agreement. + +13.2 Failing an amicable solution within two (2) months as from their +occurrence, and unless emergency proceedings are necessary, the +disagreements or disputes shall be referred to the Paris Courts having +jurisdiction, by the more diligent Party. + + +Version 2.0 dated 2006-09-05. + +------------------------------------------------------------------------------ + +CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL + + + Avertissement + +Ce contrat est une licence de logiciel libre issue d'une concertation +entre ses auteurs afin que le respect de deux grands principes préside à +sa rédaction: + + * d'une part, le respect des principes de diffusion des logiciels + libres: accès au code source, droits étendus conférés aux + utilisateurs, + * d'autre part, la désignation d'un droit applicable, le droit + français, auquel elle est conforme, tant au regard du droit de la + responsabilité civile que du droit de la propriété intellectuelle + et de la protection qu'il offre aux auteurs et titulaires des + droits patrimoniaux sur un logiciel. + +Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] +L[ibre]) sont: + +Commissariat à l'Energie Atomique - CEA, établissement public de +recherche à caractère scientifique, technique et industriel, dont le +siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. + +Centre National de la Recherche Scientifique - CNRS, établissement +public à caractère scientifique et technologique, dont le siège est +situé 3 rue Michel-Ange, 75794 Paris cedex 16. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, établissement public à caractère scientifique et technologique, +dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 +Le Chesnay cedex. + + + Préambule + +Ce contrat est une licence de logiciel libre dont l'objectif est de +conférer aux utilisateurs la liberté de modification et de +redistribution du logiciel régi par cette licence dans le cadre d'un +modèle de diffusion en logiciel libre. + +L'exercice de ces libertés est assorti de certains devoirs à la charge +des utilisateurs afin de préserver ce statut au cours des +redistributions ultérieures. + +L'accessibilité au code source et les droits de copie, de modification +et de redistribution qui en découlent ont pour contrepartie de n'offrir +aux utilisateurs qu'une garantie limitée et de ne faire peser sur +l'auteur du logiciel, le titulaire des droits patrimoniaux et les +concédants successifs qu'une responsabilité restreinte. + +A cet égard l'attention de l'utilisateur est attirée sur les risques +associés au chargement, à l'utilisation, à la modification et/ou au +développement et à la reproduction du logiciel par l'utilisateur étant +donné sa spécificité de logiciel libre, qui peut le rendre complexe à +manipuler et qui le réserve donc à des développeurs ou des +professionnels avertis possédant des connaissances informatiques +approfondies. Les utilisateurs sont donc invités à charger et tester +l'adéquation du logiciel à leurs besoins dans des conditions permettant +d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus +généralement, à l'utiliser et l'exploiter dans les mêmes conditions de +sécurité. Ce contrat peut être reproduit et diffusé librement, sous +réserve de le conserver en l'état, sans ajout ni suppression de clauses. + +Ce contrat est susceptible de s'appliquer à tout logiciel dont le +titulaire des droits patrimoniaux décide de soumettre l'exploitation aux +dispositions qu'il contient. + + + Article 1 - DEFINITIONS + +Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une +lettre capitale, auront la signification suivante: + +Contrat: désigne le présent contrat de licence, ses éventuelles versions +postérieures et annexes. + +Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code +Source et le cas échéant sa documentation, dans leur état au moment de +l'acceptation du Contrat par le Licencié. + +Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et +éventuellement de Code Objet et le cas échéant sa documentation, dans +leur état au moment de leur première diffusion sous les termes du Contrat. + +Logiciel Modifié: désigne le Logiciel modifié par au moins une +Contribution. + +Code Source: désigne l'ensemble des instructions et des lignes de +programme du Logiciel et auquel l'accès est nécessaire en vue de +modifier le Logiciel. + +Code Objet: désigne les fichiers binaires issus de la compilation du +Code Source. + +Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur +sur le Logiciel Initial. + +Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le +Contrat. + +Contributeur: désigne le Licencié auteur d'au moins une Contribution. + +Concédant: désigne le Titulaire ou toute personne physique ou morale +distribuant le Logiciel sous le Contrat. + +Contribution: désigne l'ensemble des modifications, corrections, +traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans +le Logiciel par tout Contributeur, ainsi que tout Module Interne. + +Module: désigne un ensemble de fichiers sources y compris leur +documentation qui permet de réaliser des fonctionnalités ou services +supplémentaires à ceux fournis par le Logiciel. + +Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce +Module et le Logiciel s'exécutent dans des espaces d'adressage +différents, l'un appelant l'autre au moment de leur exécution. + +Module Interne: désigne tout Module lié au Logiciel de telle sorte +qu'ils s'exécutent dans le même espace d'adressage. + +GNU GPL: désigne la GNU General Public License dans sa version 2 ou +toute version ultérieure, telle que publiée par Free Software Foundation +Inc. + +Parties: désigne collectivement le Licencié et le Concédant. + +Ces termes s'entendent au singulier comme au pluriel. + + + Article 2 - OBJET + +Le Contrat a pour objet la concession par le Concédant au Licencié d'une +licence non exclusive, cessible et mondiale du Logiciel telle que +définie ci-après à l'article 5 pour toute la durée de protection des droits +portant sur ce Logiciel. + + + Article 3 - ACCEPTATION + +3.1 L'acceptation par le Licencié des termes du Contrat est réputée +acquise du fait du premier des faits suivants: + + * (i) le chargement du Logiciel par tout moyen notamment par + téléchargement à partir d'un serveur distant ou par chargement à + partir d'un support physique; + * (ii) le premier exercice par le Licencié de l'un quelconque des + droits concédés par le Contrat. + +3.2 Un exemplaire du Contrat, contenant notamment un avertissement +relatif aux spécificités du Logiciel, à la restriction de garantie et à +la limitation à un usage par des utilisateurs expérimentés a été mis à +disposition du Licencié préalablement à son acceptation telle que +définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris +connaissance. + + + Article 4 - ENTREE EN VIGUEUR ET DUREE + + + 4.1 ENTREE EN VIGUEUR + +Le Contrat entre en vigueur à la date de son acceptation par le Licencié +telle que définie en 3.1. + + + 4.2 DUREE + +Le Contrat produira ses effets pendant toute la durée légale de +protection des droits patrimoniaux portant sur le Logiciel. + + + Article 5 - ETENDUE DES DROITS CONCEDES + +Le Concédant concède au Licencié, qui accepte, les droits suivants sur +le Logiciel pour toutes destinations et pour la durée du Contrat dans +les conditions ci-après détaillées. + +Par ailleurs, si le Concédant détient ou venait à détenir un ou +plusieurs brevets d'invention protégeant tout ou partie des +fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas +opposer les éventuels droits conférés par ces brevets aux Licenciés +successifs qui utiliseraient, exploiteraient ou modifieraient le +Logiciel. En cas de cession de ces brevets, le Concédant s'engage à +faire reprendre les obligations du présent alinéa aux cessionnaires. + + + 5.1 DROIT D'UTILISATION + +Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant +aux domaines d'application, étant ci-après précisé que cela comporte: + + 1. la reproduction permanente ou provisoire du Logiciel en tout ou + partie par tout moyen et sous toute forme. + + 2. le chargement, l'affichage, l'exécution, ou le stockage du + Logiciel sur tout support. + + 3. la possibilité d'en observer, d'en étudier, ou d'en tester le + fonctionnement afin de déterminer les idées et principes qui sont + à la base de n'importe quel élément de ce Logiciel; et ceci, + lorsque le Licencié effectue toute opération de chargement, + d'affichage, d'exécution, de transmission ou de stockage du + Logiciel qu'il est en droit d'effectuer en vertu du Contrat. + + + 5.2 DROIT D'APPORTER DES CONTRIBUTIONS + +Le droit d'apporter des Contributions comporte le droit de traduire, +d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel +et le droit de reproduire le logiciel en résultant. + +Le Licencié est autorisé à apporter toute Contribution au Logiciel sous +réserve de mentionner, de façon explicite, son nom en tant qu'auteur de +cette Contribution et la date de création de celle-ci. + + + 5.3 DROIT DE DISTRIBUTION + +Le droit de distribution comporte notamment le droit de diffuser, de +transmettre et de communiquer le Logiciel au public sur tout support et +par tout moyen ainsi que le droit de mettre sur le marché à titre +onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. + +Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou +non, à des tiers dans les conditions ci-après détaillées. + + + 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION + +Le Licencié est autorisé à distribuer des copies conformes du Logiciel, +sous forme de Code Source ou de Code Objet, à condition que cette +distribution respecte les dispositions du Contrat dans leur totalité et +soit accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le Code Objet du Logiciel est redistribué, +le Licencié permette aux futurs Licenciés d'accéder facilement au Code +Source complet du Logiciel en indiquant les modalités d'accès, étant +entendu que le coût additionnel d'acquisition du Code Source ne devra +pas excéder le simple coût de transfert des données. + + + 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE + +Lorsque le Licencié apporte une Contribution au Logiciel, les conditions +de distribution du Logiciel Modifié en résultant sont alors soumises à +l'intégralité des dispositions du Contrat. + +Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de +code source ou de code objet, à condition que cette distribution +respecte les dispositions du Contrat dans leur totalité et soit +accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le code objet du Logiciel Modifié est +redistribué, le Licencié permette aux futurs Licenciés d'accéder +facilement au code source complet du Logiciel Modifié en indiquant les +modalités d'accès, étant entendu que le coût additionnel d'acquisition +du code source ne devra pas excéder le simple coût de transfert des données. + + + 5.3.3 DISTRIBUTION DES MODULES EXTERNES + +Lorsque le Licencié a développé un Module Externe les conditions du +Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué +sous un contrat de licence différent. + + + 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL + +Le Licencié peut inclure un code soumis aux dispositions d'une des +versions de la licence GNU GPL dans le Logiciel modifié ou non et +distribuer l'ensemble sous les conditions de la même version de la +licence GNU GPL. + +Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis +aux dispositions d'une des versions de la licence GNU GPL et distribuer +l'ensemble sous les conditions de la même version de la licence GNU GPL. + + + Article 6 - PROPRIETE INTELLECTUELLE + + + 6.1 SUR LE LOGICIEL INITIAL + +Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel +Initial. Toute utilisation du Logiciel Initial est soumise au respect +des conditions dans lesquelles le Titulaire a choisi de diffuser son +oeuvre et nul autre n'a la faculté de modifier les conditions de +diffusion de ce Logiciel Initial. + +Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi +par le Contrat et ce, pour la durée visée à l'article 4.2. + + + 6.2 SUR LES CONTRIBUTIONS + +Le Licencié qui a développé une Contribution est titulaire sur celle-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable. + + + 6.3 SUR LES MODULES EXTERNES + +Le Licencié qui a développé un Module Externe est titulaire sur celui-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable et reste libre du choix du contrat régissant +sa diffusion. + + + 6.4 DISPOSITIONS COMMUNES + +Le Licencié s'engage expressément: + + 1. à ne pas supprimer ou modifier de quelque manière que ce soit les + mentions de propriété intellectuelle apposées sur le Logiciel; + + 2. à reproduire à l'identique lesdites mentions de propriété + intellectuelle sur les copies du Logiciel modifié ou non. + +Le Licencié s'engage à ne pas porter atteinte, directement ou +indirectement, aux droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs sur le Logiciel et à prendre, le cas échéant, à +l'égard de son personnel toutes les mesures nécessaires pour assurer le +respect des dits droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs. + + + Article 7 - SERVICES ASSOCIES + +7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de +prestations d'assistance technique ou de maintenance du Logiciel. + +Cependant le Concédant reste libre de proposer ce type de services. Les +termes et conditions d'une telle assistance technique et/ou d'une telle +maintenance seront alors déterminés dans un acte séparé. Ces actes de +maintenance et/ou assistance technique n'engageront que la seule +responsabilité du Concédant qui les propose. + +7.2 De même, tout Concédant est libre de proposer, sous sa seule +responsabilité, à ses licenciés une garantie, qui n'engagera que lui, +lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, +dans les conditions qu'il souhaite. Cette garantie et les modalités +financières de son application feront l'objet d'un acte séparé entre le +Concédant et le Licencié. + + + Article 8 - RESPONSABILITE + +8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la +faculté, sous réserve de prouver la faute du Concédant concerné, de +solliciter la réparation du préjudice direct qu'il subirait du fait du +Logiciel et dont il apportera la preuve. + +8.2 La responsabilité du Concédant est limitée aux engagements pris en +application du Contrat et ne saurait être engagée en raison notamment: +(i) des dommages dus à l'inexécution, totale ou partielle, de ses +obligations par le Licencié, (ii) des dommages directs ou indirects +découlant de l'utilisation ou des performances du Logiciel subis par le +Licencié et (iii) plus généralement d'un quelconque dommage indirect. En +particulier, les Parties conviennent expressément que tout préjudice +financier ou commercial (par exemple perte de données, perte de +bénéfices, perte d'exploitation, perte de clientèle ou de commandes, +manque à gagner, trouble commercial quelconque) ou toute action dirigée +contre le Licencié par un tiers, constitue un dommage indirect et +n'ouvre pas droit à réparation par le Concédant. + + + Article 9 - GARANTIE + +9.1 Le Licencié reconnaît que l'état actuel des connaissances +scientifiques et techniques au moment de la mise en circulation du +Logiciel ne permet pas d'en tester et d'en vérifier toutes les +utilisations ni de détecter l'existence d'éventuels défauts. L'attention +du Licencié a été attirée sur ce point sur les risques associés au +chargement, à l'utilisation, la modification et/ou au développement et à +la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. + +Il relève de la responsabilité du Licencié de contrôler, par tous +moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et +de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. + +9.2 Le Concédant déclare de bonne foi être en droit de concéder +l'ensemble des droits attachés au Logiciel (comprenant notamment les +droits visés à l'article 5). + +9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le +Concédant sans autre garantie, expresse ou tacite, que celle prévue à +l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, +son caractère sécurisé, innovant ou pertinent. + +En particulier, le Concédant ne garantit pas que le Logiciel est exempt +d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible +avec l'équipement du Licencié et sa configuration logicielle ni qu'il +remplira les besoins du Licencié. + +9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le +Logiciel ne porte pas atteinte à un quelconque droit de propriété +intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout +autre droit de propriété. Ainsi, le Concédant exclut toute garantie au +profit du Licencié contre les actions en contrefaçon qui pourraient être +diligentées au titre de l'utilisation, de la modification, et de la +redistribution du Logiciel. Néanmoins, si de telles actions sont +exercées contre le Licencié, le Concédant lui apportera son aide +technique et juridique pour sa défense. Cette aide technique et +juridique est déterminée au cas par cas entre le Concédant concerné et +le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage +toute responsabilité quant à l'utilisation de la dénomination du +Logiciel par le Licencié. Aucune garantie n'est apportée quant à +l'existence de droits antérieurs sur le nom du Logiciel et sur +l'existence d'une marque. + + + Article 10 - RESILIATION + +10.1 En cas de manquement par le Licencié aux obligations mises à sa +charge par le Contrat, le Concédant pourra résilier de plein droit le +Contrat trente (30) jours après notification adressée au Licencié et +restée sans effet. + +10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à +utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les +licences qu'il aura concédées antérieurement à la résiliation du Contrat +resteront valides sous réserve qu'elles aient été effectuées en +conformité avec le Contrat. + + + Article 11 - DISPOSITIONS DIVERSES + + + 11.1 CAUSE EXTERIEURE + +Aucune des Parties ne sera responsable d'un retard ou d'une défaillance +d'exécution du Contrat qui serait dû à un cas de force majeure, un cas +fortuit ou une cause extérieure, telle que, notamment, le mauvais +fonctionnement ou les interruptions du réseau électrique ou de +télécommunication, la paralysie du réseau liée à une attaque +informatique, l'intervention des autorités gouvernementales, les +catastrophes naturelles, les dégâts des eaux, les tremblements de terre, +le feu, les explosions, les grèves et les conflits sociaux, l'état de +guerre... + +11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou +plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du +Contrat, ne pourra en aucun cas impliquer renonciation par la Partie +intéressée à s'en prévaloir ultérieurement. + +11.3 Le Contrat annule et remplace toute convention antérieure, écrite +ou orale, entre les Parties sur le même objet et constitue l'accord +entier entre les Parties sur cet objet. Aucune addition ou modification +aux termes du Contrat n'aura d'effet à l'égard des Parties à moins +d'être faite par écrit et signée par leurs représentants dûment habilités. + +11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat +s'avèrerait contraire à une loi ou à un texte applicable, existants ou +futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les +amendements nécessaires pour se conformer à cette loi ou à ce texte. +Toutes les autres dispositions resteront en vigueur. De même, la +nullité, pour quelque raison que ce soit, d'une des dispositions du +Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. + + + 11.5 LANGUE + +Le Contrat est rédigé en langue française et en langue anglaise, ces +deux versions faisant également foi. + + + Article 12 - NOUVELLES VERSIONS DU CONTRAT + +12.1 Toute personne est autorisée à copier et distribuer des copies de +ce Contrat. + +12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé +et ne peut être modifié que par les auteurs de la licence, lesquels se +réservent le droit de publier périodiquement des mises à jour ou de +nouvelles versions du Contrat, qui posséderont chacune un numéro +distinct. Ces versions ultérieures seront susceptibles de prendre en +compte de nouvelles problématiques rencontrées par les logiciels libres. + +12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra +faire l'objet d'une diffusion ultérieure que sous la même version du +Contrat ou une version postérieure, sous réserve des dispositions de +l'article 5.3.4. + + + Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE + +13.1 Le Contrat est régi par la loi française. Les Parties conviennent +de tenter de régler à l'amiable les différends ou litiges qui +viendraient à se produire par suite ou à l'occasion du Contrat. + +13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter +de leur survenance et sauf situation relevant d'une procédure d'urgence, +les différends ou litiges seront portés par la Partie la plus diligente +devant les Tribunaux compétents de Paris. + + +Version 2.0 du 2006-09-05. From 2d41e2c03554e312190a955464a50ca616f96071 Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 3 Nov 2021 15:28:52 +0100 Subject: [PATCH 016/113] fix licenses - summary of licenses at root - license files in modules --- LICENSE | 1024 +------------------------------------------------- edo/LICENSE | 502 +++++++++++++++++++++++++ mo/LICENSE | 1018 +++++++++++++++++++++++++++++++++++++++++++++++++ moeo/LICENSE | 1018 +++++++++++++++++++++++++++++++++++++++++++++++++ smp/LICENSE | 1018 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 3564 insertions(+), 1016 deletions(-) create mode 100644 edo/LICENSE create mode 100644 mo/LICENSE create mode 100644 moeo/LICENSE create mode 100644 smp/LICENSE diff --git a/LICENSE b/LICENSE index b7f1e4658..7e4a015c0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,1018 +1,10 @@ -CeCILL FREE SOFTWARE LICENSE AGREEMENT +ParadisEO modules have different licenses, see LICENSE files in each directories: - Notice +- eo : LGPL v2.1 +- edo : LGPL v2.1 +- mo : CeCILL v2+ (GPL-like) +- moeo: CeCILL v2+ (GPL-like) +- smp : CeCILL v2+ (GPL-like) +- problem: depend on each file (usually CeCILL). -This Agreement is a Free Software license agreement that is the result -of discussions between its authors in order to ensure compliance with -the two main principles guiding its drafting: - - * firstly, compliance with the principles governing the distribution - of Free Software: access to source code, broad rights granted to - users, - * secondly, the election of a governing law, French law, with which - it is conformant, both as regards the law of torts and - intellectual property law, and the protection that it offers to - both authors and holders of the economic rights over software. - -The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) -license are: - -Commissariat à l'Energie Atomique - CEA, a public scientific, technical -and industrial research establishment, having its principal place of -business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. - -Centre National de la Recherche Scientifique - CNRS, a public scientific -and technological establishment, having its principal place of business -at 3 rue Michel-Ange, 75794 Paris cedex 16, France. - -Institut National de Recherche en Informatique et en Automatique - -INRIA, a public scientific and technological establishment, having its -principal place of business at Domaine de Voluceau, Rocquencourt, BP -105, 78153 Le Chesnay cedex, France. - - - Preamble - -The purpose of this Free Software license agreement is to grant users -the right to modify and redistribute the software governed by this -license within the framework of an open source distribution model. - -The exercising of these rights is conditional upon certain obligations -for users so as to preserve this status for all subsequent redistributions. - -In consideration of access to the source code and the rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors only have limited liability. - -In this respect, the risks associated with loading, using, modifying -and/or developing or reproducing the software by the user are brought to -the user's attention, given its Free Software status, which may make it -complicated to use, with the result that its use is reserved for -developers and experienced professionals having in-depth computer -knowledge. Users are therefore encouraged to load and test the -suitability of the software as regards their requirements in conditions -enabling the security of their systems and/or data to be ensured and, -more generally, to use and operate it in the same conditions of -security. This Agreement may be freely reproduced and published, -provided it is not altered, and that no provisions are either added or -removed herefrom. - -This Agreement may apply to any or all software for which the holder of -the economic rights decides to submit the use thereof to its provisions. - - - Article 1 - DEFINITIONS - -For the purpose of this Agreement, when the following expressions -commence with a capital letter, they shall have the following meaning: - -Agreement: means this license agreement, and its possible subsequent -versions and annexes. - -Software: means the software in its Object Code and/or Source Code form -and, where applicable, its documentation, "as is" when the Licensee -accepts the Agreement. - -Initial Software: means the Software in its Source Code and possibly its -Object Code form and, where applicable, its documentation, "as is" when -it is first distributed under the terms and conditions of the Agreement. - -Modified Software: means the Software modified by at least one -Contribution. - -Source Code: means all the Software's instructions and program lines to -which access is required so as to modify the Software. - -Object Code: means the binary files originating from the compilation of -the Source Code. - -Holder: means the holder(s) of the economic rights over the Initial -Software. - -Licensee: means the Software user(s) having accepted the Agreement. - -Contributor: means a Licensee having made at least one Contribution. - -Licensor: means the Holder, or any other individual or legal entity, who -distributes the Software under the Agreement. - -Contribution: means any or all modifications, corrections, translations, -adaptations and/or new functions integrated into the Software by any or -all Contributors, as well as any or all Internal Modules. - -Module: means a set of sources files including their documentation that -enables supplementary functions or services in addition to those offered -by the Software. - -External Module: means any or all Modules, not derived from the -Software, so that this Module and the Software run in separate address -spaces, with one calling the other when they are run. - -Internal Module: means any or all Module, connected to the Software so -that they both execute in the same address space. - -GNU GPL: means the GNU General Public License version 2 or any -subsequent version, as published by the Free Software Foundation Inc. - -Parties: mean both the Licensee and the Licensor. - -These expressions may be used both in singular and plural form. - - - Article 2 - PURPOSE - -The purpose of the Agreement is the grant by the Licensor to the -Licensee of a non-exclusive, transferable and worldwide license for the -Software as set forth in Article 5 hereinafter for the whole term of the -protection granted by the rights over said Software. - - - Article 3 - ACCEPTANCE - -3.1 The Licensee shall be deemed as having accepted the terms and -conditions of this Agreement upon the occurrence of the first of the -following events: - - * (i) loading the Software by any or all means, notably, by - downloading from a remote server, or by loading from a physical - medium; - * (ii) the first time the Licensee exercises any of the rights - granted hereunder. - -3.2 One copy of the Agreement, containing a notice relating to the -characteristics of the Software, to the limited warranty, and to the -fact that its use is restricted to experienced users has been provided -to the Licensee prior to its acceptance as set forth in Article 3.1 -hereinabove, and the Licensee hereby acknowledges that it has read and -understood it. - - - Article 4 - EFFECTIVE DATE AND TERM - - - 4.1 EFFECTIVE DATE - -The Agreement shall become effective on the date when it is accepted by -the Licensee as set forth in Article 3.1. - - - 4.2 TERM - -The Agreement shall remain in force for the entire legal term of -protection of the economic rights over the Software. - - - Article 5 - SCOPE OF RIGHTS GRANTED - -The Licensor hereby grants to the Licensee, who accepts, the following -rights over the Software for any or all use, and for the term of the -Agreement, on the basis of the terms and conditions set forth hereinafter. - -Besides, if the Licensor owns or comes to own one or more patents -protecting all or part of the functions of the Software or of its -components, the Licensor undertakes not to enforce the rights granted by -these patents against successive Licensees using, exploiting or -modifying the Software. If these patents are transferred, the Licensor -undertakes to have the transferees subscribe to the obligations set -forth in this paragraph. - - - 5.1 RIGHT OF USE - -The Licensee is authorized to use the Software, without any limitation -as to its fields of application, with it being hereinafter specified -that this comprises: - - 1. permanent or temporary reproduction of all or part of the Software - by any or all means and in any or all form. - - 2. loading, displaying, running, or storing the Software on any or - all medium. - - 3. entitlement to observe, study or test its operation so as to - determine the ideas and principles behind any or all constituent - elements of said Software. This shall apply when the Licensee - carries out any or all loading, displaying, running, transmission - or storage operation as regards the Software, that it is entitled - to carry out hereunder. - - - 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS - -The right to make Contributions includes the right to translate, adapt, -arrange, or make any or all modifications to the Software, and the right -to reproduce the resulting software. - -The Licensee is authorized to make any or all Contributions to the -Software provided that it includes an explicit notice that it is the -author of said Contribution and indicates the date of the creation thereof. - - - 5.3 RIGHT OF DISTRIBUTION - -In particular, the right of distribution includes the right to publish, -transmit and communicate the Software to the general public on any or -all medium, and by any or all means, and the right to market, either in -consideration of a fee, or free of charge, one or more copies of the -Software by any means. - -The Licensee is further authorized to distribute copies of the modified -or unmodified Software to third parties according to the terms and -conditions set forth hereinafter. - - - 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION - -The Licensee is authorized to distribute true copies of the Software in -Source Code or Object Code form, provided that said distribution -complies with all the provisions of the Agreement and is accompanied by: - - 1. a copy of the Agreement, - - 2. a notice relating to the limitation of both the Licensor's - warranty and liability as set forth in Articles 8 and 9, - -and that, in the event that only the Object Code of the Software is -redistributed, the Licensee allows future Licensees unhindered access to -the full Source Code of the Software by indicating how to access it, it -being understood that the additional cost of acquiring the Source Code -shall not exceed the cost of transferring the data. - - - 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE - -When the Licensee makes a Contribution to the Software, the terms and -conditions for the distribution of the resulting Modified Software -become subject to all the provisions of this Agreement. - -The Licensee is authorized to distribute the Modified Software, in -source code or object code form, provided that said distribution -complies with all the provisions of the Agreement and is accompanied by: - - 1. a copy of the Agreement, - - 2. a notice relating to the limitation of both the Licensor's - warranty and liability as set forth in Articles 8 and 9, - -and that, in the event that only the object code of the Modified -Software is redistributed, the Licensee allows future Licensees -unhindered access to the full source code of the Modified Software by -indicating how to access it, it being understood that the additional -cost of acquiring the source code shall not exceed the cost of -transferring the data. - - - 5.3.3 DISTRIBUTION OF EXTERNAL MODULES - -When the Licensee has developed an External Module, the terms and -conditions of this Agreement do not apply to said External Module, that -may be distributed under a separate license agreement. - - - 5.3.4 COMPATIBILITY WITH THE GNU GPL - -The Licensee can include a code that is subject to the provisions of one -of the versions of the GNU GPL in the Modified or unmodified Software, -and distribute that entire code under the terms of the same version of -the GNU GPL. - -The Licensee can include the Modified or unmodified Software in a code -that is subject to the provisions of one of the versions of the GNU GPL, -and distribute that entire code under the terms of the same version of -the GNU GPL. - - - Article 6 - INTELLECTUAL PROPERTY - - - 6.1 OVER THE INITIAL SOFTWARE - -The Holder owns the economic rights over the Initial Software. Any or -all use of the Initial Software is subject to compliance with the terms -and conditions under which the Holder has elected to distribute its work -and no one shall be entitled to modify the terms and conditions for the -distribution of said Initial Software. - -The Holder undertakes that the Initial Software will remain ruled at -least by this Agreement, for the duration set forth in Article 4.2. - - - 6.2 OVER THE CONTRIBUTIONS - -The Licensee who develops a Contribution is the owner of the -intellectual property rights over this Contribution as defined by -applicable law. - - - 6.3 OVER THE EXTERNAL MODULES - -The Licensee who develops an External Module is the owner of the -intellectual property rights over this External Module as defined by -applicable law and is free to choose the type of agreement that shall -govern its distribution. - - - 6.4 JOINT PROVISIONS - -The Licensee expressly undertakes: - - 1. not to remove, or modify, in any manner, the intellectual property - notices attached to the Software; - - 2. to reproduce said notices, in an identical manner, in the copies - of the Software modified or not. - -The Licensee undertakes not to directly or indirectly infringe the -intellectual property rights of the Holder and/or Contributors on the -Software and to take, where applicable, vis-à-vis its staff, any and all -measures required to ensure respect of said intellectual property rights -of the Holder and/or Contributors. - - - Article 7 - RELATED SERVICES - -7.1 Under no circumstances shall the Agreement oblige the Licensor to -provide technical assistance or maintenance services for the Software. - -However, the Licensor is entitled to offer this type of services. The -terms and conditions of such technical assistance, and/or such -maintenance, shall be set forth in a separate instrument. Only the -Licensor offering said maintenance and/or technical assistance services -shall incur liability therefor. - -7.2 Similarly, any Licensor is entitled to offer to its licensees, under -its sole responsibility, a warranty, that shall only be binding upon -itself, for the redistribution of the Software and/or the Modified -Software, under terms and conditions that it is free to decide. Said -warranty, and the financial terms and conditions of its application, -shall be subject of a separate instrument executed between the Licensor -and the Licensee. - - - Article 8 - LIABILITY - -8.1 Subject to the provisions of Article 8.2, the Licensee shall be -entitled to claim compensation for any direct loss it may have suffered -from the Software as a result of a fault on the part of the relevant -Licensor, subject to providing evidence thereof. - -8.2 The Licensor's liability is limited to the commitments made under -this Agreement and shall not be incurred as a result of in particular: -(i) loss due the Licensee's total or partial failure to fulfill its -obligations, (ii) direct or consequential loss that is suffered by the -Licensee due to the use or performance of the Software, and (iii) more -generally, any consequential loss. In particular the Parties expressly -agree that any or all pecuniary or business loss (i.e. loss of data, -loss of profits, operating loss, loss of customers or orders, -opportunity cost, any disturbance to business activities) or any or all -legal proceedings instituted against the Licensee by a third party, -shall constitute consequential loss and shall not provide entitlement to -any or all compensation from the Licensor. - - - Article 9 - WARRANTY - -9.1 The Licensee acknowledges that the scientific and technical -state-of-the-art when the Software was distributed did not enable all -possible uses to be tested and verified, nor for the presence of -possible defects to be detected. In this respect, the Licensee's -attention has been drawn to the risks associated with loading, using, -modifying and/or developing and reproducing the Software which are -reserved for experienced users. - -The Licensee shall be responsible for verifying, by any or all means, -the suitability of the product for its requirements, its good working -order, and for ensuring that it shall not cause damage to either persons -or properties. - -9.2 The Licensor hereby represents, in good faith, that it is entitled -to grant all the rights over the Software (including in particular the -rights set forth in Article 5). - -9.3 The Licensee acknowledges that the Software is supplied "as is" by -the Licensor without any other express or tacit warranty, other than -that provided for in Article 9.2 and, in particular, without any warranty -as to its commercial value, its secured, safe, innovative or relevant -nature. - -Specifically, the Licensor does not warrant that the Software is free -from any error, that it will operate without interruption, that it will -be compatible with the Licensee's own equipment and software -configuration, nor that it will meet the Licensee's requirements. - -9.4 The Licensor does not either expressly or tacitly warrant that the -Software does not infringe any third party intellectual property right -relating to a patent, software or any other property right. Therefore, -the Licensor disclaims any and all liability towards the Licensee -arising out of any or all proceedings for infringement that may be -instituted in respect of the use, modification and redistribution of the -Software. Nevertheless, should such proceedings be instituted against -the Licensee, the Licensor shall provide it with technical and legal -assistance for its defense. Such technical and legal assistance shall be -decided on a case-by-case basis between the relevant Licensor and the -Licensee pursuant to a memorandum of understanding. The Licensor -disclaims any and all liability as regards the Licensee's use of the -name of the Software. No warranty is given as regards the existence of -prior rights over the name of the Software or as regards the existence -of a trademark. - - - Article 10 - TERMINATION - -10.1 In the event of a breach by the Licensee of its obligations -hereunder, the Licensor may automatically terminate this Agreement -thirty (30) days after notice has been sent to the Licensee and has -remained ineffective. - -10.2 A Licensee whose Agreement is terminated shall no longer be -authorized to use, modify or distribute the Software. However, any -licenses that it may have granted prior to termination of the Agreement -shall remain valid subject to their having been granted in compliance -with the terms and conditions hereof. - - - Article 11 - MISCELLANEOUS - - - 11.1 EXCUSABLE EVENTS - -Neither Party shall be liable for any or all delay, or failure to -perform the Agreement, that may be attributable to an event of force -majeure, an act of God or an outside cause, such as defective -functioning or interruptions of the electricity or telecommunications -networks, network paralysis following a virus attack, intervention by -government authorities, natural disasters, water damage, earthquakes, -fire, explosions, strikes and labor unrest, war, etc. - -11.2 Any failure by either Party, on one or more occasions, to invoke -one or more of the provisions hereof, shall under no circumstances be -interpreted as being a waiver by the interested Party of its right to -invoke said provision(s) subsequently. - -11.3 The Agreement cancels and replaces any or all previous agreements, -whether written or oral, between the Parties and having the same -purpose, and constitutes the entirety of the agreement between said -Parties concerning said purpose. No supplement or modification to the -terms and conditions hereof shall be effective as between the Parties -unless it is made in writing and signed by their duly authorized -representatives. - -11.4 In the event that one or more of the provisions hereof were to -conflict with a current or future applicable act or legislative text, -said act or legislative text shall prevail, and the Parties shall make -the necessary amendments so as to comply with said act or legislative -text. All other provisions shall remain effective. Similarly, invalidity -of a provision of the Agreement, for any reason whatsoever, shall not -cause the Agreement as a whole to be invalid. - - - 11.5 LANGUAGE - -The Agreement is drafted in both French and English and both versions -are deemed authentic. - - - Article 12 - NEW VERSIONS OF THE AGREEMENT - -12.1 Any person is authorized to duplicate and distribute copies of this -Agreement. - -12.2 So as to ensure coherence, the wording of this Agreement is -protected and may only be modified by the authors of the License, who -reserve the right to periodically publish updates or new versions of the -Agreement, each with a separate number. These subsequent versions may -address new issues encountered by Free Software. - -12.3 Any Software distributed under a given version of the Agreement may -only be subsequently distributed under the same version of the Agreement -or a subsequent version, subject to the provisions of Article 5.3.4. - - - Article 13 - GOVERNING LAW AND JURISDICTION - -13.1 The Agreement is governed by French law. The Parties agree to -endeavor to seek an amicable solution to any disagreements or disputes -that may arise during the performance of the Agreement. - -13.2 Failing an amicable solution within two (2) months as from their -occurrence, and unless emergency proceedings are necessary, the -disagreements or disputes shall be referred to the Paris Courts having -jurisdiction, by the more diligent Party. - - -Version 2.0 dated 2006-09-05. - ------------------------------------------------------------------------------- - -CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL - - - Avertissement - -Ce contrat est une licence de logiciel libre issue d'une concertation -entre ses auteurs afin que le respect de deux grands principes préside à -sa rédaction: - - * d'une part, le respect des principes de diffusion des logiciels - libres: accès au code source, droits étendus conférés aux - utilisateurs, - * d'autre part, la désignation d'un droit applicable, le droit - français, auquel elle est conforme, tant au regard du droit de la - responsabilité civile que du droit de la propriété intellectuelle - et de la protection qu'il offre aux auteurs et titulaires des - droits patrimoniaux sur un logiciel. - -Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] -L[ibre]) sont: - -Commissariat à l'Energie Atomique - CEA, établissement public de -recherche à caractère scientifique, technique et industriel, dont le -siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. - -Centre National de la Recherche Scientifique - CNRS, établissement -public à caractère scientifique et technologique, dont le siège est -situé 3 rue Michel-Ange, 75794 Paris cedex 16. - -Institut National de Recherche en Informatique et en Automatique - -INRIA, établissement public à caractère scientifique et technologique, -dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 -Le Chesnay cedex. - - - Préambule - -Ce contrat est une licence de logiciel libre dont l'objectif est de -conférer aux utilisateurs la liberté de modification et de -redistribution du logiciel régi par cette licence dans le cadre d'un -modèle de diffusion en logiciel libre. - -L'exercice de ces libertés est assorti de certains devoirs à la charge -des utilisateurs afin de préserver ce statut au cours des -redistributions ultérieures. - -L'accessibilité au code source et les droits de copie, de modification -et de redistribution qui en découlent ont pour contrepartie de n'offrir -aux utilisateurs qu'une garantie limitée et de ne faire peser sur -l'auteur du logiciel, le titulaire des droits patrimoniaux et les -concédants successifs qu'une responsabilité restreinte. - -A cet égard l'attention de l'utilisateur est attirée sur les risques -associés au chargement, à l'utilisation, à la modification et/ou au -développement et à la reproduction du logiciel par l'utilisateur étant -donné sa spécificité de logiciel libre, qui peut le rendre complexe à -manipuler et qui le réserve donc à des développeurs ou des -professionnels avertis possédant des connaissances informatiques -approfondies. Les utilisateurs sont donc invités à charger et tester -l'adéquation du logiciel à leurs besoins dans des conditions permettant -d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus -généralement, à l'utiliser et l'exploiter dans les mêmes conditions de -sécurité. Ce contrat peut être reproduit et diffusé librement, sous -réserve de le conserver en l'état, sans ajout ni suppression de clauses. - -Ce contrat est susceptible de s'appliquer à tout logiciel dont le -titulaire des droits patrimoniaux décide de soumettre l'exploitation aux -dispositions qu'il contient. - - - Article 1 - DEFINITIONS - -Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une -lettre capitale, auront la signification suivante: - -Contrat: désigne le présent contrat de licence, ses éventuelles versions -postérieures et annexes. - -Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code -Source et le cas échéant sa documentation, dans leur état au moment de -l'acceptation du Contrat par le Licencié. - -Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et -éventuellement de Code Objet et le cas échéant sa documentation, dans -leur état au moment de leur première diffusion sous les termes du Contrat. - -Logiciel Modifié: désigne le Logiciel modifié par au moins une -Contribution. - -Code Source: désigne l'ensemble des instructions et des lignes de -programme du Logiciel et auquel l'accès est nécessaire en vue de -modifier le Logiciel. - -Code Objet: désigne les fichiers binaires issus de la compilation du -Code Source. - -Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur -sur le Logiciel Initial. - -Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le -Contrat. - -Contributeur: désigne le Licencié auteur d'au moins une Contribution. - -Concédant: désigne le Titulaire ou toute personne physique ou morale -distribuant le Logiciel sous le Contrat. - -Contribution: désigne l'ensemble des modifications, corrections, -traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans -le Logiciel par tout Contributeur, ainsi que tout Module Interne. - -Module: désigne un ensemble de fichiers sources y compris leur -documentation qui permet de réaliser des fonctionnalités ou services -supplémentaires à ceux fournis par le Logiciel. - -Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce -Module et le Logiciel s'exécutent dans des espaces d'adressage -différents, l'un appelant l'autre au moment de leur exécution. - -Module Interne: désigne tout Module lié au Logiciel de telle sorte -qu'ils s'exécutent dans le même espace d'adressage. - -GNU GPL: désigne la GNU General Public License dans sa version 2 ou -toute version ultérieure, telle que publiée par Free Software Foundation -Inc. - -Parties: désigne collectivement le Licencié et le Concédant. - -Ces termes s'entendent au singulier comme au pluriel. - - - Article 2 - OBJET - -Le Contrat a pour objet la concession par le Concédant au Licencié d'une -licence non exclusive, cessible et mondiale du Logiciel telle que -définie ci-après à l'article 5 pour toute la durée de protection des droits -portant sur ce Logiciel. - - - Article 3 - ACCEPTATION - -3.1 L'acceptation par le Licencié des termes du Contrat est réputée -acquise du fait du premier des faits suivants: - - * (i) le chargement du Logiciel par tout moyen notamment par - téléchargement à partir d'un serveur distant ou par chargement à - partir d'un support physique; - * (ii) le premier exercice par le Licencié de l'un quelconque des - droits concédés par le Contrat. - -3.2 Un exemplaire du Contrat, contenant notamment un avertissement -relatif aux spécificités du Logiciel, à la restriction de garantie et à -la limitation à un usage par des utilisateurs expérimentés a été mis à -disposition du Licencié préalablement à son acceptation telle que -définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris -connaissance. - - - Article 4 - ENTREE EN VIGUEUR ET DUREE - - - 4.1 ENTREE EN VIGUEUR - -Le Contrat entre en vigueur à la date de son acceptation par le Licencié -telle que définie en 3.1. - - - 4.2 DUREE - -Le Contrat produira ses effets pendant toute la durée légale de -protection des droits patrimoniaux portant sur le Logiciel. - - - Article 5 - ETENDUE DES DROITS CONCEDES - -Le Concédant concède au Licencié, qui accepte, les droits suivants sur -le Logiciel pour toutes destinations et pour la durée du Contrat dans -les conditions ci-après détaillées. - -Par ailleurs, si le Concédant détient ou venait à détenir un ou -plusieurs brevets d'invention protégeant tout ou partie des -fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas -opposer les éventuels droits conférés par ces brevets aux Licenciés -successifs qui utiliseraient, exploiteraient ou modifieraient le -Logiciel. En cas de cession de ces brevets, le Concédant s'engage à -faire reprendre les obligations du présent alinéa aux cessionnaires. - - - 5.1 DROIT D'UTILISATION - -Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant -aux domaines d'application, étant ci-après précisé que cela comporte: - - 1. la reproduction permanente ou provisoire du Logiciel en tout ou - partie par tout moyen et sous toute forme. - - 2. le chargement, l'affichage, l'exécution, ou le stockage du - Logiciel sur tout support. - - 3. la possibilité d'en observer, d'en étudier, ou d'en tester le - fonctionnement afin de déterminer les idées et principes qui sont - à la base de n'importe quel élément de ce Logiciel; et ceci, - lorsque le Licencié effectue toute opération de chargement, - d'affichage, d'exécution, de transmission ou de stockage du - Logiciel qu'il est en droit d'effectuer en vertu du Contrat. - - - 5.2 DROIT D'APPORTER DES CONTRIBUTIONS - -Le droit d'apporter des Contributions comporte le droit de traduire, -d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel -et le droit de reproduire le logiciel en résultant. - -Le Licencié est autorisé à apporter toute Contribution au Logiciel sous -réserve de mentionner, de façon explicite, son nom en tant qu'auteur de -cette Contribution et la date de création de celle-ci. - - - 5.3 DROIT DE DISTRIBUTION - -Le droit de distribution comporte notamment le droit de diffuser, de -transmettre et de communiquer le Logiciel au public sur tout support et -par tout moyen ainsi que le droit de mettre sur le marché à titre -onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. - -Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou -non, à des tiers dans les conditions ci-après détaillées. - - - 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION - -Le Licencié est autorisé à distribuer des copies conformes du Logiciel, -sous forme de Code Source ou de Code Objet, à condition que cette -distribution respecte les dispositions du Contrat dans leur totalité et -soit accompagnée: - - 1. d'un exemplaire du Contrat, - - 2. d'un avertissement relatif à la restriction de garantie et de - responsabilité du Concédant telle que prévue aux articles 8 - et 9, - -et que, dans le cas où seul le Code Objet du Logiciel est redistribué, -le Licencié permette aux futurs Licenciés d'accéder facilement au Code -Source complet du Logiciel en indiquant les modalités d'accès, étant -entendu que le coût additionnel d'acquisition du Code Source ne devra -pas excéder le simple coût de transfert des données. - - - 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE - -Lorsque le Licencié apporte une Contribution au Logiciel, les conditions -de distribution du Logiciel Modifié en résultant sont alors soumises à -l'intégralité des dispositions du Contrat. - -Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de -code source ou de code objet, à condition que cette distribution -respecte les dispositions du Contrat dans leur totalité et soit -accompagnée: - - 1. d'un exemplaire du Contrat, - - 2. d'un avertissement relatif à la restriction de garantie et de - responsabilité du Concédant telle que prévue aux articles 8 - et 9, - -et que, dans le cas où seul le code objet du Logiciel Modifié est -redistribué, le Licencié permette aux futurs Licenciés d'accéder -facilement au code source complet du Logiciel Modifié en indiquant les -modalités d'accès, étant entendu que le coût additionnel d'acquisition -du code source ne devra pas excéder le simple coût de transfert des données. - - - 5.3.3 DISTRIBUTION DES MODULES EXTERNES - -Lorsque le Licencié a développé un Module Externe les conditions du -Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué -sous un contrat de licence différent. - - - 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL - -Le Licencié peut inclure un code soumis aux dispositions d'une des -versions de la licence GNU GPL dans le Logiciel modifié ou non et -distribuer l'ensemble sous les conditions de la même version de la -licence GNU GPL. - -Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis -aux dispositions d'une des versions de la licence GNU GPL et distribuer -l'ensemble sous les conditions de la même version de la licence GNU GPL. - - - Article 6 - PROPRIETE INTELLECTUELLE - - - 6.1 SUR LE LOGICIEL INITIAL - -Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel -Initial. Toute utilisation du Logiciel Initial est soumise au respect -des conditions dans lesquelles le Titulaire a choisi de diffuser son -oeuvre et nul autre n'a la faculté de modifier les conditions de -diffusion de ce Logiciel Initial. - -Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi -par le Contrat et ce, pour la durée visée à l'article 4.2. - - - 6.2 SUR LES CONTRIBUTIONS - -Le Licencié qui a développé une Contribution est titulaire sur celle-ci -des droits de propriété intellectuelle dans les conditions définies par -la législation applicable. - - - 6.3 SUR LES MODULES EXTERNES - -Le Licencié qui a développé un Module Externe est titulaire sur celui-ci -des droits de propriété intellectuelle dans les conditions définies par -la législation applicable et reste libre du choix du contrat régissant -sa diffusion. - - - 6.4 DISPOSITIONS COMMUNES - -Le Licencié s'engage expressément: - - 1. à ne pas supprimer ou modifier de quelque manière que ce soit les - mentions de propriété intellectuelle apposées sur le Logiciel; - - 2. à reproduire à l'identique lesdites mentions de propriété - intellectuelle sur les copies du Logiciel modifié ou non. - -Le Licencié s'engage à ne pas porter atteinte, directement ou -indirectement, aux droits de propriété intellectuelle du Titulaire et/ou -des Contributeurs sur le Logiciel et à prendre, le cas échéant, à -l'égard de son personnel toutes les mesures nécessaires pour assurer le -respect des dits droits de propriété intellectuelle du Titulaire et/ou -des Contributeurs. - - - Article 7 - SERVICES ASSOCIES - -7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de -prestations d'assistance technique ou de maintenance du Logiciel. - -Cependant le Concédant reste libre de proposer ce type de services. Les -termes et conditions d'une telle assistance technique et/ou d'une telle -maintenance seront alors déterminés dans un acte séparé. Ces actes de -maintenance et/ou assistance technique n'engageront que la seule -responsabilité du Concédant qui les propose. - -7.2 De même, tout Concédant est libre de proposer, sous sa seule -responsabilité, à ses licenciés une garantie, qui n'engagera que lui, -lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, -dans les conditions qu'il souhaite. Cette garantie et les modalités -financières de son application feront l'objet d'un acte séparé entre le -Concédant et le Licencié. - - - Article 8 - RESPONSABILITE - -8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la -faculté, sous réserve de prouver la faute du Concédant concerné, de -solliciter la réparation du préjudice direct qu'il subirait du fait du -Logiciel et dont il apportera la preuve. - -8.2 La responsabilité du Concédant est limitée aux engagements pris en -application du Contrat et ne saurait être engagée en raison notamment: -(i) des dommages dus à l'inexécution, totale ou partielle, de ses -obligations par le Licencié, (ii) des dommages directs ou indirects -découlant de l'utilisation ou des performances du Logiciel subis par le -Licencié et (iii) plus généralement d'un quelconque dommage indirect. En -particulier, les Parties conviennent expressément que tout préjudice -financier ou commercial (par exemple perte de données, perte de -bénéfices, perte d'exploitation, perte de clientèle ou de commandes, -manque à gagner, trouble commercial quelconque) ou toute action dirigée -contre le Licencié par un tiers, constitue un dommage indirect et -n'ouvre pas droit à réparation par le Concédant. - - - Article 9 - GARANTIE - -9.1 Le Licencié reconnaît que l'état actuel des connaissances -scientifiques et techniques au moment de la mise en circulation du -Logiciel ne permet pas d'en tester et d'en vérifier toutes les -utilisations ni de détecter l'existence d'éventuels défauts. L'attention -du Licencié a été attirée sur ce point sur les risques associés au -chargement, à l'utilisation, la modification et/ou au développement et à -la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. - -Il relève de la responsabilité du Licencié de contrôler, par tous -moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et -de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. - -9.2 Le Concédant déclare de bonne foi être en droit de concéder -l'ensemble des droits attachés au Logiciel (comprenant notamment les -droits visés à l'article 5). - -9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le -Concédant sans autre garantie, expresse ou tacite, que celle prévue à -l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, -son caractère sécurisé, innovant ou pertinent. - -En particulier, le Concédant ne garantit pas que le Logiciel est exempt -d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible -avec l'équipement du Licencié et sa configuration logicielle ni qu'il -remplira les besoins du Licencié. - -9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le -Logiciel ne porte pas atteinte à un quelconque droit de propriété -intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout -autre droit de propriété. Ainsi, le Concédant exclut toute garantie au -profit du Licencié contre les actions en contrefaçon qui pourraient être -diligentées au titre de l'utilisation, de la modification, et de la -redistribution du Logiciel. Néanmoins, si de telles actions sont -exercées contre le Licencié, le Concédant lui apportera son aide -technique et juridique pour sa défense. Cette aide technique et -juridique est déterminée au cas par cas entre le Concédant concerné et -le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage -toute responsabilité quant à l'utilisation de la dénomination du -Logiciel par le Licencié. Aucune garantie n'est apportée quant à -l'existence de droits antérieurs sur le nom du Logiciel et sur -l'existence d'une marque. - - - Article 10 - RESILIATION - -10.1 En cas de manquement par le Licencié aux obligations mises à sa -charge par le Contrat, le Concédant pourra résilier de plein droit le -Contrat trente (30) jours après notification adressée au Licencié et -restée sans effet. - -10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à -utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les -licences qu'il aura concédées antérieurement à la résiliation du Contrat -resteront valides sous réserve qu'elles aient été effectuées en -conformité avec le Contrat. - - - Article 11 - DISPOSITIONS DIVERSES - - - 11.1 CAUSE EXTERIEURE - -Aucune des Parties ne sera responsable d'un retard ou d'une défaillance -d'exécution du Contrat qui serait dû à un cas de force majeure, un cas -fortuit ou une cause extérieure, telle que, notamment, le mauvais -fonctionnement ou les interruptions du réseau électrique ou de -télécommunication, la paralysie du réseau liée à une attaque -informatique, l'intervention des autorités gouvernementales, les -catastrophes naturelles, les dégâts des eaux, les tremblements de terre, -le feu, les explosions, les grèves et les conflits sociaux, l'état de -guerre... - -11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou -plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du -Contrat, ne pourra en aucun cas impliquer renonciation par la Partie -intéressée à s'en prévaloir ultérieurement. - -11.3 Le Contrat annule et remplace toute convention antérieure, écrite -ou orale, entre les Parties sur le même objet et constitue l'accord -entier entre les Parties sur cet objet. Aucune addition ou modification -aux termes du Contrat n'aura d'effet à l'égard des Parties à moins -d'être faite par écrit et signée par leurs représentants dûment habilités. - -11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat -s'avèrerait contraire à une loi ou à un texte applicable, existants ou -futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les -amendements nécessaires pour se conformer à cette loi ou à ce texte. -Toutes les autres dispositions resteront en vigueur. De même, la -nullité, pour quelque raison que ce soit, d'une des dispositions du -Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. - - - 11.5 LANGUE - -Le Contrat est rédigé en langue française et en langue anglaise, ces -deux versions faisant également foi. - - - Article 12 - NOUVELLES VERSIONS DU CONTRAT - -12.1 Toute personne est autorisée à copier et distribuer des copies de -ce Contrat. - -12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé -et ne peut être modifié que par les auteurs de la licence, lesquels se -réservent le droit de publier périodiquement des mises à jour ou de -nouvelles versions du Contrat, qui posséderont chacune un numéro -distinct. Ces versions ultérieures seront susceptibles de prendre en -compte de nouvelles problématiques rencontrées par les logiciels libres. - -12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra -faire l'objet d'une diffusion ultérieure que sous la même version du -Contrat ou une version postérieure, sous réserve des dispositions de -l'article 5.3.4. - - - Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE - -13.1 Le Contrat est régi par la loi française. Les Parties conviennent -de tenter de régler à l'amiable les différends ou litiges qui -viendraient à se produire par suite ou à l'occasion du Contrat. - -13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter -de leur survenance et sauf situation relevant d'une procédure d'urgence, -les différends ou litiges seront portés par la Partie la plus diligente -devant les Tribunaux compétents de Paris. - - -Version 2.0 du 2006-09-05. +You may also double check the headers of source code files. diff --git a/edo/LICENSE b/edo/LICENSE new file mode 100644 index 000000000..b8df7fd44 --- /dev/null +++ b/edo/LICENSE @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/mo/LICENSE b/mo/LICENSE new file mode 100644 index 000000000..b7f1e4658 --- /dev/null +++ b/mo/LICENSE @@ -0,0 +1,1018 @@ +CeCILL FREE SOFTWARE LICENSE AGREEMENT + + Notice + +This Agreement is a Free Software license agreement that is the result +of discussions between its authors in order to ensure compliance with +the two main principles guiding its drafting: + + * firstly, compliance with the principles governing the distribution + of Free Software: access to source code, broad rights granted to + users, + * secondly, the election of a governing law, French law, with which + it is conformant, both as regards the law of torts and + intellectual property law, and the protection that it offers to + both authors and holders of the economic rights over software. + +The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) +license are: + +Commissariat à l'Energie Atomique - CEA, a public scientific, technical +and industrial research establishment, having its principal place of +business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. + +Centre National de la Recherche Scientifique - CNRS, a public scientific +and technological establishment, having its principal place of business +at 3 rue Michel-Ange, 75794 Paris cedex 16, France. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, a public scientific and technological establishment, having its +principal place of business at Domaine de Voluceau, Rocquencourt, BP +105, 78153 Le Chesnay cedex, France. + + + Preamble + +The purpose of this Free Software license agreement is to grant users +the right to modify and redistribute the software governed by this +license within the framework of an open source distribution model. + +The exercising of these rights is conditional upon certain obligations +for users so as to preserve this status for all subsequent redistributions. + +In consideration of access to the source code and the rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors only have limited liability. + +In this respect, the risks associated with loading, using, modifying +and/or developing or reproducing the software by the user are brought to +the user's attention, given its Free Software status, which may make it +complicated to use, with the result that its use is reserved for +developers and experienced professionals having in-depth computer +knowledge. Users are therefore encouraged to load and test the +suitability of the software as regards their requirements in conditions +enabling the security of their systems and/or data to be ensured and, +more generally, to use and operate it in the same conditions of +security. This Agreement may be freely reproduced and published, +provided it is not altered, and that no provisions are either added or +removed herefrom. + +This Agreement may apply to any or all software for which the holder of +the economic rights decides to submit the use thereof to its provisions. + + + Article 1 - DEFINITIONS + +For the purpose of this Agreement, when the following expressions +commence with a capital letter, they shall have the following meaning: + +Agreement: means this license agreement, and its possible subsequent +versions and annexes. + +Software: means the software in its Object Code and/or Source Code form +and, where applicable, its documentation, "as is" when the Licensee +accepts the Agreement. + +Initial Software: means the Software in its Source Code and possibly its +Object Code form and, where applicable, its documentation, "as is" when +it is first distributed under the terms and conditions of the Agreement. + +Modified Software: means the Software modified by at least one +Contribution. + +Source Code: means all the Software's instructions and program lines to +which access is required so as to modify the Software. + +Object Code: means the binary files originating from the compilation of +the Source Code. + +Holder: means the holder(s) of the economic rights over the Initial +Software. + +Licensee: means the Software user(s) having accepted the Agreement. + +Contributor: means a Licensee having made at least one Contribution. + +Licensor: means the Holder, or any other individual or legal entity, who +distributes the Software under the Agreement. + +Contribution: means any or all modifications, corrections, translations, +adaptations and/or new functions integrated into the Software by any or +all Contributors, as well as any or all Internal Modules. + +Module: means a set of sources files including their documentation that +enables supplementary functions or services in addition to those offered +by the Software. + +External Module: means any or all Modules, not derived from the +Software, so that this Module and the Software run in separate address +spaces, with one calling the other when they are run. + +Internal Module: means any or all Module, connected to the Software so +that they both execute in the same address space. + +GNU GPL: means the GNU General Public License version 2 or any +subsequent version, as published by the Free Software Foundation Inc. + +Parties: mean both the Licensee and the Licensor. + +These expressions may be used both in singular and plural form. + + + Article 2 - PURPOSE + +The purpose of the Agreement is the grant by the Licensor to the +Licensee of a non-exclusive, transferable and worldwide license for the +Software as set forth in Article 5 hereinafter for the whole term of the +protection granted by the rights over said Software. + + + Article 3 - ACCEPTANCE + +3.1 The Licensee shall be deemed as having accepted the terms and +conditions of this Agreement upon the occurrence of the first of the +following events: + + * (i) loading the Software by any or all means, notably, by + downloading from a remote server, or by loading from a physical + medium; + * (ii) the first time the Licensee exercises any of the rights + granted hereunder. + +3.2 One copy of the Agreement, containing a notice relating to the +characteristics of the Software, to the limited warranty, and to the +fact that its use is restricted to experienced users has been provided +to the Licensee prior to its acceptance as set forth in Article 3.1 +hereinabove, and the Licensee hereby acknowledges that it has read and +understood it. + + + Article 4 - EFFECTIVE DATE AND TERM + + + 4.1 EFFECTIVE DATE + +The Agreement shall become effective on the date when it is accepted by +the Licensee as set forth in Article 3.1. + + + 4.2 TERM + +The Agreement shall remain in force for the entire legal term of +protection of the economic rights over the Software. + + + Article 5 - SCOPE OF RIGHTS GRANTED + +The Licensor hereby grants to the Licensee, who accepts, the following +rights over the Software for any or all use, and for the term of the +Agreement, on the basis of the terms and conditions set forth hereinafter. + +Besides, if the Licensor owns or comes to own one or more patents +protecting all or part of the functions of the Software or of its +components, the Licensor undertakes not to enforce the rights granted by +these patents against successive Licensees using, exploiting or +modifying the Software. If these patents are transferred, the Licensor +undertakes to have the transferees subscribe to the obligations set +forth in this paragraph. + + + 5.1 RIGHT OF USE + +The Licensee is authorized to use the Software, without any limitation +as to its fields of application, with it being hereinafter specified +that this comprises: + + 1. permanent or temporary reproduction of all or part of the Software + by any or all means and in any or all form. + + 2. loading, displaying, running, or storing the Software on any or + all medium. + + 3. entitlement to observe, study or test its operation so as to + determine the ideas and principles behind any or all constituent + elements of said Software. This shall apply when the Licensee + carries out any or all loading, displaying, running, transmission + or storage operation as regards the Software, that it is entitled + to carry out hereunder. + + + 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS + +The right to make Contributions includes the right to translate, adapt, +arrange, or make any or all modifications to the Software, and the right +to reproduce the resulting software. + +The Licensee is authorized to make any or all Contributions to the +Software provided that it includes an explicit notice that it is the +author of said Contribution and indicates the date of the creation thereof. + + + 5.3 RIGHT OF DISTRIBUTION + +In particular, the right of distribution includes the right to publish, +transmit and communicate the Software to the general public on any or +all medium, and by any or all means, and the right to market, either in +consideration of a fee, or free of charge, one or more copies of the +Software by any means. + +The Licensee is further authorized to distribute copies of the modified +or unmodified Software to third parties according to the terms and +conditions set forth hereinafter. + + + 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION + +The Licensee is authorized to distribute true copies of the Software in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Software is +redistributed, the Licensee allows future Licensees unhindered access to +the full Source Code of the Software by indicating how to access it, it +being understood that the additional cost of acquiring the Source Code +shall not exceed the cost of transferring the data. + + + 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE + +When the Licensee makes a Contribution to the Software, the terms and +conditions for the distribution of the resulting Modified Software +become subject to all the provisions of this Agreement. + +The Licensee is authorized to distribute the Modified Software, in +source code or object code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the object code of the Modified +Software is redistributed, the Licensee allows future Licensees +unhindered access to the full source code of the Modified Software by +indicating how to access it, it being understood that the additional +cost of acquiring the source code shall not exceed the cost of +transferring the data. + + + 5.3.3 DISTRIBUTION OF EXTERNAL MODULES + +When the Licensee has developed an External Module, the terms and +conditions of this Agreement do not apply to said External Module, that +may be distributed under a separate license agreement. + + + 5.3.4 COMPATIBILITY WITH THE GNU GPL + +The Licensee can include a code that is subject to the provisions of one +of the versions of the GNU GPL in the Modified or unmodified Software, +and distribute that entire code under the terms of the same version of +the GNU GPL. + +The Licensee can include the Modified or unmodified Software in a code +that is subject to the provisions of one of the versions of the GNU GPL, +and distribute that entire code under the terms of the same version of +the GNU GPL. + + + Article 6 - INTELLECTUAL PROPERTY + + + 6.1 OVER THE INITIAL SOFTWARE + +The Holder owns the economic rights over the Initial Software. Any or +all use of the Initial Software is subject to compliance with the terms +and conditions under which the Holder has elected to distribute its work +and no one shall be entitled to modify the terms and conditions for the +distribution of said Initial Software. + +The Holder undertakes that the Initial Software will remain ruled at +least by this Agreement, for the duration set forth in Article 4.2. + + + 6.2 OVER THE CONTRIBUTIONS + +The Licensee who develops a Contribution is the owner of the +intellectual property rights over this Contribution as defined by +applicable law. + + + 6.3 OVER THE EXTERNAL MODULES + +The Licensee who develops an External Module is the owner of the +intellectual property rights over this External Module as defined by +applicable law and is free to choose the type of agreement that shall +govern its distribution. + + + 6.4 JOINT PROVISIONS + +The Licensee expressly undertakes: + + 1. not to remove, or modify, in any manner, the intellectual property + notices attached to the Software; + + 2. to reproduce said notices, in an identical manner, in the copies + of the Software modified or not. + +The Licensee undertakes not to directly or indirectly infringe the +intellectual property rights of the Holder and/or Contributors on the +Software and to take, where applicable, vis-à-vis its staff, any and all +measures required to ensure respect of said intellectual property rights +of the Holder and/or Contributors. + + + Article 7 - RELATED SERVICES + +7.1 Under no circumstances shall the Agreement oblige the Licensor to +provide technical assistance or maintenance services for the Software. + +However, the Licensor is entitled to offer this type of services. The +terms and conditions of such technical assistance, and/or such +maintenance, shall be set forth in a separate instrument. Only the +Licensor offering said maintenance and/or technical assistance services +shall incur liability therefor. + +7.2 Similarly, any Licensor is entitled to offer to its licensees, under +its sole responsibility, a warranty, that shall only be binding upon +itself, for the redistribution of the Software and/or the Modified +Software, under terms and conditions that it is free to decide. Said +warranty, and the financial terms and conditions of its application, +shall be subject of a separate instrument executed between the Licensor +and the Licensee. + + + Article 8 - LIABILITY + +8.1 Subject to the provisions of Article 8.2, the Licensee shall be +entitled to claim compensation for any direct loss it may have suffered +from the Software as a result of a fault on the part of the relevant +Licensor, subject to providing evidence thereof. + +8.2 The Licensor's liability is limited to the commitments made under +this Agreement and shall not be incurred as a result of in particular: +(i) loss due the Licensee's total or partial failure to fulfill its +obligations, (ii) direct or consequential loss that is suffered by the +Licensee due to the use or performance of the Software, and (iii) more +generally, any consequential loss. In particular the Parties expressly +agree that any or all pecuniary or business loss (i.e. loss of data, +loss of profits, operating loss, loss of customers or orders, +opportunity cost, any disturbance to business activities) or any or all +legal proceedings instituted against the Licensee by a third party, +shall constitute consequential loss and shall not provide entitlement to +any or all compensation from the Licensor. + + + Article 9 - WARRANTY + +9.1 The Licensee acknowledges that the scientific and technical +state-of-the-art when the Software was distributed did not enable all +possible uses to be tested and verified, nor for the presence of +possible defects to be detected. In this respect, the Licensee's +attention has been drawn to the risks associated with loading, using, +modifying and/or developing and reproducing the Software which are +reserved for experienced users. + +The Licensee shall be responsible for verifying, by any or all means, +the suitability of the product for its requirements, its good working +order, and for ensuring that it shall not cause damage to either persons +or properties. + +9.2 The Licensor hereby represents, in good faith, that it is entitled +to grant all the rights over the Software (including in particular the +rights set forth in Article 5). + +9.3 The Licensee acknowledges that the Software is supplied "as is" by +the Licensor without any other express or tacit warranty, other than +that provided for in Article 9.2 and, in particular, without any warranty +as to its commercial value, its secured, safe, innovative or relevant +nature. + +Specifically, the Licensor does not warrant that the Software is free +from any error, that it will operate without interruption, that it will +be compatible with the Licensee's own equipment and software +configuration, nor that it will meet the Licensee's requirements. + +9.4 The Licensor does not either expressly or tacitly warrant that the +Software does not infringe any third party intellectual property right +relating to a patent, software or any other property right. Therefore, +the Licensor disclaims any and all liability towards the Licensee +arising out of any or all proceedings for infringement that may be +instituted in respect of the use, modification and redistribution of the +Software. Nevertheless, should such proceedings be instituted against +the Licensee, the Licensor shall provide it with technical and legal +assistance for its defense. Such technical and legal assistance shall be +decided on a case-by-case basis between the relevant Licensor and the +Licensee pursuant to a memorandum of understanding. The Licensor +disclaims any and all liability as regards the Licensee's use of the +name of the Software. No warranty is given as regards the existence of +prior rights over the name of the Software or as regards the existence +of a trademark. + + + Article 10 - TERMINATION + +10.1 In the event of a breach by the Licensee of its obligations +hereunder, the Licensor may automatically terminate this Agreement +thirty (30) days after notice has been sent to the Licensee and has +remained ineffective. + +10.2 A Licensee whose Agreement is terminated shall no longer be +authorized to use, modify or distribute the Software. However, any +licenses that it may have granted prior to termination of the Agreement +shall remain valid subject to their having been granted in compliance +with the terms and conditions hereof. + + + Article 11 - MISCELLANEOUS + + + 11.1 EXCUSABLE EVENTS + +Neither Party shall be liable for any or all delay, or failure to +perform the Agreement, that may be attributable to an event of force +majeure, an act of God or an outside cause, such as defective +functioning or interruptions of the electricity or telecommunications +networks, network paralysis following a virus attack, intervention by +government authorities, natural disasters, water damage, earthquakes, +fire, explosions, strikes and labor unrest, war, etc. + +11.2 Any failure by either Party, on one or more occasions, to invoke +one or more of the provisions hereof, shall under no circumstances be +interpreted as being a waiver by the interested Party of its right to +invoke said provision(s) subsequently. + +11.3 The Agreement cancels and replaces any or all previous agreements, +whether written or oral, between the Parties and having the same +purpose, and constitutes the entirety of the agreement between said +Parties concerning said purpose. No supplement or modification to the +terms and conditions hereof shall be effective as between the Parties +unless it is made in writing and signed by their duly authorized +representatives. + +11.4 In the event that one or more of the provisions hereof were to +conflict with a current or future applicable act or legislative text, +said act or legislative text shall prevail, and the Parties shall make +the necessary amendments so as to comply with said act or legislative +text. All other provisions shall remain effective. Similarly, invalidity +of a provision of the Agreement, for any reason whatsoever, shall not +cause the Agreement as a whole to be invalid. + + + 11.5 LANGUAGE + +The Agreement is drafted in both French and English and both versions +are deemed authentic. + + + Article 12 - NEW VERSIONS OF THE AGREEMENT + +12.1 Any person is authorized to duplicate and distribute copies of this +Agreement. + +12.2 So as to ensure coherence, the wording of this Agreement is +protected and may only be modified by the authors of the License, who +reserve the right to periodically publish updates or new versions of the +Agreement, each with a separate number. These subsequent versions may +address new issues encountered by Free Software. + +12.3 Any Software distributed under a given version of the Agreement may +only be subsequently distributed under the same version of the Agreement +or a subsequent version, subject to the provisions of Article 5.3.4. + + + Article 13 - GOVERNING LAW AND JURISDICTION + +13.1 The Agreement is governed by French law. The Parties agree to +endeavor to seek an amicable solution to any disagreements or disputes +that may arise during the performance of the Agreement. + +13.2 Failing an amicable solution within two (2) months as from their +occurrence, and unless emergency proceedings are necessary, the +disagreements or disputes shall be referred to the Paris Courts having +jurisdiction, by the more diligent Party. + + +Version 2.0 dated 2006-09-05. + +------------------------------------------------------------------------------ + +CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL + + + Avertissement + +Ce contrat est une licence de logiciel libre issue d'une concertation +entre ses auteurs afin que le respect de deux grands principes préside à +sa rédaction: + + * d'une part, le respect des principes de diffusion des logiciels + libres: accès au code source, droits étendus conférés aux + utilisateurs, + * d'autre part, la désignation d'un droit applicable, le droit + français, auquel elle est conforme, tant au regard du droit de la + responsabilité civile que du droit de la propriété intellectuelle + et de la protection qu'il offre aux auteurs et titulaires des + droits patrimoniaux sur un logiciel. + +Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] +L[ibre]) sont: + +Commissariat à l'Energie Atomique - CEA, établissement public de +recherche à caractère scientifique, technique et industriel, dont le +siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. + +Centre National de la Recherche Scientifique - CNRS, établissement +public à caractère scientifique et technologique, dont le siège est +situé 3 rue Michel-Ange, 75794 Paris cedex 16. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, établissement public à caractère scientifique et technologique, +dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 +Le Chesnay cedex. + + + Préambule + +Ce contrat est une licence de logiciel libre dont l'objectif est de +conférer aux utilisateurs la liberté de modification et de +redistribution du logiciel régi par cette licence dans le cadre d'un +modèle de diffusion en logiciel libre. + +L'exercice de ces libertés est assorti de certains devoirs à la charge +des utilisateurs afin de préserver ce statut au cours des +redistributions ultérieures. + +L'accessibilité au code source et les droits de copie, de modification +et de redistribution qui en découlent ont pour contrepartie de n'offrir +aux utilisateurs qu'une garantie limitée et de ne faire peser sur +l'auteur du logiciel, le titulaire des droits patrimoniaux et les +concédants successifs qu'une responsabilité restreinte. + +A cet égard l'attention de l'utilisateur est attirée sur les risques +associés au chargement, à l'utilisation, à la modification et/ou au +développement et à la reproduction du logiciel par l'utilisateur étant +donné sa spécificité de logiciel libre, qui peut le rendre complexe à +manipuler et qui le réserve donc à des développeurs ou des +professionnels avertis possédant des connaissances informatiques +approfondies. Les utilisateurs sont donc invités à charger et tester +l'adéquation du logiciel à leurs besoins dans des conditions permettant +d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus +généralement, à l'utiliser et l'exploiter dans les mêmes conditions de +sécurité. Ce contrat peut être reproduit et diffusé librement, sous +réserve de le conserver en l'état, sans ajout ni suppression de clauses. + +Ce contrat est susceptible de s'appliquer à tout logiciel dont le +titulaire des droits patrimoniaux décide de soumettre l'exploitation aux +dispositions qu'il contient. + + + Article 1 - DEFINITIONS + +Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une +lettre capitale, auront la signification suivante: + +Contrat: désigne le présent contrat de licence, ses éventuelles versions +postérieures et annexes. + +Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code +Source et le cas échéant sa documentation, dans leur état au moment de +l'acceptation du Contrat par le Licencié. + +Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et +éventuellement de Code Objet et le cas échéant sa documentation, dans +leur état au moment de leur première diffusion sous les termes du Contrat. + +Logiciel Modifié: désigne le Logiciel modifié par au moins une +Contribution. + +Code Source: désigne l'ensemble des instructions et des lignes de +programme du Logiciel et auquel l'accès est nécessaire en vue de +modifier le Logiciel. + +Code Objet: désigne les fichiers binaires issus de la compilation du +Code Source. + +Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur +sur le Logiciel Initial. + +Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le +Contrat. + +Contributeur: désigne le Licencié auteur d'au moins une Contribution. + +Concédant: désigne le Titulaire ou toute personne physique ou morale +distribuant le Logiciel sous le Contrat. + +Contribution: désigne l'ensemble des modifications, corrections, +traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans +le Logiciel par tout Contributeur, ainsi que tout Module Interne. + +Module: désigne un ensemble de fichiers sources y compris leur +documentation qui permet de réaliser des fonctionnalités ou services +supplémentaires à ceux fournis par le Logiciel. + +Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce +Module et le Logiciel s'exécutent dans des espaces d'adressage +différents, l'un appelant l'autre au moment de leur exécution. + +Module Interne: désigne tout Module lié au Logiciel de telle sorte +qu'ils s'exécutent dans le même espace d'adressage. + +GNU GPL: désigne la GNU General Public License dans sa version 2 ou +toute version ultérieure, telle que publiée par Free Software Foundation +Inc. + +Parties: désigne collectivement le Licencié et le Concédant. + +Ces termes s'entendent au singulier comme au pluriel. + + + Article 2 - OBJET + +Le Contrat a pour objet la concession par le Concédant au Licencié d'une +licence non exclusive, cessible et mondiale du Logiciel telle que +définie ci-après à l'article 5 pour toute la durée de protection des droits +portant sur ce Logiciel. + + + Article 3 - ACCEPTATION + +3.1 L'acceptation par le Licencié des termes du Contrat est réputée +acquise du fait du premier des faits suivants: + + * (i) le chargement du Logiciel par tout moyen notamment par + téléchargement à partir d'un serveur distant ou par chargement à + partir d'un support physique; + * (ii) le premier exercice par le Licencié de l'un quelconque des + droits concédés par le Contrat. + +3.2 Un exemplaire du Contrat, contenant notamment un avertissement +relatif aux spécificités du Logiciel, à la restriction de garantie et à +la limitation à un usage par des utilisateurs expérimentés a été mis à +disposition du Licencié préalablement à son acceptation telle que +définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris +connaissance. + + + Article 4 - ENTREE EN VIGUEUR ET DUREE + + + 4.1 ENTREE EN VIGUEUR + +Le Contrat entre en vigueur à la date de son acceptation par le Licencié +telle que définie en 3.1. + + + 4.2 DUREE + +Le Contrat produira ses effets pendant toute la durée légale de +protection des droits patrimoniaux portant sur le Logiciel. + + + Article 5 - ETENDUE DES DROITS CONCEDES + +Le Concédant concède au Licencié, qui accepte, les droits suivants sur +le Logiciel pour toutes destinations et pour la durée du Contrat dans +les conditions ci-après détaillées. + +Par ailleurs, si le Concédant détient ou venait à détenir un ou +plusieurs brevets d'invention protégeant tout ou partie des +fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas +opposer les éventuels droits conférés par ces brevets aux Licenciés +successifs qui utiliseraient, exploiteraient ou modifieraient le +Logiciel. En cas de cession de ces brevets, le Concédant s'engage à +faire reprendre les obligations du présent alinéa aux cessionnaires. + + + 5.1 DROIT D'UTILISATION + +Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant +aux domaines d'application, étant ci-après précisé que cela comporte: + + 1. la reproduction permanente ou provisoire du Logiciel en tout ou + partie par tout moyen et sous toute forme. + + 2. le chargement, l'affichage, l'exécution, ou le stockage du + Logiciel sur tout support. + + 3. la possibilité d'en observer, d'en étudier, ou d'en tester le + fonctionnement afin de déterminer les idées et principes qui sont + à la base de n'importe quel élément de ce Logiciel; et ceci, + lorsque le Licencié effectue toute opération de chargement, + d'affichage, d'exécution, de transmission ou de stockage du + Logiciel qu'il est en droit d'effectuer en vertu du Contrat. + + + 5.2 DROIT D'APPORTER DES CONTRIBUTIONS + +Le droit d'apporter des Contributions comporte le droit de traduire, +d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel +et le droit de reproduire le logiciel en résultant. + +Le Licencié est autorisé à apporter toute Contribution au Logiciel sous +réserve de mentionner, de façon explicite, son nom en tant qu'auteur de +cette Contribution et la date de création de celle-ci. + + + 5.3 DROIT DE DISTRIBUTION + +Le droit de distribution comporte notamment le droit de diffuser, de +transmettre et de communiquer le Logiciel au public sur tout support et +par tout moyen ainsi que le droit de mettre sur le marché à titre +onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. + +Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou +non, à des tiers dans les conditions ci-après détaillées. + + + 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION + +Le Licencié est autorisé à distribuer des copies conformes du Logiciel, +sous forme de Code Source ou de Code Objet, à condition que cette +distribution respecte les dispositions du Contrat dans leur totalité et +soit accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le Code Objet du Logiciel est redistribué, +le Licencié permette aux futurs Licenciés d'accéder facilement au Code +Source complet du Logiciel en indiquant les modalités d'accès, étant +entendu que le coût additionnel d'acquisition du Code Source ne devra +pas excéder le simple coût de transfert des données. + + + 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE + +Lorsque le Licencié apporte une Contribution au Logiciel, les conditions +de distribution du Logiciel Modifié en résultant sont alors soumises à +l'intégralité des dispositions du Contrat. + +Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de +code source ou de code objet, à condition que cette distribution +respecte les dispositions du Contrat dans leur totalité et soit +accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le code objet du Logiciel Modifié est +redistribué, le Licencié permette aux futurs Licenciés d'accéder +facilement au code source complet du Logiciel Modifié en indiquant les +modalités d'accès, étant entendu que le coût additionnel d'acquisition +du code source ne devra pas excéder le simple coût de transfert des données. + + + 5.3.3 DISTRIBUTION DES MODULES EXTERNES + +Lorsque le Licencié a développé un Module Externe les conditions du +Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué +sous un contrat de licence différent. + + + 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL + +Le Licencié peut inclure un code soumis aux dispositions d'une des +versions de la licence GNU GPL dans le Logiciel modifié ou non et +distribuer l'ensemble sous les conditions de la même version de la +licence GNU GPL. + +Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis +aux dispositions d'une des versions de la licence GNU GPL et distribuer +l'ensemble sous les conditions de la même version de la licence GNU GPL. + + + Article 6 - PROPRIETE INTELLECTUELLE + + + 6.1 SUR LE LOGICIEL INITIAL + +Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel +Initial. Toute utilisation du Logiciel Initial est soumise au respect +des conditions dans lesquelles le Titulaire a choisi de diffuser son +oeuvre et nul autre n'a la faculté de modifier les conditions de +diffusion de ce Logiciel Initial. + +Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi +par le Contrat et ce, pour la durée visée à l'article 4.2. + + + 6.2 SUR LES CONTRIBUTIONS + +Le Licencié qui a développé une Contribution est titulaire sur celle-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable. + + + 6.3 SUR LES MODULES EXTERNES + +Le Licencié qui a développé un Module Externe est titulaire sur celui-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable et reste libre du choix du contrat régissant +sa diffusion. + + + 6.4 DISPOSITIONS COMMUNES + +Le Licencié s'engage expressément: + + 1. à ne pas supprimer ou modifier de quelque manière que ce soit les + mentions de propriété intellectuelle apposées sur le Logiciel; + + 2. à reproduire à l'identique lesdites mentions de propriété + intellectuelle sur les copies du Logiciel modifié ou non. + +Le Licencié s'engage à ne pas porter atteinte, directement ou +indirectement, aux droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs sur le Logiciel et à prendre, le cas échéant, à +l'égard de son personnel toutes les mesures nécessaires pour assurer le +respect des dits droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs. + + + Article 7 - SERVICES ASSOCIES + +7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de +prestations d'assistance technique ou de maintenance du Logiciel. + +Cependant le Concédant reste libre de proposer ce type de services. Les +termes et conditions d'une telle assistance technique et/ou d'une telle +maintenance seront alors déterminés dans un acte séparé. Ces actes de +maintenance et/ou assistance technique n'engageront que la seule +responsabilité du Concédant qui les propose. + +7.2 De même, tout Concédant est libre de proposer, sous sa seule +responsabilité, à ses licenciés une garantie, qui n'engagera que lui, +lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, +dans les conditions qu'il souhaite. Cette garantie et les modalités +financières de son application feront l'objet d'un acte séparé entre le +Concédant et le Licencié. + + + Article 8 - RESPONSABILITE + +8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la +faculté, sous réserve de prouver la faute du Concédant concerné, de +solliciter la réparation du préjudice direct qu'il subirait du fait du +Logiciel et dont il apportera la preuve. + +8.2 La responsabilité du Concédant est limitée aux engagements pris en +application du Contrat et ne saurait être engagée en raison notamment: +(i) des dommages dus à l'inexécution, totale ou partielle, de ses +obligations par le Licencié, (ii) des dommages directs ou indirects +découlant de l'utilisation ou des performances du Logiciel subis par le +Licencié et (iii) plus généralement d'un quelconque dommage indirect. En +particulier, les Parties conviennent expressément que tout préjudice +financier ou commercial (par exemple perte de données, perte de +bénéfices, perte d'exploitation, perte de clientèle ou de commandes, +manque à gagner, trouble commercial quelconque) ou toute action dirigée +contre le Licencié par un tiers, constitue un dommage indirect et +n'ouvre pas droit à réparation par le Concédant. + + + Article 9 - GARANTIE + +9.1 Le Licencié reconnaît que l'état actuel des connaissances +scientifiques et techniques au moment de la mise en circulation du +Logiciel ne permet pas d'en tester et d'en vérifier toutes les +utilisations ni de détecter l'existence d'éventuels défauts. L'attention +du Licencié a été attirée sur ce point sur les risques associés au +chargement, à l'utilisation, la modification et/ou au développement et à +la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. + +Il relève de la responsabilité du Licencié de contrôler, par tous +moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et +de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. + +9.2 Le Concédant déclare de bonne foi être en droit de concéder +l'ensemble des droits attachés au Logiciel (comprenant notamment les +droits visés à l'article 5). + +9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le +Concédant sans autre garantie, expresse ou tacite, que celle prévue à +l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, +son caractère sécurisé, innovant ou pertinent. + +En particulier, le Concédant ne garantit pas que le Logiciel est exempt +d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible +avec l'équipement du Licencié et sa configuration logicielle ni qu'il +remplira les besoins du Licencié. + +9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le +Logiciel ne porte pas atteinte à un quelconque droit de propriété +intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout +autre droit de propriété. Ainsi, le Concédant exclut toute garantie au +profit du Licencié contre les actions en contrefaçon qui pourraient être +diligentées au titre de l'utilisation, de la modification, et de la +redistribution du Logiciel. Néanmoins, si de telles actions sont +exercées contre le Licencié, le Concédant lui apportera son aide +technique et juridique pour sa défense. Cette aide technique et +juridique est déterminée au cas par cas entre le Concédant concerné et +le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage +toute responsabilité quant à l'utilisation de la dénomination du +Logiciel par le Licencié. Aucune garantie n'est apportée quant à +l'existence de droits antérieurs sur le nom du Logiciel et sur +l'existence d'une marque. + + + Article 10 - RESILIATION + +10.1 En cas de manquement par le Licencié aux obligations mises à sa +charge par le Contrat, le Concédant pourra résilier de plein droit le +Contrat trente (30) jours après notification adressée au Licencié et +restée sans effet. + +10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à +utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les +licences qu'il aura concédées antérieurement à la résiliation du Contrat +resteront valides sous réserve qu'elles aient été effectuées en +conformité avec le Contrat. + + + Article 11 - DISPOSITIONS DIVERSES + + + 11.1 CAUSE EXTERIEURE + +Aucune des Parties ne sera responsable d'un retard ou d'une défaillance +d'exécution du Contrat qui serait dû à un cas de force majeure, un cas +fortuit ou une cause extérieure, telle que, notamment, le mauvais +fonctionnement ou les interruptions du réseau électrique ou de +télécommunication, la paralysie du réseau liée à une attaque +informatique, l'intervention des autorités gouvernementales, les +catastrophes naturelles, les dégâts des eaux, les tremblements de terre, +le feu, les explosions, les grèves et les conflits sociaux, l'état de +guerre... + +11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou +plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du +Contrat, ne pourra en aucun cas impliquer renonciation par la Partie +intéressée à s'en prévaloir ultérieurement. + +11.3 Le Contrat annule et remplace toute convention antérieure, écrite +ou orale, entre les Parties sur le même objet et constitue l'accord +entier entre les Parties sur cet objet. Aucune addition ou modification +aux termes du Contrat n'aura d'effet à l'égard des Parties à moins +d'être faite par écrit et signée par leurs représentants dûment habilités. + +11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat +s'avèrerait contraire à une loi ou à un texte applicable, existants ou +futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les +amendements nécessaires pour se conformer à cette loi ou à ce texte. +Toutes les autres dispositions resteront en vigueur. De même, la +nullité, pour quelque raison que ce soit, d'une des dispositions du +Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. + + + 11.5 LANGUE + +Le Contrat est rédigé en langue française et en langue anglaise, ces +deux versions faisant également foi. + + + Article 12 - NOUVELLES VERSIONS DU CONTRAT + +12.1 Toute personne est autorisée à copier et distribuer des copies de +ce Contrat. + +12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé +et ne peut être modifié que par les auteurs de la licence, lesquels se +réservent le droit de publier périodiquement des mises à jour ou de +nouvelles versions du Contrat, qui posséderont chacune un numéro +distinct. Ces versions ultérieures seront susceptibles de prendre en +compte de nouvelles problématiques rencontrées par les logiciels libres. + +12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra +faire l'objet d'une diffusion ultérieure que sous la même version du +Contrat ou une version postérieure, sous réserve des dispositions de +l'article 5.3.4. + + + Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE + +13.1 Le Contrat est régi par la loi française. Les Parties conviennent +de tenter de régler à l'amiable les différends ou litiges qui +viendraient à se produire par suite ou à l'occasion du Contrat. + +13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter +de leur survenance et sauf situation relevant d'une procédure d'urgence, +les différends ou litiges seront portés par la Partie la plus diligente +devant les Tribunaux compétents de Paris. + + +Version 2.0 du 2006-09-05. diff --git a/moeo/LICENSE b/moeo/LICENSE new file mode 100644 index 000000000..b7f1e4658 --- /dev/null +++ b/moeo/LICENSE @@ -0,0 +1,1018 @@ +CeCILL FREE SOFTWARE LICENSE AGREEMENT + + Notice + +This Agreement is a Free Software license agreement that is the result +of discussions between its authors in order to ensure compliance with +the two main principles guiding its drafting: + + * firstly, compliance with the principles governing the distribution + of Free Software: access to source code, broad rights granted to + users, + * secondly, the election of a governing law, French law, with which + it is conformant, both as regards the law of torts and + intellectual property law, and the protection that it offers to + both authors and holders of the economic rights over software. + +The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) +license are: + +Commissariat à l'Energie Atomique - CEA, a public scientific, technical +and industrial research establishment, having its principal place of +business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. + +Centre National de la Recherche Scientifique - CNRS, a public scientific +and technological establishment, having its principal place of business +at 3 rue Michel-Ange, 75794 Paris cedex 16, France. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, a public scientific and technological establishment, having its +principal place of business at Domaine de Voluceau, Rocquencourt, BP +105, 78153 Le Chesnay cedex, France. + + + Preamble + +The purpose of this Free Software license agreement is to grant users +the right to modify and redistribute the software governed by this +license within the framework of an open source distribution model. + +The exercising of these rights is conditional upon certain obligations +for users so as to preserve this status for all subsequent redistributions. + +In consideration of access to the source code and the rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors only have limited liability. + +In this respect, the risks associated with loading, using, modifying +and/or developing or reproducing the software by the user are brought to +the user's attention, given its Free Software status, which may make it +complicated to use, with the result that its use is reserved for +developers and experienced professionals having in-depth computer +knowledge. Users are therefore encouraged to load and test the +suitability of the software as regards their requirements in conditions +enabling the security of their systems and/or data to be ensured and, +more generally, to use and operate it in the same conditions of +security. This Agreement may be freely reproduced and published, +provided it is not altered, and that no provisions are either added or +removed herefrom. + +This Agreement may apply to any or all software for which the holder of +the economic rights decides to submit the use thereof to its provisions. + + + Article 1 - DEFINITIONS + +For the purpose of this Agreement, when the following expressions +commence with a capital letter, they shall have the following meaning: + +Agreement: means this license agreement, and its possible subsequent +versions and annexes. + +Software: means the software in its Object Code and/or Source Code form +and, where applicable, its documentation, "as is" when the Licensee +accepts the Agreement. + +Initial Software: means the Software in its Source Code and possibly its +Object Code form and, where applicable, its documentation, "as is" when +it is first distributed under the terms and conditions of the Agreement. + +Modified Software: means the Software modified by at least one +Contribution. + +Source Code: means all the Software's instructions and program lines to +which access is required so as to modify the Software. + +Object Code: means the binary files originating from the compilation of +the Source Code. + +Holder: means the holder(s) of the economic rights over the Initial +Software. + +Licensee: means the Software user(s) having accepted the Agreement. + +Contributor: means a Licensee having made at least one Contribution. + +Licensor: means the Holder, or any other individual or legal entity, who +distributes the Software under the Agreement. + +Contribution: means any or all modifications, corrections, translations, +adaptations and/or new functions integrated into the Software by any or +all Contributors, as well as any or all Internal Modules. + +Module: means a set of sources files including their documentation that +enables supplementary functions or services in addition to those offered +by the Software. + +External Module: means any or all Modules, not derived from the +Software, so that this Module and the Software run in separate address +spaces, with one calling the other when they are run. + +Internal Module: means any or all Module, connected to the Software so +that they both execute in the same address space. + +GNU GPL: means the GNU General Public License version 2 or any +subsequent version, as published by the Free Software Foundation Inc. + +Parties: mean both the Licensee and the Licensor. + +These expressions may be used both in singular and plural form. + + + Article 2 - PURPOSE + +The purpose of the Agreement is the grant by the Licensor to the +Licensee of a non-exclusive, transferable and worldwide license for the +Software as set forth in Article 5 hereinafter for the whole term of the +protection granted by the rights over said Software. + + + Article 3 - ACCEPTANCE + +3.1 The Licensee shall be deemed as having accepted the terms and +conditions of this Agreement upon the occurrence of the first of the +following events: + + * (i) loading the Software by any or all means, notably, by + downloading from a remote server, or by loading from a physical + medium; + * (ii) the first time the Licensee exercises any of the rights + granted hereunder. + +3.2 One copy of the Agreement, containing a notice relating to the +characteristics of the Software, to the limited warranty, and to the +fact that its use is restricted to experienced users has been provided +to the Licensee prior to its acceptance as set forth in Article 3.1 +hereinabove, and the Licensee hereby acknowledges that it has read and +understood it. + + + Article 4 - EFFECTIVE DATE AND TERM + + + 4.1 EFFECTIVE DATE + +The Agreement shall become effective on the date when it is accepted by +the Licensee as set forth in Article 3.1. + + + 4.2 TERM + +The Agreement shall remain in force for the entire legal term of +protection of the economic rights over the Software. + + + Article 5 - SCOPE OF RIGHTS GRANTED + +The Licensor hereby grants to the Licensee, who accepts, the following +rights over the Software for any or all use, and for the term of the +Agreement, on the basis of the terms and conditions set forth hereinafter. + +Besides, if the Licensor owns or comes to own one or more patents +protecting all or part of the functions of the Software or of its +components, the Licensor undertakes not to enforce the rights granted by +these patents against successive Licensees using, exploiting or +modifying the Software. If these patents are transferred, the Licensor +undertakes to have the transferees subscribe to the obligations set +forth in this paragraph. + + + 5.1 RIGHT OF USE + +The Licensee is authorized to use the Software, without any limitation +as to its fields of application, with it being hereinafter specified +that this comprises: + + 1. permanent or temporary reproduction of all or part of the Software + by any or all means and in any or all form. + + 2. loading, displaying, running, or storing the Software on any or + all medium. + + 3. entitlement to observe, study or test its operation so as to + determine the ideas and principles behind any or all constituent + elements of said Software. This shall apply when the Licensee + carries out any or all loading, displaying, running, transmission + or storage operation as regards the Software, that it is entitled + to carry out hereunder. + + + 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS + +The right to make Contributions includes the right to translate, adapt, +arrange, or make any or all modifications to the Software, and the right +to reproduce the resulting software. + +The Licensee is authorized to make any or all Contributions to the +Software provided that it includes an explicit notice that it is the +author of said Contribution and indicates the date of the creation thereof. + + + 5.3 RIGHT OF DISTRIBUTION + +In particular, the right of distribution includes the right to publish, +transmit and communicate the Software to the general public on any or +all medium, and by any or all means, and the right to market, either in +consideration of a fee, or free of charge, one or more copies of the +Software by any means. + +The Licensee is further authorized to distribute copies of the modified +or unmodified Software to third parties according to the terms and +conditions set forth hereinafter. + + + 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION + +The Licensee is authorized to distribute true copies of the Software in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Software is +redistributed, the Licensee allows future Licensees unhindered access to +the full Source Code of the Software by indicating how to access it, it +being understood that the additional cost of acquiring the Source Code +shall not exceed the cost of transferring the data. + + + 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE + +When the Licensee makes a Contribution to the Software, the terms and +conditions for the distribution of the resulting Modified Software +become subject to all the provisions of this Agreement. + +The Licensee is authorized to distribute the Modified Software, in +source code or object code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the object code of the Modified +Software is redistributed, the Licensee allows future Licensees +unhindered access to the full source code of the Modified Software by +indicating how to access it, it being understood that the additional +cost of acquiring the source code shall not exceed the cost of +transferring the data. + + + 5.3.3 DISTRIBUTION OF EXTERNAL MODULES + +When the Licensee has developed an External Module, the terms and +conditions of this Agreement do not apply to said External Module, that +may be distributed under a separate license agreement. + + + 5.3.4 COMPATIBILITY WITH THE GNU GPL + +The Licensee can include a code that is subject to the provisions of one +of the versions of the GNU GPL in the Modified or unmodified Software, +and distribute that entire code under the terms of the same version of +the GNU GPL. + +The Licensee can include the Modified or unmodified Software in a code +that is subject to the provisions of one of the versions of the GNU GPL, +and distribute that entire code under the terms of the same version of +the GNU GPL. + + + Article 6 - INTELLECTUAL PROPERTY + + + 6.1 OVER THE INITIAL SOFTWARE + +The Holder owns the economic rights over the Initial Software. Any or +all use of the Initial Software is subject to compliance with the terms +and conditions under which the Holder has elected to distribute its work +and no one shall be entitled to modify the terms and conditions for the +distribution of said Initial Software. + +The Holder undertakes that the Initial Software will remain ruled at +least by this Agreement, for the duration set forth in Article 4.2. + + + 6.2 OVER THE CONTRIBUTIONS + +The Licensee who develops a Contribution is the owner of the +intellectual property rights over this Contribution as defined by +applicable law. + + + 6.3 OVER THE EXTERNAL MODULES + +The Licensee who develops an External Module is the owner of the +intellectual property rights over this External Module as defined by +applicable law and is free to choose the type of agreement that shall +govern its distribution. + + + 6.4 JOINT PROVISIONS + +The Licensee expressly undertakes: + + 1. not to remove, or modify, in any manner, the intellectual property + notices attached to the Software; + + 2. to reproduce said notices, in an identical manner, in the copies + of the Software modified or not. + +The Licensee undertakes not to directly or indirectly infringe the +intellectual property rights of the Holder and/or Contributors on the +Software and to take, where applicable, vis-à-vis its staff, any and all +measures required to ensure respect of said intellectual property rights +of the Holder and/or Contributors. + + + Article 7 - RELATED SERVICES + +7.1 Under no circumstances shall the Agreement oblige the Licensor to +provide technical assistance or maintenance services for the Software. + +However, the Licensor is entitled to offer this type of services. The +terms and conditions of such technical assistance, and/or such +maintenance, shall be set forth in a separate instrument. Only the +Licensor offering said maintenance and/or technical assistance services +shall incur liability therefor. + +7.2 Similarly, any Licensor is entitled to offer to its licensees, under +its sole responsibility, a warranty, that shall only be binding upon +itself, for the redistribution of the Software and/or the Modified +Software, under terms and conditions that it is free to decide. Said +warranty, and the financial terms and conditions of its application, +shall be subject of a separate instrument executed between the Licensor +and the Licensee. + + + Article 8 - LIABILITY + +8.1 Subject to the provisions of Article 8.2, the Licensee shall be +entitled to claim compensation for any direct loss it may have suffered +from the Software as a result of a fault on the part of the relevant +Licensor, subject to providing evidence thereof. + +8.2 The Licensor's liability is limited to the commitments made under +this Agreement and shall not be incurred as a result of in particular: +(i) loss due the Licensee's total or partial failure to fulfill its +obligations, (ii) direct or consequential loss that is suffered by the +Licensee due to the use or performance of the Software, and (iii) more +generally, any consequential loss. In particular the Parties expressly +agree that any or all pecuniary or business loss (i.e. loss of data, +loss of profits, operating loss, loss of customers or orders, +opportunity cost, any disturbance to business activities) or any or all +legal proceedings instituted against the Licensee by a third party, +shall constitute consequential loss and shall not provide entitlement to +any or all compensation from the Licensor. + + + Article 9 - WARRANTY + +9.1 The Licensee acknowledges that the scientific and technical +state-of-the-art when the Software was distributed did not enable all +possible uses to be tested and verified, nor for the presence of +possible defects to be detected. In this respect, the Licensee's +attention has been drawn to the risks associated with loading, using, +modifying and/or developing and reproducing the Software which are +reserved for experienced users. + +The Licensee shall be responsible for verifying, by any or all means, +the suitability of the product for its requirements, its good working +order, and for ensuring that it shall not cause damage to either persons +or properties. + +9.2 The Licensor hereby represents, in good faith, that it is entitled +to grant all the rights over the Software (including in particular the +rights set forth in Article 5). + +9.3 The Licensee acknowledges that the Software is supplied "as is" by +the Licensor without any other express or tacit warranty, other than +that provided for in Article 9.2 and, in particular, without any warranty +as to its commercial value, its secured, safe, innovative or relevant +nature. + +Specifically, the Licensor does not warrant that the Software is free +from any error, that it will operate without interruption, that it will +be compatible with the Licensee's own equipment and software +configuration, nor that it will meet the Licensee's requirements. + +9.4 The Licensor does not either expressly or tacitly warrant that the +Software does not infringe any third party intellectual property right +relating to a patent, software or any other property right. Therefore, +the Licensor disclaims any and all liability towards the Licensee +arising out of any or all proceedings for infringement that may be +instituted in respect of the use, modification and redistribution of the +Software. Nevertheless, should such proceedings be instituted against +the Licensee, the Licensor shall provide it with technical and legal +assistance for its defense. Such technical and legal assistance shall be +decided on a case-by-case basis between the relevant Licensor and the +Licensee pursuant to a memorandum of understanding. The Licensor +disclaims any and all liability as regards the Licensee's use of the +name of the Software. No warranty is given as regards the existence of +prior rights over the name of the Software or as regards the existence +of a trademark. + + + Article 10 - TERMINATION + +10.1 In the event of a breach by the Licensee of its obligations +hereunder, the Licensor may automatically terminate this Agreement +thirty (30) days after notice has been sent to the Licensee and has +remained ineffective. + +10.2 A Licensee whose Agreement is terminated shall no longer be +authorized to use, modify or distribute the Software. However, any +licenses that it may have granted prior to termination of the Agreement +shall remain valid subject to their having been granted in compliance +with the terms and conditions hereof. + + + Article 11 - MISCELLANEOUS + + + 11.1 EXCUSABLE EVENTS + +Neither Party shall be liable for any or all delay, or failure to +perform the Agreement, that may be attributable to an event of force +majeure, an act of God or an outside cause, such as defective +functioning or interruptions of the electricity or telecommunications +networks, network paralysis following a virus attack, intervention by +government authorities, natural disasters, water damage, earthquakes, +fire, explosions, strikes and labor unrest, war, etc. + +11.2 Any failure by either Party, on one or more occasions, to invoke +one or more of the provisions hereof, shall under no circumstances be +interpreted as being a waiver by the interested Party of its right to +invoke said provision(s) subsequently. + +11.3 The Agreement cancels and replaces any or all previous agreements, +whether written or oral, between the Parties and having the same +purpose, and constitutes the entirety of the agreement between said +Parties concerning said purpose. No supplement or modification to the +terms and conditions hereof shall be effective as between the Parties +unless it is made in writing and signed by their duly authorized +representatives. + +11.4 In the event that one or more of the provisions hereof were to +conflict with a current or future applicable act or legislative text, +said act or legislative text shall prevail, and the Parties shall make +the necessary amendments so as to comply with said act or legislative +text. All other provisions shall remain effective. Similarly, invalidity +of a provision of the Agreement, for any reason whatsoever, shall not +cause the Agreement as a whole to be invalid. + + + 11.5 LANGUAGE + +The Agreement is drafted in both French and English and both versions +are deemed authentic. + + + Article 12 - NEW VERSIONS OF THE AGREEMENT + +12.1 Any person is authorized to duplicate and distribute copies of this +Agreement. + +12.2 So as to ensure coherence, the wording of this Agreement is +protected and may only be modified by the authors of the License, who +reserve the right to periodically publish updates or new versions of the +Agreement, each with a separate number. These subsequent versions may +address new issues encountered by Free Software. + +12.3 Any Software distributed under a given version of the Agreement may +only be subsequently distributed under the same version of the Agreement +or a subsequent version, subject to the provisions of Article 5.3.4. + + + Article 13 - GOVERNING LAW AND JURISDICTION + +13.1 The Agreement is governed by French law. The Parties agree to +endeavor to seek an amicable solution to any disagreements or disputes +that may arise during the performance of the Agreement. + +13.2 Failing an amicable solution within two (2) months as from their +occurrence, and unless emergency proceedings are necessary, the +disagreements or disputes shall be referred to the Paris Courts having +jurisdiction, by the more diligent Party. + + +Version 2.0 dated 2006-09-05. + +------------------------------------------------------------------------------ + +CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL + + + Avertissement + +Ce contrat est une licence de logiciel libre issue d'une concertation +entre ses auteurs afin que le respect de deux grands principes préside à +sa rédaction: + + * d'une part, le respect des principes de diffusion des logiciels + libres: accès au code source, droits étendus conférés aux + utilisateurs, + * d'autre part, la désignation d'un droit applicable, le droit + français, auquel elle est conforme, tant au regard du droit de la + responsabilité civile que du droit de la propriété intellectuelle + et de la protection qu'il offre aux auteurs et titulaires des + droits patrimoniaux sur un logiciel. + +Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] +L[ibre]) sont: + +Commissariat à l'Energie Atomique - CEA, établissement public de +recherche à caractère scientifique, technique et industriel, dont le +siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. + +Centre National de la Recherche Scientifique - CNRS, établissement +public à caractère scientifique et technologique, dont le siège est +situé 3 rue Michel-Ange, 75794 Paris cedex 16. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, établissement public à caractère scientifique et technologique, +dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 +Le Chesnay cedex. + + + Préambule + +Ce contrat est une licence de logiciel libre dont l'objectif est de +conférer aux utilisateurs la liberté de modification et de +redistribution du logiciel régi par cette licence dans le cadre d'un +modèle de diffusion en logiciel libre. + +L'exercice de ces libertés est assorti de certains devoirs à la charge +des utilisateurs afin de préserver ce statut au cours des +redistributions ultérieures. + +L'accessibilité au code source et les droits de copie, de modification +et de redistribution qui en découlent ont pour contrepartie de n'offrir +aux utilisateurs qu'une garantie limitée et de ne faire peser sur +l'auteur du logiciel, le titulaire des droits patrimoniaux et les +concédants successifs qu'une responsabilité restreinte. + +A cet égard l'attention de l'utilisateur est attirée sur les risques +associés au chargement, à l'utilisation, à la modification et/ou au +développement et à la reproduction du logiciel par l'utilisateur étant +donné sa spécificité de logiciel libre, qui peut le rendre complexe à +manipuler et qui le réserve donc à des développeurs ou des +professionnels avertis possédant des connaissances informatiques +approfondies. Les utilisateurs sont donc invités à charger et tester +l'adéquation du logiciel à leurs besoins dans des conditions permettant +d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus +généralement, à l'utiliser et l'exploiter dans les mêmes conditions de +sécurité. Ce contrat peut être reproduit et diffusé librement, sous +réserve de le conserver en l'état, sans ajout ni suppression de clauses. + +Ce contrat est susceptible de s'appliquer à tout logiciel dont le +titulaire des droits patrimoniaux décide de soumettre l'exploitation aux +dispositions qu'il contient. + + + Article 1 - DEFINITIONS + +Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une +lettre capitale, auront la signification suivante: + +Contrat: désigne le présent contrat de licence, ses éventuelles versions +postérieures et annexes. + +Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code +Source et le cas échéant sa documentation, dans leur état au moment de +l'acceptation du Contrat par le Licencié. + +Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et +éventuellement de Code Objet et le cas échéant sa documentation, dans +leur état au moment de leur première diffusion sous les termes du Contrat. + +Logiciel Modifié: désigne le Logiciel modifié par au moins une +Contribution. + +Code Source: désigne l'ensemble des instructions et des lignes de +programme du Logiciel et auquel l'accès est nécessaire en vue de +modifier le Logiciel. + +Code Objet: désigne les fichiers binaires issus de la compilation du +Code Source. + +Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur +sur le Logiciel Initial. + +Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le +Contrat. + +Contributeur: désigne le Licencié auteur d'au moins une Contribution. + +Concédant: désigne le Titulaire ou toute personne physique ou morale +distribuant le Logiciel sous le Contrat. + +Contribution: désigne l'ensemble des modifications, corrections, +traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans +le Logiciel par tout Contributeur, ainsi que tout Module Interne. + +Module: désigne un ensemble de fichiers sources y compris leur +documentation qui permet de réaliser des fonctionnalités ou services +supplémentaires à ceux fournis par le Logiciel. + +Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce +Module et le Logiciel s'exécutent dans des espaces d'adressage +différents, l'un appelant l'autre au moment de leur exécution. + +Module Interne: désigne tout Module lié au Logiciel de telle sorte +qu'ils s'exécutent dans le même espace d'adressage. + +GNU GPL: désigne la GNU General Public License dans sa version 2 ou +toute version ultérieure, telle que publiée par Free Software Foundation +Inc. + +Parties: désigne collectivement le Licencié et le Concédant. + +Ces termes s'entendent au singulier comme au pluriel. + + + Article 2 - OBJET + +Le Contrat a pour objet la concession par le Concédant au Licencié d'une +licence non exclusive, cessible et mondiale du Logiciel telle que +définie ci-après à l'article 5 pour toute la durée de protection des droits +portant sur ce Logiciel. + + + Article 3 - ACCEPTATION + +3.1 L'acceptation par le Licencié des termes du Contrat est réputée +acquise du fait du premier des faits suivants: + + * (i) le chargement du Logiciel par tout moyen notamment par + téléchargement à partir d'un serveur distant ou par chargement à + partir d'un support physique; + * (ii) le premier exercice par le Licencié de l'un quelconque des + droits concédés par le Contrat. + +3.2 Un exemplaire du Contrat, contenant notamment un avertissement +relatif aux spécificités du Logiciel, à la restriction de garantie et à +la limitation à un usage par des utilisateurs expérimentés a été mis à +disposition du Licencié préalablement à son acceptation telle que +définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris +connaissance. + + + Article 4 - ENTREE EN VIGUEUR ET DUREE + + + 4.1 ENTREE EN VIGUEUR + +Le Contrat entre en vigueur à la date de son acceptation par le Licencié +telle que définie en 3.1. + + + 4.2 DUREE + +Le Contrat produira ses effets pendant toute la durée légale de +protection des droits patrimoniaux portant sur le Logiciel. + + + Article 5 - ETENDUE DES DROITS CONCEDES + +Le Concédant concède au Licencié, qui accepte, les droits suivants sur +le Logiciel pour toutes destinations et pour la durée du Contrat dans +les conditions ci-après détaillées. + +Par ailleurs, si le Concédant détient ou venait à détenir un ou +plusieurs brevets d'invention protégeant tout ou partie des +fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas +opposer les éventuels droits conférés par ces brevets aux Licenciés +successifs qui utiliseraient, exploiteraient ou modifieraient le +Logiciel. En cas de cession de ces brevets, le Concédant s'engage à +faire reprendre les obligations du présent alinéa aux cessionnaires. + + + 5.1 DROIT D'UTILISATION + +Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant +aux domaines d'application, étant ci-après précisé que cela comporte: + + 1. la reproduction permanente ou provisoire du Logiciel en tout ou + partie par tout moyen et sous toute forme. + + 2. le chargement, l'affichage, l'exécution, ou le stockage du + Logiciel sur tout support. + + 3. la possibilité d'en observer, d'en étudier, ou d'en tester le + fonctionnement afin de déterminer les idées et principes qui sont + à la base de n'importe quel élément de ce Logiciel; et ceci, + lorsque le Licencié effectue toute opération de chargement, + d'affichage, d'exécution, de transmission ou de stockage du + Logiciel qu'il est en droit d'effectuer en vertu du Contrat. + + + 5.2 DROIT D'APPORTER DES CONTRIBUTIONS + +Le droit d'apporter des Contributions comporte le droit de traduire, +d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel +et le droit de reproduire le logiciel en résultant. + +Le Licencié est autorisé à apporter toute Contribution au Logiciel sous +réserve de mentionner, de façon explicite, son nom en tant qu'auteur de +cette Contribution et la date de création de celle-ci. + + + 5.3 DROIT DE DISTRIBUTION + +Le droit de distribution comporte notamment le droit de diffuser, de +transmettre et de communiquer le Logiciel au public sur tout support et +par tout moyen ainsi que le droit de mettre sur le marché à titre +onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. + +Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou +non, à des tiers dans les conditions ci-après détaillées. + + + 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION + +Le Licencié est autorisé à distribuer des copies conformes du Logiciel, +sous forme de Code Source ou de Code Objet, à condition que cette +distribution respecte les dispositions du Contrat dans leur totalité et +soit accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le Code Objet du Logiciel est redistribué, +le Licencié permette aux futurs Licenciés d'accéder facilement au Code +Source complet du Logiciel en indiquant les modalités d'accès, étant +entendu que le coût additionnel d'acquisition du Code Source ne devra +pas excéder le simple coût de transfert des données. + + + 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE + +Lorsque le Licencié apporte une Contribution au Logiciel, les conditions +de distribution du Logiciel Modifié en résultant sont alors soumises à +l'intégralité des dispositions du Contrat. + +Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de +code source ou de code objet, à condition que cette distribution +respecte les dispositions du Contrat dans leur totalité et soit +accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le code objet du Logiciel Modifié est +redistribué, le Licencié permette aux futurs Licenciés d'accéder +facilement au code source complet du Logiciel Modifié en indiquant les +modalités d'accès, étant entendu que le coût additionnel d'acquisition +du code source ne devra pas excéder le simple coût de transfert des données. + + + 5.3.3 DISTRIBUTION DES MODULES EXTERNES + +Lorsque le Licencié a développé un Module Externe les conditions du +Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué +sous un contrat de licence différent. + + + 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL + +Le Licencié peut inclure un code soumis aux dispositions d'une des +versions de la licence GNU GPL dans le Logiciel modifié ou non et +distribuer l'ensemble sous les conditions de la même version de la +licence GNU GPL. + +Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis +aux dispositions d'une des versions de la licence GNU GPL et distribuer +l'ensemble sous les conditions de la même version de la licence GNU GPL. + + + Article 6 - PROPRIETE INTELLECTUELLE + + + 6.1 SUR LE LOGICIEL INITIAL + +Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel +Initial. Toute utilisation du Logiciel Initial est soumise au respect +des conditions dans lesquelles le Titulaire a choisi de diffuser son +oeuvre et nul autre n'a la faculté de modifier les conditions de +diffusion de ce Logiciel Initial. + +Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi +par le Contrat et ce, pour la durée visée à l'article 4.2. + + + 6.2 SUR LES CONTRIBUTIONS + +Le Licencié qui a développé une Contribution est titulaire sur celle-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable. + + + 6.3 SUR LES MODULES EXTERNES + +Le Licencié qui a développé un Module Externe est titulaire sur celui-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable et reste libre du choix du contrat régissant +sa diffusion. + + + 6.4 DISPOSITIONS COMMUNES + +Le Licencié s'engage expressément: + + 1. à ne pas supprimer ou modifier de quelque manière que ce soit les + mentions de propriété intellectuelle apposées sur le Logiciel; + + 2. à reproduire à l'identique lesdites mentions de propriété + intellectuelle sur les copies du Logiciel modifié ou non. + +Le Licencié s'engage à ne pas porter atteinte, directement ou +indirectement, aux droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs sur le Logiciel et à prendre, le cas échéant, à +l'égard de son personnel toutes les mesures nécessaires pour assurer le +respect des dits droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs. + + + Article 7 - SERVICES ASSOCIES + +7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de +prestations d'assistance technique ou de maintenance du Logiciel. + +Cependant le Concédant reste libre de proposer ce type de services. Les +termes et conditions d'une telle assistance technique et/ou d'une telle +maintenance seront alors déterminés dans un acte séparé. Ces actes de +maintenance et/ou assistance technique n'engageront que la seule +responsabilité du Concédant qui les propose. + +7.2 De même, tout Concédant est libre de proposer, sous sa seule +responsabilité, à ses licenciés une garantie, qui n'engagera que lui, +lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, +dans les conditions qu'il souhaite. Cette garantie et les modalités +financières de son application feront l'objet d'un acte séparé entre le +Concédant et le Licencié. + + + Article 8 - RESPONSABILITE + +8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la +faculté, sous réserve de prouver la faute du Concédant concerné, de +solliciter la réparation du préjudice direct qu'il subirait du fait du +Logiciel et dont il apportera la preuve. + +8.2 La responsabilité du Concédant est limitée aux engagements pris en +application du Contrat et ne saurait être engagée en raison notamment: +(i) des dommages dus à l'inexécution, totale ou partielle, de ses +obligations par le Licencié, (ii) des dommages directs ou indirects +découlant de l'utilisation ou des performances du Logiciel subis par le +Licencié et (iii) plus généralement d'un quelconque dommage indirect. En +particulier, les Parties conviennent expressément que tout préjudice +financier ou commercial (par exemple perte de données, perte de +bénéfices, perte d'exploitation, perte de clientèle ou de commandes, +manque à gagner, trouble commercial quelconque) ou toute action dirigée +contre le Licencié par un tiers, constitue un dommage indirect et +n'ouvre pas droit à réparation par le Concédant. + + + Article 9 - GARANTIE + +9.1 Le Licencié reconnaît que l'état actuel des connaissances +scientifiques et techniques au moment de la mise en circulation du +Logiciel ne permet pas d'en tester et d'en vérifier toutes les +utilisations ni de détecter l'existence d'éventuels défauts. L'attention +du Licencié a été attirée sur ce point sur les risques associés au +chargement, à l'utilisation, la modification et/ou au développement et à +la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. + +Il relève de la responsabilité du Licencié de contrôler, par tous +moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et +de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. + +9.2 Le Concédant déclare de bonne foi être en droit de concéder +l'ensemble des droits attachés au Logiciel (comprenant notamment les +droits visés à l'article 5). + +9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le +Concédant sans autre garantie, expresse ou tacite, que celle prévue à +l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, +son caractère sécurisé, innovant ou pertinent. + +En particulier, le Concédant ne garantit pas que le Logiciel est exempt +d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible +avec l'équipement du Licencié et sa configuration logicielle ni qu'il +remplira les besoins du Licencié. + +9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le +Logiciel ne porte pas atteinte à un quelconque droit de propriété +intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout +autre droit de propriété. Ainsi, le Concédant exclut toute garantie au +profit du Licencié contre les actions en contrefaçon qui pourraient être +diligentées au titre de l'utilisation, de la modification, et de la +redistribution du Logiciel. Néanmoins, si de telles actions sont +exercées contre le Licencié, le Concédant lui apportera son aide +technique et juridique pour sa défense. Cette aide technique et +juridique est déterminée au cas par cas entre le Concédant concerné et +le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage +toute responsabilité quant à l'utilisation de la dénomination du +Logiciel par le Licencié. Aucune garantie n'est apportée quant à +l'existence de droits antérieurs sur le nom du Logiciel et sur +l'existence d'une marque. + + + Article 10 - RESILIATION + +10.1 En cas de manquement par le Licencié aux obligations mises à sa +charge par le Contrat, le Concédant pourra résilier de plein droit le +Contrat trente (30) jours après notification adressée au Licencié et +restée sans effet. + +10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à +utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les +licences qu'il aura concédées antérieurement à la résiliation du Contrat +resteront valides sous réserve qu'elles aient été effectuées en +conformité avec le Contrat. + + + Article 11 - DISPOSITIONS DIVERSES + + + 11.1 CAUSE EXTERIEURE + +Aucune des Parties ne sera responsable d'un retard ou d'une défaillance +d'exécution du Contrat qui serait dû à un cas de force majeure, un cas +fortuit ou une cause extérieure, telle que, notamment, le mauvais +fonctionnement ou les interruptions du réseau électrique ou de +télécommunication, la paralysie du réseau liée à une attaque +informatique, l'intervention des autorités gouvernementales, les +catastrophes naturelles, les dégâts des eaux, les tremblements de terre, +le feu, les explosions, les grèves et les conflits sociaux, l'état de +guerre... + +11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou +plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du +Contrat, ne pourra en aucun cas impliquer renonciation par la Partie +intéressée à s'en prévaloir ultérieurement. + +11.3 Le Contrat annule et remplace toute convention antérieure, écrite +ou orale, entre les Parties sur le même objet et constitue l'accord +entier entre les Parties sur cet objet. Aucune addition ou modification +aux termes du Contrat n'aura d'effet à l'égard des Parties à moins +d'être faite par écrit et signée par leurs représentants dûment habilités. + +11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat +s'avèrerait contraire à une loi ou à un texte applicable, existants ou +futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les +amendements nécessaires pour se conformer à cette loi ou à ce texte. +Toutes les autres dispositions resteront en vigueur. De même, la +nullité, pour quelque raison que ce soit, d'une des dispositions du +Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. + + + 11.5 LANGUE + +Le Contrat est rédigé en langue française et en langue anglaise, ces +deux versions faisant également foi. + + + Article 12 - NOUVELLES VERSIONS DU CONTRAT + +12.1 Toute personne est autorisée à copier et distribuer des copies de +ce Contrat. + +12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé +et ne peut être modifié que par les auteurs de la licence, lesquels se +réservent le droit de publier périodiquement des mises à jour ou de +nouvelles versions du Contrat, qui posséderont chacune un numéro +distinct. Ces versions ultérieures seront susceptibles de prendre en +compte de nouvelles problématiques rencontrées par les logiciels libres. + +12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra +faire l'objet d'une diffusion ultérieure que sous la même version du +Contrat ou une version postérieure, sous réserve des dispositions de +l'article 5.3.4. + + + Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE + +13.1 Le Contrat est régi par la loi française. Les Parties conviennent +de tenter de régler à l'amiable les différends ou litiges qui +viendraient à se produire par suite ou à l'occasion du Contrat. + +13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter +de leur survenance et sauf situation relevant d'une procédure d'urgence, +les différends ou litiges seront portés par la Partie la plus diligente +devant les Tribunaux compétents de Paris. + + +Version 2.0 du 2006-09-05. diff --git a/smp/LICENSE b/smp/LICENSE new file mode 100644 index 000000000..b7f1e4658 --- /dev/null +++ b/smp/LICENSE @@ -0,0 +1,1018 @@ +CeCILL FREE SOFTWARE LICENSE AGREEMENT + + Notice + +This Agreement is a Free Software license agreement that is the result +of discussions between its authors in order to ensure compliance with +the two main principles guiding its drafting: + + * firstly, compliance with the principles governing the distribution + of Free Software: access to source code, broad rights granted to + users, + * secondly, the election of a governing law, French law, with which + it is conformant, both as regards the law of torts and + intellectual property law, and the protection that it offers to + both authors and holders of the economic rights over software. + +The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) +license are: + +Commissariat à l'Energie Atomique - CEA, a public scientific, technical +and industrial research establishment, having its principal place of +business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. + +Centre National de la Recherche Scientifique - CNRS, a public scientific +and technological establishment, having its principal place of business +at 3 rue Michel-Ange, 75794 Paris cedex 16, France. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, a public scientific and technological establishment, having its +principal place of business at Domaine de Voluceau, Rocquencourt, BP +105, 78153 Le Chesnay cedex, France. + + + Preamble + +The purpose of this Free Software license agreement is to grant users +the right to modify and redistribute the software governed by this +license within the framework of an open source distribution model. + +The exercising of these rights is conditional upon certain obligations +for users so as to preserve this status for all subsequent redistributions. + +In consideration of access to the source code and the rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors only have limited liability. + +In this respect, the risks associated with loading, using, modifying +and/or developing or reproducing the software by the user are brought to +the user's attention, given its Free Software status, which may make it +complicated to use, with the result that its use is reserved for +developers and experienced professionals having in-depth computer +knowledge. Users are therefore encouraged to load and test the +suitability of the software as regards their requirements in conditions +enabling the security of their systems and/or data to be ensured and, +more generally, to use and operate it in the same conditions of +security. This Agreement may be freely reproduced and published, +provided it is not altered, and that no provisions are either added or +removed herefrom. + +This Agreement may apply to any or all software for which the holder of +the economic rights decides to submit the use thereof to its provisions. + + + Article 1 - DEFINITIONS + +For the purpose of this Agreement, when the following expressions +commence with a capital letter, they shall have the following meaning: + +Agreement: means this license agreement, and its possible subsequent +versions and annexes. + +Software: means the software in its Object Code and/or Source Code form +and, where applicable, its documentation, "as is" when the Licensee +accepts the Agreement. + +Initial Software: means the Software in its Source Code and possibly its +Object Code form and, where applicable, its documentation, "as is" when +it is first distributed under the terms and conditions of the Agreement. + +Modified Software: means the Software modified by at least one +Contribution. + +Source Code: means all the Software's instructions and program lines to +which access is required so as to modify the Software. + +Object Code: means the binary files originating from the compilation of +the Source Code. + +Holder: means the holder(s) of the economic rights over the Initial +Software. + +Licensee: means the Software user(s) having accepted the Agreement. + +Contributor: means a Licensee having made at least one Contribution. + +Licensor: means the Holder, or any other individual or legal entity, who +distributes the Software under the Agreement. + +Contribution: means any or all modifications, corrections, translations, +adaptations and/or new functions integrated into the Software by any or +all Contributors, as well as any or all Internal Modules. + +Module: means a set of sources files including their documentation that +enables supplementary functions or services in addition to those offered +by the Software. + +External Module: means any or all Modules, not derived from the +Software, so that this Module and the Software run in separate address +spaces, with one calling the other when they are run. + +Internal Module: means any or all Module, connected to the Software so +that they both execute in the same address space. + +GNU GPL: means the GNU General Public License version 2 or any +subsequent version, as published by the Free Software Foundation Inc. + +Parties: mean both the Licensee and the Licensor. + +These expressions may be used both in singular and plural form. + + + Article 2 - PURPOSE + +The purpose of the Agreement is the grant by the Licensor to the +Licensee of a non-exclusive, transferable and worldwide license for the +Software as set forth in Article 5 hereinafter for the whole term of the +protection granted by the rights over said Software. + + + Article 3 - ACCEPTANCE + +3.1 The Licensee shall be deemed as having accepted the terms and +conditions of this Agreement upon the occurrence of the first of the +following events: + + * (i) loading the Software by any or all means, notably, by + downloading from a remote server, or by loading from a physical + medium; + * (ii) the first time the Licensee exercises any of the rights + granted hereunder. + +3.2 One copy of the Agreement, containing a notice relating to the +characteristics of the Software, to the limited warranty, and to the +fact that its use is restricted to experienced users has been provided +to the Licensee prior to its acceptance as set forth in Article 3.1 +hereinabove, and the Licensee hereby acknowledges that it has read and +understood it. + + + Article 4 - EFFECTIVE DATE AND TERM + + + 4.1 EFFECTIVE DATE + +The Agreement shall become effective on the date when it is accepted by +the Licensee as set forth in Article 3.1. + + + 4.2 TERM + +The Agreement shall remain in force for the entire legal term of +protection of the economic rights over the Software. + + + Article 5 - SCOPE OF RIGHTS GRANTED + +The Licensor hereby grants to the Licensee, who accepts, the following +rights over the Software for any or all use, and for the term of the +Agreement, on the basis of the terms and conditions set forth hereinafter. + +Besides, if the Licensor owns or comes to own one or more patents +protecting all or part of the functions of the Software or of its +components, the Licensor undertakes not to enforce the rights granted by +these patents against successive Licensees using, exploiting or +modifying the Software. If these patents are transferred, the Licensor +undertakes to have the transferees subscribe to the obligations set +forth in this paragraph. + + + 5.1 RIGHT OF USE + +The Licensee is authorized to use the Software, without any limitation +as to its fields of application, with it being hereinafter specified +that this comprises: + + 1. permanent or temporary reproduction of all or part of the Software + by any or all means and in any or all form. + + 2. loading, displaying, running, or storing the Software on any or + all medium. + + 3. entitlement to observe, study or test its operation so as to + determine the ideas and principles behind any or all constituent + elements of said Software. This shall apply when the Licensee + carries out any or all loading, displaying, running, transmission + or storage operation as regards the Software, that it is entitled + to carry out hereunder. + + + 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS + +The right to make Contributions includes the right to translate, adapt, +arrange, or make any or all modifications to the Software, and the right +to reproduce the resulting software. + +The Licensee is authorized to make any or all Contributions to the +Software provided that it includes an explicit notice that it is the +author of said Contribution and indicates the date of the creation thereof. + + + 5.3 RIGHT OF DISTRIBUTION + +In particular, the right of distribution includes the right to publish, +transmit and communicate the Software to the general public on any or +all medium, and by any or all means, and the right to market, either in +consideration of a fee, or free of charge, one or more copies of the +Software by any means. + +The Licensee is further authorized to distribute copies of the modified +or unmodified Software to third parties according to the terms and +conditions set forth hereinafter. + + + 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION + +The Licensee is authorized to distribute true copies of the Software in +Source Code or Object Code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the Object Code of the Software is +redistributed, the Licensee allows future Licensees unhindered access to +the full Source Code of the Software by indicating how to access it, it +being understood that the additional cost of acquiring the Source Code +shall not exceed the cost of transferring the data. + + + 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE + +When the Licensee makes a Contribution to the Software, the terms and +conditions for the distribution of the resulting Modified Software +become subject to all the provisions of this Agreement. + +The Licensee is authorized to distribute the Modified Software, in +source code or object code form, provided that said distribution +complies with all the provisions of the Agreement and is accompanied by: + + 1. a copy of the Agreement, + + 2. a notice relating to the limitation of both the Licensor's + warranty and liability as set forth in Articles 8 and 9, + +and that, in the event that only the object code of the Modified +Software is redistributed, the Licensee allows future Licensees +unhindered access to the full source code of the Modified Software by +indicating how to access it, it being understood that the additional +cost of acquiring the source code shall not exceed the cost of +transferring the data. + + + 5.3.3 DISTRIBUTION OF EXTERNAL MODULES + +When the Licensee has developed an External Module, the terms and +conditions of this Agreement do not apply to said External Module, that +may be distributed under a separate license agreement. + + + 5.3.4 COMPATIBILITY WITH THE GNU GPL + +The Licensee can include a code that is subject to the provisions of one +of the versions of the GNU GPL in the Modified or unmodified Software, +and distribute that entire code under the terms of the same version of +the GNU GPL. + +The Licensee can include the Modified or unmodified Software in a code +that is subject to the provisions of one of the versions of the GNU GPL, +and distribute that entire code under the terms of the same version of +the GNU GPL. + + + Article 6 - INTELLECTUAL PROPERTY + + + 6.1 OVER THE INITIAL SOFTWARE + +The Holder owns the economic rights over the Initial Software. Any or +all use of the Initial Software is subject to compliance with the terms +and conditions under which the Holder has elected to distribute its work +and no one shall be entitled to modify the terms and conditions for the +distribution of said Initial Software. + +The Holder undertakes that the Initial Software will remain ruled at +least by this Agreement, for the duration set forth in Article 4.2. + + + 6.2 OVER THE CONTRIBUTIONS + +The Licensee who develops a Contribution is the owner of the +intellectual property rights over this Contribution as defined by +applicable law. + + + 6.3 OVER THE EXTERNAL MODULES + +The Licensee who develops an External Module is the owner of the +intellectual property rights over this External Module as defined by +applicable law and is free to choose the type of agreement that shall +govern its distribution. + + + 6.4 JOINT PROVISIONS + +The Licensee expressly undertakes: + + 1. not to remove, or modify, in any manner, the intellectual property + notices attached to the Software; + + 2. to reproduce said notices, in an identical manner, in the copies + of the Software modified or not. + +The Licensee undertakes not to directly or indirectly infringe the +intellectual property rights of the Holder and/or Contributors on the +Software and to take, where applicable, vis-à-vis its staff, any and all +measures required to ensure respect of said intellectual property rights +of the Holder and/or Contributors. + + + Article 7 - RELATED SERVICES + +7.1 Under no circumstances shall the Agreement oblige the Licensor to +provide technical assistance or maintenance services for the Software. + +However, the Licensor is entitled to offer this type of services. The +terms and conditions of such technical assistance, and/or such +maintenance, shall be set forth in a separate instrument. Only the +Licensor offering said maintenance and/or technical assistance services +shall incur liability therefor. + +7.2 Similarly, any Licensor is entitled to offer to its licensees, under +its sole responsibility, a warranty, that shall only be binding upon +itself, for the redistribution of the Software and/or the Modified +Software, under terms and conditions that it is free to decide. Said +warranty, and the financial terms and conditions of its application, +shall be subject of a separate instrument executed between the Licensor +and the Licensee. + + + Article 8 - LIABILITY + +8.1 Subject to the provisions of Article 8.2, the Licensee shall be +entitled to claim compensation for any direct loss it may have suffered +from the Software as a result of a fault on the part of the relevant +Licensor, subject to providing evidence thereof. + +8.2 The Licensor's liability is limited to the commitments made under +this Agreement and shall not be incurred as a result of in particular: +(i) loss due the Licensee's total or partial failure to fulfill its +obligations, (ii) direct or consequential loss that is suffered by the +Licensee due to the use or performance of the Software, and (iii) more +generally, any consequential loss. In particular the Parties expressly +agree that any or all pecuniary or business loss (i.e. loss of data, +loss of profits, operating loss, loss of customers or orders, +opportunity cost, any disturbance to business activities) or any or all +legal proceedings instituted against the Licensee by a third party, +shall constitute consequential loss and shall not provide entitlement to +any or all compensation from the Licensor. + + + Article 9 - WARRANTY + +9.1 The Licensee acknowledges that the scientific and technical +state-of-the-art when the Software was distributed did not enable all +possible uses to be tested and verified, nor for the presence of +possible defects to be detected. In this respect, the Licensee's +attention has been drawn to the risks associated with loading, using, +modifying and/or developing and reproducing the Software which are +reserved for experienced users. + +The Licensee shall be responsible for verifying, by any or all means, +the suitability of the product for its requirements, its good working +order, and for ensuring that it shall not cause damage to either persons +or properties. + +9.2 The Licensor hereby represents, in good faith, that it is entitled +to grant all the rights over the Software (including in particular the +rights set forth in Article 5). + +9.3 The Licensee acknowledges that the Software is supplied "as is" by +the Licensor without any other express or tacit warranty, other than +that provided for in Article 9.2 and, in particular, without any warranty +as to its commercial value, its secured, safe, innovative or relevant +nature. + +Specifically, the Licensor does not warrant that the Software is free +from any error, that it will operate without interruption, that it will +be compatible with the Licensee's own equipment and software +configuration, nor that it will meet the Licensee's requirements. + +9.4 The Licensor does not either expressly or tacitly warrant that the +Software does not infringe any third party intellectual property right +relating to a patent, software or any other property right. Therefore, +the Licensor disclaims any and all liability towards the Licensee +arising out of any or all proceedings for infringement that may be +instituted in respect of the use, modification and redistribution of the +Software. Nevertheless, should such proceedings be instituted against +the Licensee, the Licensor shall provide it with technical and legal +assistance for its defense. Such technical and legal assistance shall be +decided on a case-by-case basis between the relevant Licensor and the +Licensee pursuant to a memorandum of understanding. The Licensor +disclaims any and all liability as regards the Licensee's use of the +name of the Software. No warranty is given as regards the existence of +prior rights over the name of the Software or as regards the existence +of a trademark. + + + Article 10 - TERMINATION + +10.1 In the event of a breach by the Licensee of its obligations +hereunder, the Licensor may automatically terminate this Agreement +thirty (30) days after notice has been sent to the Licensee and has +remained ineffective. + +10.2 A Licensee whose Agreement is terminated shall no longer be +authorized to use, modify or distribute the Software. However, any +licenses that it may have granted prior to termination of the Agreement +shall remain valid subject to their having been granted in compliance +with the terms and conditions hereof. + + + Article 11 - MISCELLANEOUS + + + 11.1 EXCUSABLE EVENTS + +Neither Party shall be liable for any or all delay, or failure to +perform the Agreement, that may be attributable to an event of force +majeure, an act of God or an outside cause, such as defective +functioning or interruptions of the electricity or telecommunications +networks, network paralysis following a virus attack, intervention by +government authorities, natural disasters, water damage, earthquakes, +fire, explosions, strikes and labor unrest, war, etc. + +11.2 Any failure by either Party, on one or more occasions, to invoke +one or more of the provisions hereof, shall under no circumstances be +interpreted as being a waiver by the interested Party of its right to +invoke said provision(s) subsequently. + +11.3 The Agreement cancels and replaces any or all previous agreements, +whether written or oral, between the Parties and having the same +purpose, and constitutes the entirety of the agreement between said +Parties concerning said purpose. No supplement or modification to the +terms and conditions hereof shall be effective as between the Parties +unless it is made in writing and signed by their duly authorized +representatives. + +11.4 In the event that one or more of the provisions hereof were to +conflict with a current or future applicable act or legislative text, +said act or legislative text shall prevail, and the Parties shall make +the necessary amendments so as to comply with said act or legislative +text. All other provisions shall remain effective. Similarly, invalidity +of a provision of the Agreement, for any reason whatsoever, shall not +cause the Agreement as a whole to be invalid. + + + 11.5 LANGUAGE + +The Agreement is drafted in both French and English and both versions +are deemed authentic. + + + Article 12 - NEW VERSIONS OF THE AGREEMENT + +12.1 Any person is authorized to duplicate and distribute copies of this +Agreement. + +12.2 So as to ensure coherence, the wording of this Agreement is +protected and may only be modified by the authors of the License, who +reserve the right to periodically publish updates or new versions of the +Agreement, each with a separate number. These subsequent versions may +address new issues encountered by Free Software. + +12.3 Any Software distributed under a given version of the Agreement may +only be subsequently distributed under the same version of the Agreement +or a subsequent version, subject to the provisions of Article 5.3.4. + + + Article 13 - GOVERNING LAW AND JURISDICTION + +13.1 The Agreement is governed by French law. The Parties agree to +endeavor to seek an amicable solution to any disagreements or disputes +that may arise during the performance of the Agreement. + +13.2 Failing an amicable solution within two (2) months as from their +occurrence, and unless emergency proceedings are necessary, the +disagreements or disputes shall be referred to the Paris Courts having +jurisdiction, by the more diligent Party. + + +Version 2.0 dated 2006-09-05. + +------------------------------------------------------------------------------ + +CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL + + + Avertissement + +Ce contrat est une licence de logiciel libre issue d'une concertation +entre ses auteurs afin que le respect de deux grands principes préside à +sa rédaction: + + * d'une part, le respect des principes de diffusion des logiciels + libres: accès au code source, droits étendus conférés aux + utilisateurs, + * d'autre part, la désignation d'un droit applicable, le droit + français, auquel elle est conforme, tant au regard du droit de la + responsabilité civile que du droit de la propriété intellectuelle + et de la protection qu'il offre aux auteurs et titulaires des + droits patrimoniaux sur un logiciel. + +Les auteurs de la licence CeCILL (pour Ce[a] C[nrs] I[nria] L[ogiciel] +L[ibre]) sont: + +Commissariat à l'Energie Atomique - CEA, établissement public de +recherche à caractère scientifique, technique et industriel, dont le +siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. + +Centre National de la Recherche Scientifique - CNRS, établissement +public à caractère scientifique et technologique, dont le siège est +situé 3 rue Michel-Ange, 75794 Paris cedex 16. + +Institut National de Recherche en Informatique et en Automatique - +INRIA, établissement public à caractère scientifique et technologique, +dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153 +Le Chesnay cedex. + + + Préambule + +Ce contrat est une licence de logiciel libre dont l'objectif est de +conférer aux utilisateurs la liberté de modification et de +redistribution du logiciel régi par cette licence dans le cadre d'un +modèle de diffusion en logiciel libre. + +L'exercice de ces libertés est assorti de certains devoirs à la charge +des utilisateurs afin de préserver ce statut au cours des +redistributions ultérieures. + +L'accessibilité au code source et les droits de copie, de modification +et de redistribution qui en découlent ont pour contrepartie de n'offrir +aux utilisateurs qu'une garantie limitée et de ne faire peser sur +l'auteur du logiciel, le titulaire des droits patrimoniaux et les +concédants successifs qu'une responsabilité restreinte. + +A cet égard l'attention de l'utilisateur est attirée sur les risques +associés au chargement, à l'utilisation, à la modification et/ou au +développement et à la reproduction du logiciel par l'utilisateur étant +donné sa spécificité de logiciel libre, qui peut le rendre complexe à +manipuler et qui le réserve donc à des développeurs ou des +professionnels avertis possédant des connaissances informatiques +approfondies. Les utilisateurs sont donc invités à charger et tester +l'adéquation du logiciel à leurs besoins dans des conditions permettant +d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus +généralement, à l'utiliser et l'exploiter dans les mêmes conditions de +sécurité. Ce contrat peut être reproduit et diffusé librement, sous +réserve de le conserver en l'état, sans ajout ni suppression de clauses. + +Ce contrat est susceptible de s'appliquer à tout logiciel dont le +titulaire des droits patrimoniaux décide de soumettre l'exploitation aux +dispositions qu'il contient. + + + Article 1 - DEFINITIONS + +Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une +lettre capitale, auront la signification suivante: + +Contrat: désigne le présent contrat de licence, ses éventuelles versions +postérieures et annexes. + +Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code +Source et le cas échéant sa documentation, dans leur état au moment de +l'acceptation du Contrat par le Licencié. + +Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et +éventuellement de Code Objet et le cas échéant sa documentation, dans +leur état au moment de leur première diffusion sous les termes du Contrat. + +Logiciel Modifié: désigne le Logiciel modifié par au moins une +Contribution. + +Code Source: désigne l'ensemble des instructions et des lignes de +programme du Logiciel et auquel l'accès est nécessaire en vue de +modifier le Logiciel. + +Code Objet: désigne les fichiers binaires issus de la compilation du +Code Source. + +Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur +sur le Logiciel Initial. + +Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le +Contrat. + +Contributeur: désigne le Licencié auteur d'au moins une Contribution. + +Concédant: désigne le Titulaire ou toute personne physique ou morale +distribuant le Logiciel sous le Contrat. + +Contribution: désigne l'ensemble des modifications, corrections, +traductions, adaptations et/ou nouvelles fonctionnalités intégrées dans +le Logiciel par tout Contributeur, ainsi que tout Module Interne. + +Module: désigne un ensemble de fichiers sources y compris leur +documentation qui permet de réaliser des fonctionnalités ou services +supplémentaires à ceux fournis par le Logiciel. + +Module Externe: désigne tout Module, non dérivé du Logiciel, tel que ce +Module et le Logiciel s'exécutent dans des espaces d'adressage +différents, l'un appelant l'autre au moment de leur exécution. + +Module Interne: désigne tout Module lié au Logiciel de telle sorte +qu'ils s'exécutent dans le même espace d'adressage. + +GNU GPL: désigne la GNU General Public License dans sa version 2 ou +toute version ultérieure, telle que publiée par Free Software Foundation +Inc. + +Parties: désigne collectivement le Licencié et le Concédant. + +Ces termes s'entendent au singulier comme au pluriel. + + + Article 2 - OBJET + +Le Contrat a pour objet la concession par le Concédant au Licencié d'une +licence non exclusive, cessible et mondiale du Logiciel telle que +définie ci-après à l'article 5 pour toute la durée de protection des droits +portant sur ce Logiciel. + + + Article 3 - ACCEPTATION + +3.1 L'acceptation par le Licencié des termes du Contrat est réputée +acquise du fait du premier des faits suivants: + + * (i) le chargement du Logiciel par tout moyen notamment par + téléchargement à partir d'un serveur distant ou par chargement à + partir d'un support physique; + * (ii) le premier exercice par le Licencié de l'un quelconque des + droits concédés par le Contrat. + +3.2 Un exemplaire du Contrat, contenant notamment un avertissement +relatif aux spécificités du Logiciel, à la restriction de garantie et à +la limitation à un usage par des utilisateurs expérimentés a été mis à +disposition du Licencié préalablement à son acceptation telle que +définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris +connaissance. + + + Article 4 - ENTREE EN VIGUEUR ET DUREE + + + 4.1 ENTREE EN VIGUEUR + +Le Contrat entre en vigueur à la date de son acceptation par le Licencié +telle que définie en 3.1. + + + 4.2 DUREE + +Le Contrat produira ses effets pendant toute la durée légale de +protection des droits patrimoniaux portant sur le Logiciel. + + + Article 5 - ETENDUE DES DROITS CONCEDES + +Le Concédant concède au Licencié, qui accepte, les droits suivants sur +le Logiciel pour toutes destinations et pour la durée du Contrat dans +les conditions ci-après détaillées. + +Par ailleurs, si le Concédant détient ou venait à détenir un ou +plusieurs brevets d'invention protégeant tout ou partie des +fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas +opposer les éventuels droits conférés par ces brevets aux Licenciés +successifs qui utiliseraient, exploiteraient ou modifieraient le +Logiciel. En cas de cession de ces brevets, le Concédant s'engage à +faire reprendre les obligations du présent alinéa aux cessionnaires. + + + 5.1 DROIT D'UTILISATION + +Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant +aux domaines d'application, étant ci-après précisé que cela comporte: + + 1. la reproduction permanente ou provisoire du Logiciel en tout ou + partie par tout moyen et sous toute forme. + + 2. le chargement, l'affichage, l'exécution, ou le stockage du + Logiciel sur tout support. + + 3. la possibilité d'en observer, d'en étudier, ou d'en tester le + fonctionnement afin de déterminer les idées et principes qui sont + à la base de n'importe quel élément de ce Logiciel; et ceci, + lorsque le Licencié effectue toute opération de chargement, + d'affichage, d'exécution, de transmission ou de stockage du + Logiciel qu'il est en droit d'effectuer en vertu du Contrat. + + + 5.2 DROIT D'APPORTER DES CONTRIBUTIONS + +Le droit d'apporter des Contributions comporte le droit de traduire, +d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel +et le droit de reproduire le logiciel en résultant. + +Le Licencié est autorisé à apporter toute Contribution au Logiciel sous +réserve de mentionner, de façon explicite, son nom en tant qu'auteur de +cette Contribution et la date de création de celle-ci. + + + 5.3 DROIT DE DISTRIBUTION + +Le droit de distribution comporte notamment le droit de diffuser, de +transmettre et de communiquer le Logiciel au public sur tout support et +par tout moyen ainsi que le droit de mettre sur le marché à titre +onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé. + +Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou +non, à des tiers dans les conditions ci-après détaillées. + + + 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION + +Le Licencié est autorisé à distribuer des copies conformes du Logiciel, +sous forme de Code Source ou de Code Objet, à condition que cette +distribution respecte les dispositions du Contrat dans leur totalité et +soit accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le Code Objet du Logiciel est redistribué, +le Licencié permette aux futurs Licenciés d'accéder facilement au Code +Source complet du Logiciel en indiquant les modalités d'accès, étant +entendu que le coût additionnel d'acquisition du Code Source ne devra +pas excéder le simple coût de transfert des données. + + + 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE + +Lorsque le Licencié apporte une Contribution au Logiciel, les conditions +de distribution du Logiciel Modifié en résultant sont alors soumises à +l'intégralité des dispositions du Contrat. + +Le Licencié est autorisé à distribuer le Logiciel Modifié, sous forme de +code source ou de code objet, à condition que cette distribution +respecte les dispositions du Contrat dans leur totalité et soit +accompagnée: + + 1. d'un exemplaire du Contrat, + + 2. d'un avertissement relatif à la restriction de garantie et de + responsabilité du Concédant telle que prévue aux articles 8 + et 9, + +et que, dans le cas où seul le code objet du Logiciel Modifié est +redistribué, le Licencié permette aux futurs Licenciés d'accéder +facilement au code source complet du Logiciel Modifié en indiquant les +modalités d'accès, étant entendu que le coût additionnel d'acquisition +du code source ne devra pas excéder le simple coût de transfert des données. + + + 5.3.3 DISTRIBUTION DES MODULES EXTERNES + +Lorsque le Licencié a développé un Module Externe les conditions du +Contrat ne s'appliquent pas à ce Module Externe, qui peut être distribué +sous un contrat de licence différent. + + + 5.3.4 COMPATIBILITE AVEC LA LICENCE GNU GPL + +Le Licencié peut inclure un code soumis aux dispositions d'une des +versions de la licence GNU GPL dans le Logiciel modifié ou non et +distribuer l'ensemble sous les conditions de la même version de la +licence GNU GPL. + +Le Licencié peut inclure le Logiciel modifié ou non dans un code soumis +aux dispositions d'une des versions de la licence GNU GPL et distribuer +l'ensemble sous les conditions de la même version de la licence GNU GPL. + + + Article 6 - PROPRIETE INTELLECTUELLE + + + 6.1 SUR LE LOGICIEL INITIAL + +Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel +Initial. Toute utilisation du Logiciel Initial est soumise au respect +des conditions dans lesquelles le Titulaire a choisi de diffuser son +oeuvre et nul autre n'a la faculté de modifier les conditions de +diffusion de ce Logiciel Initial. + +Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi +par le Contrat et ce, pour la durée visée à l'article 4.2. + + + 6.2 SUR LES CONTRIBUTIONS + +Le Licencié qui a développé une Contribution est titulaire sur celle-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable. + + + 6.3 SUR LES MODULES EXTERNES + +Le Licencié qui a développé un Module Externe est titulaire sur celui-ci +des droits de propriété intellectuelle dans les conditions définies par +la législation applicable et reste libre du choix du contrat régissant +sa diffusion. + + + 6.4 DISPOSITIONS COMMUNES + +Le Licencié s'engage expressément: + + 1. à ne pas supprimer ou modifier de quelque manière que ce soit les + mentions de propriété intellectuelle apposées sur le Logiciel; + + 2. à reproduire à l'identique lesdites mentions de propriété + intellectuelle sur les copies du Logiciel modifié ou non. + +Le Licencié s'engage à ne pas porter atteinte, directement ou +indirectement, aux droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs sur le Logiciel et à prendre, le cas échéant, à +l'égard de son personnel toutes les mesures nécessaires pour assurer le +respect des dits droits de propriété intellectuelle du Titulaire et/ou +des Contributeurs. + + + Article 7 - SERVICES ASSOCIES + +7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de +prestations d'assistance technique ou de maintenance du Logiciel. + +Cependant le Concédant reste libre de proposer ce type de services. Les +termes et conditions d'une telle assistance technique et/ou d'une telle +maintenance seront alors déterminés dans un acte séparé. Ces actes de +maintenance et/ou assistance technique n'engageront que la seule +responsabilité du Concédant qui les propose. + +7.2 De même, tout Concédant est libre de proposer, sous sa seule +responsabilité, à ses licenciés une garantie, qui n'engagera que lui, +lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce, +dans les conditions qu'il souhaite. Cette garantie et les modalités +financières de son application feront l'objet d'un acte séparé entre le +Concédant et le Licencié. + + + Article 8 - RESPONSABILITE + +8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la +faculté, sous réserve de prouver la faute du Concédant concerné, de +solliciter la réparation du préjudice direct qu'il subirait du fait du +Logiciel et dont il apportera la preuve. + +8.2 La responsabilité du Concédant est limitée aux engagements pris en +application du Contrat et ne saurait être engagée en raison notamment: +(i) des dommages dus à l'inexécution, totale ou partielle, de ses +obligations par le Licencié, (ii) des dommages directs ou indirects +découlant de l'utilisation ou des performances du Logiciel subis par le +Licencié et (iii) plus généralement d'un quelconque dommage indirect. En +particulier, les Parties conviennent expressément que tout préjudice +financier ou commercial (par exemple perte de données, perte de +bénéfices, perte d'exploitation, perte de clientèle ou de commandes, +manque à gagner, trouble commercial quelconque) ou toute action dirigée +contre le Licencié par un tiers, constitue un dommage indirect et +n'ouvre pas droit à réparation par le Concédant. + + + Article 9 - GARANTIE + +9.1 Le Licencié reconnaît que l'état actuel des connaissances +scientifiques et techniques au moment de la mise en circulation du +Logiciel ne permet pas d'en tester et d'en vérifier toutes les +utilisations ni de détecter l'existence d'éventuels défauts. L'attention +du Licencié a été attirée sur ce point sur les risques associés au +chargement, à l'utilisation, la modification et/ou au développement et à +la reproduction du Logiciel qui sont réservés à des utilisateurs avertis. + +Il relève de la responsabilité du Licencié de contrôler, par tous +moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et +de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. + +9.2 Le Concédant déclare de bonne foi être en droit de concéder +l'ensemble des droits attachés au Logiciel (comprenant notamment les +droits visés à l'article 5). + +9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le +Concédant sans autre garantie, expresse ou tacite, que celle prévue à +l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, +son caractère sécurisé, innovant ou pertinent. + +En particulier, le Concédant ne garantit pas que le Logiciel est exempt +d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible +avec l'équipement du Licencié et sa configuration logicielle ni qu'il +remplira les besoins du Licencié. + +9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le +Logiciel ne porte pas atteinte à un quelconque droit de propriété +intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout +autre droit de propriété. Ainsi, le Concédant exclut toute garantie au +profit du Licencié contre les actions en contrefaçon qui pourraient être +diligentées au titre de l'utilisation, de la modification, et de la +redistribution du Logiciel. Néanmoins, si de telles actions sont +exercées contre le Licencié, le Concédant lui apportera son aide +technique et juridique pour sa défense. Cette aide technique et +juridique est déterminée au cas par cas entre le Concédant concerné et +le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage +toute responsabilité quant à l'utilisation de la dénomination du +Logiciel par le Licencié. Aucune garantie n'est apportée quant à +l'existence de droits antérieurs sur le nom du Logiciel et sur +l'existence d'une marque. + + + Article 10 - RESILIATION + +10.1 En cas de manquement par le Licencié aux obligations mises à sa +charge par le Contrat, le Concédant pourra résilier de plein droit le +Contrat trente (30) jours après notification adressée au Licencié et +restée sans effet. + +10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à +utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les +licences qu'il aura concédées antérieurement à la résiliation du Contrat +resteront valides sous réserve qu'elles aient été effectuées en +conformité avec le Contrat. + + + Article 11 - DISPOSITIONS DIVERSES + + + 11.1 CAUSE EXTERIEURE + +Aucune des Parties ne sera responsable d'un retard ou d'une défaillance +d'exécution du Contrat qui serait dû à un cas de force majeure, un cas +fortuit ou une cause extérieure, telle que, notamment, le mauvais +fonctionnement ou les interruptions du réseau électrique ou de +télécommunication, la paralysie du réseau liée à une attaque +informatique, l'intervention des autorités gouvernementales, les +catastrophes naturelles, les dégâts des eaux, les tremblements de terre, +le feu, les explosions, les grèves et les conflits sociaux, l'état de +guerre... + +11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou +plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du +Contrat, ne pourra en aucun cas impliquer renonciation par la Partie +intéressée à s'en prévaloir ultérieurement. + +11.3 Le Contrat annule et remplace toute convention antérieure, écrite +ou orale, entre les Parties sur le même objet et constitue l'accord +entier entre les Parties sur cet objet. Aucune addition ou modification +aux termes du Contrat n'aura d'effet à l'égard des Parties à moins +d'être faite par écrit et signée par leurs représentants dûment habilités. + +11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat +s'avèrerait contraire à une loi ou à un texte applicable, existants ou +futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les +amendements nécessaires pour se conformer à cette loi ou à ce texte. +Toutes les autres dispositions resteront en vigueur. De même, la +nullité, pour quelque raison que ce soit, d'une des dispositions du +Contrat ne saurait entraîner la nullité de l'ensemble du Contrat. + + + 11.5 LANGUE + +Le Contrat est rédigé en langue française et en langue anglaise, ces +deux versions faisant également foi. + + + Article 12 - NOUVELLES VERSIONS DU CONTRAT + +12.1 Toute personne est autorisée à copier et distribuer des copies de +ce Contrat. + +12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé +et ne peut être modifié que par les auteurs de la licence, lesquels se +réservent le droit de publier périodiquement des mises à jour ou de +nouvelles versions du Contrat, qui posséderont chacune un numéro +distinct. Ces versions ultérieures seront susceptibles de prendre en +compte de nouvelles problématiques rencontrées par les logiciels libres. + +12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra +faire l'objet d'une diffusion ultérieure que sous la même version du +Contrat ou une version postérieure, sous réserve des dispositions de +l'article 5.3.4. + + + Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE + +13.1 Le Contrat est régi par la loi française. Les Parties conviennent +de tenter de régler à l'amiable les différends ou litiges qui +viendraient à se produire par suite ou à l'occasion du Contrat. + +13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter +de leur survenance et sauf situation relevant d'une procédure d'urgence, +les différends ou litiges seront portés par la Partie la plus diligente +devant les Tribunaux compétents de Paris. + + +Version 2.0 du 2006-09-05. From 104d5dc71787f27dc092a91025429a0c35d6f5ef Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 3 Nov 2021 16:56:23 +0100 Subject: [PATCH 017/113] fix signal management on MacOS --- eo/src/eoSIGContinue.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index a84440c72..727c74a01 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -32,7 +32,7 @@ #ifndef eoSIGContinue_h #define eoSIGContinue_h -#include +#include #include "eoContinue.h" /** @addtogroup Continuators @@ -51,6 +51,11 @@ template< class EOT> class eoSIGContinue: public eoContinue { public: + +#ifdef __APPLE__ // FIXME there should be a way to be more portable here + using sighandler_t = void (*)(int); +#endif + /// Ctor : installs the signal handler eoSIGContinue(int sig, sighandler_t fct) : _sig(sig), _fct(fct) From 00c6a8c4546efef5eb9787ccece81a7da82c06d0 Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 10 Nov 2021 09:37:21 +0100 Subject: [PATCH 018/113] change the chat address --- docs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index e93e5ee19..640d14813 100644 --- a/docs/index.html +++ b/docs/index.html @@ -30,7 +30,7 @@
  • Why choosing ?
  • Downloads
  • Git repository
  • -
  • Chat with us
  • +
  • Chat with us
  • @@ -236,7 +236,7 @@ answers is to send an email to paradiseo-help@lists.gforge.inria.fr. You can also consult the help archives, subscribe to our (low traffic) mailing-list or consult its archives.

    -

    Alternatively, you can join us on the official chatroom. You can try our webchat interface, or if you already use IRC, you can directly connect to the irc.freenode.org/#paradiseo multi-user chatroom with your favorite client.

    +

    Alternatively, you can join us on the official chatroom. You can try the online webchat app, or if you already use Element.io, you can directly connect to the #paradiseo:matrix.org multi-user chatroom with your favorite client.

    From 62d3b2f68fdd66b742fc3518c430ebd950c04850 Mon Sep 17 00:00:00 2001 From: Johann Dreo <75248710+jdreo@users.noreply.github.com> Date: Sat, 11 Dec 2021 18:14:16 +0100 Subject: [PATCH 019/113] Add a Github action --- .github/workflows/build_ubuntu_debug.yml | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/build_ubuntu_debug.yml diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml new file mode 100644 index 000000000..2b2c27835 --- /dev/null +++ b/.github/workflows/build_ubuntu_debug.yml @@ -0,0 +1,45 @@ +name: Build_Ubuntu_Debug + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12] + + steps: + - uses: actions/checkout@v2 + + - name: Install Dependencies + shell: bash + run: | + sudo apt-get install libeigen3-dev + + - name: Configure + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -EDO=ON -EDO_USE_LIB=Eigen3 -DENABLE_CMAKE_EXAMPLE=ON -DENABLE_CMAKE_TESTING=ON + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + From 069a05edc9ae8cce8d6eb3936c97291b4b4535d3 Mon Sep 17 00:00:00 2001 From: Johann Dreo <75248710+jdreo@users.noreply.github.com> Date: Sat, 11 Dec 2021 18:25:53 +0100 Subject: [PATCH 020/113] Fix ubuntu debug action --- .github/workflows/build_ubuntu_debug.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml index 2b2c27835..b2fa74830 100644 --- a/.github/workflows/build_ubuntu_debug.yml +++ b/.github/workflows/build_ubuntu_debug.yml @@ -1,4 +1,4 @@ -name: Build_Ubuntu_Debug +name: Build Debug (Ubuntu) on: push: @@ -31,7 +31,7 @@ jobs: - name: Configure # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -EDO=ON -EDO_USE_LIB=Eigen3 -DENABLE_CMAKE_EXAMPLE=ON -DENABLE_CMAKE_TESTING=ON + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEDO=ON -DEDO_USE_LIB=Eigen3 -DENABLE_CMAKE_EXAMPLE=ON -DENABLE_CMAKE_TESTING=ON - name: Build # Build your program with the given configuration From 75fd06abc1ab77a8dc9a9a592863dcf378634a4f Mon Sep 17 00:00:00 2001 From: Johann Dreo <75248710+jdreo@users.noreply.github.com> Date: Sat, 11 Dec 2021 21:25:17 +0100 Subject: [PATCH 021/113] fix missing dep in action --- .github/workflows/build_ubuntu_debug.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml index b2fa74830..d6d5cad4b 100644 --- a/.github/workflows/build_ubuntu_debug.yml +++ b/.github/workflows/build_ubuntu_debug.yml @@ -26,7 +26,7 @@ jobs: - name: Install Dependencies shell: bash run: | - sudo apt-get install libeigen3-dev + sudo apt-get install libeigen3-dev libboost-dev - name: Configure # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. From 00b66afcaac84b20c61df9b51c1c080e4eb76e21 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 4 Jan 2022 11:03:53 +0100 Subject: [PATCH 022/113] fix a missing update in fastga.sindef --- eo/contrib/irace/fastga.sindef | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eo/contrib/irace/fastga.sindef b/eo/contrib/irace/fastga.sindef index 86fa3e7cd..b27155ecf 100644 --- a/eo/contrib/irace/fastga.sindef +++ b/eo/contrib/irace/fastga.sindef @@ -1,9 +1,10 @@ -Bootstrap: library +https://github.com/drbild/json2yaml.gitBootstrap: library From: ubuntu:20.04 %post # Dependencies + apt -y update apt -y install software-properties-common add-apt-repository universe apt -y update From a96db239c465c5de432db2376b375f50fe2cf8c2 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 4 Jan 2022 11:04:11 +0100 Subject: [PATCH 023/113] update the doc index - get rid of several INRIA's gforge links - update the last reference --- docs/index.html | 70 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/docs/index.html b/docs/index.html index 640d14813..f64f8b94a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,8 +28,8 @@

    Shortcuts:

    @@ -125,9 +125,9 @@

    Download

    - Download the latest stable release. + Download the latest stable release. -

    Or clone the latest version: git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git

    +

    Or clone the latest version: git clone https://github.com/nojhan/paradiseo.git

    @@ -147,7 +147,9 @@

    Develop

    +

    To show you how does a code look, you will find here a minimal implementation of the popular CMA-ES algorithm.

    @@ -808,18 +810,32 @@
    • -

      The core EO module is described in the following scientific article: -

      M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer, - Evolving - objects: A general purpose evolutionary computation - library, Artificial Evolution, 2310, 829--888 (2002).
      +

      The latest state of the whole framework is introduced in the following article (see also the preprint): +

      Johann Dreo, Arnaud Liefooghe, Sébastien Verel, Marc Schoenauer, Juan J. Merelo, Alexandre Quemy, Benjamin Bouvier, and Jan Gmys, + Paradiseo: from a modular framework for evolutionary computation to the automated design of metaheuristics —22 years of Paradiseo—, GECCO'21: Proceedings of the Genetic and Evolutionary Computation Conference Companion, 1522–1530 (2021).

      - - + +
      -

      If you used EO in a study, please cite it. As of today, it has been cited more than 250 times.

      +

      If you used in a study, please cite the publication above:

      + + @inproceedings{Dreo-al_2021_Paradiseo,
      +     author    = {Dreo, Johann and Liefooghe, Arnaud and Verel, S\'{e}bastien and Schoenauer, Marc and Merelo, Juan J. and Quemy, Alexandre and Bouvier, Benjamin and Gmys, Jan},
      +     title     = {Paradiseo: From a Modular Framework for Evolutionary Computation to the Automated Design of Metaheuristics: 22 Years of Paradiseo},
      +     year      = {2021},
      +     isbn      = {9781450383516},
      +     publisher = {Association for Computing Machinery},
      +     address   = {New York, NY, USA},
      +     url       = {https://doi.org/10.1145/3449726.3463276},
      +     booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference Companion},
      +     pages     = {1522–1530},
      +     numpages  = {9}
      + }
      +
      + + - - - - - }

      + -->

    • +
    • +

      The core EO module is described in the following scientific article: +

      M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer, + Evolving + objects: A general purpose evolutionary computation + library, Artificial Evolution, 2310, 829--888 (2002).
      +

      +
    • + @@ -1132,16 +1152,17 @@ undiscovered knowledge.

      Downloads

      -

      The current stable release is version 2.0.1: ParadisEO 2.0.1. Some other releases (older or newer) can be found on GitHub/paradiseo/releases.

      +

      The current stable release is version: Paradiseo 3.0.0-beta. Some other releases (older or newer) can be found on GitHub/paradiseo/releases.

      -

      You can obtain the latest stable and beta version directly via the official Git repository: - git clone git://scm.gforge.inria.fr/paradiseo/paradiseo.git. +

      You can obtain the latest stable and beta version directly via the Git repository: + git clone https://github.com/jdreo/paradiseo.git. The release are on the "master" branch.

      Or you can use (at your own risks) the development repositories of the developers:

      @@ -1214,7 +1235,7 @@ undiscovered knowledge.

      Contribute

      development is open and contributions are welcomed.

      -

      The official bug tracker is available on the project page. But you may be more confortable using the issue tracker of Johann Dreo's project page on GitHub.

      +

      The official bug tracker is available on the project page.

      If you have any question about contributing: subscribe to our (low traffic) mailing-list.

    @@ -1231,7 +1252,8 @@ undiscovered knowledge.
    • INRIA (current maintainer)
    • University of the Littoral Opal Coast (current maintainer)
    • -
    • Thales (current maintainer)
    • +
    • Institut Pasteur (current maintainer)
    • +
    • Thales group
    • École Polytechnique
    • University of Granada
    • Vrije Universiteit Amsterdam
    • From e5b5e8807d4e2f90880fcb334c9d67dfa663f03d Mon Sep 17 00:00:00 2001 From: Potalas Date: Wed, 5 Jan 2022 10:37:21 +0100 Subject: [PATCH 024/113] The new feature onlymutga with new mutation and experiments --- eo/contrib/irace/CMakeLists.txt | 4 + .../expe/gamma/irace-config/target-runner.py | 119 +++ eo/contrib/irace/expe/gamma/run_irace.ipynb | 267 ++++++ eo/contrib/irace/expe/gamma/run_irace.py | 12 + eo/contrib/irace/expe/gamma/target-runner.py | 119 +++ eo/contrib/irace/onlymutga.cpp | 770 ++++++++++++++++++ eo/src/ga/eoStandardBitMutation.h | 48 ++ 7 files changed, 1339 insertions(+) create mode 100755 eo/contrib/irace/expe/gamma/irace-config/target-runner.py create mode 100644 eo/contrib/irace/expe/gamma/run_irace.ipynb create mode 100644 eo/contrib/irace/expe/gamma/run_irace.py create mode 100644 eo/contrib/irace/expe/gamma/target-runner.py create mode 100644 eo/contrib/irace/onlymutga.cpp diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt index 1e968d817..1c713bf5b 100644 --- a/eo/contrib/irace/CMakeLists.txt +++ b/eo/contrib/irace/CMakeLists.txt @@ -73,3 +73,7 @@ add_executable(fastga fastga.cpp) # target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt) +add_executable(onlymutga onlymutga.cpp) +# target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) +target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} fmt) + diff --git a/eo/contrib/irace/expe/gamma/irace-config/target-runner.py b/eo/contrib/irace/expe/gamma/irace-config/target-runner.py new file mode 100755 index 000000000..91db92b71 --- /dev/null +++ b/eo/contrib/irace/expe/gamma/irace-config/target-runner.py @@ -0,0 +1,119 @@ +#!/usr/bin/python +############################################################################### +# This script is the command that is executed every run. +# Check the examples in examples/ +# +# This script is run in the execution directory (execDir, --exec-dir). +# +# PARAMETERS: +# argv[1] is the candidate configuration ID +# argv[2] is the instance ID +# argv[3] is the seed +# argv[4] is the instance name +# The rest (argv[5:]) are parameters to the run +# +# RETURN VALUE: +# This script should print one numerical value: the cost that must be minimized. +# Exit with 0 if no error, with 1 in case of error +############################################################################### + +import datetime +import os.path +import re +import subprocess +import sys + +exe = "../../../../release/onlymutga" + +problem = 19 +pop_size = 1 +offspring_size = 100 + +fixed_parameters = ["--problem", str(problem), "--crossover-rate", "0", "--mutation-rate", "1", "--pop-size", str(pop_size), " --offspring-size", str(offspring_size)] + +if __name__=='__main__': + if len(sys.argv) < 5: + print("\nUsage: ./target-runner.py \n") + sys.exit(1) + +# Get the parameters as command line arguments. +configuration_id = sys.argv[1] +instance_id = sys.argv[2] +seed = sys.argv[3] +instance = sys.argv[4] +slices_prop = sys.argv[5:] +#print(sys.argv) + +exe = os.path.expanduser(exe) + +cmd = [exe] + fixed_parameters + ["--instance", instance, "--seed", seed] + +residual_prob = 1 +cl_probs = [] +residual_size = 1 +cl_sizes = [] + +values = "" +sizes = "" +for i in range(len(slices_prop)): + cl_probs.append(residual_prob * float(slices_prop[i])) + cl_sizes.append(residual_size * (1-float(slices_prop[i]))) + residual_prob -= cl_probs[-1] + residual_size -= cl_sizes[-1] + values += "%.2f,"%cl_probs[-1] + sizes += "%.2f,"%cl_sizes[-1] + +cl_probs.append(residual_prob) +values += "%.2f"%cl_probs[-1] +sizes += "%.2f"%cl_sizes[-1] + +cmd += ["--cl-probs", values, "--cl-sizes", sizes] + + +# Define the stdout and stderr files. +out_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stdout" +err_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stderr" + +def target_runner_error(msg): + now = datetime.datetime.now() + print(str(now) + " error: " + msg) + sys.exit(1) + +def check_executable(fpath): + fpath = os.path.expanduser(fpath) + if not os.path.isfile(fpath): + target_runner_error(str(fpath) + " not found") + if not os.access(fpath, os.X_OK): + target_runner_error(str(fpath) + " is not executable") + +# This is an example of reading a number from the output. +def parse_output(out): + match = re.search(r'Best ([-+0-9.eE]+)', out.strip()) + if match: + return match.group(1); + else: + return "No match" + +check_executable (exe) + +outf = open(out_file, "w") +errf = open(err_file, "w") +return_code = subprocess.call(cmd, stdout = outf, stderr = errf) + +outf.close() +errf.close() + +if return_code != 0: + target_runner_error("command returned code " + str(return_code)) + +if not os.path.isfile(out_file): + target_runner_error("output file " + out_file + " not found.") + +cost = parse_output (open(out_file).read()) +#print(cost) +print(open(out_file).read().strip()) + +os.remove(out_file) +os.remove(err_file) +sys.exit(0) + diff --git a/eo/contrib/irace/expe/gamma/run_irace.ipynb b/eo/contrib/irace/expe/gamma/run_irace.ipynb new file mode 100644 index 000000000..251422d22 --- /dev/null +++ b/eo/contrib/irace/expe/gamma/run_irace.ipynb @@ -0,0 +1,267 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04867792", + "metadata": {}, + "source": [ + "# Imports" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "435212a6", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "import seaborn as sb\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib.ticker import MaxNLocator\n", + "import matplotlib.animation\n", + "from math import sqrt, log, cos, sin, pi\n", + "import numpy as np\n", + "import os\n", + "import shutil\n", + "import re\n", + "from subprocess import call\n", + "sb.set_style(\"whitegrid\")\n", + "#sb.set_palette(\"cubehelix\")\n", + "sb.set_palette(\"husl\")\n", + "sb.set(font_scale=1) # crazy big\n", + "sb.set_style('whitegrid', {'legend.frameon':True})\n", + "myfontsize = 12\n", + "titlesize = 15\n", + "%matplotlib notebook" + ] + }, + { + "cell_type": "markdown", + "id": "d76bdf6b", + "metadata": {}, + "source": [ + "# Function to generate the scenario file for irace" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "d86a9ca8", + "metadata": {}, + "outputs": [], + "source": [ + "def scenario(filename=\"scenario.txt\", \n", + " parameterFile=\"parameters.txt\", \n", + " execDir=\".\", \n", + " logFile=\"./irace.Rdata\", \n", + " targetRunner = \"target-runner.py\", \n", + " maxExperiments = 100000,\n", + " digits = 2):\n", + " f = open(filename, \"w\")\n", + " f.write(\"parameterFile=\" + parameterFile +\"\\n\")\n", + " f.write(\"execDir=\" + execDir + \"\\n\")\n", + " f.write(\"logFile=\" + logFile + \"\\n\")\n", + " f.write(\"targetRunner=\" + targetRunner + \"\\n\")\n", + " f.write(\"maxExperiments=\" + maxExperiments + \"\\n\")\n", + " f.write(\"digits=\" + digits + \"\\n\")\n", + " f.close()" + ] + }, + { + "cell_type": "markdown", + "id": "1213321a", + "metadata": {}, + "source": [ + "# Function to generate the parameter file for irace" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "70d221c9", + "metadata": {}, + "outputs": [], + "source": [ + "# Generate the param file for irace with all configuarable parameters\n", + "def parameters(filename=\"parameters.txt\"):\n", + " f = open(\"parameters.txt\", \"w\")\n", + " f.write(\"# name\\tswitch\\ttype\\tvalues\\n\") # head of the param file\n", + " cl_nb_part = 10 # number of category for the custom categorial probabilistic law\n", + " for i in range(cl_nb_part-1): # minus 1 slice than the number of categories\n", + " f.write(\"slice_prob_%s\\t\\\"\\\"\\tr\\t(0,1)\\n\"%i) # percentage of the residual probability for the slice\n", + "\n", + " ######################################### NOT USED YET ##########################################\n", + " #for i in range(cl_nb_part-1): # minus 1 slice than the number of categories\n", + " # f.write(\"slice_size_%s\\t\\\"\\\"\\tr\\t(0,1)\\n\"%i) # percentage of the residual size for the slice\n", + " #################################################################################################\n", + " f.close()" + ] + }, + { + "cell_type": "markdown", + "id": "65fcb69d", + "metadata": {}, + "source": [ + "# Fonction to generate problem dedicated target-runner.py" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "a18ba251", + "metadata": {}, + "outputs": [], + "source": [ + "def target_runner(origin=\"irace-config/target-runner.py\", path=\"target-runner.py\", problem=1):\n", + " \n", + " generalTR = open(origin, \"r\")\n", + " dedicatedTR = open(path, \"w\")\n", + " for line in generalTR:\n", + " if re.search(\"problem = \", line, flags=0):\n", + " dedicatedTR.write(\"problem = \" + str(problem) + \"\\n\")\n", + " else:\n", + " dedicatedTR.write(line)\n", + " generalTR.close()\n", + " dedicatedTR.close()" + ] + }, + { + "cell_type": "markdown", + "id": "59421dee", + "metadata": {}, + "source": [ + "# Run script" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "38dfec96", + "metadata": {}, + "outputs": [], + "source": [ + "results_directory = \"results\"\n", + "irace_path = \"/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/irace/bin/irace\"\n", + "instances_file = \"instances.txt\"\n", + "scenario_file = \"scenario.txt\"\n", + "parameters_file = \"parameters.txt\"\n", + "target_runner_file = \"target-runner.py\"\n", + "\n", + "# create or clear the results directory\n", + "if not os.path.isdir(results_directory):\n", + " os.mkdir(results_directory)\n", + " \n", + "for pb in range(1,3): # for each problem\n", + " # create or clear a subdirectory for the problem\n", + " problem_directory = results_directory + \"/problem_%s\"%pb\n", + " if os.path.isdir(problem_directory):\n", + " shutil.rmtree(problem_directory)\n", + " os.mkdir(problem_directory)\n", + " \n", + " # generate a custom target runner file for the problem\n", + " target_runner(path = problem_directory + \"/\" + target_runner_file, problem = pb)\n", + "\n", + " # copy the config files for iraces\n", + " for filename in [instances_file, scenario_file, parameters_file, target_runner_file]:\n", + " src = r'irace-config/' + filename\n", + " dst = problem_directory + \"/\" + filename\n", + " shutil.copyfile(src, dst)\n", + " \n", + " # run irace for\n", + " cmd = [irace_path, \"--scenario\", problem_directory + \"/\" + scenario_file] #, \"&> irace.log\"\n", + " call(cmd)\n", + "#call(cmd)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "b707ff3b", + "metadata": {}, + "outputs": [], + "source": [ + "shutil.rmtree(\"results\")" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "460c588e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-10" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "call([\"../../release/onlymutga\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "eb234425", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'problem_1/default.instances'" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import shutil\n", + "import os\n", + "src = r'irace-config/default.instances'\n", + "dst = r'problem_1/default.instances'\n", + "shutil.copyfile(src, dst)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7a62c411", + "metadata": {}, + "outputs": [], + "source": [ + "chmod u+x script.py\n", + "cp -a a b" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/eo/contrib/irace/expe/gamma/run_irace.py b/eo/contrib/irace/expe/gamma/run_irace.py new file mode 100644 index 000000000..caa7ea928 --- /dev/null +++ b/eo/contrib/irace/expe/gamma/run_irace.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Tue Dec 14 12:16:17 2021 + +@author: labeiros +""" + +import sys + +print('Number of arguments:', len(sys.argv), 'arguments.') +print('Argument List:', str(sys.argv)) diff --git a/eo/contrib/irace/expe/gamma/target-runner.py b/eo/contrib/irace/expe/gamma/target-runner.py new file mode 100644 index 000000000..c1dca9c36 --- /dev/null +++ b/eo/contrib/irace/expe/gamma/target-runner.py @@ -0,0 +1,119 @@ +#!/usr/bin/python +############################################################################### +# This script is the command that is executed every run. +# Check the examples in examples/ +# +# This script is run in the execution directory (execDir, --exec-dir). +# +# PARAMETERS: +# argv[1] is the candidate configuration ID +# argv[2] is the instance ID +# argv[3] is the seed +# argv[4] is the instance name +# The rest (argv[5:]) are parameters to the run +# +# RETURN VALUE: +# This script should print one numerical value: the cost that must be minimized. +# Exit with 0 if no error, with 1 in case of error +############################################################################### + +import datetime +import os.path +import re +import subprocess +import sys + +exe = "../../../../release/onlymutga" + +problem = blabla +pop_size = 1 +offspring_size = 100 + +fixed_parameters = ["--problem", str(problem), "--crossover-rate", "0", "--mutation-rate", "1", "--pop-size", str(pop_size), " --offspring-size", str(offspring_size)] + +if __name__=='__main__': + if len(sys.argv) < 5: + print("\nUsage: ./target-runner.py \n") + sys.exit(1) + +# Get the parameters as command line arguments. +configuration_id = sys.argv[1] +instance_id = sys.argv[2] +seed = sys.argv[3] +instance = sys.argv[4] +slices_prop = sys.argv[5:] +#print(sys.argv) + +exe = os.path.expanduser(exe) + +cmd = [exe] + fixed_parameters + ["--instance", instance, "--seed", seed] + +residual_prob = 1 +cl_probs = [] +residual_size = 1 +cl_sizes = [] + +values = "" +sizes = "" +for i in range(len(slices_prop)): + cl_probs.append(residual_prob * float(slices_prop[i])) + cl_sizes.append(residual_size * (1-float(slices_prop[i]))) + residual_prob -= cl_probs[-1] + residual_size -= cl_sizes[-1] + values += "%.2f,"%cl_probs[-1] + sizes += "%.2f,"%cl_sizes[-1] + +cl_probs.append(residual_prob) +values += "%.2f"%cl_probs[-1] +sizes += "%.2f"%cl_sizes[-1] + +cmd += ["--cl-probs", values, "--cl-sizes", sizes] + + +# Define the stdout and stderr files. +out_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stdout" +err_file = "c" + str(configuration_id) + "-" + str(instance_id) + str(seed) + ".stderr" + +def target_runner_error(msg): + now = datetime.datetime.now() + print(str(now) + " error: " + msg) + sys.exit(1) + +def check_executable(fpath): + fpath = os.path.expanduser(fpath) + if not os.path.isfile(fpath): + target_runner_error(str(fpath) + " not found") + if not os.access(fpath, os.X_OK): + target_runner_error(str(fpath) + " is not executable") + +# This is an example of reading a number from the output. +def parse_output(out): + match = re.search(r'Best ([-+0-9.eE]+)', out.strip()) + if match: + return match.group(1); + else: + return "No match" + +check_executable (exe) + +outf = open(out_file, "w") +errf = open(err_file, "w") +return_code = subprocess.call(cmd, stdout = outf, stderr = errf) + +outf.close() +errf.close() + +if return_code != 0: + target_runner_error("command returned code " + str(return_code)) + +if not os.path.isfile(out_file): + target_runner_error("output file " + out_file + " not found.") + +cost = parse_output (open(out_file).read()) +#print(cost) +print(open(out_file).read().strip()) + +os.remove(out_file) +os.remove(err_file) +sys.exit(0) + diff --git a/eo/contrib/irace/onlymutga.cpp b/eo/contrib/irace/onlymutga.cpp new file mode 100644 index 000000000..1c7b0937d --- /dev/null +++ b/eo/contrib/irace/onlymutga.cpp @@ -0,0 +1,770 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +/***************************************************************************** + * ParadisEO algorithmic grammar definition. + *****************************************************************************/ + +// using Particle = eoRealParticle; +using Ints = eoInt, size_t>; +using Bits = eoBit, int>; + +// by enumerating candidate operators and their parameters. +eoAlgoFoundryFastGA& make_foundry( + eoFunctorStore& store, + eoInit& init, + eoEvalFunc& eval, + const size_t max_evals, + const size_t generations, + const double optimum, + const size_t pop_size, + const size_t offspring_size, + std::vector cl_sizes, + std::vector cl_values + ) +{ + // FIXME using max_restarts>1 does not allow to honor max evals. + auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval, max_evals, /*max_restarts=*/1); + + /***** Continuators ****/ + auto& fitcont = store.pack< eoFitContinue >(optimum); + auto& gencont = store.pack< eoGenContinue >(generations); + auto combconts = std::make_shared< std::vector*> >(); + combconts->push_back( &fitcont ); + combconts->push_back( &gencont ); + foundry.continuators.add< eoCombinedContinue >( *combconts ); + // for(size_t i=1; i<10; i++) { + // foundry.continuators.add< eoGenContinue >(i); + // } + // for(size_t i=10; i < 100; i+=2 ) { + // 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); + // } + + /***** Offsprings size *****/ + // for(size_t i=5; i<100; i+=10) { + // foundry.offspring_sizes.add(i); + // } + + foundry.offspring_sizes.setup(0,offspring_size); // 0 = use parents fixed pop size. + + /***** Crossovers ****/ + for(double i=0.1; i<1.0; i+=0.2) { + foundry.crossovers.add< eoUBitXover >(i); // preference over 1 + } + for(size_t i=1; i < 10; i+=2) { + + foundry.crossovers.add< eoNPtsBitXover >(i); // nb of points + } + // foundry.crossovers.add< eo1PtBitXover >(); // Same as NPts=1 + + /***** Mutations ****/ + /* ######################## Removed by Alexis ######################## */ + /* + double p = 1.0; // Probability of flipping each bit. + // proba of flipping k bits, k drawn in uniform distrib + foundry.mutations.add< eoUniformBitMutation >(p); + // proba of flipping k bits, k drawn in binomial distrib + foundry.mutations.add< eoStandardBitMutation >(p); + // proba of flipping k bits, k drawn in binomial distrib, minus zero + foundry.mutations.add< eoConditionalBitMutation >(p); + // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one + foundry.mutations.add< eoShiftedBitMutation >(p); + // proba of flipping k bits, k drawn in normal distrib + foundry.mutations.add< eoNormalBitMutation >(p); + // proba of flipping k bits, k drawn in powerlaw distrib + foundry.mutations.add< eoFastBitMutation >(p); + for(size_t i=1; i < 11; i+=2) { + // mutate k bits without duplicates + foundry.mutations.add< eoDetSingleBitFlip >(i); + } + */ + /* ######################## RbA END ######################## */ + + /* ######################## Add by Alexis ######################## */ + foundry.mutations.add< eoBucketBitMutation >(cl_sizes, cl_values); + /* ######################## AbA END ######################## */ + + /***** Selectors *****/ + for(eoOperatorFoundry>& ops : + {std::ref(foundry.crossover_selectors), + std::ref(foundry.mutation_selectors) }) { + + ops.add< eoRandomSelect >(); + ops.add< eoStochTournamentSelect >(0.5); + ops.add< eoSequentialSelect >(); + ops.add< eoProportionalSelect >(); + for(size_t i=2; i < 11; i+=4) { + ops.add< eoDetTournamentSelect >(i); + } + } + + foundry.aftercross_selectors.add< eoRandomSelect >(); + + + /***** Replacements ****/ + /* ######################## Removed by Alexis ######################## */ + /* + foundry.replacements.add< eoPlusReplacement >(); + foundry.replacements.add< eoCommaReplacement >(); + foundry.replacements.add< eoSSGAWorseReplacement >(); + for(double i=0.51; i<0.92; i+=0.2) { + foundry.replacements.add< eoSSGAStochTournamentReplacement >(i); + } + for(size_t i=2; i < 11; i+=2) { + foundry.replacements.add< eoSSGADetTournamentReplacement >(i); + } + */ + /* ######################## RbA END ######################## */ + + /* ######################## Add by Alexis ######################## */ + //foundry.replacements.add< eoSSGADetTournamentReplacement >(1); + foundry.replacements.add< eoCommaReplacement >(); + /* ######################## AbA END ######################## */ + + return foundry; +} + +/***************************************************************************** + * irace helper functions. + *****************************************************************************/ + +Bits::Fitness fake_func(const Bits&) { return 0; } + +void print_irace_categorical(const eoParam& param, const size_t slot_size, std::string type="c", std::ostream& out = std::cout) +{ + // If there is no choice to be made on this operator, comment it out. + if(slot_size - 1 <= 0) { + out << "# "; + } + + // irace doesn't support "-" in names. + std::string irace_name = param.longName(); + irace_name.erase(std::remove(irace_name.begin(), irace_name.end(), '-'), irace_name.end()); + + out << irace_name + << "\t\"--" << param.longName() << "=\"" + << "\t" << type; + + out << "\t(0"; + for(size_t i=1; i +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_oper(const eoParam& param, const eoOperatorFoundry& op_foundry, std::ostream& out = std::cout) +{ + print_irace_categorical(param, op_foundry.size(), "c", out); +} + +// FIXME generalize to any scalar type with enable_if +// template +void print_irace_param( + const eoParam& param, + // const eoParameterFoundry::value >::type>& op_foundry, + const eoParameterFoundry& op_foundry, + std::ostream& out) +{ + print_irace_ranged(param, op_foundry.min(), op_foundry.max(), "r", out); +} + +// template +void print_irace_param( + const eoParam& param, + // const eoParameterFoundry::value >::type>& op_foundry, + const eoParameterFoundry& op_foundry, + std::ostream& 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_irace(const eoParam& param, const size_t min, const size_t max, std::ostream& out = std::cout) +{ + print_irace_ranged(param, min, max, "i", out); +} + +void print_operator_typed(const eoFunctorBase& op, std::ostream& out) +{ + out << op.className(); +} + +void print_operator_typed(const double& op, std::ostream& out) +{ + out << op; +} + +template +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) { + out << indent << indent << i << ": "; + auto& op = op_foundry.instantiate(i); + print_operator_typed(op, out); + out << std::endl; + } +} + +template +void print_operators(const eoParam& param, T min, T max, std::ostream& out = std::cout, std::string indent=" ") +{ + out << indent << "[" << min << "," << max << "] " << param.longName() << "." << std::endl; +} + +template +void print_operators(const eoParam& param, eoParameterFoundry& op_foundry, std::ostream& out = std::cout, std::string indent=" ") +{ + print_operators(param, op_foundry.min(), op_foundry.max(), out, indent); +} + +// Problem configuration. +struct Problem { + double dummy; + size_t epistasis; + size_t neutrality; + size_t ruggedness; + size_t max_target; + size_t dimension; + friend std::ostream& operator<<(std::ostream& os, const Problem& pb); +}; + +std::ostream& operator<<(std::ostream& os, const Problem& pb) +{ + os << "u=" << pb.dummy << "_" + << "e=" << pb.epistasis << "_" + << "n=" << pb.neutrality << "_" + << "r=" << pb.ruggedness << "_" + << "t=" << pb.max_target << "_" + << "d=" << pb.dimension; + return os; +} + +/***************************************************************************** + * IOH problem adaptation. + *****************************************************************************/ + +class WModelFlat : public ioh::problem::wmodel::WModelOneMax +{ + public: + WModelFlat(const int instance, const int n_variables, + const double dummy_para, const int epistasis_para, const int neutrality_para, + const int ruggedness_para) + : WModelOneMax(instance, n_variables, dummy_para, epistasis_para, neutrality_para, ruggedness_para) + { } + + protected: + double transform_objectives(const double y) override + { // Disable objective function shift & scaling. + return y; + } +}; + +/***************************************************************************** + * Command line interface. + *****************************************************************************/ + +int main(int argc, char* argv[]) +{ + /***** Global parameters. *****/ + enum { NO_ERROR = 0, ERROR_USAGE = 100 }; + + std::map benchmark { + /* ┌ problem index in the map + * │ ┌ problem ID in IOH experimenter + * │ │ ┌ dummy + * │ │ │ ┌ epistasis + * │ │ │ │ ┌ neutrality + * │ │ │ │ │ ┌ ruggedness + * │ │ │ │ │ │ ┌ max target + * │ │ │ │ │ │ │ ┌ dimension (bitstring length) */ + { 0 /* 1*/, {0, 6, 2, 10, 10, 20 }}, + { 1 /* 2*/, {0, 6, 2, 18, 10, 20 }}, + { 2 /* 3*/, {0, 5, 1, 72, 16, 16 }}, + { 3 /* 4*/, {0, 9, 3, 72, 16, 48 }}, + { 4 /* 5*/, {0, 23, 1, 90, 25, 25 }}, + { 5 /* 6*/, {0, 2, 1, 397, 32, 32 }}, + { 6 /* 7*/, {0, 11, 4, 0, 32, 128 }}, + { 7 /* 8*/, {0, 14, 4, 0, 32, 128 }}, + { 8 /* 9*/, {0, 8, 4, 128, 32, 128 }}, + { 9 /*10*/, {0, 36, 1, 245, 50, 50 }}, + {10 /*11*/, {0, 21, 2, 256, 50, 100 }}, + {11 /*12*/, {0, 16, 3, 613, 50, 150 }}, + {12 /*13*/, {0, 32, 2, 256, 64, 128 }}, + {13 /*14*/, {0, 21, 3, 16, 64, 192 }}, + {14 /*15*/, {0, 21, 3, 256, 64, 192 }}, + {15 /*16*/, {0, 21, 3, 403, 64, 192 }}, + {16 /*17*/, {0, 52, 4, 2, 64, 256 }}, + {17 /*18*/, {0, 60, 1, 16, 75, 75 }}, + {18 /*19*/, {0, 32, 2, 4, 75, 150 }}, + {19 /*20?*/, {0, 0, 0, 0, 0, 64 }} // Add by Alexis + }; + + eoFunctorStore store; + + eoParser parser(argc, argv, "OnlymutGA interface for iRace"); + + /***** Problem parameters *****/ + auto problem_p = parser.getORcreateParam(0, + "problem", "Problem ID", + 'p', "Problem", /*required=*/true); + const size_t problem = problem_p.value(); + assert(0 <= problem and problem < benchmark.size()); + + // const size_t dimension = parser.getORcreateParam(1000, + // "dimension", "Dimension size", + // 'd', "Problem").value(); + 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 (default: 5*dim, else the given value)", + 'e', "Stopping criterion").value(); + + const size_t buckets = parser.getORcreateParam(100, + "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)", + 'S').value(); + if(seed == 0) { + seed = time(0); + } + // rng is a global + rng.reseed(seed); + + bool full_log = + parser.getORcreateParam(0, + "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 (fancy colormap on stderr, parsable CSV on stdout).", + 'A').value(); + + /***** populations sizes *****/ + auto pop_size_p = parser.getORcreateParam(1, + "pop-size", "Population size", + 'P', "Operator Choice", /*required=*/false); // Changed by Alexis: 5 -> 1 + const size_t pop_size = pop_size_p.value(); + const size_t pop_size_max = 10; + + auto offspring_size_p = parser.getORcreateParam(10, + "offspring-size", "Offsprings size (0 = same size than the parents pop, see --pop-size)", + 'O', "Operator Choice", /*required=*/false); // Single alternative, not required. // Changed by Alexis: 0 -> 10 + const size_t offspring_size = offspring_size_p.value(); + + size_t generations = static_cast(std::floor( + static_cast(max_evals) / static_cast(pop_size))); + // const size_t generations = std::numeric_limits::max(); + if(generations < 1) { + generations = 1; + } + + /***** metric parameters *****/ + auto crossover_rate_p = parser.getORcreateParam(0, + "crossover-rate", "", + 'C', "Operator Choice", /*required=*/false); // Changed by Alexis: 0.5 -> 0 | true -> false + const double crossover_rate = crossover_rate_p.value(); + + auto mutation_rate_p = parser.getORcreateParam(1, + "mutation-rate", "", + 'M', "Operator Choice", /*required=*/false); // Changed by Alexis: 0 -> 1 | true -> false + const double mutation_rate = mutation_rate_p.value(); + + /***** operators *****/ + auto continuator_p = parser.getORcreateParam(0, + "continuator", "Stopping criterion", + 'o', "Operator Choice", /*required=*/false); // Single alternative, not required. + const size_t continuator = continuator_p.value(); + + auto crossover_selector_p = parser.getORcreateParam(0, + "cross-selector", "How to selects candidates for cross-over", + 's', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false + const size_t crossover_selector = crossover_selector_p.value(); + + auto crossover_p = parser.getORcreateParam(0, + "crossover", "", + 'c', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false + const size_t crossover = crossover_p.value(); + + auto aftercross_selector_p = parser.getORcreateParam(0, + "aftercross-selector", "How to selects between the two individuals altered by cross-over which one will mutate", + 'a', "Operator Choice", /*required=*/false); // Single alternative, not required. + const size_t aftercross_selector = aftercross_selector_p.value(); + + auto mutation_selector_p = parser.getORcreateParam(0, + "mut-selector", "How to selects candidate for mutation", + 'u', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false + const size_t mutation_selector = mutation_selector_p.value(); + + auto mutation_p = parser.getORcreateParam(0, + "mutation", "", + 'm', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false + const size_t mutation = mutation_p.value(); + + auto replacement_p = parser.getORcreateParam(0, + "replacement", "", + 'r', "Operator Choice", /*required=*/false); // Changed by Alexis: true -> false + const size_t replacement = replacement_p.value(); + + /* ######################## Add by Alexis ######################## */ + + auto cl_values_p = parser.getORcreateParam("0.8,0.2", + "cl-probs", "Probabilities of each part for the custom law (sum = 1)", + 'y', "Operator Choice", false); + + std::string cl_v = cl_values_p.value(); + std::vector cl_probs = std::vector(); + + std::string sep = ","; + + size_t pos = 0; + std::string token; + while ((pos = cl_v.find(sep)) != std::string::npos) { + token = cl_v.substr(0, pos); + cl_probs.push_back(std::stod(token)); + cl_v.erase(0, pos + sep.length()); + } + cl_probs.push_back(std::stod(cl_v)); + + auto cl_sizes_p = parser.getORcreateParam("0.5,0.5", + "cl-sizes", "Proportion sizes of each part for the custom law (sum = 1)", + 'x', "Operator Choice", false); + std::string cl_s = cl_sizes_p.value(); + std::vector cl_sizes = std::vector(); + + pos = 0; + while ((pos = cl_s.find(sep)) != std::string::npos) { + token = cl_s.substr(0, pos); + cl_sizes.push_back(std::stod(token)); + cl_s.erase(0, pos + sep.length()); + } + cl_sizes.push_back(std::stod(cl_s)); + /* ######################## AbA END ######################## */ + + // Help + Verbose routines + make_verbose(parser); + make_help(parser, /*exit_after*/false, std::clog); + + if(parser.userNeedsHelp()) { + + // Fake operators, just to be able to call make_foundry + // to get the configured operators slots. + eoEvalFuncPtr fake_eval(fake_func); + eoUniformGenerator fake_gen(0, 1); + eoInitFixedLength fake_init(/*bitstring size=*/1, fake_gen); + auto fake_foundry = make_foundry(store, fake_init, fake_eval, max_evals, /*generations=*/ 1, 0, pop_size_max, offspring_size, cl_sizes, cl_probs); + + std::clog << std::endl << "Available operators:" << std::endl; + + print_operators( continuator_p, fake_foundry.continuators , std::clog); + print_operators( crossover_rate_p, fake_foundry.crossover_rates , std::clog); + print_operators( crossover_selector_p, fake_foundry.crossover_selectors , std::clog); + print_operators(aftercross_selector_p, fake_foundry.aftercross_selectors, std::clog); + print_operators( crossover_p, fake_foundry.crossovers , std::clog); + print_operators( mutation_rate_p, fake_foundry.mutation_rates , std::clog); + print_operators( mutation_selector_p, fake_foundry.mutation_selectors , std::clog); + print_operators( mutation_p, fake_foundry.mutations , std::clog); + print_operators( replacement_p, fake_foundry.replacements , std::clog); + print_operators( offspring_size_p, fake_foundry.offspring_sizes , std::clog); + print_operators( pop_size_p, (size_t)1, pop_size_max , std::clog); + /* ######################## Add by Alexis ######################## */ + print_operators( cl_values_p, "(1)", "(0.01,...,0.99)" , std::clog); + print_operators( cl_sizes_p, "(1)", "(0.01,...,0.99)" , std::clog); + /* ######################## AbA END ######################## */ + std::clog << std::endl; + + + + // If we were to make a DoE sampling numeric parameters, + // we would use that many samples: + size_t fake_sample_size = 10; + std::clog << "With " << fake_sample_size << " samples for numeric parameters..." << std::endl; + size_t n = + fake_sample_size //crossover_rates + * fake_foundry.crossover_selectors.size() + * fake_foundry.crossovers.size() + * fake_foundry.aftercross_selectors.size() + * fake_sample_size //mutation_rates + * fake_foundry.mutation_selectors.size() + * fake_foundry.mutations.size() + * fake_foundry.replacements.size() + * fake_foundry.continuators.size() + * fake_sample_size //offspring_sizes + * fake_sample_size //pop_size + ; + std::clog << "~" << n << " possible algorithms configurations." << std::endl; + + std::clog << "Ranges of configurable parameters (redirect the stdout in a file to use it with iRace): " << std::endl; + + // Do not print problem and instances, as they are managed separately by irace. + std::cout << "# name\tswitch\ttype\trange" << std::endl; + /* ######################## Removed by Alexis ######################## */ + /* + print_irace( continuator_p, fake_foundry.continuators , std::cout); + print_irace( crossover_rate_p, fake_foundry.crossover_rates , std::cout); + print_irace( crossover_selector_p, fake_foundry.crossover_selectors , std::cout); + print_irace(aftercross_selector_p, fake_foundry.aftercross_selectors, std::cout); + print_irace( crossover_p, fake_foundry.crossovers , std::cout); + print_irace( mutation_rate_p, fake_foundry.mutation_rates , std::cout); + print_irace( mutation_selector_p, fake_foundry.mutation_selectors , std::cout); + print_irace( mutation_p, fake_foundry.mutations , std::cout); + print_irace( replacement_p, fake_foundry.replacements , std::cout); + print_irace( offspring_size_p, fake_foundry.offspring_sizes , std::cout); + print_irace( pop_size_p, 1, pop_size_max , std::cout); + */ + /* ######################## RbA END ######################## */ + + //std::ofstream irace_param("fastga.params"); + //irace_param << "# name\tswitch\ttype\tvalues" << std::endl; + + exit(NO_ERROR); + } + + eo::log << eo::debug << "Maximum number of evaluations: " << max_evals << std::endl; + eo::log << eo::debug << "Number of generations: " << generations << std::endl; + + + /***************************************************************************** + * IOH stuff. + *****************************************************************************/ + + /***** IOH logger *****/ + auto max_target = benchmark[problem].max_target; + ioh::logger::eah::Log10Scale 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); + + std::shared_ptr csv_logger = nullptr; + if(full_log) { + // Build up an algorithm name from main parameters. + std::ostringstream name; + name << "OnlymutGA"; + for(auto& p : { + crossover_selector_p, + crossover_p, + aftercross_selector_p, + mutation_selector_p, + mutation_p, + replacement_p }) { + name << "_" << p.shortName() << "=" << p.getValue(); + } + for(auto& p : { + crossover_rate_p, + mutation_rate_p }) { + name << "_" << p.shortName() << "=" << p.getValue(); + } + for(auto& p : {pop_size_p, + offspring_size_p }) { + name << "_" << p.shortName() << "=" << p.getValue(); + } + std::clog << name.str() << std::endl; + + // Build up a problem description. + std::ostringstream desc; + desc << "pb=" << problem << "_"; + desc << benchmark[problem]; // Use the `operator<<` above. + std::clog << desc.str() << std::endl; + + std::filesystem::path folder = desc.str(); + std::filesystem::create_directories(folder); + + ioh::trigger::OnImprovement on_improvement; + ioh::watch::Evaluations evaluations; + ioh::watch::TransformedYBest transformed_y_best; + std::vector> t = {on_improvement}; + std::vector> w = {evaluations,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_dummy = benchmark[problem].dummy; + int w_epitasis = benchmark[problem].epistasis; + int w_neutrality = benchmark[problem].neutrality; + int w_ruggedness = benchmark[problem].ruggedness; + + // std::string problem_name = "OneMax"; + // problem_name = problem_name + // + "_D" + std::to_string((int)(w_dummy * dimension)) + // + "_E" + std::to_string(w_epitasis) + // + "_N" + std::to_string(w_neutrality) + // + "_R" + std::to_string(w_ruggedness); + + // ioh::problem::wmodel::WModelOneMax w_model_om( + WModelFlat w_model_om( + instance, + dimension, + w_dummy, + w_epitasis, + w_neutrality, + w_ruggedness); + + /***** Bindings *****/ + w_model_om.attach_logger(loggers); + + /***************************************************************************** + * Binding everything together. + *****************************************************************************/ + + eoEvalIOHproblem onemax_pb(w_model_om, loggers); + + // eoEvalPrint eval_print(onemax_pb, std::clog, "\n"); + // eoEvalFuncCounter eval_count(onemax_pb); + eoEvalCounterThrowException eval_count(onemax_pb, max_evals); + + eoPopLoopEval onemax_eval(eval_count); + + /***** Instanciate and run the algo *****/ + + eoBooleanGenerator bgen; + eoInitFixedLength onemax_init(/*bitstring size=*/dimension, bgen); + auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target, pop_size_max, offspring_size, cl_sizes, cl_probs); + + Ints encoded_algo(foundry.size()); + + encoded_algo[foundry.crossover_rates .index()] = crossover_rate; + encoded_algo[foundry.crossover_selectors .index()] = crossover_selector; + encoded_algo[foundry.crossovers .index()] = crossover; + encoded_algo[foundry.aftercross_selectors.index()] = aftercross_selector; + encoded_algo[foundry.mutation_rates .index()] = mutation_rate; + encoded_algo[foundry.mutation_selectors .index()] = mutation_selector; + encoded_algo[foundry.mutations .index()] = mutation; + encoded_algo[foundry.replacements .index()] = replacement; + encoded_algo[foundry.continuators .index()] = continuator; + encoded_algo[foundry.offspring_sizes .index()] = offspring_size; + + // std::clog << "Encoded algorithm:" << std::endl; + foundry.select(encoded_algo); + + std::clog << foundry.name() << std::endl; + + // // Evaluation of a forged encoded_algo on the sub-problem + // eoEvalFoundryFastGA eval_foundry( + // foundry, pop_size, + // onemax_init, onemax_eval, + // /*penalization=*/ dimension, // Worst case penalization. + // /*normalized=*/ false); // Use direct integer encoding. + // + // // Actually instanciate and run the algorithm. + // eval_foundry(encoded_algo); + + /***************************************************************************** + * Run and output results. + *****************************************************************************/ + + eoPop pop; + pop.append(pop_size, onemax_init); + try { + onemax_eval(pop,pop); + foundry(pop); // Actually run the selected algorithm. + + } catch(eoMaxEvalException e) { + eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl; + } + + /***** IOH perf stats *****/ + double perf = ioh::logger::eah::stat::under_curve::volume(eah_logger); + + if(perf == 0 or perf > max_target * max_evals * 1.0) { + std::cerr << "WARNING: illogical performance? " << perf + << " Check the bounds or the algorithm." << std::endl; + } + + // std::clog << "After " << eval_count.getValue() << " / " << max_evals << " evaluations" << std::endl; + + if(output_mat) { + std::vector> mat = ioh::logger::eah::stat::distribution(eah_logger); + + // Fancy color map on clog. + std::clog << ioh::logger::eah::colormap(mat) << std::endl; + + // Parsable CSV on cout. + std::clog << "Attainment matrix distribution: " << std::endl; + assert(mat.size() > 0); + assert(mat[0].size() > 1); + for(size_t i = mat.size()-1; i > 0; --i) { + assert(mat[i].size() >= 1); + std::cout << mat[i][0]; + for(size_t j = 1; j < mat[i].size(); ++j) { + std::cout << "," << mat[i][j]; + } + std::cout << std::endl; + } + + } else { + // iRace expects minimization + std::cout << -1 * perf << std::endl; + } +} diff --git a/eo/src/ga/eoStandardBitMutation.h b/eo/src/ga/eoStandardBitMutation.h index a2f7f12aa..fd6e4263e 100644 --- a/eo/src/ga/eoStandardBitMutation.h +++ b/eo/src/ga/eoStandardBitMutation.h @@ -222,4 +222,52 @@ class eoFastBitMutation : public eoStandardBitMutation double _beta; }; +/** Bucket mutation which assign probability for each bucket + * + * From: + * Carola Doerr, Johann Dréo, Alexis Robbes + */ +template +class eoBucketBitMutation : public eoStandardBitMutation +{ + public: + eoBucketBitMutation(std::vector bucketsSizes, std::vector bucketValues) : + _bucketsSizes(bucketsSizes), + _bucketValues(bucketValues) + + { + assert(bucketsSizes.size() != bucketValues.size()); + } + + virtual bool operator()(EOT& chrom) + { + + this->_nb = customlaw(chrom.size(), _bucketsSizes, _bucketValues); + // BitFlip operator is bound to the _nb reference, + // thus one don't need to re-instantiate. + return this->_bitflip(chrom); + } + + virtual std::string className() const {return "eoBucketBitMutation";} + + protected: + + double customlaw(unsigned n, std::vector bucketsSizes, std::vector bucketValues) + { + int targetBucketIndex = eo::rng.roulette_wheel(bucketValues); + int nb = 0; + int bucketIndex = 0; + while (nb < n && bucketIndex <= targetBucketIndex) + { + if (bucketIndex < targetBucketIndex) nb += int(n*bucketsSizes[bucketIndex]); + else nb += int(eo::rng.uniform(1, n*bucketsSizes[targetBucketIndex])); + } + if (nb > n) nb = n; + + return nb; + } + + std::vector _bucketsSizes; + std::vector _bucketValues; +}; #endif // _eoStandardBitMutation_h_ From dfb6f7c2d9637f5a60f1300e7528dc13565208c2 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 22 Jan 2022 18:40:02 +0100 Subject: [PATCH 025/113] fix warning on signedess of comparison --- eo/src/eoProportionalSelect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/eoProportionalSelect.h b/eo/src/eoProportionalSelect.h index 7f10d53dc..65188bfe4 100644 --- a/eo/src/eoProportionalSelect.h +++ b/eo/src/eoProportionalSelect.h @@ -95,7 +95,7 @@ public: // assert(fortune <= cumulative.back()); - if(result - cumulative.begin() >= _pop.size()) { + if(static_cast(result - cumulative.begin()) >= _pop.size()) { return _pop.back(); } else { return _pop[result - cumulative.begin()]; From ef0e6531ee961438a9aeb5817efae2118ff9489d Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 23 Jan 2022 18:15:38 +0100 Subject: [PATCH 026/113] fix warnings about useless typedef --- eo/test/t-eoESAll.cpp | 2 +- eo/tutorial/Lesson4/ESEA.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eo/test/t-eoESAll.cpp b/eo/test/t-eoESAll.cpp index 3a77b6292..1da6659c5 100644 --- a/eo/test/t-eoESAll.cpp +++ b/eo/test/t-eoESAll.cpp @@ -101,7 +101,7 @@ in test dir) template void runAlgorithm(EOT, eoParser& _parser, eoState& _state) { - typedef typename EOT::Fitness FitT; + // typedef typename EOT::Fitness FitT; ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// diff --git a/eo/tutorial/Lesson4/ESEA.cpp b/eo/tutorial/Lesson4/ESEA.cpp index 6a2b51a23..a2f4c0acf 100644 --- a/eo/tutorial/Lesson4/ESEA.cpp +++ b/eo/tutorial/Lesson4/ESEA.cpp @@ -87,7 +87,7 @@ int main(int argc, char **argv) template void runAlgorithm(EOT, eoParser& _parser, eoState& _state) { - typedef typename EOT::Fitness FitT; + // typedef typename EOT::Fitness FitT; ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// From 009ef5e1d81d51ece84d48e8f61a9755ad5b1f33 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 23 Jan 2022 18:17:14 +0100 Subject: [PATCH 027/113] fix warning about useless arg --- eo/src/eoStochasticUniversalSelect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/eoStochasticUniversalSelect.h b/eo/src/eoStochasticUniversalSelect.h index e95f9eb0b..e6ddfe757 100644 --- a/eo/src/eoStochasticUniversalSelect.h +++ b/eo/src/eoStochasticUniversalSelect.h @@ -44,7 +44,7 @@ template class eoStochasticUniversalSelect: public eoSelectOne { public: /// Sanity check - eoStochasticUniversalSelect(const eoPop& pop = eoPop()) + eoStochasticUniversalSelect(/*const eoPop& pop = eoPop()*/) { if (minimizing_fitness()) throw eoException("eoStochasticUniversalSelect: minimizing fitness"); From 4ee48e760be1a24b5b61347440c88e147ddb564f Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 23 Jan 2022 18:17:48 +0100 Subject: [PATCH 028/113] refactor UF_random_generator to fit the new std::shuffle --- eo/src/eoInit.h | 10 ++++--- eo/src/utils/rnd_generators.h | 26 +++++++++++++------ eo/test/t-eoInitPermutation.cpp | 4 +-- eo/test/t-eobin.cpp | 20 +++++++------- mo/src/neighborhood/moRndVectorVNSelection.h | 4 +-- moeo/src/selection/moeoDetArchiveSelect.h | 2 +- .../src/selection/moeoNumberUnvisitedSelect.h | 2 +- 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index a73310778..58eef63e0 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -193,17 +193,19 @@ class eoInitPermutation: public eoInit // FIXME inherit from eoInitWithDim virtual void operator()(EOT& chrom) { chrom.resize(chromSize); - for(unsigned idx=0;idx gen(chrom.size()); + std::shuffle(chrom.begin(), chrom.end(), gen); chrom.invalidate(); } private : unsigned chromSize; unsigned startFrom; - UF_random_generator gen; + // UF_random_generator gen; }; /** @example t-eoInitPermutation.cpp */ diff --git a/eo/src/utils/rnd_generators.h b/eo/src/utils/rnd_generators.h index 60ff04b3f..01b682b67 100644 --- a/eo/src/utils/rnd_generators.h +++ b/eo/src/utils/rnd_generators.h @@ -89,7 +89,8 @@ class boolean_generator either between [0, _max) if only one value (_max) is given to the ctor or in [_min,_max) if 2 values are given (_min, _max) */ -template class random_generator +template +class random_generator { public : // added new ctor with 2 params, and modified the data to minim and range @@ -123,16 +124,25 @@ inline bool random_generator::operator()(void) function (see eoPop::shuffle): its operator() takes an unsigned argument m and must return an unsigned uniformly distributed in [0,m} */ -template class UF_random_generator +template +class UF_random_generator { - public : - UF_random_generator(eoRng& _rng = rng) : - random(_rng) {} + public : + using result_type = T; - T operator()(T _t) { return (T) (random.random(_t)); } + UF_random_generator(T max, eoRng& _rng = rng) + : _max(max), _random(_rng) + {} -private : - eoRng& random; + T operator()() { return _random.random(_max); } + T operator()(T m) { return _random.random(m); } + + T min() { return 0; } + T max() { return _max; } + + private : + T _max; + eoRng& _random; }; diff --git a/eo/test/t-eoInitPermutation.cpp b/eo/test/t-eoInitPermutation.cpp index 4b64f3576..44af6f6b0 100644 --- a/eo/test/t-eoInitPermutation.cpp +++ b/eo/test/t-eoInitPermutation.cpp @@ -43,7 +43,7 @@ int main() unsigned i; // a chromosome randomizer - eoInitPermutation random(CHROM_SIZE); + eoInitPermutation randomize(CHROM_SIZE); // the population: eoPop pop; @@ -55,7 +55,7 @@ int main() { Chrom chrom(CHROM_SIZE); std::cout << " Initial chromosome n°" << i << " : " << chrom << "..." << std::endl; - random(chrom); + randomize(chrom); eval(chrom); std::cout << " ... becomes : " << chrom << " after initialization" << std::endl; check_permutation(chrom); diff --git a/eo/test/t-eobin.cpp b/eo/test/t-eobin.cpp index 2a36d0ee1..4d3445faa 100644 --- a/eo/test/t-eobin.cpp +++ b/eo/test/t-eobin.cpp @@ -123,17 +123,17 @@ void main_function() << chrom << " " << chrom2 << std::endl; } - for (i = 1; i < SIZE / 2; i++) - for (j = 1; j < SIZE / 2; j++) - { - eoBitGxOver gxover(i, j); - std::fill(chrom.begin(), chrom.end(), false); - std::fill(chrom2.begin(), chrom2.end(), true); - gxover(chrom, chrom2); - chrom.fitness(binary_value(chrom)); chrom2.fitness(binary_value(chrom2)); - std::cout << "eoBinGxOver(" << i << ", " << j << ") ..... " - << chrom << " " << chrom2 << std::endl; + for (i = 1; i < SIZE / 2; i++) { + for (j = 1; j < SIZE / 2; j++) { + eoBitGxOver gxover(i, j); + std::fill(chrom.begin(), chrom.end(), false); + std::fill(chrom2.begin(), chrom2.end(), true); + gxover(chrom, chrom2); + chrom.fitness(binary_value(chrom)); chrom2.fitness(binary_value(chrom2)); + std::cout << "eoBinGxOver(" << i << ", " << j << ") ..... " + << chrom << " " << chrom2 << std::endl; } + } // test SGA algorithm eoGenContinue continuator1(50); diff --git a/mo/src/neighborhood/moRndVectorVNSelection.h b/mo/src/neighborhood/moRndVectorVNSelection.h index 3debb85d4..a460f2d45 100644 --- a/mo/src/neighborhood/moRndVectorVNSelection.h +++ b/mo/src/neighborhood/moRndVectorVNSelection.h @@ -86,6 +86,7 @@ public: for(unsigned int i = 0; i < LSvector.size(); i++) order.push_back(i); + UF_random_generator gen(order.size()); std::random_shuffle(order.begin(), order.end(), gen); currentOrder = 0; @@ -110,9 +111,6 @@ private: unsigned int currentOrder; // the index of heuristics in random order std::vector order; - // random generator - UF_random_generator gen; - }; #endif diff --git a/moeo/src/selection/moeoDetArchiveSelect.h b/moeo/src/selection/moeoDetArchiveSelect.h index 81e09e36c..78b69a06e 100644 --- a/moeo/src/selection/moeoDetArchiveSelect.h +++ b/moeo/src/selection/moeoDetArchiveSelect.h @@ -71,10 +71,10 @@ class moeoDetArchiveSelect : public eoSelect _dest.push_back(archive[i]); } else if (archive_size > max){ - UF_random_generator rndGen; std::vector permutation; for(unsigned int i=0; i < archive_size; i++) permutation.push_back(i); + UF_random_generator rndGen(permutation.size()); random_shuffle(permutation.begin(), permutation.end(), rndGen); for (unsigned int i=0; i rndGen; + UF_random_generator rndGen(res.size()); std::random_shuffle(res.begin(), res.end(), rndGen); res.resize(number); } From 3a6236594eb067fcb1f11804d58bd77ecacea2a6 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 23 Jan 2022 18:18:40 +0100 Subject: [PATCH 029/113] fix foundries examples Were declaring forges for parameters, the old way. --- eo/test/t-eoAlgoFoundryFastGA.cpp | 29 +++-------------------------- eo/test/t-eoFoundryFastGA.cpp | 24 +++--------------------- 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/eo/test/t-eoAlgoFoundryFastGA.cpp b/eo/test/t-eoAlgoFoundryFastGA.cpp index b80d19eb5..2c37d8190 100644 --- a/eo/test/t-eoAlgoFoundryFastGA.cpp +++ b/eo/test/t-eoAlgoFoundryFastGA.cpp @@ -22,12 +22,6 @@ int main(int /*argc*/, char** /*argv*/) eoAlgoFoundryFastGA foundry(init, eval, pop_size*10); - /***** Variation rates *****/ - for(double r = 0.0; r < 1.0; r+=0.1) { - foundry.crossover_rates.add(r); - foundry. mutation_rates.add(r); - } - /***** Crossovers ****/ foundry.crossovers.add< eo1PtBitXover >(); foundry.crossovers.add< eoUBitXover >(0.5); // preference over 1 @@ -70,56 +64,42 @@ int main(int /*argc*/, char** /*argv*/) foundry.continuators.add< eoSteadyFitContinue >(10,i); } - /***** Offspring population size *****/ - foundry.offspring_sizes.add(0); // 0 = same as parent pop - // for(size_t s = pop_size; s < 2*pop_size; s+=pop_size/10) { - // foundry.offspring_sizes.add(s); - // } - size_t n = - foundry.crossover_rates.size() - * foundry.crossover_selectors.size() + foundry.crossover_selectors.size() * foundry.crossovers.size() * foundry.aftercross_selectors.size() - * foundry.mutation_rates.size() * foundry.mutation_selectors.size() * foundry.mutations.size() * foundry.replacements.size() * foundry.continuators.size() - * foundry.offspring_sizes.size(); + ; std::clog << n << " possible algorithms instances." << std::endl; EOT best_sol; std::string best_algo = ""; size_t i=0; - for(size_t i_crossrate = 0; i_crossrate < foundry.crossover_rates.size(); ++i_crossrate ) { for(size_t i_crossselect = 0; i_crossselect < foundry.crossover_selectors.size(); ++i_crossselect ) { for(size_t i_cross = 0; i_cross < foundry.crossovers.size(); ++i_cross ) { for(size_t i_aftercrosel = 0; i_aftercrosel < foundry.aftercross_selectors.size(); ++i_aftercrosel ) { - for(size_t i_mutrate = 0; i_mutrate < foundry.mutation_rates.size(); ++i_mutrate ) { for(size_t i_mutselect = 0; i_mutselect < foundry.mutation_selectors.size(); ++i_mutselect ) { for(size_t i_mut = 0; i_mut < foundry.mutations.size(); ++i_mut ) { for(size_t i_rep = 0; i_rep < foundry.replacements.size(); ++i_rep ) { for(size_t i_cont = 0; i_cont < foundry.continuators.size(); ++i_cont ) { - for(size_t i_pop = 0; i_pop < foundry.offspring_sizes.size(); ++i_pop ) { std::clog << "\r" << i++ << "/" << n-1; std::clog.flush(); eoPop pop; pop.append(pop_size, init); foundry.select({ - i_crossrate, i_crossselect, i_cross, i_aftercrosel, - i_mutrate, i_mutselect, i_mut, i_rep, - i_cont, - i_pop + i_cont }); // Actually perform a search @@ -132,16 +112,13 @@ int main(int /*argc*/, char** /*argv*/) best_sol = pop.best_element(); best_algo = foundry.name(); } - } } } } } - } } } } - } std::cout << std::endl << "Best algo: " << best_algo << ", with " << best_sol << std::endl; } diff --git a/eo/test/t-eoFoundryFastGA.cpp b/eo/test/t-eoFoundryFastGA.cpp index 45abe7d84..b5960f55c 100644 --- a/eo/test/t-eoFoundryFastGA.cpp +++ b/eo/test/t-eoFoundryFastGA.cpp @@ -20,15 +20,6 @@ eoAlgoFoundryFastGA& make_foundry(eoFunctorStore& store, eoInit& ini foundry.continuators.add< eoSteadyFitContinue >(10,i); } - for(double i=0.1; i<1.0; i+=0.1) { - foundry.crossover_rates.add(i); - foundry.mutation_rates.add(i); - } - - for(size_t i=5; i<100; i+=10) { - foundry.offspring_sizes.add(i); - } - /***** Crossovers ****/ for(double i=0.1; i<0.9; i+=0.1) { foundry.crossovers.add< eoUBitXover >(i); // preference over 1 @@ -65,12 +56,6 @@ eoAlgoFoundryFastGA& make_foundry(eoFunctorStore& store, eoInit& ini } } - /***** Variation rates *****/ - for(double r = 0.0; r < 1.0; r+=0.1) { - foundry.crossover_rates.add(r); - foundry. mutation_rates.add(r); - } - /***** Replacements ****/ foundry.replacements.add< eoPlusReplacement >(); foundry.replacements.add< eoCommaReplacement >(); @@ -100,16 +85,13 @@ int main(int /*argc*/, char** /*argv*/) size_t n = - foundry.crossover_rates.size() - * foundry.crossover_selectors.size() - * foundry.crossovers.size() + foundry.crossover_selectors.size() * foundry.aftercross_selectors.size() - * foundry.mutation_rates.size() * foundry.mutation_selectors.size() * foundry.mutations.size() * foundry.replacements.size() * foundry.continuators.size() - * foundry.offspring_sizes.size(); + ; std::clog << n << " possible algorithms instances." << std::endl; @@ -117,7 +99,7 @@ int main(int /*argc*/, char** /*argv*/) pop.append(5,init); ::apply(onemax_eval,pop); - foundry.select({0,0,0,0,0,0,0,0}); + foundry.select({0,0,0,0,0,0/*,0,0*/}); foundry(pop); std::cout << "Done" << std::endl; From 02eb0e967da2ff05e87ac5f11d479f0d22d5295e Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 26 Jan 2022 10:40:50 +0100 Subject: [PATCH 030/113] fix eoAlgoFoundry management of numeric parameters - Use a variant to avoid implicit casting to integer when selecting with brace-initialization. - Add more doc around parameter forges. --- eo/contrib/irace/fastga.cpp | 18 +-- eo/src/eoAlgoFoundry.h | 190 ++++++++++++++++++++++++------ eo/src/eoAlgoFoundryEA.h | 73 +++++++----- eo/src/eoAlgoFoundryFastGA.h | 155 +++++++++++++++--------- eo/src/eoEvalFoundryEA.h | 25 ++-- eo/src/eoFastGA.h | 10 ++ eo/src/eoForge.h | 34 +++++- eo/src/utils/eoRNG.h | 1 + eo/test/t-algo-forged.cpp | 15 ++- eo/test/t-eoAlgoFoundryFastGA.cpp | 22 ++-- eo/test/t-eoFoundryFastGA.cpp | 13 +- 11 files changed, 393 insertions(+), 163 deletions(-) diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 73f0e5388..a7514f4b1 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -16,8 +16,6 @@ * ParadisEO algorithmic grammar definition. *****************************************************************************/ -// using Particle = eoRealParticle; -using Ints = eoInt, size_t>; using Bits = eoBit, int>; // by enumerating candidate operators and their parameters. @@ -341,7 +339,7 @@ int main(int argc, char* argv[]) "problem", "Problem ID", 'p', "Problem", /*required=*/true); const size_t problem = problem_p.value(); - assert(0 <= problem and problem < benchmark.size()); + assert(problem < benchmark.size()); // const size_t dimension = parser.getORcreateParam(1000, // "dimension", "Dimension size", @@ -624,7 +622,7 @@ int main(int argc, char* argv[]) eoInitFixedLength onemax_init(/*bitstring size=*/dimension, bgen); auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations, max_target); - Ints encoded_algo(foundry.size()); + eoAlgoFoundry::Encodings encoded_algo(foundry.size()); encoded_algo[foundry.crossover_rates .index()] = crossover_rate; encoded_algo[foundry.crossover_selectors .index()] = crossover_selector; @@ -641,16 +639,6 @@ int main(int argc, char* argv[]) foundry.select(encoded_algo); std::clog << foundry.name() << std::endl; - // // Evaluation of a forged encoded_algo on the sub-problem - // eoEvalFoundryFastGA eval_foundry( - // foundry, pop_size, - // onemax_init, onemax_eval, - // /*penalization=*/ dimension, // Worst case penalization. - // /*normalized=*/ false); // Use direct integer encoding. - // - // // Actually instanciate and run the algorithm. - // eval_foundry(encoded_algo); - /***************************************************************************** * Run and output results. *****************************************************************************/ @@ -661,7 +649,7 @@ int main(int argc, char* argv[]) onemax_eval(pop,pop); foundry(pop); // Actually run the selected algorithm. - } catch(eoMaxEvalException e) { + } catch(eoMaxEvalException & e) { eo::log << eo::debug << "Reached maximum evaluations: " << eval_count.getValue() << " / " << max_evals << std::endl; } diff --git a/eo/src/eoAlgoFoundry.h b/eo/src/eoAlgoFoundry.h index 2e7064c99..79591b085 100644 --- a/eo/src/eoAlgoFoundry.h +++ b/eo/src/eoAlgoFoundry.h @@ -15,6 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA © 2020 Thales group + © 2022 Institut Pasteur Authors: Johann Dreo @@ -24,6 +25,7 @@ #define _eoAlgoFoundry_H_ #include +#include /** A vector of eoForge which hold an index. * @@ -36,13 +38,13 @@ * which takes the class name as template and its constructor's parameters * as arguments. For example: * @code - * eoOperatorFoundry< eoSelectOne > selectors; - * selectors.add< eoStochTournamentSelect >( 0.5 ); + * eoOperatorFoundry< eoSelectOne > selectors; + * selectors.add< eoStochTournamentSelect >( 0.5 ); * @endcode * * @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it - * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, - * which would effectively disable any link between operators. + * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, + * which would effectively disable any link between operators. * * @ingroup Core * @ingroup Foundry @@ -51,11 +53,18 @@ template class eoOperatorFoundry : public eoForgeVector< Itf > { public: + /** Constructor + * + * @param encoding_index The slot position in the encodings, at which this operator is held. + * @param always_reinstantiate If false, will enable cache for the forges in this container. + */ eoOperatorFoundry(size_t encoding_index, bool always_reinstantiate = true ) : eoForgeVector(always_reinstantiate), _index(encoding_index) { } + /** Returns the slot index at which this is registered. + */ size_t index() const { return _index; } protected: @@ -63,6 +72,24 @@ class eoOperatorFoundry : public eoForgeVector< Itf > size_t _index; }; + +/** A vector of eoForge which hold a scalar numeric value. + * + * To be used in conjunction with a subclass of an eoAlgoFoundry, + * where it can hold a range of parameter values + * and hold the link to the encoding. @see eoAlgoFoundryEA + * + * As with eoForgeScalar, managed parameters + * are represented through a [min,max] range. + * + * For example: + * @code + * eoParameterFoundry< double > proba(0.0, 1.0); + * @endcode + * + * @ingroup Core + * @ingroup Foundry + */ template class eoParameterFoundry : public eoForgeScalar< Itf > { @@ -70,11 +97,26 @@ class eoParameterFoundry : public eoForgeScalar< Itf > "eoParameterFoundry should only be used on arithmetic types (i.e. integer or floating point types)"); public: + /** Underlying type of the parameter. + * + * @note: You probably only want to use either `double` or `size_t`. + * @see eoAlgoFoundry + */ + using Type = Itf; + + /** Constructor + * + * @param encoding_index The slot position in the encodings, at which this parameter is held. + * @param min Minimium possible value. + * @param max Maximum possible value. + */ eoParameterFoundry(size_t encoding_index, Itf min, Itf max) : eoForgeScalar(min, max), _index(encoding_index) { } + /** Returns the slot index at which this is registered. + */ size_t index() const { return _index; } protected: @@ -84,48 +126,54 @@ class eoParameterFoundry : public eoForgeScalar< Itf > /** Interface of a Foundry: a class that instantiate an eoAlgo on-the-fly, given a choice of its operators. * - * The chosen operators are encoded in a vector of indices. + * The chosen operators are encoded in a vector of numbers. * * The foundry subclass should first be set up with sets of operators of the same interface, * held within an eoOperatorFoundry member. * @code - * eoOperatorFoundry< eoSelectOne > selectors; + * eoOperatorFoundry< eoSelectOne > selectors; * @endcode * * In a second step, the operators to be used should be selected * by indicating their index, just like if the foundry was an array: * @code - * foundry.select({0, 1, 2}); - * // ^ ^ ^ - * // | | | - * // | | + 3d operator - * // | + 2d operator - * // + 1st operator + * foundry.select({size_t{0}, size_t{1}, size_t{2}}); + * // ^ ^ ^ + * // | | | + * // | | + 3d operator + * // | + 2d operator + * // + 1st operator * @endcode * * If you don't (want to) recall the order of the operators in the encoding, * you can use the `index()` member of eoOperatorFoundry, for example: * @code - * foundry.at(foundry.continuators.index()) = 2; // select the third continuator + * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator * @endcode * * Now, you must implement the foundry just like any eoAlgo, by using the eoPop interface: * @code - * foundry(pop); + * foundry(pop); * @encode * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. + * + * @note: The "encoding" which represent the selected options, figuring the actual meta-algorithm, + * is a vector of `std::variant`, which can hold either a `size_t` or a `double`. + * The first one is used to indicate the index of an operator class + * *or* a parameter which is a size. + * The second is used to store numerical parameters values. * * @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. - * Every instantiation is deferred upon actual use. That way, you can still reconfigure them - * at any time with `eoForgeOperator::setup`, for example: - * @code - * foundry.selector.at(0).setup(0.5); // using constructor's arguments - * @endcode + * Every instantiation is deferred upon actual use. That way, you can still reconfigure them + * at any time with `eoForgeOperator::setup`, for example: + * @code + * foundry.selector.at(0).setup(0.5); // using constructor's arguments + * @endcode * * @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it - * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, - * which would effectively disable any link between operators. + * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, + * which would effectively disable any link between operators. * * @ingroup Core * @ingroup Foundry @@ -135,30 +183,104 @@ template class eoAlgoFoundry : public eoAlgo { public: - /** + // We could use `std::any` instead of a variant, + // but this would be more prone to errors from the end user, at the end. + // Either the encoding is an index (of the operator within the list of instances) + // either it's a real-valued parameter, + // either it's a size. + // So there's no need for more types (AFAIK). + + /** The type use to represent a selected option in the meta-algorithm. + * + * This can figure, either: + * - the index of an operator in the list of possible ones, + * - the actual value of a numeric paramater, + * - the value of a parameter which is a size. */ - eoAlgoFoundry( size_t nb_operators ) : - _size(nb_operators), - _encoding(_size,0) + using Encoding = std::variant; + + /** The type use to store all selected options. + */ + using Encodings = std::vector; + + /** Constructor. + * + * @param nb_slots Number of operators or parameters that are assembled to make an algorithm. + */ + eoAlgoFoundry( size_t nb_slots ) : + _size(nb_slots) { } /** Select indices of all the operators. * * i.e. Select an algorithm to instantiate. + * + * @note: You need to indicate the type of each item + * if you want to call this with a brace-initialized vector. + * + * For example: + * @code + * foundry.select({ size_t{1}, double{0.5}, size_t{3} }); + * @endcode + * + * Or you can initialize the vector first: + * @code + * double crossover_rate = 0.5; + * size_t crossover_oper = 3; + * eoAlgoFoundry::Encodings encoded_algo(foundry.size()); + * encoded_algo[foundry.crossover_rates.index()] = crossover_rate; + * encoded_algo[foundry.crossover_opers.index()] = crossover_oper; + * @encdoe */ - void select( std::vector encoding ) + void select( Encodings encodings ) { - assert(encoding.size() == _encoding.size()); - _encoding = encoding; + assert(encodings.size() == _size); + _encodings = encodings; } - /** Access to the index of the currently selected operator. + /** Access to the encoding of the currently selected operator. + * + * @warning: This returns a `std::variant`, which you should `std::get`. + * + * For example: + * @code + * size_t opera_id = std::get(foundry.at(2)); + * double param_id = std::get(foundry.at(3)); + * @endcode + * + * @note: You can use rank, value or len to have automatic casting. */ - size_t& at(size_t i) + Encoding & at(size_t i) { - return _encoding.at(i); + return _encodings.at(i); } + /** Access to the currently selected ID of an operator. + */ + template + size_t rank(const OP& op) + { + return std::get( at(op.index()) ); + } + + /** Access to the currently selected value of a numeric parameter. + */ + template + double value(const OP& param) + { + return std::get( at(param.index()) ); + } + + /** Access to the currently selected value of a unsigned integer parameter. + */ + template + size_t len(const OP& param) + { + return std::get( at(param.index()) ); + } + + /** Returns the number of slots that makes this algorithm. + */ size_t size() const { return _size; @@ -166,14 +288,14 @@ class eoAlgoFoundry : public eoAlgo /** Return the underlying encoding vector. */ - std::vector encoding() const + Encodings encodings() const { - return _encoding; + return _encodings; } protected: const size_t _size; - std::vector _encoding; + std::vector _encodings; }; diff --git a/eo/src/eoAlgoFoundryEA.h b/eo/src/eoAlgoFoundryEA.h index 264072d2d..b88870208 100644 --- a/eo/src/eoAlgoFoundryEA.h +++ b/eo/src/eoAlgoFoundryEA.h @@ -15,9 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA © 2020 Thales group + © 2022 Institut Pasteur Authors: - Johann Dreo + Johann Dreo */ #ifndef _eoAlgoFoundryEA_H_ @@ -36,7 +37,7 @@ * which takes the class name as template and its constructor's parameters * as arguments. For example: * @code - * foundry.selectors.add< eoStochTournamentSelect >( 0.5 ); + * foundry.selectors.add< eoStochTournamentSelect >( 0.5 ); * @endcode * * @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it @@ -46,12 +47,12 @@ * In a second step, the operators to be used should be selected * by indicating their index, just like the foundry was a array of five elements: * @code - * foundry = {0, 1, 2, 0, 3}; - * // ^ ^ ^ ^ ^ replacement - * // | | | + selection - * // | | + mutation - * // | + crossover - * // + continue + * foundry = {size_t{0}, size_t{1}, size_t{2}, size_t{0}, size_t{3}}; + * // ^ ^ ^ ^ ^ replacement + * // | | | + selection + * // | | + mutation + * // | + crossover + * // + continue * @endcode * * @note: by default, the firsts of the five operators are selected. @@ -59,12 +60,12 @@ * If you don't (want to) recall the order of the operators in the encoding, * you can use the `index()` member, for example: * @code - * foundry.at(foundry.continuators.index()) = 2; // select the third continuator + * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator * @endcode * * Now, you can call the fourdry just like any eoAlgo, by passing it an eoPop: * @code - * foundry(pop); + * foundry(pop); * @encode * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. @@ -73,7 +74,7 @@ * Every instantiation is deferred upon actual use. That way, you can still reconfigure them * at any time with `eoForgeOperator::setup`, for example: * @code - * foundry.selector.at(0).setup(0.5); // using constructor's arguments + * foundry.selectors.at(0).setup(0.5); // using constructor's arguments * @endcode * * @ingroup Foundry @@ -111,11 +112,11 @@ class eoAlgoFoundryEA : public eoAlgoFoundry */ void operator()(eoPop& pop) { - assert(continuators.size() > 0); assert(this->at(continuators.index()) < continuators.size()); - assert( crossovers.size() > 0); assert(this->at( crossovers.index()) < crossovers.size()); - assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size()); - assert( selectors.size() > 0); assert(this->at( selectors.index()) < selectors.size()); - assert(replacements.size() > 0); assert(this->at(replacements.index()) < replacements.size()); + assert(continuators.size() > 0); assert(this->rank(continuators) < continuators.size()); + assert( crossovers.size() > 0); assert(this->rank( crossovers) < crossovers.size()); + assert( mutations.size() > 0); assert(this->rank( mutations) < mutations.size()); + assert( selectors.size() > 0); assert(this->rank( selectors) < selectors.size()); + assert(replacements.size() > 0); assert(this->rank(replacements) < replacements.size()); eoSequentialOp variator; variator.add(this->crossover(), 1.0); @@ -140,11 +141,11 @@ class eoAlgoFoundryEA : public eoAlgoFoundry std::string name() { std::ostringstream name; - name << this->at(continuators.index()) << " (" << this->continuator().className() << ") + "; - name << this->at(crossovers.index()) << " (" << this->crossover().className() << ") + "; - name << this->at(mutations.index()) << " (" << this->mutation().className() << ") + "; - name << this->at(selectors.index()) << " (" << this->selector().className() << ") + "; - name << this->at(replacements.index()) << " (" << this->replacement().className() << ")"; + name << this->continuator().className() << " [" << this->rank(continuators) << "] + "; + name << this->crossover() .className() << " [" << this->rank(crossovers) << "] + "; + name << this->mutation() .className() << " [" << this->rank(mutations) << "] + "; + name << this->selector() .className() << " [" << this->rank(selectors) << "] + "; + name << this->replacement().className() << " [" << this->rank(replacements) << "]"; return name.str(); } @@ -153,34 +154,44 @@ class eoAlgoFoundryEA : public eoAlgoFoundry const size_t _max_gen; public: + /** Currently selected continuator. + */ eoContinue& continuator() { - assert(this->at(continuators.index()) < continuators.size()); - return continuators.instantiate(this->at(continuators.index())); + assert(this->rank(continuators) < continuators.size()); + return continuators.instantiate(this->rank(continuators)); } + /** Currently selected crossover. + */ eoQuadOp& crossover() { - assert(this->at(crossovers.index()) < crossovers.size()); - return crossovers.instantiate(this->at(crossovers.index())); + assert(this->rank(crossovers) < crossovers.size()); + return crossovers.instantiate(this->rank(crossovers)); } + /** Currently selected mutation. + */ eoMonOp& mutation() { - assert(this->at(mutations.index()) < mutations.size()); - return mutations.instantiate(this->at(mutations.index())); + assert(this->rank(mutations) < mutations.size()); + return mutations.instantiate(this->rank(mutations)); } + /** Currently selected selector. + */ eoSelectOne& selector() { - assert(this->at(selectors.index()) < selectors.size()); - return selectors.instantiate(this->at(selectors.index())); + assert(this->rank(selectors) < selectors.size()); + return selectors.instantiate(this->rank(selectors)); } + /** Currently selected replacement. + */ eoReplacement& replacement() { - assert(this->at(replacements.index()) < replacements.size()); - return replacements.instantiate(this->at(replacements.index())); + assert(this->rank(replacements) < replacements.size()); + return replacements.instantiate(this->rank(replacements)); } }; diff --git a/eo/src/eoAlgoFoundryFastGA.h b/eo/src/eoAlgoFoundryFastGA.h index 0417511cb..8ccbb7039 100644 --- a/eo/src/eoAlgoFoundryFastGA.h +++ b/eo/src/eoAlgoFoundryFastGA.h @@ -29,25 +29,37 @@ /** A class that assemble an eoFastGA on the fly, given a combination of available operators. * - * The foundry should first be set up with sets of operators + * The foundry should first be set up with sets of operators/parameters * for the main modules of a FastGA: - * continuators, crossovers, mutations, selections, replacement operators, etc. + * continuators, crossovers (and rate of call), mutations (and rate of call), + * selections, replacement operators, offspring size, etc. * * This is done through public member variable's `add` method, * which takes the class name as template and its constructor's parameters * as arguments. For example: * @code - * foundry.selectors.add< eoRandomSelect >(); + * foundry.selectors.add< eoRandomSelect >(); * @endcode * * @warning If the constructor takes a reference YOU SHOULD ABSOLUTELY wrap it - * in a `std::ref`, or it will silently be passed as a copy, - * which would effectively disable any link with other operator(s). + * in a `std::ref`, or it will silently be passed as a copy, + * which would effectively disable any link with other operator(s). * * In a second step, the operators to be used should be selected - * by indicating their index, passing an array of 10 elements: + * by indicating their wanted index or value, passing an array of 10 elements: * @code - * foundry.select({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + * foundry.select({ + * double{0.1}, // crossover rate + * size_t{1}, // crossover selector + * size_t{2}, // crossover + * size_t{3}, // selector after crossover + * double{0.4}, // mutation rate + * size_t{5}, // mutation selector + * size_t{6}, // mutation + * size_t{7}, // replacement + * size_t{8}, // continuator + * size_t{9} // nb of offsprings + * }); * @endcode * * @note: by default, the firsts of the 10 operators are selected. @@ -55,22 +67,22 @@ * If you don't (want to) recall the order of the operators in the encoding, * you can use the `index()` member, for example: * @code - * foundry.at(foundry.continuators.index()) = 2; // select the third continuator + * foundry.at(foundry.continuators.index()) = size_t{2}; // select the third continuator * @endcode * * Now, you can call the foundry just like any eoAlgo, by passing it an eoPop: * @code - * foundry(pop); + * foundry(pop); * @encode * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. * * @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. - * Every instantiation is deferred upon actual use. That way, you can still reconfigure them - * at any time with `eoForgeOperator::setup`, for example: - * @code - * foundry.selector.at(0).setup(0.5); // Will call constructor's arguments - * @endcode + * Every instantiation is deferred upon actual use. That way, you can still reconfigure them + * at any time with `eoForgeOperator::setup`, for example: + * @code + * foundry.selector.at(0).setup(0.5); // Will call constructor's arguments + * @endcode * * @ingroup Foundry * @ingroup Algorithms @@ -111,31 +123,31 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry public: /* Operators containers @{ */ - eoParameterFoundry< double > crossover_rates; + eoParameterFoundry< double > crossover_rates; eoOperatorFoundry< eoSelectOne > crossover_selectors; eoOperatorFoundry< eoQuadOp > crossovers; eoOperatorFoundry< eoSelectOne > aftercross_selectors; - eoParameterFoundry< double > mutation_rates; + eoParameterFoundry< double > mutation_rates; eoOperatorFoundry< eoSelectOne > mutation_selectors; eoOperatorFoundry< eoMonOp > mutations; eoOperatorFoundry< eoReplacement > replacements; eoOperatorFoundry< eoContinue > continuators; - eoParameterFoundry< size_t > offspring_sizes; + eoParameterFoundry< size_t > offspring_sizes; /* @} */ /** instantiate and call the pre-selected algorithm. */ void operator()(eoPop& pop) { - assert( crossover_selectors.size() > 0); assert(this->at( crossover_selectors.index()) < crossover_selectors.size()); - assert( crossovers.size() > 0); assert(this->at( crossovers.index()) < crossovers.size()); - assert(aftercross_selectors.size() > 0); assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size()); - assert( mutation_selectors.size() > 0); assert(this->at( mutation_selectors.index()) < mutation_selectors.size()); - assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size()); - assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size()); - assert( continuators.size() > 0); assert(this->at( continuators.index()) < continuators.size()); + assert( crossover_selectors.size() > 0); assert(this->rank( crossover_selectors) < crossover_selectors.size()); + assert( crossovers.size() > 0); assert(this->rank( crossovers) < crossovers.size()); + assert(aftercross_selectors.size() > 0); assert(this->rank(aftercross_selectors) < aftercross_selectors.size()); + assert( mutation_selectors.size() > 0); assert(this->rank( mutation_selectors) < mutation_selectors.size()); + assert( mutations.size() > 0); assert(this->rank( mutations) < mutations.size()); + assert( replacements.size() > 0); assert(this->rank( replacements) < replacements.size()); + assert( continuators.size() > 0); assert(this->rank( continuators) < continuators.size()); // Objective function calls counter eoEvalCounterThrowException eval(_eval, _max_evals); @@ -165,7 +177,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry try { // restart(pop); algo(pop); - } catch(eoMaxEvalException e) { + } catch(eoMaxEvalException & e) { #ifndef NDEBUG eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl; #endif @@ -181,17 +193,18 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry std::string name() { std::ostringstream name; - name << "crossover_rates: " << this->at( crossover_rates.index()) << " (" << this-> crossover_rate() << ") + "; - name << "crossover_selectors: " << this->at( crossover_selectors.index()) << " (" << this-> crossover_selector().className() << ") + "; - name << "aftercross_selector: " << this->at(aftercross_selectors.index()) << " (" << this->aftercross_selector().className() << ") + "; - name << "crossovers: " << this->at( crossovers.index()) << " (" << this-> crossover().className() << ") + "; - name << "mutation_rates: " << this->at( mutation_rates.index()) << " (" << this-> mutation_rate() << ") + "; - name << "mutation_selectors: " << this->at( mutation_selectors.index()) << " (" << this-> mutation_selector().className() << ") + "; - name << "mutations: " << this->at( mutations.index()) << " (" << this-> mutation().className() << ") + "; - name << "replacements: " << this->at( replacements.index()) << " (" << this-> replacement().className() << ") + "; - name << "continuators: " << this->at( continuators.index()) << " (" << this-> continuator().className() << ") + "; - name << "offspring_sizes: " << this->at( offspring_sizes.index()) << " (" << this-> offspring_size() << ")"; - return name.str(); + name << "crossover_rate: " << this-> crossover_rate() << " + "; + name << "crossover_selector: " << this-> crossover_selector().className() << " [" << this->rank( crossover_selectors) << "] + "; + name << "aftercross_selector: " << this->aftercross_selector().className() << " [" << this->rank(aftercross_selectors) << "] + "; + name << "crossover: " << this-> crossover().className() << " [" << this->rank( crossovers) << "] + "; + name << "mutation_rate: " << this-> mutation_rate() << " + "; + name << "mutation_selector: " << this-> mutation_selector().className() << " [" << this->rank( mutation_selectors) << "] + "; + name << "mutation: " << this-> mutation().className() << " [" << this->rank( mutations) << "] + "; + name << "replacement: " << this-> replacement().className() << " [" << this->rank( replacements) << "] + "; + name << "continuator: " << this-> continuator().className() << " [" << this->rank( continuators) << "] + "; + name << "offspring_size: " << this-> offspring_size() << ""; + + return name.str(); } protected: @@ -201,61 +214,97 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry const size_t _max_restarts; public: + /** Currently selected continuator. + */ eoContinue& continuator() { - assert(this->at(continuators.index()) < continuators.size()); - return continuators.instantiate(this->at(continuators.index())); + const size_t r = this->rank(continuators); + assert(r < continuators.size()); + return continuators.instantiate(r); } + /** Currently selected crossover_rate. + */ double& crossover_rate() { - return crossover_rates.instantiate(this->at(crossover_rates.index())); + // We could have used `decltype(crossover_rates)::Type` instead of `double`, here, + // but this is less readable and the type is declared just above, + // so we are supposed to know it. + const double val = this->value(crossover_rates); + assert(crossover_rates.min() <= val and val <= crossover_rates.max()); + return crossover_rates.instantiate(val); } + /** Currently selected crossover. + */ eoQuadOp& crossover() { - assert(this->at(crossovers.index()) < crossovers.size()); - return crossovers.instantiate(this->at(crossovers.index())); + const size_t r = this->rank(crossovers); + assert(r < crossovers.size()); + return crossovers.instantiate(r); } + /** Currently selected mutation_rate. + */ double& mutation_rate() { - return mutation_rates.instantiate(this->at(mutation_rates.index())); + const double val = this->value(mutation_rates); + assert(mutation_rates.min() <= val and val <= mutation_rates.max()); + return mutation_rates.instantiate(val); } + /** Currently selected mutation. + */ eoMonOp& mutation() { - assert(this->at(mutations.index()) < mutations.size()); - return mutations.instantiate(this->at(mutations.index())); + const size_t r = this->rank(mutations); + assert(r < mutations.size()); + return mutations.instantiate(r); } + /** Currently selected crossover_selector. + */ eoSelectOne& crossover_selector() { - assert(this->at(crossover_selectors.index()) < crossover_selectors.size()); - return crossover_selectors.instantiate(this->at(crossover_selectors.index())); + const size_t r = this->rank(crossover_selectors); + assert(r < crossover_selectors.size()); + return crossover_selectors.instantiate(r); } + /** Currently selected aftercross_selector. + */ eoSelectOne& aftercross_selector() { - assert(this->at(aftercross_selectors.index()) < aftercross_selectors.size()); - return aftercross_selectors.instantiate(this->at(aftercross_selectors.index())); + const size_t r = this->rank(aftercross_selectors); + assert(r < aftercross_selectors.size()); + return aftercross_selectors.instantiate(r); } + /** Currently selected mutation_selector. + */ eoSelectOne& mutation_selector() { - assert(this->at(mutation_selectors.index()) < mutation_selectors.size()); - return mutation_selectors.instantiate(this->at(mutation_selectors.index())); + const size_t r = this->rank(mutation_selectors); + assert(r < mutation_selectors.size()); + return mutation_selectors.instantiate(r); } + /** Currently selected offspring_size. + */ size_t& offspring_size() { - return offspring_sizes.instantiate(this->at(offspring_sizes.index())); + const size_t val = this->len(offspring_sizes); + assert(offspring_sizes.min() <= val and val <= offspring_sizes.max()); + return offspring_sizes.instantiate(val); } + /** Currently selected replacement. + */ eoReplacement& replacement() { - assert(this->at(replacements.index()) < replacements.size()); - return replacements.instantiate(this->at(replacements.index())); + const size_t r = this->rank(replacements); + assert(r < replacements.size()); + return replacements.instantiate(r); } }; diff --git a/eo/src/eoEvalFoundryEA.h b/eo/src/eoEvalFoundryEA.h index 76521c9b6..e28645b73 100644 --- a/eo/src/eoEvalFoundryEA.h +++ b/eo/src/eoEvalFoundryEA.h @@ -15,9 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA © 2020 Thales group + © 2022 Institut Pasteur Authors: - Johann Dreo + Johann Dreo */ #ifndef _eoEvalFoundryEA_H_ @@ -90,7 +91,7 @@ public: * auto& cont = foundry.continuator(); // Get the configured operator * @encode */ - std::vector decode( const EOT& sol ) const + typename eoAlgoFoundry::Encodings decode( const EOT& sol ) const { // // Denormalize // size_t cont = static_cast(std::ceil( sol[i_cont] * _foundry.continuators.size() )); @@ -125,18 +126,18 @@ public: _subpb_eval(pop,pop); auto config = decode(sol); - double cont = config[i_cont]; - double cros = config[i_cros]; - double muta = config[i_muta]; - double sele = config[i_sele]; - double repl = config[i_repl]; + size_t cont = std::get(config[i_cont]); + size_t cros = std::get(config[i_cros]); + size_t muta = std::get(config[i_muta]); + size_t sele = std::get(config[i_sele]); + size_t repl = std::get(config[i_repl]); if( - 0 <= cont and cont < _foundry.continuators.size() - and 0 <= cros and cros < _foundry.crossovers .size() - and 0 <= muta and muta < _foundry.mutations .size() - and 0 <= sele and sele < _foundry.selectors .size() - and 0 <= repl and repl < _foundry.replacements.size() + cont < _foundry.continuators.size() + and cros < _foundry.crossovers .size() + and muta < _foundry.mutations .size() + and sele < _foundry.selectors .size() + and repl < _foundry.replacements.size() ) { _foundry.select(config); diff --git a/eo/src/eoFastGA.h b/eo/src/eoFastGA.h index f157377f1..91300d4a8 100644 --- a/eo/src/eoFastGA.h +++ b/eo/src/eoFastGA.h @@ -13,6 +13,11 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + © 2022 Institut Pasteur + + Authors: + Johann Dreo */ #ifndef _eoFastGA_H_ @@ -116,6 +121,11 @@ public: eoPop crossed; crossed.push_back(sol1); crossed.push_back(sol2); + + // The aftercross selector may need fitness, + // so we evaluate those two solutions, if needed. + _pop_eval(crossed,crossed); + _select_aftercross.setup(crossed); EOT sol3 = _select_aftercross(crossed); diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index f36476579..bc2dbb67d 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -15,9 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA © 2020 Thales group + © 2022 Institut Pasteur Authors: - Johann Dreo + Johann Dreo */ #ifndef _eoForge_H_ @@ -185,7 +186,7 @@ class eoForgeOperator : public eoForgeInterface Itf* _instantiated; }; -/** A vector holding an operator with deferred instantiation at a given index. +/** A vector holding an operator (with deferred instantiation) at a given index. * * @note You can actually store several instances of the same class, * with different parametrization (or not). @@ -319,18 +320,41 @@ class eoForgeVector : public std::vector*> bool _no_cache; }; +/** A range holding a parameter value at a given index. + * + * This is essential a scalar numerical parameter, with bounds check + * and an interface similar to an eoForgeVector. + * + * @note Contrary to eoForgeVector, this does not store a set of possible values. + * + * @code + eoForgeScalar factories(0.0, 1.0); + + // Actually instantiate. + double param = factories.instantiate(0.5); + * @endcode + * + * @ingroup Foundry + */ template class eoForgeScalar { public: using Interface = Itf; + /** Constructor + * + * @param min Minimum possible value. + * @param may Maximum possible value. + */ eoForgeScalar(Itf min, Itf max) : _min(min), _max(max) { } /** Just return the same value, without managing any instantiation. + * + * Actually checks if value is in range. */ Itf& instantiate(double value) { @@ -353,18 +377,24 @@ class eoForgeScalar Itf min() const { return _min; } Itf max() const { return _max; } + /** Set the minimum possible value. + */ void min(Itf min) { assert(_min <= _max); _min = min; } + /** Set the maximum possible value. + */ void max(Itf max) { assert(_max >= _min); _max = max; } + /** Set the possible range of values. + */ void setup(Itf min, Itf max) { _min = min; diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index 5733f9e6b..e91c6af5f 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -55,6 +55,7 @@ typedef unsigned long uint32_t; #include "../eoObject.h" + /** Random Number Generator @class eoRng eoRNG.h utils/eoRNG.h diff --git a/eo/test/t-algo-forged.cpp b/eo/test/t-algo-forged.cpp index b2f6b4d46..194edc9aa 100644 --- a/eo/test/t-algo-forged.cpp +++ b/eo/test/t-algo-forged.cpp @@ -77,14 +77,13 @@ int main(int /*argc*/, char** /*argv*/) pop.append(pop_size, init); eval(pop,pop); - foundry.at(foundry.continuators.index()) = i_cont; - foundry.at(foundry.crossovers.index()) = i_cross; - foundry.at(foundry.mutations.index()) = i_mut; - foundry.at(foundry.selectors.index()) = i_sel; - foundry.at(foundry.replacements.index()) = i_rep; - - // Or, if you know the order. - foundry.select({i_cont, i_cross, i_mut, i_sel, i_rep}); + foundry.select({ + size_t{i_cont}, + size_t{i_cross}, + size_t{i_mut}, + size_t{i_sel}, + size_t{i_rep} + }); // Actually perform a search foundry(pop); diff --git a/eo/test/t-eoAlgoFoundryFastGA.cpp b/eo/test/t-eoAlgoFoundryFastGA.cpp index 2c37d8190..fa97ca1b8 100644 --- a/eo/test/t-eoAlgoFoundryFastGA.cpp +++ b/eo/test/t-eoAlgoFoundryFastGA.cpp @@ -16,6 +16,7 @@ int main(int /*argc*/, char** /*argv*/) using EOT = eoBit; oneMaxEval eval; + eoPopLoopEval popeval(eval); eoBooleanGenerator gen(0.5); eoInitFixedLength init(dim, gen); @@ -76,6 +77,8 @@ int main(int /*argc*/, char** /*argv*/) ; std::clog << n << " possible algorithms instances." << std::endl; + std::clog << "Running everything (this may take time)..." << std::endl; + EOT best_sol; std::string best_algo = ""; @@ -91,15 +94,20 @@ int main(int /*argc*/, char** /*argv*/) eoPop pop; pop.append(pop_size, init); + popeval(pop,pop); + // FIXME put the parameters in the test? foundry.select({ - i_crossselect, - i_cross, - i_aftercrosel, - i_mutselect, - i_mut, - i_rep, - i_cont + double{0.5}, // crossover_rate + size_t{i_crossselect}, + size_t{i_cross}, + size_t{i_aftercrosel}, + double{0.5}, // mutation_rate + size_t{i_mutselect}, + size_t{i_mut}, + size_t{i_rep}, + size_t{i_cont}, + size_t{pop_size} // offspring_size }); // Actually perform a search diff --git a/eo/test/t-eoFoundryFastGA.cpp b/eo/test/t-eoFoundryFastGA.cpp index b5960f55c..6a6ee0322 100644 --- a/eo/test/t-eoFoundryFastGA.cpp +++ b/eo/test/t-eoFoundryFastGA.cpp @@ -99,7 +99,18 @@ int main(int /*argc*/, char** /*argv*/) pop.append(5,init); ::apply(onemax_eval,pop); - foundry.select({0,0,0,0,0,0/*,0,0*/}); + foundry.select({ + /*crossover_rates */ double{0.8}, + /*crossover_selectors */ size_t{0}, + /*crossovers */ size_t{0}, + /*aftercross_selectors*/ size_t{0}, + /*mutation_rates */ double{0.9}, + /*mutation_selectors */ size_t{0}, + /*mutations */ size_t{0}, + /*replacements */ size_t{0}, + /*continuators */ size_t{0}, + /*offspring_sizes */ size_t{1}, + }); foundry(pop); std::cout << "Done" << std::endl; From 8948f0a3dca96b6845f82dd4d4ea8e5f6745ba0c Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 26 Jan 2022 16:45:51 +0100 Subject: [PATCH 031/113] fix doc: big update - use single doxyfile instead of one per module - use a cleaner and more modern style - reorder sections to put details first - hide diagrams by default - remove deprecated doxygen variables - disable latex generation by default - fix some doc typos --- CMakeLists.txt | 6 +- DoxygenLayout.xml | 226 +++++++ README.md | 4 + eo/doc/eo.doxyfile.cmake => doxyfile.cmake | 83 +-- doxygen-style.css | 736 +++++++++++++++++++++ edo/doc/CMakeLists.txt | 3 +- edo/doc/edo.doxyfile.cmake | 6 +- eo/doc/CMakeLists.txt | 3 +- eo/src/eoAlgoFoundry.h | 21 +- eo/src/eoAlgoFoundryEA.h | 12 +- eo/src/eoAlgoFoundryFastGA.h | 7 +- mo/doc/CMakeLists.txt | 3 +- mo/doc/mo.doxyfile.cmake | 4 +- moeo/doc/CMakeLists.txt | 3 +- moeo/doc/moeo.doxyfile.cmake | 4 +- problems/DTLZ/doc/moeo.doxyfile.cmake | 2 +- smp/doc/CMakeLists.txt | 3 +- smp/doc/smp.doxyfile.cmake | 4 +- 18 files changed, 1038 insertions(+), 92 deletions(-) create mode 100644 DoxygenLayout.xml rename eo/doc/eo.doxyfile.cmake => doxyfile.cmake (96%) create mode 100644 doxygen-style.css diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f415bc67..57a9f5d2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,13 +81,15 @@ set(SMP "false" CACHE BOOL "Build the SMP module") set(MPI "false" CACHE BOOL "Build the MPI module") ## EO Module -set(EO_MODULE_NAME "Evolving Object") +# set(EO_MODULE_NAME "Evolving Objects") +set(MODULE_NAME "Evolving Objects") set(CMAKE_SOURCE_DIR ${EO_SRC_DIR}) add_subdirectory(${EO_SRC_DIR}) if(NOT EO_ONLY) ## MO Module - set(MO_MODULE_NAME "Moving objects") + # set(MO_MODULE_NAME "Moving Objects") + set(MODULE_NAME "Moving Objects") set(CMAKE_SOURCE_DIR ${MO_SRC_DIR}) add_subdirectory(${MO_SRC_DIR}) diff --git a/DoxygenLayout.xml b/DoxygenLayout.xml new file mode 100644 index 000000000..562b5f2b8 --- /dev/null +++ b/DoxygenLayout.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index c9a6f9ef3..59ded2801 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,10 @@ If you `ENABLE_CMAKE_TESTING` and `BUILD_TESTING`, it will be the tests, which y If you `ENABLE_CMAKE_EXAMPLE`, it will also build the examples. +If may want to make build scripts more verbose (especially when building the +doc) by enabling `CMAKE_VERBOSE_MAKEFILE`. + + ## Licenses Paradiseo is distributed under the GNU Lesser General Public License and the CeCILL license (depending on the modules). diff --git a/eo/doc/eo.doxyfile.cmake b/doxyfile.cmake similarity index 96% rename from eo/doc/eo.doxyfile.cmake rename to doxyfile.cmake index 934114d8f..6b1cb5257 100644 --- a/eo/doc/eo.doxyfile.cmake +++ b/doxyfile.cmake @@ -25,13 +25,13 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = @PACKAGE_NAME@ +PROJECT_NAME = @MODULE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -272,22 +272,6 @@ SUBGROUPING = YES TYPEDEF_HIDES_STRUCT = NO -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -500,7 +484,7 @@ FILE_VERSION_FILTER = # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. -LAYOUT_FILE = +LAYOUT_FILE = @CMAKE_SOURCE_DIR@/DoxygenLayout.xml #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -594,7 +578,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = @CMAKE_SOURCE_DIR@/src/obsolete @CMAKE_SOURCE_DIR@/test @CMAKE_SOURCE_DIR@/tutorial @CMAKE_SOURCE_DIR@/contrib @CMAKE_SOURCE_DIR@/app +EXCLUDE = @CMAKE_SOURCE_DIR@/deprecated @CMAKE_SOURCE_DIR@/eo/contrib @CMAKE_SOURCE_DIR@/eo/app @CMAKE_SOURCE_DIR@/eo/tutorial @CMAKE_SOURCE_DIR@/mo/tutorial @CMAKE_SOURCE_DIR@/moeo/tutorial @CMAKE_SOURCE_DIR@/smp/tutorial # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -608,7 +592,7 @@ EXCLUDE_SYMLINKS = NO # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = *.sif/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -622,7 +606,7 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/test +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/eo/test @CMAKE_SOURCE_DIR@/edo/test @CMAKE_SOURCE_DIR@/mo/test @CMAKE_SOURCE_DIR@/moeo/test @CMAKE_SOURCE_DIR@/smp/test # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -784,14 +768,16 @@ HTML_HEADER = HTML_FOOTER = -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# The HTML_EXTRA_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -HTML_STYLESHEET = +# HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen-awesome-css/doxygen-awesome.css +# HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen_theme_flat_design/src/doxygen-style.css +HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen-style.css # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML @@ -800,7 +786,7 @@ HTML_STYLESHEET = # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). -HTML_DYNAMIC_SECTIONS = NO +HTML_DYNAMIC_SECTIONS = YES # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 @@ -970,7 +956,7 @@ SEARCHENGINE = YES # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be @@ -1129,18 +1115,6 @@ GENERATE_XML = NO XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that @@ -1301,11 +1275,6 @@ ALLEXTERNALS = NO EXTERNAL_GROUPS = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- @@ -1319,15 +1288,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. @@ -1350,7 +1310,7 @@ HAVE_DOT = YES # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. -DOT_FONTNAME = FreeSans +DOT_FONTNAME = # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. @@ -1392,7 +1352,7 @@ UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. -TEMPLATE_RELATIONS = NO +TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented @@ -1440,7 +1400,18 @@ DIRECTORY_GRAPH = YES # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. -DOT_IMAGE_FORMAT = png +DOT_IMAGE_FORMAT = svg + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES +# to enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml +# in order to make the SVG files visible. +# Older versions of IE do not have SVG support. +# This tag requires that the tag HAVE_DOT is set to YES. + +INTERACTIVE_SVG = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. @@ -1486,7 +1457,7 @@ DOT_TRANSPARENT = NO # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. -DOT_MULTI_TARGETS = NO +DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and diff --git a/doxygen-style.css b/doxygen-style.css new file mode 100644 index 000000000..4877ae6aa --- /dev/null +++ b/doxygen-style.css @@ -0,0 +1,736 @@ +/* This doxygen theme is free to use. If you like this, please Star https://github.com/kcwongjoe/doxygen_theme_flat_design */ + +/* Color Pattern. You can change this pattern to design your theme. */ + +:root { + /* Content */ + --bgcolor: #ffffff; + --bgfont: #303030; + --bgfont2: #3771c8; + --bgfont-hover: #3771c8; + --bgfont-hover-text-decoration: none; + --bgborder: #7d7d7d; + --bgborder2: #f6f6f6; + /* Main Header */ + --bg1color: #303030; + --bg1font: #ffffff; + --bg1font2: #3771c8; + /* Second header */ + --bg2color: #E2E2E2; + --bg2font: #7D7D7D; + --bg2-hover-bg: #ffffff; + --bg2-hover-font: #303030; + --bg2-hover-topborder: #3771c8; + /* Third header */ + --bg3color: #f6f6f6; + --bg3font: #303030; + --bg3font2: #7D7D7D; + /* Code */ + --code-bg: #f6f6f6; + --code-comment: #7D7D7D; + --code-keyword: #d73a49; + --code-preprocessor: #d73a49; + --code-keywordtype: #d73a49; + --code-text: #303030; + --code-code: #6f42c1; + --code-line: #7D7D7D; + --code-line-bg: #D8D8D8; + /* Namespace List, Class List icon */ + --icon-bg: #303030 + --icon-font: #3771c8; + /* Class Index */ + --qindex-menu-bg: #303030; + --qindex-menu-font: #ffffff; + --qindex-menu-font-hover: #3771c8; + --qindex-icon-bg: #3771c8; + --qindex-icon-font: #303030; + /* Member table */ + --mem-title-bg: #3771c8; + --mem-title-font: #ffffff; + --mem-subtitle-bg: #77b1f8; + --mem-subtitle-font: #303030; + --mem-subtitle-font-hover: #303030; + --mem-content-bg: #ffffff; + --mem-content-font: #303030; + --mem-content-border: grey; + --mem-content-highlighted:#3771c8; + /* Nav Tree */ + --nav-tree-bg: #E2E2E2; + --nav-tree-bg-hover: #ffffff; + --nav-tree-font: #7D7D7D; + --nav-tree-font-hover: #303030; + --nav-tree-bg-selected: #3771c8; + --nav-tree-font-selected: white; +} + +body, table, div, p, dl { + color: var(--bgfont); + background-color: var(--bgcolor); + line-height: 150%; + font: 14px/22px, Roboto, Arial; +} + +div.contents { + margin: 20px 40px; +} + +div.contents ul { + line-height: 200%; +} + +/***********************************/ + +/********** Project header *********/ + +/***********************************/ + +#titlearea { + border-bottom: none; + padding-bottom: 20px; + padding-top: 20px; +} + +#titlearea, #titlearea * { + color: var(--bg1font); + background-color: var(--bg1color); +} + +#projectname { + padding: 0px 40px !important; +} + +#projectbrief { + padding: 0px 40px !important; +} + +#projectalign { + padding: 0px !important; +} + +/***********************************/ + +/************ Main Menu ************/ + +/***********************************/ + +/* Margin */ + +#main-menu { + padding: 0px 30px; +} + +#main-menu a, #main-menu a:hover { + padding-top: 10px; + padding-bottom: 10px; +} + +/* Menu button */ + +#main-menu li a { + background-image: none; + font-family: Arial; + text-shadow: none; + font-size: 14px; + font-weight: 700; +} + +#main-menu, #main-menu>li>a { + background-image: none; + background-color: var(--bg2color); + color: var(--bg2font); + transition: 0.2s; +} + +/* hover Effect */ + +#main-menu>li { + border-top: 5px solid var(--bg2color); +} + +#main-menu>li:hover { + color: var(--bg2-hover-font); + background-color: var(--bg2-hover-bg); + border-top: 5px solid var(--bg2-hover-topborder); + font-width: bold; +} + +#main-menu>li:hover, #main-menu>li>a:hover, #main-menu>li>a.highlighted { + color: var(--bg2-hover-font); + background-color: var(--bg2-hover-bg); + font-width: bold; +} + +/* Search Bar */ + +#MSearchBox { + border-radius: 0; + box-shadow: none; +} + +#MSearchBox>span { + margin: 10px; +} + +#main-menu>li:last-child { + padding: 25px 0px; +} + +/* Reset search hover color*/ + +#main-menu>li:last-child:hover { + color: var(--bg2font); + background-color: var(--bg2color); + border-top: 5px solid var(--bg2color); +} + +#MSearchResultsWindow { + border: 1px solid var(--bg3font2); + background-color: var(--bg3color); + padding: 10px; +} + +body.SRPage, body.SRPage * { + font-family: Arial; +} + +/* Sub Menu */ + +#main-menu>li ul { + transition: max-height 0.2s ease-in-out; + padding: 0px; + border-radius: 0px !important; +} + +#main-menu>li ul:before, #main-menu>li ul:after { + border-width: 0px; +} + +#main-menu>li>ul li a, #main-menu>li>ul li { + background-color: var(--bgcolor); + color: var(--bgfont); + background-image: none; +} + +#main-menu>li>ul li a:hover, #main-menu>li>ul li:hover { + background-color: var(--bgfont2); + /*color: var(--bgfont);*/ + color: white; + font-width: bold; +} + +/***********************************/ + +/************** Header *************/ + +/***********************************/ + +div.headertitle { + padding: 5px 40px; +} + +div.header, div.header * { + color: var(--bg3font); + background-color: var(--bg3color); + border-bottom: none; +} + +div.summary { + padding-right: 40px; +} + +/***********************************/ + +/************** Link *************/ + +/***********************************/ + +a, a:visited, a:active, .contents a:visited, body.SRPage a, body.SRPage a:visited, body.SRPage a:active { + color: var(--bgfont); + text-decoration: none; +} + +a:hover, .contents a:hover, body.SRPage a:hover { + color: var(--bgfont-hover); + text-decoration: var(--bgfont-hover-text-decoration); +} + +/***********************************/ + +/************ Nav-path ************/ + +/***********************************/ + +#nav-path, #nav-path ul { + background-image: none; +} + +#nav-path ul { + padding: 5px 30px; +} + +#nav-path, #nav-path * { + color: var(--bg3font2); + background-color: var(--bg3color); + border: none; + font-family: Arial; +} + +li.navelem { + background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuY29tL3N2Z2pzIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDI5Mi4zNTkgMjkyLjM1OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgY2xhc3M9IiI+PGc+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+Cgk8cGF0aCBkPSJNMjIyLjk3OSwxMzMuMzMxTDk1LjA3Myw1LjQyNEM5MS40NTYsMS44MDcsODcuMTc4LDAsODIuMjI2LDBjLTQuOTUyLDAtOS4yMzMsMS44MDctMTIuODUsNS40MjQgICBjLTMuNjE3LDMuNjE3LTUuNDI0LDcuODk4LTUuNDI0LDEyLjg0N3YyNTUuODEzYzAsNC45NDgsMS44MDcsOS4yMzIsNS40MjQsMTIuODQ3YzMuNjIxLDMuNjE3LDcuOTAyLDUuNDI4LDEyLjg1LDUuNDI4ICAgYzQuOTQ5LDAsOS4yMy0xLjgxMSwxMi44NDctNS40MjhsMTI3LjkwNi0xMjcuOTA3YzMuNjE0LTMuNjEzLDUuNDI4LTcuODk3LDUuNDI4LTEyLjg0NyAgIEMyMjguNDA3LDE0MS4yMjksMjI2LjU5NCwxMzYuOTQ4LDIyMi45NzksMTMzLjMzMXoiIGZpbGw9IiM3ZDdkN2QiIGRhdGEtb3JpZ2luYWw9IiMwMDAwMDAiIHN0eWxlPSIiIGNsYXNzPSIiPjwvcGF0aD4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8L2c+PC9zdmc+); + background-size: 9px; +} + +li.navelem a { + margin-right: 20px; +} + +/***********************************/ + +/*************** mem ***************/ + +/***********************************/ + +.memtitle { + padding: 15px; + margin-top: 30px; + border-top-left-radius: 0px; + border-top-right-radius: 0px; +} + +.memtitle, .memtitle *, .memtitle a:visited { + border: none; + background-image: none; + color: var(--mem-title-font); + background-color: var(--mem-title-bg); +} + +.memproto { + padding: 2em; + text-shadow: none; + border-top-right-radius: 0px; + -moz-border-radius-topright: 0px; + -webkit-border-top-right-radius: 0px; +} + +.memproto, .memproto *, .memproto a:visited { + border: none; + background-image: none; + background-color: var(--mem-subtitle-bg); + color: var(--mem-subtitle-font); + font-size: inherit; + line-height: 100% +} + +.memproto a:hover { + color: var(--mem-subtitle-font-hover); +} + +.memdoc { + border-bottom: 1px solid var(--mem-content-border); + border-left: 1px solid var(--mem-content-border); + border-right: 1px solid var(--mem-content-border); + background-color: var(--mem-content-bg); + color: var(--mem-content-font); + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; + -moz-border-radius-bottomleft: 0px; + -moz-border-radius-bottomright: 0px; + -webkit-border-bottom-left-radius: 0px; + -webkit-border-bottom-right-radius: 0px; + padding:1em; +} + +.memdoc p, .memdoc dt { + padding: 0px 20px; +} + +.memdoc > p { + font-size:1.2em; +} + +.paramname { + color:black; +} + +td.memItemRight > a:first-of-type { + font-size:1.3em; +} + +/***********************************/ + +/************* Contents ************/ + +/***********************************/ + +a.anchor { + padding-top: 20px; +} + +dl { + border-left: 5px solid; + padding:1em; +} + +dt { + font-variant-caps: small-caps; +} + +dl.warning { + border-top: thin solid red; + border-right: thin solid red; + border-bottom: thin solid red; + border-left-color: red; + background-color: #fee; +} + +dl.warning > dt { + color: #500; +} + +dl.note { + border-top:thin solid green; + border-right:thin solid green; + border-bottom:thin solid green; + border-left-color:green; + background-color: #efe; +} + +dl.note > dt { + color: #050; +} + +div.textblock { + padding:2em; + border: 2px solid var(--bgfont2); + box-shadow:0.5em 0.5em 0.5em var(--bgfont); + background-color: #fafaff; +} + +div.textblock > p { + font-size:1.2em; +} + +div.textblock > p.definition { + font-size:0.8em; +} + +p.definition { + font-size: 0.8em; +} + +p.reference { + font-size: 0.8em; +} + +p { + background-color: transparent; +} + +table { + margin-top:4em; +} + +table.memname { + margin-top:0.1em; +} + +table.mlabels { + margin-top:0.1em; +} + +/***********************************/ + +/************* fragment ************/ + +/***********************************/ + +h2.groupheader { + color: #303030; + font-size: 200%; + font-weight: bold; + border-bottom: thin solid var(--bgfont2); + padding-bottom:1px; + margin-top:3em; +} + +h3 { + background-color:var(--bgfont2); + color: var(--bgcolor); + font-size: 1.5em; + margin:0px; + padding:1em; + margin-bottom:2em; + border: 2px solid var(--bgfont2); + box-shadow:0.5em 0.5em 0.5em var(--bgfont); +} + +div.fragment, pre.fragment { + border: none; + padding: 20px; + margin: none; + background-color: var(--code-bg); +} + +div.line { + background-color: var(--code-bg); +} + +span.comment { + color: var(--code-comment); +} + +span.keyword { + color: var(--code-keyword); +} + +span.preprocessor { + color: var(--code-preprocessor); +} + +span.keywordtype { + color: var(--code-keywordtype); +} + +span.mlabel { + background-color: var(--code-text); + color: var(--code-bg); + border-top: none; + border-left: none; + border-right: none; + border-bottom: none; + padding: 10px; + border-radius: 0px; +} + +a.code { + color: var(--code-code); +} + +span.lineno, span.lineno>* { + color: var(--code-line); + border-right: none; + background-color: var(--code-bg); +} + +span.lineno a { + background-color: var(--code-line-bg); +} + +span.lineno a:hover { + color: var(--bg3font); + background-color: var(--code-line-bg); +} + +/***********************************/ + +/************* directory ***********/ + +/***********************************/ + +.directory tr.even { + background-color: inherit; +} + +.iconfclosed { + background-image: url(closed-folder.png); + margin-right: 10px; +} + +.iconfopen { + background-image: url(opened-folder.png); + margin-right: 10px; +} + +.icondoc { + background-image: url(document.png); + margin-right: 10px; +} + +.arrow { + color: #7d7d7d; +} + +.icona { + vertical-align: middle; + margin-right: 5px; +} + +.icon { + background-color: var(--icon-bg); + color: var(--icon-font); + display: table-cell; + vertical-align: middle; + height: 20px; + width: 20px; +} + +div.ah { + background-color: var(--qindex-icon-bg); + color: var(--qindex-icon-font); + text-align: center; + background-image: none; + -webkit-box-shadow: none; + box-shadow: none; + -webkit-border-radius: 0px; + border-radius: 0px; + border: none; +} + +div.qindex { + background-color: var(--qindex-menu-bg); + border: none; + padding: 20px; +} + +a.qindex { + color: var(--qindex-menu-font); + font-weight: normal; + font-size: 20px; +} + +a:hover.qindex { + color: var(--qindex-menu-font-hover); +} + +a:visited.qindex { + color: var(--qindex-menu-font); +} + +table.classindex { + margin-top: 30px; + margin-bottom: 30px; +} + +table.classindex a.el { + font-weight: normal; +} + +/***********************************/ + +/************** footer *************/ + +/***********************************/ + +div.directory { + border-top: 1px solid var(--bgborder); + border-bottom: none; + margin: 20px 0px; +} + +div.directory a.el { + font-weight: normal; +} + +div.directory>table { + margin: 20px 0px; +} + +hr.footer { + border: none; +} + +.contents>hr { + border-top: 0px; +} + +/***********************************/ + +/*********** memberdecls ***********/ + +/***********************************/ + +.memItemLeft, .memItemRight { + padding: 15px 30px; + background-color: inherit; +} + +.mdescRight { + padding: 0px 30px 10px 30px; +} + +.memberdecls * { + background-color: inherit; +} + +.memSeparator { + border-bottom: 1px solid var(--bgborder2); +} + +.memTemplParams { + color: var(--bgfont); +} + +/***********************************/ + +/*********** nav-tree ***********/ + +/***********************************/ + +#nav-tree-contents { + background-color: var(--nav-tree-bg); + margin: 0px; +} + +#side-nav, #nav-tree { + background-image: none; + background-color: var(--nav-tree-bg); +} + +#nav-tree .item { + background-color: var(--nav-tree-bg); + font-family: Arial; + text-shadow: none; + font-size: 14px; + font-weight: 700; + padding: 10px; + color: var(--nav-tree-font); +} + +#nav-tree .arrow { + color: var(--nav-tree-font); +} + +#nav-tree .selected { + background-image: none; + background-color: var(--nav-tree-bg-selected); +} + +#nav-tree .selected a { + color: var(--nav-tree-font-selected); +} + +#nav-tree .item:hover { + background-color: var(--nav-tree-bg-hover); + color: var(--nav-tree-font-hover); +} + +#nav-tree .item a:hover { + color: var(--nav-tree-font-hover); +} + +#side-nav .ui-resizable-e { + background-image: none; + background-color: var(--nav-tree-bg); +} + +#nav-sync { + background-color: transparent; +} + +#nav-sync>img { + content: url(off_sync.png); +} + +#nav-sync.sync>img { + content: url(on_sync.png); +} + +/***********************************/ + +/*********** Plant UML ***********/ + +/***********************************/ + +.plantumlgraph > img { + width: 80%; +} diff --git a/edo/doc/CMakeLists.txt b/edo/doc/CMakeLists.txt index 435b71f75..b06aabcb3 100644 --- a/edo/doc/CMakeLists.txt +++ b/edo/doc/CMakeLists.txt @@ -22,7 +22,8 @@ if(DOXYGEN_FOUND) ) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake" + # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake" + configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" "${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/edo/doc/edo.doxyfile.cmake b/edo/doc/edo.doxyfile.cmake index e3eef6602..252be5232 100644 --- a/edo/doc/edo.doxyfile.cmake +++ b/edo/doc/edo.doxyfile.cmake @@ -25,13 +25,13 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = @PACKAGE_NAME@ +PROJECT_NAME = @EDO_MODULE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -1030,7 +1030,7 @@ SERVER_BASED_SEARCH = NO # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/eo/doc/CMakeLists.txt b/eo/doc/CMakeLists.txt index d33151474..f82b25551 100644 --- a/eo/doc/CMakeLists.txt +++ b/eo/doc/CMakeLists.txt @@ -32,8 +32,9 @@ IF (DOXYGEN_FOUND) ENDIF (DOXYGEN_EXECUTABLE) # configure cfg file + # "${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake" CONFIGURE_FILE( - "${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake" + "${CMAKE_SOURCE_DIR}/doxyfile.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${EO_DOC_CONFIG_FILE}" ) diff --git a/eo/src/eoAlgoFoundry.h b/eo/src/eoAlgoFoundry.h index 79591b085..b85d919c4 100644 --- a/eo/src/eoAlgoFoundry.h +++ b/eo/src/eoAlgoFoundry.h @@ -99,7 +99,7 @@ class eoParameterFoundry : public eoForgeScalar< Itf > public: /** Underlying type of the parameter. * - * @note: You probably only want to use either `double` or `size_t`. + * @note You probably only want to use either `double` or `size_t`. * @see eoAlgoFoundry */ using Type = Itf; @@ -154,24 +154,25 @@ class eoParameterFoundry : public eoForgeScalar< Itf > * Now, you must implement the foundry just like any eoAlgo, by using the eoPop interface: * @code * foundry(pop); - * @encode + * @endcode + * * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. * - * @note: The "encoding" which represent the selected options, figuring the actual meta-algorithm, + * @note The "encoding" which represent the selected options, figuring the actual meta-algorithm, * is a vector of `std::variant`, which can hold either a `size_t` or a `double`. * The first one is used to indicate the index of an operator class * *or* a parameter which is a size. * The second is used to store numerical parameters values. * - * @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. + * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. * Every instantiation is deferred upon actual use. That way, you can still reconfigure them * at any time with `eoForgeOperator::setup`, for example: * @code * foundry.selector.at(0).setup(0.5); // using constructor's arguments * @endcode * - * @warning If the managed constructor takes a reference YOU SHOULD ABSOLUTELY wrap it + * @warning If the managed constructor takes a reference *YOU SHOULD ABSOLUTELY* wrap it * in a `std::ref` when using `add` or `setup`, or it will silently be passed as a copy, * which would effectively disable any link between operators. * @@ -215,7 +216,7 @@ class eoAlgoFoundry : public eoAlgo * * i.e. Select an algorithm to instantiate. * - * @note: You need to indicate the type of each item + * @note You need to indicate the type of each item * if you want to call this with a brace-initialized vector. * * For example: @@ -230,7 +231,7 @@ class eoAlgoFoundry : public eoAlgo * eoAlgoFoundry::Encodings encoded_algo(foundry.size()); * encoded_algo[foundry.crossover_rates.index()] = crossover_rate; * encoded_algo[foundry.crossover_opers.index()] = crossover_oper; - * @encdoe + * @endcode */ void select( Encodings encodings ) { @@ -240,7 +241,7 @@ class eoAlgoFoundry : public eoAlgo /** Access to the encoding of the currently selected operator. * - * @warning: This returns a `std::variant`, which you should `std::get`. + * @warning This returns a `std::variant`, which you should `std::get`. * * For example: * @code @@ -248,14 +249,14 @@ class eoAlgoFoundry : public eoAlgo * double param_id = std::get(foundry.at(3)); * @endcode * - * @note: You can use rank, value or len to have automatic casting. + * @see rank, @see value or @see len to have automatic casting. */ Encoding & at(size_t i) { return _encodings.at(i); } - /** Access to the currently selected ID of an operator. + /** Access to the currently selected ID of an operator. */ template size_t rank(const OP& op) diff --git a/eo/src/eoAlgoFoundryEA.h b/eo/src/eoAlgoFoundryEA.h index b88870208..0167ae659 100644 --- a/eo/src/eoAlgoFoundryEA.h +++ b/eo/src/eoAlgoFoundryEA.h @@ -55,7 +55,7 @@ * // + continue * @endcode * - * @note: by default, the firsts of the five operators are selected. + * @note by default, the firsts of the five operators are select ed. * * If you don't (want to) recall the order of the operators in the encoding, * you can use the `index()` member, for example: @@ -66,12 +66,12 @@ * Now, you can call the fourdry just like any eoAlgo, by passing it an eoPop: * @code * foundry(pop); - * @encode + * @endcode * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. * - * @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. - * Every instantiation is deferred upon actual use. That way, you can still reconfigure them + * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. + * Every instantiation is deferred upon actual use. That way, you can still reconfigure them * at any time with `eoForgeOperator::setup`, for example: * @code * foundry.selectors.at(0).setup(0.5); // using constructor's arguments @@ -135,8 +135,8 @@ class eoAlgoFoundryEA : public eoAlgoFoundry /** Return an approximate name of the seected algorithm. * - * @note: does not take into account parameters of the operators, - * only show class names. + * @note does not take into account parameters of the operators, + * only show class names. */ std::string name() { diff --git a/eo/src/eoAlgoFoundryFastGA.h b/eo/src/eoAlgoFoundryFastGA.h index 8ccbb7039..fefd9aa42 100644 --- a/eo/src/eoAlgoFoundryFastGA.h +++ b/eo/src/eoAlgoFoundryFastGA.h @@ -62,7 +62,7 @@ * }); * @endcode * - * @note: by default, the firsts of the 10 operators are selected. + * @note by default, the firsts of the 10 operators are selected. * * If you don't (want to) recall the order of the operators in the encoding, * you can use the `index()` member, for example: @@ -73,11 +73,12 @@ * Now, you can call the foundry just like any eoAlgo, by passing it an eoPop: * @code * foundry(pop); - * @encode + * @endcode + * * It will instantiate the needed operators (only) and the algorithm itself on-the-fly, * and then run it. * - * @note: Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. + * @note Thanks to the underlying eoOperatorFoundry, not all the added operators are instantiated. * Every instantiation is deferred upon actual use. That way, you can still reconfigure them * at any time with `eoForgeOperator::setup`, for example: * @code diff --git a/mo/doc/CMakeLists.txt b/mo/doc/CMakeLists.txt index 6d37c9470..b9c8854ba 100755 --- a/mo/doc/CMakeLists.txt +++ b/mo/doc/CMakeLists.txt @@ -19,7 +19,8 @@ if(DOXYGEN_FOUND) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake" + # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake" + configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" "${MO_DOC_DIR}/${MO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/mo/doc/mo.doxyfile.cmake b/mo/doc/mo.doxyfile.cmake index 406b4e042..a3bbe9e1a 100644 --- a/mo/doc/mo.doxyfile.cmake +++ b/mo/doc/mo.doxyfile.cmake @@ -31,7 +31,7 @@ PROJECT_NAME = @MO_MODULE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -987,7 +987,7 @@ FORMULA_FONTSIZE = 10 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/moeo/doc/CMakeLists.txt b/moeo/doc/CMakeLists.txt index 01eaa1633..5c51bc3aa 100644 --- a/moeo/doc/CMakeLists.txt +++ b/moeo/doc/CMakeLists.txt @@ -22,7 +22,8 @@ if(DOXYGEN_FOUND) ) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MOEO_DOC_CONFIG_FILE}.cmake" + # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MOEO_DOC_CONFIG_FILE}.cmake" + configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" "${MOEO_DOC_DIR}/${MOEO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/moeo/doc/moeo.doxyfile.cmake b/moeo/doc/moeo.doxyfile.cmake index db45d599c..37ff49465 100644 --- a/moeo/doc/moeo.doxyfile.cmake +++ b/moeo/doc/moeo.doxyfile.cmake @@ -31,7 +31,7 @@ PROJECT_NAME = @MOEO_MODULE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -987,7 +987,7 @@ FORMULA_FONTSIZE = 10 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/problems/DTLZ/doc/moeo.doxyfile.cmake b/problems/DTLZ/doc/moeo.doxyfile.cmake index 3f56ae1a2..cf02db64b 100644 --- a/problems/DTLZ/doc/moeo.doxyfile.cmake +++ b/problems/DTLZ/doc/moeo.doxyfile.cmake @@ -137,7 +137,7 @@ TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- -GENERATE_LATEX = YES +GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex diff --git a/smp/doc/CMakeLists.txt b/smp/doc/CMakeLists.txt index 3fa4481eb..05dc15e7f 100644 --- a/smp/doc/CMakeLists.txt +++ b/smp/doc/CMakeLists.txt @@ -19,7 +19,8 @@ if(DOXYGEN_FOUND) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${SMP_DOC_CONFIG_FILE}.cmake" + # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${SMP_DOC_CONFIG_FILE}.cmake" + configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" "${SMP_DOC_DIR}/${SMP_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/smp/doc/smp.doxyfile.cmake b/smp/doc/smp.doxyfile.cmake index c84c918eb..4b918135f 100644 --- a/smp/doc/smp.doxyfile.cmake +++ b/smp/doc/smp.doxyfile.cmake @@ -31,7 +31,7 @@ PROJECT_NAME = @SMP_MODULE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -988,7 +988,7 @@ FORMULA_FONTSIZE = 10 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be From 132eb4f50e9b05aa48d2bda13e6dabed95611fc7 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 27 Jan 2022 13:11:20 +0100 Subject: [PATCH 032/113] refactor doc style --- .gitignore | 14 ++- CMakeLists.txt | 11 +-- .../DoxygenLayout.xml | 0 doxyfile.cmake => doxygen/doxyfile.cmake | 14 ++- .../doxygen-style.css | 89 +++++++++++++++---- edo/doc/CMakeLists.txt | 2 +- eo/doc/CMakeLists.txt | 2 +- mo/doc/CMakeLists.txt | 2 +- moeo/doc/CMakeLists.txt | 2 +- smp/doc/CMakeLists.txt | 2 +- 10 files changed, 106 insertions(+), 32 deletions(-) rename DoxygenLayout.xml => doxygen/DoxygenLayout.xml (100%) rename doxyfile.cmake => doxygen/doxyfile.cmake (99%) rename doxygen-style.css => doxygen/doxygen-style.css (91%) diff --git a/.gitignore b/.gitignore index 5de8ffbd3..ef1e87e20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,20 @@ -# ignore html files +# ignore generated files *.html +*.pdf # ignore all textual files *.txt +*.swp +*.swo +.kak_history +*.log +*.csv +*.ods # ignore object and archive files *.[oa] +*.bak +*.tar* tags # ignore auto-saved files @@ -29,4 +38,7 @@ debug/* build/* website/EO_star.png website/paradiseo_logo.png +Release/* +Debug/* +Build/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 57a9f5d2c..abe421bb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,33 +81,34 @@ set(SMP "false" CACHE BOOL "Build the SMP module") set(MPI "false" CACHE BOOL "Build the MPI module") ## EO Module +set(MODULE_NAME "Paradiseo") +set(DOXYGEN_CONFIG_DIR ${CMAKE_SOURCE_DIR}/doxygen) # set(EO_MODULE_NAME "Evolving Objects") -set(MODULE_NAME "Evolving Objects") set(CMAKE_SOURCE_DIR ${EO_SRC_DIR}) add_subdirectory(${EO_SRC_DIR}) if(NOT EO_ONLY) ## MO Module # set(MO_MODULE_NAME "Moving Objects") - set(MODULE_NAME "Moving Objects") + # set(MODULE_NAME "Moving Objects") set(CMAKE_SOURCE_DIR ${MO_SRC_DIR}) add_subdirectory(${MO_SRC_DIR}) ## EDO Module if(EDO) - set(EDO_MODULE_NAME "Evolving Distribution Objects") + # set(EDO_MODULE_NAME "Evolving Distribution Objects") set(CMAKE_SOURCE_DIR ${EDO_SRC_DIR}) add_subdirectory(${EDO_SRC_DIR}) endif() ## MOEO Module - set(MOEO_MODULE_NAME "Multi-Objectives EO") + # set(MOEO_MODULE_NAME "Multi-Objectives EO") set(CMAKE_SOURCE_DIR ${MOEO_SRC_DIR}) add_subdirectory(${MOEO_SRC_DIR}) ## SMP Module if(SMP) - set(SMP_MODULE_NAME "Symmetric Multi-Processing") + # set(SMP_MODULE_NAME "Symmetric Multi-Processing") set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR}) add_subdirectory(${SMP_SRC_DIR}) endif() diff --git a/DoxygenLayout.xml b/doxygen/DoxygenLayout.xml similarity index 100% rename from DoxygenLayout.xml rename to doxygen/DoxygenLayout.xml diff --git a/doxyfile.cmake b/doxygen/doxyfile.cmake similarity index 99% rename from doxyfile.cmake rename to doxygen/doxyfile.cmake index 6b1cb5257..301b36f6b 100644 --- a/doxyfile.cmake +++ b/doxygen/doxyfile.cmake @@ -27,6 +27,14 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = @MODULE_NAME@ +# With the PROJECT_LOGO tag one can specify a logo or an icon +# that is included in the documentation. +# The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = @CMAKE_SOURCE_DIR@/docs/img/paradiseo_logo.svg + # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. @@ -484,7 +492,7 @@ FILE_VERSION_FILTER = # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. -LAYOUT_FILE = @CMAKE_SOURCE_DIR@/DoxygenLayout.xml +LAYOUT_FILE = @CMAKE_SOURCE_DIR@/doxygen/DoxygenLayout.xml #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -775,9 +783,7 @@ HTML_FOOTER = # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -# HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen-awesome-css/doxygen-awesome.css -# HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen_theme_flat_design/src/doxygen-style.css -HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen-style.css +HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doxygen/doxygen-style.css # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML diff --git a/doxygen-style.css b/doxygen/doxygen-style.css similarity index 91% rename from doxygen-style.css rename to doxygen/doxygen-style.css index 4877ae6aa..94825f8c3 100644 --- a/doxygen-style.css +++ b/doxygen/doxygen-style.css @@ -8,9 +8,10 @@ --bgfont: #303030; --bgfont2: #3771c8; --bgfont-hover: #3771c8; - --bgfont-hover-text-decoration: none; + --bgfont-hover-text-decoration: underline solid #3771c8; --bgborder: #7d7d7d; --bgborder2: #f6f6f6; + --bgfont-link:#1751a8; /* Main Header */ --bg1color: #303030; --bg1font: #ffffff; @@ -26,15 +27,16 @@ --bg3font: #303030; --bg3font2: #7D7D7D; /* Code */ - --code-bg: #f6f6f6; - --code-comment: #7D7D7D; - --code-keyword: #d73a49; - --code-preprocessor: #d73a49; - --code-keywordtype: #d73a49; - --code-text: #303030; - --code-code: #6f42c1; - --code-line: #7D7D7D; - --code-line-bg: #D8D8D8; + --code-bg: #232323; + --code-comment: #a5c261; + --code-keyword: #db4939; + --code-preprocessor: #efcd45; + --code-keywordtype: #87bbff; + --code-text: #b1cfb1; + --code-code: #d3d0cc; + --code-line: #73707c; + --code-line-bg: #232323; + --code-link: #b7dbff; /* Namespace List, Class List icon */ --icon-bg: #303030 --icon-font: #3771c8; @@ -105,6 +107,7 @@ div.contents ul { #projectalign { padding: 0px !important; + vertical-align: bottom; } /***********************************/ @@ -245,13 +248,24 @@ div.summary { /***********************************/ a, a:visited, a:active, .contents a:visited, body.SRPage a, body.SRPage a:visited, body.SRPage a:active { - color: var(--bgfont); + color: var(--bgfont-link); text-decoration: none; } a:hover, .contents a:hover, body.SRPage a:hover { color: var(--bgfont-hover); text-decoration: var(--bgfont-hover-text-decoration); + +} + +.dynheader { + color: var(--bgfont-link); + text-decoration: none; +} + +.dynheader:hover { + color: var(--bgfont-hover); + text-decoration: var(--bgfont-hover-text-decoration); } /***********************************/ @@ -341,11 +355,11 @@ li.navelem a { } .memdoc p, .memdoc dt { - padding: 0px 20px; + /*padding: 0px 20px;*/ } .memdoc > p { - font-size:1.2em; + font-size:1em; } .paramname { @@ -462,13 +476,33 @@ h3 { margin-bottom:2em; border: 2px solid var(--bgfont2); box-shadow:0.5em 0.5em 0.5em var(--bgfont); + font-family:monospace; } div.fragment, pre.fragment { border: none; - padding: 20px; - margin: none; + padding: 1em; + margin-left: 1em; + margin-right: 1em; background-color: var(--code-bg); + border-left: 2px solid black; + border-top: 2px solid black; + border-right: 2px solid grey; + border-bottom: 2px solid grey; +} + +div.fragment > div.line { + font-size:1em; + line-height:150%; + color: var(--code-code); +} + +.textblock > div.fragment { + font-size: 1em; +} + +.textblock > dl.section { + font-size: 1.2em; } div.line { @@ -491,6 +525,10 @@ span.keywordtype { color: var(--code-keywordtype); } +span.stringliteral { + color: var(--code-text); +} + span.mlabel { background-color: var(--code-text); color: var(--code-bg); @@ -502,8 +540,8 @@ span.mlabel { border-radius: 0px; } -a.code { - color: var(--code-code); +div.fragment > div.line > a.code { + color: var(--code-link); } span.lineno, span.lineno>* { @@ -521,6 +559,10 @@ span.lineno a:hover { background-color: var(--code-line-bg); } +code { + color:black; +} + /***********************************/ /************* directory ***********/ @@ -605,6 +647,19 @@ table.classindex a.el { font-weight: normal; } +table.params { + margin-top:1em; +} + +#titlearea > table { + margin-top:0px; +} + +table.directory > tbody > tr { + border-top: thin solid var(--nav-tree-bg); + border-bottom: thin solid var(--nav-tree-bg); +} + /***********************************/ /************** footer *************/ diff --git a/edo/doc/CMakeLists.txt b/edo/doc/CMakeLists.txt index b06aabcb3..e2aed7810 100644 --- a/edo/doc/CMakeLists.txt +++ b/edo/doc/CMakeLists.txt @@ -23,7 +23,7 @@ if(DOXYGEN_FOUND) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${EDO_DOC_CONFIG_FILE}.cmake" - configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" + configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake" "${EDO_DOC_DIR}/${EDO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/eo/doc/CMakeLists.txt b/eo/doc/CMakeLists.txt index f82b25551..bd216bec2 100644 --- a/eo/doc/CMakeLists.txt +++ b/eo/doc/CMakeLists.txt @@ -34,7 +34,7 @@ IF (DOXYGEN_FOUND) # configure cfg file # "${CMAKE_CURRENT_SOURCE_DIR}/${EO_DOC_CONFIG_FILE}.cmake" CONFIGURE_FILE( - "${CMAKE_SOURCE_DIR}/doxyfile.cmake" + "${DOXYGEN_CONFIG_DIR}/doxyfile.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${EO_DOC_CONFIG_FILE}" ) diff --git a/mo/doc/CMakeLists.txt b/mo/doc/CMakeLists.txt index b9c8854ba..6ac8c01a9 100755 --- a/mo/doc/CMakeLists.txt +++ b/mo/doc/CMakeLists.txt @@ -20,7 +20,7 @@ if(DOXYGEN_FOUND) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MO_DOC_CONFIG_FILE}.cmake" - configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" + configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake" "${MO_DOC_DIR}/${MO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/moeo/doc/CMakeLists.txt b/moeo/doc/CMakeLists.txt index 5c51bc3aa..04a8fdf6f 100644 --- a/moeo/doc/CMakeLists.txt +++ b/moeo/doc/CMakeLists.txt @@ -23,7 +23,7 @@ if(DOXYGEN_FOUND) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${MOEO_DOC_CONFIG_FILE}.cmake" - configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" + configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake" "${MOEO_DOC_DIR}/${MOEO_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/smp/doc/CMakeLists.txt b/smp/doc/CMakeLists.txt index 05dc15e7f..972cb57c9 100644 --- a/smp/doc/CMakeLists.txt +++ b/smp/doc/CMakeLists.txt @@ -20,7 +20,7 @@ if(DOXYGEN_FOUND) endif(UNIX AND NOT ${CMAKE_VERBOSE_MAKEFILE}) endif(DOXYGEN_EXECUTABLE) # configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${SMP_DOC_CONFIG_FILE}.cmake" - configure_file("${CMAKE_SOURCE_DIR}/doxyfile.cmake" + configure_file("${DOXYGEN_CONFIG_DIR}/doxyfile.cmake" "${SMP_DOC_DIR}/${SMP_DOC_CONFIG_FILE}") install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} From 3b7ffbbfae845c27d2846c7462b9435ed365f4bb Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 31 Jan 2022 20:14:38 +0100 Subject: [PATCH 033/113] fix Ubuntu-related memory allocation bug --- eo/contrib/irace/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt index 1c713bf5b..bee473be7 100644 --- a/eo/contrib/irace/CMakeLists.txt +++ b/eo/contrib/irace/CMakeLists.txt @@ -70,10 +70,9 @@ endif() ###################################################################################### add_executable(fastga fastga.cpp) -# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) -target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt) +# Link to stdc++fs at the end because of an Ubuntu bug, see: https://stackoverflow.com/a/57760267 +target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt stdc++fs) add_executable(onlymutga onlymutga.cpp) -# target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} fmt) From 0d3580ae2da1e86dc6128d3b8affb712c47139fb Mon Sep 17 00:00:00 2001 From: AI Xin Date: Sun, 8 May 2022 18:59:34 +0800 Subject: [PATCH 034/113] add mo tutorial doc in Markdown format The original tutorial link[http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials] is broken. I found the archive from here: https://web.archive.org/web/20210119160107/http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials --- mo/tutorial/Lesson1/README.md | 448 ++++++++++++++++++ mo/tutorial/Lesson1/schemaLS.jpg | Bin 0 -> 30185 bytes mo/tutorial/Lesson2/README.md | 124 +++++ mo/tutorial/Lesson3/README.md | 110 +++++ mo/tutorial/Lesson4/README.md | 67 +++ mo/tutorial/Lesson5/README.md | 64 +++ mo/tutorial/Lesson6/README.md | 250 ++++++++++ .../Lesson6/multimodalFitnessLandscape.jpg | Bin 0 -> 19455 bytes mo/tutorial/Lesson7/README.md | 60 +++ 9 files changed, 1123 insertions(+) create mode 100644 mo/tutorial/Lesson1/README.md create mode 100755 mo/tutorial/Lesson1/schemaLS.jpg create mode 100644 mo/tutorial/Lesson2/README.md create mode 100644 mo/tutorial/Lesson3/README.md create mode 100644 mo/tutorial/Lesson4/README.md create mode 100644 mo/tutorial/Lesson5/README.md create mode 100644 mo/tutorial/Lesson6/README.md create mode 100755 mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg create mode 100644 mo/tutorial/Lesson7/README.md diff --git a/mo/tutorial/Lesson1/README.md b/mo/tutorial/Lesson1/README.md new file mode 100644 index 000000000..466986cd3 --- /dev/null +++ b/mo/tutorial/Lesson1/README.md @@ -0,0 +1,448 @@ +# How to implement your first hill-climber algorithm? +This lesson will let you +* Run your first simple Hill-Climber within MO library +* Learn the main principles of MO +* Browse through the code of these algorithm +* Run other kind of Hill-Climbers: first-improvment, random best, neutral hill-climbers. +* Design your own evaluation functions +* Add your own stopping criteria + +## 1. I want to run my first hill-climber! +If you followed the the Install instructions, all examples would be compiled. If it is not the case, refer to the above instructions. + +You can run your hill-climber. From the "build/mo/tutorial/Lesson1" directory, type: +```shell +./lesson1_simpleHC -V=20 +``` +Great! A very simple hill-climber had solved the oneMax problem (which maximizes the number of ones in the bit string) for the bit strings of size 20. On your output screen, you can see on the first line the random initial solution, and the second line, the final solution which is (I hope) the bit string of size 20 with all ones. For example: +```text +initial: 6 20 00010000011000100101 +final: 20 20 11111111111111111111 +``` +The first number is the fitness of the solution, the second the size of the bit string and following all the bits of the solution. + +## 2. The main principles of MO +In MO a local search is defined by this schema: + +![](./schemaLS.jpg) + +At each iteration, from the current solution: +* Generate neighbors from the neighborhood and evaluate them +* Select a neighbor +* Decide to replace solution by the selected neighbor + +Like in paradisEO-eo, MO separates the representation-dependent part (represention of solution, neighbor, evaluation) from the generic part (the order of neighbors generation, selection, replacement, etc.). + +So, to define a local search, it is necessary to define: +* the solution representation, +* the neighbor representation, +* the evaluation function of a solution, +* the evaluation function of a neighbor, +* the neighborhood (generation of the neighbors) + +If you can define the representation-dependent part of your problem, you can use all local search algorithms from MO (Hill-climbing, simulated annealing, tabu search, iterated local search, variable neighborhood search, and more) and even combined them with evolutionary algorithms ! + +Of course a lot of classical representations, neighborhoods and problems are already defined in MO. They will be explained all along this tutorial. +Let's first have a look on the oneMax problem solved by a simple Hill-Climber algorithm defined as follows: +```text +Choose randomly initial solution x +Do + best <- first neighbor of x + For all y in the neighborhood of x + If (f(y) > f(best)) + best <- y + endif + endfor + If (f(x) < f(best)) + x <- best + continue <- true + else + continue <- false + endif + While continue == true +``` + +The simple HC stops on local optima when no improvement can not be made. + +## 3. Browsing the code + +Now let's have a look on the code. All the elements of the simple HC are already defined in the MO framework, and the code only puts all this bricks together. The code following the previous general principles. It defines the solution and neighbor representation, the solution and neighbor evaluation, the neighborhood, and the local search used. +Please, open the file "mo/tutorial/Lesson1/lesson1_simpleHC.cpp", and follow me in the code: + +### 1. The includes part: + +The general includes for the c++ stdlib streams: +```c++ +#include +#include +#include +#include +#include +``` + +This includes for eo which contains all include files of EO: +```c++ +#include +``` + +The first line to include the bit string representation defined in eo, and the second one to include the bit string neighbor representation. All classical problem-dependent part of MO are defined in the sub-directory "problems". How to define your representation is explained in EO tutorial, and how to design your neighbor will be explain in the next lesson 2. Here just use it. +```c++ +#include +#include +``` + +This includes the evaluation function of a solution (full evaluation), the incremental evaluation of a neighbor for the oneMax problem, and a possible evaluation of neighbor using the full evaluation. You will learn at the end how to define your evaluations. +```c++ +#include +#include +#include +``` + +This neighborhood visits all bit string at Hamming distance 1 in increasing order of bit index from bit 0 to bit vecSize-1. All the neighborhoods are included in the "neighborhood" directory. +```c++ +#include +``` + +Now we can include the simple hill-climbing local search. All local search algorithms are included in the "algo" directory. +```c++ +#include +``` + +### 2. The typedef part: + +EO can apply an evolutionary algorithm on any type of solution. So, all EO classes are parametrized by the type of solutions, and it is useful to use a synonym (with a typedef) of the solution's type. +MO can apply an local search algorithm on any type of solution and neighbor. So, for the same reason, all classes of MO are parametrized by the neighbor's type. In the neighbor class, the solution's type is defined. More precision on the neighbor design will be given in the lesson 2. +Here the solution representation is a bit string and the neighbor representation is related to a bit string solution and Hamming distance 1 (only 1 bit can be flipped), both using an "unsigned int" fitness value. +```c++ +typedef eoBit Indi; +typedef moBitNeighbor Neighbor; +``` + +### 3. Object definition part: + +Follows the main function "main_function" where all useful objects are defined.\\ +First, a code to parse the command line and a file. It gives the value of the random seed and the size of bit string. The lesson 3 of EO tutorial gives more precision on this code. Here we have only to understand that the variables "seed" and "vecSize" are initialized. +```c++ +eoParser parser(argc, argv); + +eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); +parser.processParam( seedParam ); +unsigned seed = seedParam.value(); + +// length of the bit string +eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); +parser.processParam( vecSizeParam, "Representation" ); +unsigned vecSize = vecSizeParam.value(); +(...) +``` + +To seed the random seed (see lesson 1 of EO tutorial for more precision): +```c++ +rng.reseed(seed); +``` + +The definition the initialization of solutions is not defined is MO but in EO. The "eoInitFixedLength" is a class that makes a random intialization of bit string of a given length. Each bit is true with 1/2 rate. You can see the lesson 1 of EO tutorial lesson 1 for more precision. +```c++ +eoUniformGenerator uGen; +eoInitFixedLength random(vecSize, uGen); +``` + +The fitness function of the oneMax problem is the number of 1 in the bit string. It is already defined in MO: +```c++ +oneMaxFullEval fullEval; +``` + +A neighbor is not necessary a modified copy of the solution. But often a neighbor defines how to move, i.e. how to modify a solution to compute the neighbor. For example, for the bit string, a neighbor indicates which bit is flipped. +In the same way, it is often possible to define the incremental evaluation of a neighbor knowing the modification (the move). +The incremental evaluation for the oneMax problem is already defined and adds +1 or -1 at the fitness value according to the flipped bit. +```c++ +moOneMaxIncrEval neighborEval; +``` + +When the incremental evaluation can not be defined. The neighbor can be evaluated with the full evaluation. First the solution is modified on the neighbor, than the full evaluation is computed on it and then the solution is move back. This is done by the class "moFullEvalByModif". If you want you to test it comment the line with moOneMaxIncrEval and uncomment the line with moFullEvalByCopy: +```c++ +// moFullEvalByModif neighborEval(fullEval); +``` + +For the simple hill-climbing, all the neighbors are explored in increasing order of their bit flip. So, you can use the class "moOrderNeighborhood" where the size of the neighborhood has to be precise in the constructor: +```c++ +moOrderNeighborhood neighborhood(vecSize); +``` + +All representation-dependent part is now defined, so the simple Hill-Climbing can be defined. The constructor needs the neighborhood, the solution and neighbor evaluations. The solution and neighbor representation are defined by the template of the class: +```c++ +moSimpleHC hc(neighborhood, fullEval, neighborEval); + +``` + +### 4. The execution of hill-climbing part: + +Always in the "main_function" function, it is the execution part. +In MO, the local search algorithm never initializes the solution. It must be made outside the local search algorithm. This allows to combine local search algorithms with evolutionary algorithms or with others local search algorithms. +Now apply your local search on the solution as follows: +```c++ +// The current solution +Indi solution; + +// random initialization +random(solution); + +// Evaluation of the intial solution: +// can be evaluated here, or else it will be done at the beginning of the local search +fullEval(solution); + +// output: the initial solution +std::cout << "initial: " << solution << std::endl ; + +// apply the local search on the solution ! +hc(solution); + +// output: the final solution +std::cout << "final: " << solution << std::endl ; +``` + +The main line is "hc(solution)" which apply the local search on the solution. +Easy, isn't it? + +## 4. Others hill-climbing algorithms + +You may think that the simple hill-climbing is not the hill-climbing you need because you don't want to explore all the neighborhood or because there is several solutions with the same fitness value. + +You may want to implement the first improvement hill-climbing defined as follows: +```text +Choose randomly initial solution x +Do + y <- not visited random neighbor of x + If (f(x) < f(y)) + x <- y + else + y.visited <- true + endif + While number of non visited neighbor of x > 0 +``` + +In the first improvement HC, if the fitness of a random neighbor is higher than the current fitness, the neighbor is selected. And this hill-climber stops on local optima when no more fitness improvement can be made in the neighborhood. + +To implement the first improvement HC, you have to change only 2 lines in the previous code. +The one to change the neighborhood generation: +```c++ +moRndWithoutReplNeighborhood neighborhood(vecSize); +``` +In this neighborhood, the neighbors are generated in an randomly order (not from 0 to vecSize-1) without replacement which means that the neighbors are generated only once. + +And of course, the other one to change the local search algorithm: +```c++ +moFirstImprHC hc(neighborhood, fullEval, neighborEval); +``` + +The corresponding include files have to be changed too. See and run the code "mo/tutorial/Lesson1/lesson1_firstImprHC.cpp". + +For a hill-climbing which takes care on the solutions with equal fitness value such as this one: +```text +Choose randomly initial solution x +Do + bestVect <- [ first neighbor of x ] + For all y in the neighborhood of x + If (f(y) > f(bestVect.first)) + bestVect <- [ y ] + else if (f(y) == f(bestVect.first) and y != bestVect.first) + bestVect.push_back(y) + endif + endfor + If (f(x) < f(bestVect.first)) + x <- choose randomly a solution from bestVect + continue <- true + else + continue <- false + endif + While continue == true +``` + +You only have to change the local search algorithm by (see the code in mo/tutorial/Lesson1/lesson1_randomBestHC.cpp) : +```c++ +moRandomBestHC hc(neighborhood, fullEval, neighborEval); +``` + +Easy, isn't it? + +And if you don't want that your hill-climber stops if there is some solution with the same fitness in the neighborhood like this: +```text +nbStep <- 0 +Choose randomly initial solution x +Do + bestVect <- [ first neighbor of x ] + For all y in the neighborhood of x + If (f(y) > f(bestVect.first)) + bestVect <- [ y ] + else if (f(y) == f(bestVect.first)) + bestVect.push_back(y) + endif + endfor + If (f(x) <= f(bestVect.first)) + x <- choose randomly a solution from bestVect + continue <- true + else + continue <- false + endif + nbStep <- nbStep + 1 + While continue == true and nbStep > nbStepMax +``` + +This hill-climber stops on strict local optima, but not plateau which are local optima. So, another parameter is need to stop the algorithm (nbStepMax). Then you only have to change the local search algorithm by (see the code in Lesson1/lesson1_neutralHC.cpp) : +```c++ +moNeutralHC hc(neighborhood, fullEval, neighborEval, nbStepMax); +``` + +Easy, isn't it? + +## 5. Define your evaluation + +### 1. Evaluation of solutions: +You can learn to define your fitness function in the EO tutorial lesson 1. But let's me shortly explain how to do. +You have to define a class inherited from the "eoEvalFunc". For example, the oneMaxFullEval is defined as follows: +```c++ +#include +template< class EOT > +class oneMaxFullEval : public eoEvalFunc +{ +public: + + /** + * Count the number of 1 in a bitString + * @param _sol the solution to evaluate + */ + void operator() (EOT& _solution) { + unsigned int sum = 0; + for (unsigned int i = 0; i < _solution.size(); i++) + sum += _solution[i]; + _solution.fitness(sum); + } +}; +``` + +The file "eoEvalFunc.h" must be included at the begining. The class "oneMaxFullEval" inherits from the "eoEvalFunc" class. Like all class in EO, the classes are templatized by the solution type "EOT". +EO uses a functor style: the fitness function is computed in the method "operator()(EOT& _sol)". Do what you want to compute the fitness value in this method, and puts the fitness value in the solution at the end by using its method "fitness": +```c++ +_solution.fitness( fitnessValue ); +``` + +The "eoBit" class is vector of boolean. The size of the vector is obtained by the method "size()": +```c++ +_solution.size() +``` +and the value of the ith bit is given by the classical method "operator[]": +```c++ +_solution[i] +``` +The fitness value of a solution can be obtained with the method "fitness()": +```c++ +_solution.fitness() +``` + +### 2. Evaluation of neighbors: +MO uses the same idea to evaluate a neighbor. You have to define a class which inherits from "moEval" class. For example, the oneMaxIncrEval is defined as follows: +```c++ +#include +template< class Neighbor > +class moOneMaxIncrEval : public moEval +{ +public: + + typedef typename Neighbor::EOT EOT; + + /* + * incremental evaluation of the neighbor for the oneMax problem + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider (of type moBitNeigbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + if (_solution[_neighbor.index()] == 0) + _neighbor.fitness(_solution.fitness() + 1); + else + _neighbor.fitness(_solution.fitness() - 1); + } +}; + +``` + +The file "moEval.h" must be included at the begining. All class to define evalutation function are in the "eval" directory of MO. The class "oneMaxIncrEval" inherits from the "moEval" class. Like all class in MO, the classes are templatized by the neighbor's type "Neighbor". +A typedef is defined to easily have access to the solution type "EOT". The solution type is the type "EOT" in the class of Neighbor: +```c++ +typedef typename Neighbor::EOT EOT; +``` + +MO also uses a functor style: the evaluation function is computed in the method "operator()(EOT& _solution, Neighbor & _neighbor)" which depends on the current solution and its neighbor to consider. Do what you want to compute the fitness value of the neighbor in this method, and puts the fitness value in the neighbor by using its method "fitness": +```c++ +_neighbor.fitness( fitnessValue ); +``` + +The "moBitNeighbor" has a method "index()" which gives the number of flipped bit. When the flipped bit of the solution is set to "0" the number of 1 in the neighbor is increased by one, and decreased by one otherwise. +When it is possible the incremental evaluation of neighbor gives a better complexity. For example the full evaluation needs vecSize comparisons, and the incremental evaluation only one comparison. +This prototypical example helps you to define your own solution and neighbor evaluations ! + +### 6. Use your stopping criteria + +All local search algorithms have their own stopping criteria, but it is possible to add other stopping criteria. The predefined stopping criteria you can add are: +* stop on the number of iterations +* stop on the number of full evaluation +* stop on the number of neighbor evaluation +* stop on the fitness value reached +* stop on a time limit + +All criteria inherit from the class "moContinuator" in the directory "continuator". To use one of them, you have to include the correct file, to define your object from the class and add the continuator to the local search constructor. +For example, to add a maximum number of iteration to your simple hill-climber. First include the correct file: +```c++ +#include +``` + +Define an object from the class: +```c++ +moIterContinuator continuator(iterMax); +``` + +And add the continuator in the constructor of the HC: +```c++ +moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); +``` + +Examples on all continuators are given in the source codes "lesson1_iterContinuator.cpp", "lesson1_fitContinuator.cpp", "lesson1_fullevalContinuator.cpp", "lesson1_evalContinuator.cpp". + +It is also possible to combine several continuators with the class "moCombinedContinuator.h" as follows: +```c++ +moIterContinuator iterCont(iterMax); +moFitContinuator fitCont(fitnessMax); +moFullEvalContinuator fullevalCont(fullEval, fullevalMax); +moNeighborEvalContinuator evalCont(neighborEval, evalMax); + +moCombinedContinuator continuator(iterCont); +continuator.add(fitCont); +continuator.add(fullevalCont); +continuator.add(evalCont); +``` + +The local search stops when one of the continuators is false. +Easy, isn't it? + +Of course, you can define your own continuator. You must inherit your own class from the "moContinuator" class. Then 2 methods must be defined: +* the test method: + ```c++ + virtual bool operator()(EOT & _solution) + ``` + + The returned value is true when the local search can continue for the next iteration, and false otherwise. + +* the intialisation method: + ```c++ + virtual void init(EOT & _solution) + ``` + Something you want to initialize before starting the local search (for example a counter). + The predefined continuator can help you to define your own continuator. Have fun now! + +## 7. Exercices + +1. Define the evaluation function and the incremental evaluation of the Royal Road problem. And run a first-improvement hill-climber on it! + + The Royal Road is defined in this paper: + "[The Royal Road for Genetic Algorithms: Fitness Landscapes and GA Performance](http://web.cecs.pdx.edu/~mm/handbook-of-ec-rr.pdf)" Mitchell, Forerest, Holland. + +2. Define the evaluation function and the incremental evaluation of the MAX-SAT problem. And run a first-improvement hill-climber on it! \ No newline at end of file diff --git a/mo/tutorial/Lesson1/schemaLS.jpg b/mo/tutorial/Lesson1/schemaLS.jpg new file mode 100755 index 0000000000000000000000000000000000000000..701b9dc7f855c517e2468ba19164aec92f0a8efb GIT binary patch literal 30185 zcmb@tQ*F?e<#(6vE;lEW6 zYt*P(v+AKnVa>TdS3iFPkU`>7;s6K;2!Q0j3i#Xri2T?3AC><={zm}+Ie+#6P~ZUb z5MxjfBmhVh2q+YY&p`ko00IC70f2=1x8VP;z`-NH!hC^({tEfu05)U*;0qK00vZw$ z0tyNW2JmkzG|U%R00bO73Mv{p0tS#6lZ2ERi;R^;$N-yL*rn~C7v4WO2$=tk`41Wz z>Yo=J1mwS7K9ql*00<~ZXlN*Cgn!cm{!IY+AL>6uVmNeWAq)~l15y?TAZC0%tFVZ& zp`(97{U4)%f}78Ez_di0`ckbFb zs>Dg%>X5~igJ z;k6l2Xq>bGDGv7(M2FZZD>T znBiR5Bz$x8&fIBO^y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RK0pQSiHm z)G4XbWxGi8iT>xp3hm5Ut4sI>kgEIg8eVk8Nya3EoioA&nL?oGxdR6DgzZk*3rdWII2OYy_^P85*mo z283QS)U4LDU*RIXXRE_7g-JO?DI{Zv-ZjmEfR)to=*na{vP~Jeq@%aU)cdA*aHB)} zR!KO;%x3hS69H?AZp_qxgSg-@o?i@^D@BfMP4JX_a{B}Ya_6icYvZcW_(sL(6FaJm z{sHI`1uB3SWI?V*r~Bo%Q4?Q{NruL6V&CDWqEftF+DC`@tTRa-LzbPFM1#H;_6a8| z&-lWmcN_6FJ0X7W^xb~a&1_>Wwg;{|3_-_|H(a3|IfB5{C_L| E3-^Z@egFUf literal 0 HcmV?d00001 diff --git a/mo/tutorial/Lesson2/README.md b/mo/tutorial/Lesson2/README.md new file mode 100644 index 000000000..8d5d8aba0 --- /dev/null +++ b/mo/tutorial/Lesson2/README.md @@ -0,0 +1,124 @@ +# How to implement and use neighborhoods +In this lesson, you will learn how to implement a neighbor, neighborhood and the evaluation function. Two ways will be show, one generic and one using an indexed neighborhoods. As an example, it will be illustrated on the Queens problem. + +1. Classical neighborhoods (example with a swap operator) +2. Indexed neighbordhoods (example with a shift operator) +3. Evaluation of neighbors +4. Exercise + +## 1. Classical neighborhoods (example with a swap operator) + +### Implementation +To implement a neighborhood for your problem, you must have a class that inherits from "moNeighborhood" and a class that inherits from "moNeighbor" for the corresponding neighbors. As a consequence, in the neighborhood class, you have to implement the following methods: + +hasNeighbor (test if there is at least one valid neighbor) +init (init the first neighbor) +cont (test if there is again a valid neighbor) +next (compute the next valid neighbor) +And in the neighbor class: + +move (how to apply the move corresponding to the neighbor on a solution) +### Example +In the "paradiseo-mo/src/problems/permutation" directory, classical neighborhood and neighbor for swap operator (moSwapNeighborhood.h and moSwapNeighbor.h) are defined. Some methods are specific to the swap operator and you can see a "move_back" methods that is explained at the end of this tutorial. + +In "mo/tutorial/Lesson2" directory, open the source file "testNeighborhood.cpp". You can see how to use this first neighborhood... + +After inclusion, useful types are defined for more lisibility: + +Define type of representation +```c++ +typedef eoInt Queen; +``` +Define type of a swap neighbor +```c++ +typedef moSwapNeighbor swapNeighbor; +``` +Define type of the swap neighborhood +```c++ +typedef moSwapNeighborhood swapNeighborhood; +``` +And in the "main" fonction, a neighborhood, a solution and a neighbor are declared: +```c++ +swapNeighborhood swapNH; +Queen solution; +swapNeighbor n1; +``` + +Then they are used to explore and print all the neighbors of the neighborhood for a Queen problem of size 8 (swapEval is the evaluation function declared previously) +```c++ +swapNH.init(solution, n1); +swapEval(solution,n1); +n1.print(); +while(swapNH.cont(solution)){ + swapNH.next(solution, n1); + swapEval(solution,n1); + n1.print(); +} +``` + +You can run the executable on the lesson 2 directory and see the output (the beginning). + +## 2. Indexed neighbordhoods (example with a shift operator) + +### Implementation +Three indexed neighborhoods are already defined in Paradiseo-MO. To use them you have to know the size of your neighborhoods and define a mapping that associates a neighbor from a known key, in your class neighbor. This neighbor must inherit from "moIndexNeighbor". + +### Example +In the mo/src/problems/permutation" directory, a neighbor for shift operator (moShiftNeighbor.h) is defined. In this class, the mapping is done in the method "translate". + +After inclusion useful types are defined for more lisibility: + +Define type of a shift neighbor +```c++ +typedef moShiftNeighbor shiftNeighbor; +``` +Define three different indexed neighborhoods for shift operator +```c++ +typedef moOrderNeighborhood orderShiftNeighborhood; +typedef moRndWithoutReplNeighborhood rndWithoutReplShiftNeighborhood; +typedef moRndWithReplNeighborhood rndWithReplShiftNeighborhood; +``` + +And in the "main" fonction, a shift neighbor and the three indexed neighborhoods are declared: +```c++ +shiftNeighbor n2; +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); +rndWithoutReplShiftNeighborhood rndNoReplShiftNH(pow(vecSize-1, 2)); +rndWithReplShiftNeighborhood rndReplShiftNH(pow(vecSize-1, 2)); +``` + +Exploration of the neighborhoods is done like with a classical neighborhood. + +You can run the executable on the lesson 2 directory and see the output. + +## 3. Evaluation of neighbors + +There are three ways to evaluate a neighbor: + +1. Incremental evaluation +2. Full evaluation by modification +3. Full evaluation by copy + +In terms of performance, it is more efficient to use incremental evaluation and if it cannot be defined, full evaluation by modification is better than that one by copy. + +### Incremental evaluation +To implement an incremental evaluation, you have to create a class which inherits of "**moEval**". So you have to define the method: +```c++ +void operator()(EOT&, Neighbor&){ ... } +``` +EOT and Neighbor are respectively the templates for a solution and a neighbor. + +### Full evaluation +The two full evaluations are already defined in Paradiseo-MO. The full evaluation by modification applies the move on the initial solution, evaluates the obtained solution and affects the fitness value to the neighbor. Then the "moveBack" is applied to come back to the initial solution. On the other hand, the full evaluation by copy applies the move on a temporary copy of the solution, evaluates it and affects the fitness value to the neighbor. + +To use these evaluations, you need your classical full evaluation function ("eoEvalFunc") in the constructors: +```c++ +moFullEvalByCopy(eoEvalFunc& _eval) +moFullEvalByModif(eoEvalFunc& _eval) +``` + +Be carefull, if you want to use the class "moFullEvalByModif", your neighbor must be "backable" and so it has to inherit of the class "**moBackableNeighbor**" and consequently to have a method "moveBack". + +## 4. Exercise + +Try to define an indexed swap neighbor like in the file "moShiftNeighbor.h". Then explore and print the neighborhood randomly. \ No newline at end of file diff --git a/mo/tutorial/Lesson3/README.md b/mo/tutorial/Lesson3/README.md new file mode 100644 index 000000000..ea68ad686 --- /dev/null +++ b/mo/tutorial/Lesson3/README.md @@ -0,0 +1,110 @@ +# Lesson3 - How to use Simulated Annealing and Checkpointing +In this lesson, a simple simulated annealing is presented, using an order neighborhood based on a shift operator, to solve the Queen problem. Then, a checkpoint will be used to save some informations during the search. + +1. Simulating Annealing on the Queen problem. +2. Checkpointing +3. Avalaible statistics in MO +4. Exercise + +## 1. Simulating Annealing (example on the Queen problem) + +First you have to define the representation of a Queen, how to initialize and evaluate it. So you have to declare three classes: +```c++ +queenFullEval fullEval; +eoInitPermutation init(vecSize); +Queen solution1; +``` + +Then, you have to ramdomly intialize and evaluate the solution: +```c++ +init(solution1); +fullEval(solution1); +``` + +Let see the most simple constructor of a Simulated Annealing (in algo/moSA.h). You need three parameters: +* a neighborhood +* a full evaluation function (declared before) +* a neighbor's evaluation function +```c++ +moFullEvalByCopy shiftEval(fullEval); +rndShiftNeighborhood rndShiftNH(pow(vecSize-1, 2)); +``` + +You can now declare the Simulated Annealing: +```c++ +moSA localSearch1(rndShiftNH, fullEval, shiftEval); +``` +This simple constructor uses by default three components: +* moSimpleCoolingSchedule (with default parameters) +* moSolNeighborComparator +* moTrueContinuator + +More flexible constructors exist in which you can change these components. In the following, the "moTrueContinuator" is replaced by a "moCheckpoint". + +You can try this first algorithm with different problem sizes (use parameter file or the option --vecSize=X on command line to execute "testSimulatedAnnealing"). It prints the initial and final solution1. + +## 2. Checkpointing (example on the Queen problem) + +The class "moCheckpoint" inherits of the abstract class "moContinuator" and allows to incorporate one or many "moContinuator" classes (Composite pattern). It also allows to incorporate many "eoMonitor", "eoUpdater" and "moStatBase" classes. + +Here, an example of checkpointing is presented, including: +* a continuator returning always true (moTrueContinuator) +* a monitor saving information in a file (eoFileMonitor) +* an updater using the file monitor with a determinated frequency (moCounterMonitorSaver) +* a very simple statistical operator giving only the fitness of the current solution (moFitnessStat) + +First, you have to define the "moTrueContinuator" and build the "moCheckpoint": +```c++ +moTrueContinuator continuator; +moCheckpoint checkpoint(continuator); +``` + +Then, create the "moFitnessStat" and add it in the checkpoint: +```c++ +moFitnessStat fitStat; +checkpoint.add(fitStat); +``` + +Finally, create the "eoFileMonitor" to write fitness values in the file fitness.out and the "moCounterMonitorSaver" to use the file monitor only for each 100 iterations. +```c++ +eoFileMonitor monitor("fitness.out", ""); +moCounterMonitorSaver countMon(100, monitor); +checkpoint.add(countMon); +monitor.add(fitStat); +``` + +So you can create a Simulated Annealing with this checkpoint: +```c++ +moSA localSearch2(rndShiftNH, fullEval, shiftEval, coolingSchedule, solComparator, checkpoint); +``` + +Try this second algorithm with different problem sizes (use parameter file or the option --vecSize=X on command line to execute "testSimulatedAnnealing"). It prints the initial and final solution2 and you can see the evolution of fitness values in the file fitness.out (only 1 value each 100 iterations). + +## 3. Avalaible statistics + +A lot of statistics are avalaible to have informations during the search: + +* moCounterStat +* moMinusOneCounterStat +* moStatFromStat +* moFitnessStat +* moNbInfNeighborStat +* moNbSupNeighborStat +* moNeutralDegreeNeighborStat +* moSizeNeighborStat +* moNeighborhoodStat +* moDistanceStat +* moSolutionStat +* moBestSoFarStat +* moSecondMomentNeighborStat +* moMaxNeighborStat +* moMinNeighborStat +* moNeighborBestStat +* moNeighborFitnessStat +* moAverageFitnessNeighborStat +* moStdFitnessNeighborStat + +## 4. Exercise + +1. Try to add the cooling schedule parameters into the parameters file. Then, try the simulated annealing with different parameters to see theirs impacts on the search. +2. Add an existed operator (in continuator directory) to print the solution each 100 iterations. \ No newline at end of file diff --git a/mo/tutorial/Lesson4/README.md b/mo/tutorial/Lesson4/README.md new file mode 100644 index 000000000..c416fbd1a --- /dev/null +++ b/mo/tutorial/Lesson4/README.md @@ -0,0 +1,67 @@ +# How to use Tabu Search +In this lesson, a simple tabu search is presented, using an order neighborhood based on a shift operator, to solve the Queen problem. +1. Tabu Search on the Queen problem. +2. Exercise + +## 1. Tabu Search (example on the Queen problem) + +First you have to define the representation of a Queen, how to initialize and how to evaluate it. So you have to declare three classes: +```c++ +queenFullEval fullEval; +eoInitPermutation init(vecSize); +Queen sol1; +``` + +Then, you have to ramdomly intialize a solution: +```c++ +init(sol1); +fullEval(sol1); +``` + +Let see the most simple constructor of a Tabu Search (in mo/src/algo/moTS.h). You need five parameters: + +* a neighborhood +```c++ +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); +``` +* a full evaluation function (declared before) +* a neighbor evaluation function* +```c++ +moFullEvalByCopy shiftEval(fullEval); +``` +* a time limit for the search (in seconds) +* a size for the tabu list + +You can now declare the Tabu Search: +```c++ +moTS localSearch1(orderShiftNH, fullEval, shiftEval, 2, 7); +// 2 is the time limit, 7 is the size of the tabu List +``` + +This simple constructor uses by default seven components: +* moTimeContinuator +* moNeighborComparator +* moSolNeighborComparator +* moNeighborVectorTabuList +* moDummyIntensification +* moDummyDiversification +* moBestImprAspiration + +More flexible constructors exist as you can change these components: +```c++ +moNeighborVectorTabuList tl(sizeTabuList,0); +moTS localSearch2(orderShiftNH, fullEval, shiftEval, 3, tl); +// 3 is the time limit +``` +In this one, the tabuList has been specified. +```c++ +moTS localSearch3(orderShiftNH, fullEval, shiftEval, + comparator, solComparator, continuator, tl, inten, div, asp); +``` +In this one, comparators, continuator, tabu list, intensification strategy, diversification strategy and aspiration criteria have been specified. + +You can test these three algorithms by changing problem sizes, time limit and the size of tabu list (use parameters file or the option --vecSize=X, --timeLimit=Y and --sizeTabuList=Z on command line to execute "testSimpleTS"). It prints the initial and final solutions. + +## 2. Exercise + +1. Try to implement and use a diversification strategy in 'testSimpleTS". You can also use a predifined strategy: moMonOpDiversification (in "memory" directory) \ No newline at end of file diff --git a/mo/tutorial/Lesson5/README.md b/mo/tutorial/Lesson5/README.md new file mode 100644 index 000000000..8a684df71 --- /dev/null +++ b/mo/tutorial/Lesson5/README.md @@ -0,0 +1,64 @@ +# How to use Iterated Local Search +In this lesson, an Iterated Local Search is presented. The Tabu Search of the Lesson 4 is used with an order neighborhood based on a shift operator, to solve the Queen problem. + +1. Iterated Tabu Search on the Queen problem. +2. Exercise + +## 1. Iterated Tabu Search (example on the Queen problem) + +As in Lesson 4, you have to define a Solution, the method to initialize and evaluate it. Then you have to define a Tabu Search. + +Declaration of the Tabu Search: +```c++ +moTS ts(orderShiftNH, fullEval, shiftEval, 1, 7); +``` + +To use a simple Iterated Local Search, a mutation operator is needed. So the swap mutation defined in EO is used: +```c++ +eoSwapMutation mut; +``` + +Now, a simple Iterated Tabu Search can be declared as follow: +```c++ +moILS localSearch1(ts, fullEval, mut, 3); +``` +This constructor has got 4 parameters: +1. a local search (ts) +2. a full evaluation function (fullEval) +3. a mutation operator (mut) +4. a number of iterations (3) + +**localSearch1** performs the Tabu Search 3 times. The first solution of each iteration(except the first one) is obtained by applying the mutation operator on the last visited solution. + +A constructor allows to specify the continuator. **_Be carefull_**, the continuator must be templatized by a "moDummyNeighbor": +```c++ +moIterContinuator > cont(4, false); +``` +The explorer of the Iterated local search don't use its own neighborhood. Here, the neighborhood of the Tabu Search is used. But to respect the conception, we create a "moDummyNeighbor" using as template for Iterated Local Search. + +An Iterated Tabu Search with this continuator can be declared as: +```c++ +moILS localSearch2(ts, fullEval, mut, cont); +``` + +A general constructor is available allowing to specify the perturbation operator and the acceptance criteria. First, you have to declare a perturbation operator: +```c++ +moMonOpPerturb perturb(mut, fullEval); +``` +And, the acceptance criteria: +```c++ +moSolComparator solComp; +moBetterAcceptCrit accept(solComp); +``` +Finally, the Iterated Local Search can be declared as: +```c++ +moILS localSearch3(ts, fullEval, cont, perturb, accept); +``` + +You can test these three algorithms by changing problem sizes(use parameter file or the option --vecSize=X on command line to execute "testILS"). It prints the initial and the final solutions. + +## 2. Exercise + +* Try to implement an Iterated Hill Climbing on the Queen problem with these caracteristics: + 1. Hill Climbing with a "moShiftNeighborhood" and a "moTrueContinuator" + 2. Iterated Local Search using a "moIterContinuator" and a "moNeighborhoodPerturb" with a "moSwapNeighborhood". \ No newline at end of file diff --git a/mo/tutorial/Lesson6/README.md b/mo/tutorial/Lesson6/README.md new file mode 100644 index 000000000..e8f4ba747 --- /dev/null +++ b/mo/tutorial/Lesson6/README.md @@ -0,0 +1,250 @@ +# How to perform a fitness analysis? + +![](multimodalFitnessLandscape.jpg) + +A lot of tools to perform the fitness landscapes analysis are defined in paradisEO-MO: +* Density Of States +* Fitness Distance Correlation +* Autocorrelation length and autocorrelation functions +* Sampling the local optima by adaptive walks +* Neutral degree distribution +* Evolvability of neutral networks by neutral walks +* Fitness Cloud + +With the same code (and effort ;-) ), you can make an apriori study of your problem with fitness landscapes analysis and use efficient solution-based metaheuristics. You can also make an aposteriori fitness landscapes analysis of your problem to explain why your metaheuristics works or not. + +This lesson will let you: +* Use the fitness analysis tools of MO library +* Learn to perform your own fitness landscapes analysis + +In lesson 1, you have learnt to define the fitness function. In lesson 2, you have learn to define a neighbor and a neighborhoods. This lesson will used those previous lessons. + +This tutorial is made to learn how to perform a fitness landscapes analysis with paradisEO-MO. It is not a course to learn fitness landscapes analysis. You can find some information about fitness landscapes analysis here: [tutorial GECCO 09 (pdf)](http://www.i3s.unice.fr/~verel/talks/tutorialFitnessLandscapes_gecco2009.pdf) or [tutorial WCCI-CEC 10 (pdf)](http://www.i3s.unice.fr/~verel/talks/tutorialCEC2010.pdf) + +## 1. I want to compute the Fitness Distance Correlation (FDC)! + +You can compute the FDC. From the "paradiseo-mo/build/tutorial/Lesson6" directory, type: +```shell +./fdc -V=20 -n=500 +``` + +Great! You have sample fitness and distance to global optimum of 500 random solutions on the oneMax problem (which maximizes the number of ones in the bit string) for the bit strings of size 20. On your output screen, you can see the fitness and distance of the first and last solution of the sample. For example: +```text +First values: +Fitness 8 +Distance 12 +Last values: +Fitness 6 +Distance 14 +``` + +In the file "out.dat", you have all the sample. First column is the fitness and the second column is the distance to global optimum of the 500 solutions. + +After you can compute the correlation coefficient with your best statistical software such as R (with this small script) or excel with this help (import data and correlation) or with this small awk script. + +I found -1 with my sample which means that it is very easy function, isn't it? + +## 2. The main principles of fitness landscapes analysis with MO + +The fitness landscapes analysis is based on a sampling of the search space. During this sampling, data are collected, and then some statistics can be computed to deduce the structure of the search space. + +The class to define a sampling is moSampling in the directory mo/src/sampling. All classes of the standard tools of fitness landscapes analysis inherit from this class (see documentation): +* moDensityOfStatesSampling : density of states (distribution of fitness values) +* moAutocorrelationSampling : autocorrelation length and functions +* moFDCsampling : fitness distance correlation +* moHillClimberSampling : adaptive walks +* moNeutralDegreeSampling : neutral degree +* moNeutralWalkSampling : evolvability of neutral networks +* moFitnessCloudSampling : evolvability of the operator, and the neighborhood + +The constructor of moSampling is: +```c++ +moSampling (eoInit< EOT > &_init, moLocalSearch< Neighbor > &_localSearch, moStat< EOT, ValueType > &_stat, bool _monitoring=true) +``` + +As usual in paradiseo, EOT is the typedef of the solution, and Neighbor is the typedef of the neighbor (see lesson 1). This constructor needs an initialization methods (see tutorial on paradiseo-eo), a local search which perform the sampling of the search space (see previous lessons to define it), and a object which able to compute a statistic. At each iteration of the local search, the given statistic is computed, and is saved if boolean monitoring is true. + +The statistics inherit from the class moStat. The include file can be found in mo/src/continuator directory. The pre-defined statistics are: +* moFitnessStat : the fitness of the current solution +* moDistanceStat : the distance between the current solution and a given solution +* moSolutionStat : the current solution +* moCounterStat : the number of iterations +* moBestSoFarStat : the best current solution found +* moNeighborBestStat : best fitness over k neighbors +* moNeighborhoodStat : to compute the statistics from the neighbors solutions : + * moAverageFitnessNeighborStat : average fitness in the neighborhood + * moStdFitnessNeighborStat : standard deviation of fitness + * moMaxNeighborStat : maximum fitness + * moMinNeighborStat : minimum fitness + * moSecondMomentNeighborStat : average and standard deviation + * moSizeNeighborStat : size of the neighborhood + * moNeutralDegreeNeighborStat : number of neighbors with equal fitness + * moNbInfNeighborStat : number of neighbors with lower fitness + * moNbSupNeighborStat : number of neighbor with higher fitness + +All those statistics can be used in the sampling. Of course you can define your own statistic class. Several statistics can be collected at each iteration: use the method add of the class moSampling to collect another statistic. + +For standard tools of fitness landscapes analysis, there is no need to give the sampling method, and the statistics objects. You only have to give which is specific to your problem such as the initialization method, the fitness function, the neighborhood, or the evaluation function of a neighbor. + +## 3. Browsing the code + +Please, open the file "mo/tutorial/Lesson6/fdc.cpp", and follow me in the code: + +### 1. The includes part: + +The general includes for the c++ stdlib streams: +```c++ +#include +#include +#include +#include +#include +``` + +This includes for eo which contains all include files of EO: +```c++ +#include +``` + +The first line to include the bit string representation defined in eo, and the second one to include the bit string neighbor representation. All classical problem-dependent part of MO are defined in the sub-directory "problems". How to define your representation is explained in EO tutorial, and how to design your neighbor is explained in the lesson 2. Here just use it. +```c++ +#include +#include +``` + +This includes the evaluation function of a solution (full evaluation). There is no evaluation function for the neighbor because there is no need in FDC. Some others tools such as autocorrelation neighbor evaluation is defined such as the lesson 1. +```c++ +#include +``` + +The fitness distance correlation is the correlation between the fitness of solution and the distance to global optimum (or at least to some best known solution). So, this include file uses the Hamming distance. +```c++ +#include +``` + +Now we can include the FDC tool. +```c++ +#include +``` + +### 2. The typedef part: + +EO can apply an evolutionary algorithm on any type of solution. So, all EO classes are parametrized by the type of solutions, and it is useful to use a synonym (with a typedef) of the solution's type. +MO can apply an local search algorithm on any type of solution and neighbor. So, for the same reason, all classes of MO are parametrized by the neighbor's type. In the neighbor class, the solution's type is defined. More precision on the neighbor design will be given in the lesson 2. +Here the solution representation is a bit string and the neighbor representation is related to a bit string solution and Hamming distance 1 (only 1 bit can be flipped), both using an "unsigned int" fitness value. +```c++ +typedef eoBit Indi; +typedef moBitNeighbor Neighbor; +``` + +### 3. Object definition part: + +Follows the main function "main_function" where all useful objects are defined.\\ +First, a code to parse the command line and a file. It gives the value of the random seed and the size of bit string. The lesson 3 of EO tutorial gives more precision on this code. Here we have only to understand that the variables "seed" and "vecSize" are initialized. +```c++ +eoParser parser(argc, argv); + +eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); +parser.processParam( seedParam ); +unsigned seed = seedParam.value(); + +// length of the bit string +eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); +parser.processParam( vecSizeParam, "Representation" ); +unsigned vecSize = vecSizeParam.value(); + +// the number of solution sampled +eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); +parser.processParam( solParam, "Representation" ); +unsigned nbSol = solParam.value(); + +// the name of the output file +string str_out = "out.dat"; // default value +eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); +``` + +To seed the random seed (see lesson 1 of EO tutorial for more precision): +```c++ +rng.reseed(seed); +``` + +The definition the initialization of solutions is not defined is MO but in EO. The "eoInitFixedLength" is a class that makes a random intialization of bit string of a given length. Each bit is true with 1/2 rate. You can see the lesson 1 of EO tutorial lesson 1 for more precision. +```c++ +eoUniformGenerator uGen; +eoInitFixedLength random(vecSize, uGen); +``` + +The fitness function of the oneMax problem is the number of 1 in the bit string. It is already defined in MO: +```c++ +oneMaxFullEval fullEval; +``` + +The distance used is the classical Hamming distance: +```c++ +eoHammingDistance distance; +``` + +For this analysis, the best solution is needed: the solution with all 1s. +```c++ +Indi bestSolution(vecSize, true); // global optimum +``` + +All representation-dependent part is now defined, so the FDC sampling can be defined. The constructor needs the initialization, the fitness function, the distance used, the reference solution, and the size of the sample: +```c++ +moFDCsampling sampling(random, fullEval, distance, bestSolution, nbSol); +``` + +### 4. The execution of sampling part: + +Now apply your sampling as follows: +```c++ +sampling(); +``` + +This sampling uses the initialization method to define a pure random search, and at each iteration the fitness and the distance are computed. + +4. The export part: + +To export your sample into a file: +```c++ +sampling.fileExport(str_out); +``` + +The first column of the file is the fitness and the second the distance from the global optimum. + +Maybe you may want to read the data from your c++ code. So it is possible to export the data into a vector: +```c++ +const std::vector & fitnessValues = sampling.getValues(0); +const std::vector & distValues = sampling.getValues(1); +``` + +Note that the indexes of the statistics (here 0 and 1) are in the same order of the declaration with the constructor and the "add" method of moSampling. + +After you can use the vector as you want: +```c++ +std::cout << "Fitness " << fitnessValues[0] << std::endl; +std::cout << "First values:" << std::endl; +std::cout << "Distance " << distValues[0] << std::endl; + +std::cout << "Last values:" << std::endl; +std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; +std::cout << "Distance " << distValues[distValues.size() - 1] << std::endl; + +``` + +Easy, isn't it? + +## 4. Others fitness landscapes tools + +The other tools can be used in the same way. For each tool, an example has been made. Please read the code of: + +* densityOfStates.cpp : density of states example +* autocorrelation.cpp : autocorrelation length and functions +* adaptiveWalks.cpp : sampling by hill-climbings, length of adaptative walks +* fdc.cpp : ;-) +* fitnessCloud.cpp : bivariate density of fitness of solutions and fitness of neighbors +* neutralDegree.cpp : number of neighbor with the same fitness +* neutralWalk.cpp : evolvability of the neutral networks +* sampling.cpp : general sampling method + +If you have some questions or remarks, please contact us! sebastien.verel aaattt unice.fr or member of the development team. \ No newline at end of file diff --git a/mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg b/mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg new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b4Nd$nlW{Uewp~Cg61z6N?aM(4V2ZK>D*GsCtH)+a|*51i;U-tUv zNcnS(EUQAiLk5h%v0+%8{kY^tCy?yJHr9F^GGHgyem2)I*bfOPH2KLTK zUl$6uXj)6e4W~`p^xc%~0$wFDb5)MU7qt=d8%tI}b4EXh?M%Z|ip7Hu?IQ4BuJ~KA z8r;Xh-(*?bCu~Qs$1*y0jCQ1QreZJpEnBVoF zA;`e+3(24;S|kiJmZka8ard|^x%BDrlqQCwjGW`$m^--ltG1uw1;-&kSR2(?*IuI# zmrfBA#bFLx8h;uJJh?T)VtP?8a zDa!Tf{na1qA%ui4Zk~tEc$!K}Zj_sFozU9mUeN$oBX|iA{JwC$)#wUzr6IYlzU~g3Y@Fv~-UT}9&rqLn zhTWbf-lO%l8tGK^TUr}fsw)y+ug{F)@$8^pi5r;i0eRWI$0QMY7k;3@=<$cb|IYvB Hjd#BT_^tD& literal 0 HcmV?d00001 diff --git a/mo/tutorial/Lesson7/README.md b/mo/tutorial/Lesson7/README.md new file mode 100644 index 000000000..5f493a130 --- /dev/null +++ b/mo/tutorial/Lesson7/README.md @@ -0,0 +1,60 @@ +# How to hybrid an evolutionary algorithm and a local search +In this lesson, a hybridization between an evolutionary algorithm(EA) and a local search is presented. It will be illustrated by an example on the Queen problem. Here, the hybridization consists in replacing the mutation operator of the EA by a first improvement hill climber. + +1. hybridization +2. Exercise + +## 1. Hybridization (example on the Queen problem) + +First, you have to define the represenation of a Queen, how to initialize and how to evaluate a population of solutions: +```c++ +queenFullEval fullEval; + +eoInitPermutation init(vecSize); + +eoPop pop; +Queen tmp; +for(unsigned int i=0; i<20; i++){ //population size is fixed to 20 + init(tmp); + fullEval(tmp); + pop.push_back(tmp); +} +``` + +As in previous lessons, a local search is declared (first improvement hill climber): +```c++ +moFullEvalByCopy shiftEval(fullEval); + +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); + +moFirstImprHC hc(orderShiftNH, fullEval, shiftEval); +``` +To hybrid this local search with an EA, you just have to use it instead of a classical mutation: +```c++ +eoOrderXover cross; +eoSGATransform transform(cross, 0.3, hc, 0.7); // cross and mutation probabilities are fixed +``` + +Others components of the "eoEasyEA" have to be declared: +```c++ +eoGenContinue EAcont(50); //nb generations is fixed to 50 +eoDetTournamentSelect selectOne(2); //size of tournament is fixed to 2 +eoSelectMany select(selectOne, 1); //rate of selection is fixed to 1 +eoGenerationalReplacement repl; +``` +More details are available in EO lessons. + +Finally, the hybrid algorithm is declared as: +```c++ +eoEasyEA hybridAlgo(EAcont, fullEval, select, transform, repl); +``` +and should be applied on the population with: +```c++ +hybridAlgo(pop); +``` + +You can test this hybrid algorithm by changing problem size (use parameters file or the option --vecSize=X on command line to execute "hybridAlgo"). It prints the initial and final population. + +## 2. Exercise + +Try to use a hybridization at the checkpointing step rather than at the mutation step. You have to implement an "eoUpdater" which applies a local search. This updater should be added in a "eoCheckpoint". \ No newline at end of file From 023cb45ca54768c5972cbd574eba5bf5e2544f00 Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 31 Aug 2022 23:46:46 +0200 Subject: [PATCH 035/113] fix logo display in readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59ded2801..686b08334 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ It focus on the efficiency of the implementation of solvers, by providing: - tools for ***automated design and selection*** of algorithms, - a focus on ***speed*** and several ***parallelization*** options. -![Paradiseo logo](https://github.com/nojhan/paradiseo/blob/master/website/paradiseo_logo_200px_dark.png) +
      + Paradiseo logo +
      # Quick Start From c2f2e635c8072b926710c93e62505b377ad4d882 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 31 Jan 2022 20:14:38 +0100 Subject: [PATCH 036/113] fix Ubuntu-related memory allocation bug --- eo/contrib/irace/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eo/contrib/irace/CMakeLists.txt b/eo/contrib/irace/CMakeLists.txt index 1c713bf5b..bee473be7 100644 --- a/eo/contrib/irace/CMakeLists.txt +++ b/eo/contrib/irace/CMakeLists.txt @@ -70,10 +70,9 @@ endif() ###################################################################################### add_executable(fastga fastga.cpp) -# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) -target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt) +# Link to stdc++fs at the end because of an Ubuntu bug, see: https://stackoverflow.com/a/57760267 +target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt stdc++fs) add_executable(onlymutga onlymutga.cpp) -# target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs) target_link_libraries(onlymutga ${PARADISEO_LIBRARIES} fmt) From 80140ddcc34bf0ec165aea01a0d097240d837a29 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 31 Jan 2022 22:33:36 +0100 Subject: [PATCH 037/113] feat: add an eoForgeMap Same features than an eoForgeVector, but allowing to bind a string name to the instance. --- eo/src/eoForge.h | 138 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 133 insertions(+), 5 deletions(-) diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index bc2dbb67d..6fcccf811 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -192,13 +192,13 @@ class eoForgeOperator : public eoForgeInterface * with different parametrization (or not). * * @warning When passing a reference (as it is often the case within ParadisEO), - * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. - * This is is a source of bug which your compiler will to detect and that would - * disable any link between operators. + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will fail to detect and that would + * disable any link between operators. * * @warning You may want to enable instantiation cache to grab some performances. - * The default is set to disable the cache, because its use with operators - * which hold a state will lead to unwanted behaviour. + * The default is set to disable the cache, because its use with operators + * which hold a state will lead to unwanted behaviour. * * @code eoForgeVector> factories(false); @@ -320,6 +320,134 @@ class eoForgeVector : public std::vector*> bool _no_cache; }; +/** A map holding an operator (with deferred instantiation) at a given name. + * + * @note You can actually store several instances of the same class, + * with different parametrization (or not). + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will fail to detect and that would + * disable any link between operators. + * + * @warning You may want to enable instantiation cache to grab some performances. + * The default is set to disable the cache, because its use with operators + * which hold a state will lead to unwanted behaviour. + * + * @code + eoForgeMap> factories(false); + + // Capture constructor's parameters and defer instantiation. + factories.add>(1); + factories.setup>(0, 5); // Edit + + // Actually instantiate. + eoSelect& op = factories.instantiate(0); + + // Call. + op(); + * @endcode + * + * @ingroup Foundry + */ +template +class eoForgeMap : public std::map*> +{ + public: + using Interface = Itf; + + /** Default constructor do not cache instantiations. + * + * @warning + * You most probably want to disable caching for operators that hold a state. + * If you enable the cache, the last used instantiation will be used, + * at its last state. + * For example, continuators should most probably not be cached, + * as they very often hold a state in the form of a counter. + * At the end of a search, the continuator will be in the end state, + * and thus always ask for a stop. + * Reusing an instance in this state will de facto disable further searches. + * + * @param always_reinstantiate If false, will enable cache for the forges in this container. + */ + eoForgeMap( bool always_reinstantiate = true ) : + _no_cache(always_reinstantiate) + { } + + /** instantiate the operator managed at the given name. + */ + Itf& instantiate(const std::string& name) + { + return this->at(name)->instantiate(_no_cache); + } + + /** Add an operator to the list. + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will to detect and that would + * disable any link between operators. + * + */ + template + void add(const std::string& name, Args... args) + { + // We decay all args to ensure storing everything by value within the forge. + // The references should thus be wrapped in a std::ref. + auto pfo = new eoForgeOperator...>( + std::forward(args)...); + this->insert({name, pfo}); + } + + /** Specialization for operators with empty constructors. + */ + template + void add(const std::string& name) + { + eoForgeInterface* pfo = new eoForgeOperator; + this->insert({name, pfo}); + } + + /** Change the set up arguments to the constructor. + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will to detect and that would + * disable any link between operators. + * + * @warning The operator at `name` should have been added with eoForgeMap::add already.. + */ + template + void setup(const std::string& name, Args... args) + { + delete this->at(name); // Silent on nullptr. + auto pfo = new eoForgeOperator...>( + std::forward(args)...); + this->emplace({name, pfo}); + } + + /** Specialization for empty constructors. + */ + template + void setup(const std::string& name) + { + delete this->at(name); + auto pfo = new eoForgeOperator; + this->emplace({name, pfo}); + } + + virtual ~eoForgeMap() + { + for(auto kv : *this) { + delete kv.second; + } + } + + protected: + bool _no_cache; +}; + + /** A range holding a parameter value at a given index. * * This is essential a scalar numerical parameter, with bounds check From 1f1f59831472412d092400be8998c5c4775e8e0d Mon Sep 17 00:00:00 2001 From: AI Xin Date: Sun, 8 May 2022 18:59:34 +0800 Subject: [PATCH 038/113] add mo tutorial doc in Markdown format The original tutorial link[http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials] is broken. I found the archive from here: https://web.archive.org/web/20210119160107/http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials --- mo/tutorial/Lesson1/README.md | 448 ++++++++++++++++++ mo/tutorial/Lesson1/schemaLS.jpg | Bin 0 -> 30185 bytes mo/tutorial/Lesson2/README.md | 124 +++++ mo/tutorial/Lesson3/README.md | 110 +++++ mo/tutorial/Lesson4/README.md | 67 +++ mo/tutorial/Lesson5/README.md | 64 +++ mo/tutorial/Lesson6/README.md | 250 ++++++++++ .../Lesson6/multimodalFitnessLandscape.jpg | Bin 0 -> 19455 bytes mo/tutorial/Lesson7/README.md | 60 +++ 9 files changed, 1123 insertions(+) create mode 100644 mo/tutorial/Lesson1/README.md create mode 100755 mo/tutorial/Lesson1/schemaLS.jpg create mode 100644 mo/tutorial/Lesson2/README.md create mode 100644 mo/tutorial/Lesson3/README.md create mode 100644 mo/tutorial/Lesson4/README.md create mode 100644 mo/tutorial/Lesson5/README.md create mode 100644 mo/tutorial/Lesson6/README.md create mode 100755 mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg create mode 100644 mo/tutorial/Lesson7/README.md diff --git a/mo/tutorial/Lesson1/README.md b/mo/tutorial/Lesson1/README.md new file mode 100644 index 000000000..466986cd3 --- /dev/null +++ b/mo/tutorial/Lesson1/README.md @@ -0,0 +1,448 @@ +# How to implement your first hill-climber algorithm? +This lesson will let you +* Run your first simple Hill-Climber within MO library +* Learn the main principles of MO +* Browse through the code of these algorithm +* Run other kind of Hill-Climbers: first-improvment, random best, neutral hill-climbers. +* Design your own evaluation functions +* Add your own stopping criteria + +## 1. I want to run my first hill-climber! +If you followed the the Install instructions, all examples would be compiled. If it is not the case, refer to the above instructions. + +You can run your hill-climber. From the "build/mo/tutorial/Lesson1" directory, type: +```shell +./lesson1_simpleHC -V=20 +``` +Great! A very simple hill-climber had solved the oneMax problem (which maximizes the number of ones in the bit string) for the bit strings of size 20. On your output screen, you can see on the first line the random initial solution, and the second line, the final solution which is (I hope) the bit string of size 20 with all ones. For example: +```text +initial: 6 20 00010000011000100101 +final: 20 20 11111111111111111111 +``` +The first number is the fitness of the solution, the second the size of the bit string and following all the bits of the solution. + +## 2. The main principles of MO +In MO a local search is defined by this schema: + +![](./schemaLS.jpg) + +At each iteration, from the current solution: +* Generate neighbors from the neighborhood and evaluate them +* Select a neighbor +* Decide to replace solution by the selected neighbor + +Like in paradisEO-eo, MO separates the representation-dependent part (represention of solution, neighbor, evaluation) from the generic part (the order of neighbors generation, selection, replacement, etc.). + +So, to define a local search, it is necessary to define: +* the solution representation, +* the neighbor representation, +* the evaluation function of a solution, +* the evaluation function of a neighbor, +* the neighborhood (generation of the neighbors) + +If you can define the representation-dependent part of your problem, you can use all local search algorithms from MO (Hill-climbing, simulated annealing, tabu search, iterated local search, variable neighborhood search, and more) and even combined them with evolutionary algorithms ! + +Of course a lot of classical representations, neighborhoods and problems are already defined in MO. They will be explained all along this tutorial. +Let's first have a look on the oneMax problem solved by a simple Hill-Climber algorithm defined as follows: +```text +Choose randomly initial solution x +Do + best <- first neighbor of x + For all y in the neighborhood of x + If (f(y) > f(best)) + best <- y + endif + endfor + If (f(x) < f(best)) + x <- best + continue <- true + else + continue <- false + endif + While continue == true +``` + +The simple HC stops on local optima when no improvement can not be made. + +## 3. Browsing the code + +Now let's have a look on the code. All the elements of the simple HC are already defined in the MO framework, and the code only puts all this bricks together. The code following the previous general principles. It defines the solution and neighbor representation, the solution and neighbor evaluation, the neighborhood, and the local search used. +Please, open the file "mo/tutorial/Lesson1/lesson1_simpleHC.cpp", and follow me in the code: + +### 1. The includes part: + +The general includes for the c++ stdlib streams: +```c++ +#include +#include +#include +#include +#include +``` + +This includes for eo which contains all include files of EO: +```c++ +#include +``` + +The first line to include the bit string representation defined in eo, and the second one to include the bit string neighbor representation. All classical problem-dependent part of MO are defined in the sub-directory "problems". How to define your representation is explained in EO tutorial, and how to design your neighbor will be explain in the next lesson 2. Here just use it. +```c++ +#include +#include +``` + +This includes the evaluation function of a solution (full evaluation), the incremental evaluation of a neighbor for the oneMax problem, and a possible evaluation of neighbor using the full evaluation. You will learn at the end how to define your evaluations. +```c++ +#include +#include +#include +``` + +This neighborhood visits all bit string at Hamming distance 1 in increasing order of bit index from bit 0 to bit vecSize-1. All the neighborhoods are included in the "neighborhood" directory. +```c++ +#include +``` + +Now we can include the simple hill-climbing local search. All local search algorithms are included in the "algo" directory. +```c++ +#include +``` + +### 2. The typedef part: + +EO can apply an evolutionary algorithm on any type of solution. So, all EO classes are parametrized by the type of solutions, and it is useful to use a synonym (with a typedef) of the solution's type. +MO can apply an local search algorithm on any type of solution and neighbor. So, for the same reason, all classes of MO are parametrized by the neighbor's type. In the neighbor class, the solution's type is defined. More precision on the neighbor design will be given in the lesson 2. +Here the solution representation is a bit string and the neighbor representation is related to a bit string solution and Hamming distance 1 (only 1 bit can be flipped), both using an "unsigned int" fitness value. +```c++ +typedef eoBit Indi; +typedef moBitNeighbor Neighbor; +``` + +### 3. Object definition part: + +Follows the main function "main_function" where all useful objects are defined.\\ +First, a code to parse the command line and a file. It gives the value of the random seed and the size of bit string. The lesson 3 of EO tutorial gives more precision on this code. Here we have only to understand that the variables "seed" and "vecSize" are initialized. +```c++ +eoParser parser(argc, argv); + +eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); +parser.processParam( seedParam ); +unsigned seed = seedParam.value(); + +// length of the bit string +eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); +parser.processParam( vecSizeParam, "Representation" ); +unsigned vecSize = vecSizeParam.value(); +(...) +``` + +To seed the random seed (see lesson 1 of EO tutorial for more precision): +```c++ +rng.reseed(seed); +``` + +The definition the initialization of solutions is not defined is MO but in EO. The "eoInitFixedLength" is a class that makes a random intialization of bit string of a given length. Each bit is true with 1/2 rate. You can see the lesson 1 of EO tutorial lesson 1 for more precision. +```c++ +eoUniformGenerator uGen; +eoInitFixedLength random(vecSize, uGen); +``` + +The fitness function of the oneMax problem is the number of 1 in the bit string. It is already defined in MO: +```c++ +oneMaxFullEval fullEval; +``` + +A neighbor is not necessary a modified copy of the solution. But often a neighbor defines how to move, i.e. how to modify a solution to compute the neighbor. For example, for the bit string, a neighbor indicates which bit is flipped. +In the same way, it is often possible to define the incremental evaluation of a neighbor knowing the modification (the move). +The incremental evaluation for the oneMax problem is already defined and adds +1 or -1 at the fitness value according to the flipped bit. +```c++ +moOneMaxIncrEval neighborEval; +``` + +When the incremental evaluation can not be defined. The neighbor can be evaluated with the full evaluation. First the solution is modified on the neighbor, than the full evaluation is computed on it and then the solution is move back. This is done by the class "moFullEvalByModif". If you want you to test it comment the line with moOneMaxIncrEval and uncomment the line with moFullEvalByCopy: +```c++ +// moFullEvalByModif neighborEval(fullEval); +``` + +For the simple hill-climbing, all the neighbors are explored in increasing order of their bit flip. So, you can use the class "moOrderNeighborhood" where the size of the neighborhood has to be precise in the constructor: +```c++ +moOrderNeighborhood neighborhood(vecSize); +``` + +All representation-dependent part is now defined, so the simple Hill-Climbing can be defined. The constructor needs the neighborhood, the solution and neighbor evaluations. The solution and neighbor representation are defined by the template of the class: +```c++ +moSimpleHC hc(neighborhood, fullEval, neighborEval); + +``` + +### 4. The execution of hill-climbing part: + +Always in the "main_function" function, it is the execution part. +In MO, the local search algorithm never initializes the solution. It must be made outside the local search algorithm. This allows to combine local search algorithms with evolutionary algorithms or with others local search algorithms. +Now apply your local search on the solution as follows: +```c++ +// The current solution +Indi solution; + +// random initialization +random(solution); + +// Evaluation of the intial solution: +// can be evaluated here, or else it will be done at the beginning of the local search +fullEval(solution); + +// output: the initial solution +std::cout << "initial: " << solution << std::endl ; + +// apply the local search on the solution ! +hc(solution); + +// output: the final solution +std::cout << "final: " << solution << std::endl ; +``` + +The main line is "hc(solution)" which apply the local search on the solution. +Easy, isn't it? + +## 4. Others hill-climbing algorithms + +You may think that the simple hill-climbing is not the hill-climbing you need because you don't want to explore all the neighborhood or because there is several solutions with the same fitness value. + +You may want to implement the first improvement hill-climbing defined as follows: +```text +Choose randomly initial solution x +Do + y <- not visited random neighbor of x + If (f(x) < f(y)) + x <- y + else + y.visited <- true + endif + While number of non visited neighbor of x > 0 +``` + +In the first improvement HC, if the fitness of a random neighbor is higher than the current fitness, the neighbor is selected. And this hill-climber stops on local optima when no more fitness improvement can be made in the neighborhood. + +To implement the first improvement HC, you have to change only 2 lines in the previous code. +The one to change the neighborhood generation: +```c++ +moRndWithoutReplNeighborhood neighborhood(vecSize); +``` +In this neighborhood, the neighbors are generated in an randomly order (not from 0 to vecSize-1) without replacement which means that the neighbors are generated only once. + +And of course, the other one to change the local search algorithm: +```c++ +moFirstImprHC hc(neighborhood, fullEval, neighborEval); +``` + +The corresponding include files have to be changed too. See and run the code "mo/tutorial/Lesson1/lesson1_firstImprHC.cpp". + +For a hill-climbing which takes care on the solutions with equal fitness value such as this one: +```text +Choose randomly initial solution x +Do + bestVect <- [ first neighbor of x ] + For all y in the neighborhood of x + If (f(y) > f(bestVect.first)) + bestVect <- [ y ] + else if (f(y) == f(bestVect.first) and y != bestVect.first) + bestVect.push_back(y) + endif + endfor + If (f(x) < f(bestVect.first)) + x <- choose randomly a solution from bestVect + continue <- true + else + continue <- false + endif + While continue == true +``` + +You only have to change the local search algorithm by (see the code in mo/tutorial/Lesson1/lesson1_randomBestHC.cpp) : +```c++ +moRandomBestHC hc(neighborhood, fullEval, neighborEval); +``` + +Easy, isn't it? + +And if you don't want that your hill-climber stops if there is some solution with the same fitness in the neighborhood like this: +```text +nbStep <- 0 +Choose randomly initial solution x +Do + bestVect <- [ first neighbor of x ] + For all y in the neighborhood of x + If (f(y) > f(bestVect.first)) + bestVect <- [ y ] + else if (f(y) == f(bestVect.first)) + bestVect.push_back(y) + endif + endfor + If (f(x) <= f(bestVect.first)) + x <- choose randomly a solution from bestVect + continue <- true + else + continue <- false + endif + nbStep <- nbStep + 1 + While continue == true and nbStep > nbStepMax +``` + +This hill-climber stops on strict local optima, but not plateau which are local optima. So, another parameter is need to stop the algorithm (nbStepMax). Then you only have to change the local search algorithm by (see the code in Lesson1/lesson1_neutralHC.cpp) : +```c++ +moNeutralHC hc(neighborhood, fullEval, neighborEval, nbStepMax); +``` + +Easy, isn't it? + +## 5. Define your evaluation + +### 1. Evaluation of solutions: +You can learn to define your fitness function in the EO tutorial lesson 1. But let's me shortly explain how to do. +You have to define a class inherited from the "eoEvalFunc". For example, the oneMaxFullEval is defined as follows: +```c++ +#include +template< class EOT > +class oneMaxFullEval : public eoEvalFunc +{ +public: + + /** + * Count the number of 1 in a bitString + * @param _sol the solution to evaluate + */ + void operator() (EOT& _solution) { + unsigned int sum = 0; + for (unsigned int i = 0; i < _solution.size(); i++) + sum += _solution[i]; + _solution.fitness(sum); + } +}; +``` + +The file "eoEvalFunc.h" must be included at the begining. The class "oneMaxFullEval" inherits from the "eoEvalFunc" class. Like all class in EO, the classes are templatized by the solution type "EOT". +EO uses a functor style: the fitness function is computed in the method "operator()(EOT& _sol)". Do what you want to compute the fitness value in this method, and puts the fitness value in the solution at the end by using its method "fitness": +```c++ +_solution.fitness( fitnessValue ); +``` + +The "eoBit" class is vector of boolean. The size of the vector is obtained by the method "size()": +```c++ +_solution.size() +``` +and the value of the ith bit is given by the classical method "operator[]": +```c++ +_solution[i] +``` +The fitness value of a solution can be obtained with the method "fitness()": +```c++ +_solution.fitness() +``` + +### 2. Evaluation of neighbors: +MO uses the same idea to evaluate a neighbor. You have to define a class which inherits from "moEval" class. For example, the oneMaxIncrEval is defined as follows: +```c++ +#include +template< class Neighbor > +class moOneMaxIncrEval : public moEval +{ +public: + + typedef typename Neighbor::EOT EOT; + + /* + * incremental evaluation of the neighbor for the oneMax problem + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider (of type moBitNeigbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + if (_solution[_neighbor.index()] == 0) + _neighbor.fitness(_solution.fitness() + 1); + else + _neighbor.fitness(_solution.fitness() - 1); + } +}; + +``` + +The file "moEval.h" must be included at the begining. All class to define evalutation function are in the "eval" directory of MO. The class "oneMaxIncrEval" inherits from the "moEval" class. Like all class in MO, the classes are templatized by the neighbor's type "Neighbor". +A typedef is defined to easily have access to the solution type "EOT". The solution type is the type "EOT" in the class of Neighbor: +```c++ +typedef typename Neighbor::EOT EOT; +``` + +MO also uses a functor style: the evaluation function is computed in the method "operator()(EOT& _solution, Neighbor & _neighbor)" which depends on the current solution and its neighbor to consider. Do what you want to compute the fitness value of the neighbor in this method, and puts the fitness value in the neighbor by using its method "fitness": +```c++ +_neighbor.fitness( fitnessValue ); +``` + +The "moBitNeighbor" has a method "index()" which gives the number of flipped bit. When the flipped bit of the solution is set to "0" the number of 1 in the neighbor is increased by one, and decreased by one otherwise. +When it is possible the incremental evaluation of neighbor gives a better complexity. For example the full evaluation needs vecSize comparisons, and the incremental evaluation only one comparison. +This prototypical example helps you to define your own solution and neighbor evaluations ! + +### 6. Use your stopping criteria + +All local search algorithms have their own stopping criteria, but it is possible to add other stopping criteria. The predefined stopping criteria you can add are: +* stop on the number of iterations +* stop on the number of full evaluation +* stop on the number of neighbor evaluation +* stop on the fitness value reached +* stop on a time limit + +All criteria inherit from the class "moContinuator" in the directory "continuator". To use one of them, you have to include the correct file, to define your object from the class and add the continuator to the local search constructor. +For example, to add a maximum number of iteration to your simple hill-climber. First include the correct file: +```c++ +#include +``` + +Define an object from the class: +```c++ +moIterContinuator continuator(iterMax); +``` + +And add the continuator in the constructor of the HC: +```c++ +moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); +``` + +Examples on all continuators are given in the source codes "lesson1_iterContinuator.cpp", "lesson1_fitContinuator.cpp", "lesson1_fullevalContinuator.cpp", "lesson1_evalContinuator.cpp". + +It is also possible to combine several continuators with the class "moCombinedContinuator.h" as follows: +```c++ +moIterContinuator iterCont(iterMax); +moFitContinuator fitCont(fitnessMax); +moFullEvalContinuator fullevalCont(fullEval, fullevalMax); +moNeighborEvalContinuator evalCont(neighborEval, evalMax); + +moCombinedContinuator continuator(iterCont); +continuator.add(fitCont); +continuator.add(fullevalCont); +continuator.add(evalCont); +``` + +The local search stops when one of the continuators is false. +Easy, isn't it? + +Of course, you can define your own continuator. You must inherit your own class from the "moContinuator" class. Then 2 methods must be defined: +* the test method: + ```c++ + virtual bool operator()(EOT & _solution) + ``` + + The returned value is true when the local search can continue for the next iteration, and false otherwise. + +* the intialisation method: + ```c++ + virtual void init(EOT & _solution) + ``` + Something you want to initialize before starting the local search (for example a counter). + The predefined continuator can help you to define your own continuator. Have fun now! + +## 7. Exercices + +1. Define the evaluation function and the incremental evaluation of the Royal Road problem. And run a first-improvement hill-climber on it! + + The Royal Road is defined in this paper: + "[The Royal Road for Genetic Algorithms: Fitness Landscapes and GA Performance](http://web.cecs.pdx.edu/~mm/handbook-of-ec-rr.pdf)" Mitchell, Forerest, Holland. + +2. Define the evaluation function and the incremental evaluation of the MAX-SAT problem. And run a first-improvement hill-climber on it! \ No newline at end of file diff --git a/mo/tutorial/Lesson1/schemaLS.jpg b/mo/tutorial/Lesson1/schemaLS.jpg new file mode 100755 index 0000000000000000000000000000000000000000..701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+zS1hT%DHxc?9GTC16cnm)7T7eY8*O*@ z9}{FQ{%IB>nnR9jZ^7B!jP&bGI(KsJTW`1U^pshfi|Tu%RaU*kALf!WtIgC2mj6hc zNR>n$Kwi^Hp{Hc#o)sk*`kiluuxogslDQ;sq7*~4v0cuW zf0nWb4q#8NmZxCYcVm6wI@X+@d)+?VrdbOws@?o`6i2PGRA#!8i*-tm`~!q%7Y-r& z#-ETdmA9lRwY@xXVfw9qU^@-fJ@1JBpx$Xp`2 zx?8Tmk&}~NncNf9-x1G7q8-96%-iTf$ za`1&u8X5NOu(eg#1rpjaS)+cnxQj}$BbhU_mNmt<(H-piA57WcCRo!6ZC$aoHejgUKF zCSc27QGm6)FfNP)?L}J`Um9*C3=7R5E*WSo(V@DhbD7e(-b#F$TuqyJ`RK0pQSiHm z)G4XbWxGi8iT>xp3hm5Ut4sI>kgEIg8eVk8Nya3EoioA&nL?oGxdR6DgzZk*3rdWII2OYy_^P85*mo z283QS)U4LDU*RIXXRE_7g-JO?DI{Zv-ZjmEfR)to=*na{vP~Jeq@%aU)cdA*aHB)} zR!KO;%x3hS69H?AZp_qxgSg-@o?i@^D@BfMP4JX_a{B}Ya_6icYvZcW_(sL(6FaJm z{sHI`1uB3SWI?V*r~Bo%Q4?Q{NruL6V&CDWqEftF+DC`@tTRa-LzbPFM1#H;_6a8| z&-lWmcN_6FJ0X7W^xb~a&1_>Wwg;{|3_-_|H(a3|IfB5{C_L| E3-^Z@egFUf literal 0 HcmV?d00001 diff --git a/mo/tutorial/Lesson2/README.md b/mo/tutorial/Lesson2/README.md new file mode 100644 index 000000000..8d5d8aba0 --- /dev/null +++ b/mo/tutorial/Lesson2/README.md @@ -0,0 +1,124 @@ +# How to implement and use neighborhoods +In this lesson, you will learn how to implement a neighbor, neighborhood and the evaluation function. Two ways will be show, one generic and one using an indexed neighborhoods. As an example, it will be illustrated on the Queens problem. + +1. Classical neighborhoods (example with a swap operator) +2. Indexed neighbordhoods (example with a shift operator) +3. Evaluation of neighbors +4. Exercise + +## 1. Classical neighborhoods (example with a swap operator) + +### Implementation +To implement a neighborhood for your problem, you must have a class that inherits from "moNeighborhood" and a class that inherits from "moNeighbor" for the corresponding neighbors. As a consequence, in the neighborhood class, you have to implement the following methods: + +hasNeighbor (test if there is at least one valid neighbor) +init (init the first neighbor) +cont (test if there is again a valid neighbor) +next (compute the next valid neighbor) +And in the neighbor class: + +move (how to apply the move corresponding to the neighbor on a solution) +### Example +In the "paradiseo-mo/src/problems/permutation" directory, classical neighborhood and neighbor for swap operator (moSwapNeighborhood.h and moSwapNeighbor.h) are defined. Some methods are specific to the swap operator and you can see a "move_back" methods that is explained at the end of this tutorial. + +In "mo/tutorial/Lesson2" directory, open the source file "testNeighborhood.cpp". You can see how to use this first neighborhood... + +After inclusion, useful types are defined for more lisibility: + +Define type of representation +```c++ +typedef eoInt Queen; +``` +Define type of a swap neighbor +```c++ +typedef moSwapNeighbor swapNeighbor; +``` +Define type of the swap neighborhood +```c++ +typedef moSwapNeighborhood swapNeighborhood; +``` +And in the "main" fonction, a neighborhood, a solution and a neighbor are declared: +```c++ +swapNeighborhood swapNH; +Queen solution; +swapNeighbor n1; +``` + +Then they are used to explore and print all the neighbors of the neighborhood for a Queen problem of size 8 (swapEval is the evaluation function declared previously) +```c++ +swapNH.init(solution, n1); +swapEval(solution,n1); +n1.print(); +while(swapNH.cont(solution)){ + swapNH.next(solution, n1); + swapEval(solution,n1); + n1.print(); +} +``` + +You can run the executable on the lesson 2 directory and see the output (the beginning). + +## 2. Indexed neighbordhoods (example with a shift operator) + +### Implementation +Three indexed neighborhoods are already defined in Paradiseo-MO. To use them you have to know the size of your neighborhoods and define a mapping that associates a neighbor from a known key, in your class neighbor. This neighbor must inherit from "moIndexNeighbor". + +### Example +In the mo/src/problems/permutation" directory, a neighbor for shift operator (moShiftNeighbor.h) is defined. In this class, the mapping is done in the method "translate". + +After inclusion useful types are defined for more lisibility: + +Define type of a shift neighbor +```c++ +typedef moShiftNeighbor shiftNeighbor; +``` +Define three different indexed neighborhoods for shift operator +```c++ +typedef moOrderNeighborhood orderShiftNeighborhood; +typedef moRndWithoutReplNeighborhood rndWithoutReplShiftNeighborhood; +typedef moRndWithReplNeighborhood rndWithReplShiftNeighborhood; +``` + +And in the "main" fonction, a shift neighbor and the three indexed neighborhoods are declared: +```c++ +shiftNeighbor n2; +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); +rndWithoutReplShiftNeighborhood rndNoReplShiftNH(pow(vecSize-1, 2)); +rndWithReplShiftNeighborhood rndReplShiftNH(pow(vecSize-1, 2)); +``` + +Exploration of the neighborhoods is done like with a classical neighborhood. + +You can run the executable on the lesson 2 directory and see the output. + +## 3. Evaluation of neighbors + +There are three ways to evaluate a neighbor: + +1. Incremental evaluation +2. Full evaluation by modification +3. Full evaluation by copy + +In terms of performance, it is more efficient to use incremental evaluation and if it cannot be defined, full evaluation by modification is better than that one by copy. + +### Incremental evaluation +To implement an incremental evaluation, you have to create a class which inherits of "**moEval**". So you have to define the method: +```c++ +void operator()(EOT&, Neighbor&){ ... } +``` +EOT and Neighbor are respectively the templates for a solution and a neighbor. + +### Full evaluation +The two full evaluations are already defined in Paradiseo-MO. The full evaluation by modification applies the move on the initial solution, evaluates the obtained solution and affects the fitness value to the neighbor. Then the "moveBack" is applied to come back to the initial solution. On the other hand, the full evaluation by copy applies the move on a temporary copy of the solution, evaluates it and affects the fitness value to the neighbor. + +To use these evaluations, you need your classical full evaluation function ("eoEvalFunc") in the constructors: +```c++ +moFullEvalByCopy(eoEvalFunc& _eval) +moFullEvalByModif(eoEvalFunc& _eval) +``` + +Be carefull, if you want to use the class "moFullEvalByModif", your neighbor must be "backable" and so it has to inherit of the class "**moBackableNeighbor**" and consequently to have a method "moveBack". + +## 4. Exercise + +Try to define an indexed swap neighbor like in the file "moShiftNeighbor.h". Then explore and print the neighborhood randomly. \ No newline at end of file diff --git a/mo/tutorial/Lesson3/README.md b/mo/tutorial/Lesson3/README.md new file mode 100644 index 000000000..ea68ad686 --- /dev/null +++ b/mo/tutorial/Lesson3/README.md @@ -0,0 +1,110 @@ +# Lesson3 - How to use Simulated Annealing and Checkpointing +In this lesson, a simple simulated annealing is presented, using an order neighborhood based on a shift operator, to solve the Queen problem. Then, a checkpoint will be used to save some informations during the search. + +1. Simulating Annealing on the Queen problem. +2. Checkpointing +3. Avalaible statistics in MO +4. Exercise + +## 1. Simulating Annealing (example on the Queen problem) + +First you have to define the representation of a Queen, how to initialize and evaluate it. So you have to declare three classes: +```c++ +queenFullEval fullEval; +eoInitPermutation init(vecSize); +Queen solution1; +``` + +Then, you have to ramdomly intialize and evaluate the solution: +```c++ +init(solution1); +fullEval(solution1); +``` + +Let see the most simple constructor of a Simulated Annealing (in algo/moSA.h). You need three parameters: +* a neighborhood +* a full evaluation function (declared before) +* a neighbor's evaluation function +```c++ +moFullEvalByCopy shiftEval(fullEval); +rndShiftNeighborhood rndShiftNH(pow(vecSize-1, 2)); +``` + +You can now declare the Simulated Annealing: +```c++ +moSA localSearch1(rndShiftNH, fullEval, shiftEval); +``` +This simple constructor uses by default three components: +* moSimpleCoolingSchedule (with default parameters) +* moSolNeighborComparator +* moTrueContinuator + +More flexible constructors exist in which you can change these components. In the following, the "moTrueContinuator" is replaced by a "moCheckpoint". + +You can try this first algorithm with different problem sizes (use parameter file or the option --vecSize=X on command line to execute "testSimulatedAnnealing"). It prints the initial and final solution1. + +## 2. Checkpointing (example on the Queen problem) + +The class "moCheckpoint" inherits of the abstract class "moContinuator" and allows to incorporate one or many "moContinuator" classes (Composite pattern). It also allows to incorporate many "eoMonitor", "eoUpdater" and "moStatBase" classes. + +Here, an example of checkpointing is presented, including: +* a continuator returning always true (moTrueContinuator) +* a monitor saving information in a file (eoFileMonitor) +* an updater using the file monitor with a determinated frequency (moCounterMonitorSaver) +* a very simple statistical operator giving only the fitness of the current solution (moFitnessStat) + +First, you have to define the "moTrueContinuator" and build the "moCheckpoint": +```c++ +moTrueContinuator continuator; +moCheckpoint checkpoint(continuator); +``` + +Then, create the "moFitnessStat" and add it in the checkpoint: +```c++ +moFitnessStat fitStat; +checkpoint.add(fitStat); +``` + +Finally, create the "eoFileMonitor" to write fitness values in the file fitness.out and the "moCounterMonitorSaver" to use the file monitor only for each 100 iterations. +```c++ +eoFileMonitor monitor("fitness.out", ""); +moCounterMonitorSaver countMon(100, monitor); +checkpoint.add(countMon); +monitor.add(fitStat); +``` + +So you can create a Simulated Annealing with this checkpoint: +```c++ +moSA localSearch2(rndShiftNH, fullEval, shiftEval, coolingSchedule, solComparator, checkpoint); +``` + +Try this second algorithm with different problem sizes (use parameter file or the option --vecSize=X on command line to execute "testSimulatedAnnealing"). It prints the initial and final solution2 and you can see the evolution of fitness values in the file fitness.out (only 1 value each 100 iterations). + +## 3. Avalaible statistics + +A lot of statistics are avalaible to have informations during the search: + +* moCounterStat +* moMinusOneCounterStat +* moStatFromStat +* moFitnessStat +* moNbInfNeighborStat +* moNbSupNeighborStat +* moNeutralDegreeNeighborStat +* moSizeNeighborStat +* moNeighborhoodStat +* moDistanceStat +* moSolutionStat +* moBestSoFarStat +* moSecondMomentNeighborStat +* moMaxNeighborStat +* moMinNeighborStat +* moNeighborBestStat +* moNeighborFitnessStat +* moAverageFitnessNeighborStat +* moStdFitnessNeighborStat + +## 4. Exercise + +1. Try to add the cooling schedule parameters into the parameters file. Then, try the simulated annealing with different parameters to see theirs impacts on the search. +2. Add an existed operator (in continuator directory) to print the solution each 100 iterations. \ No newline at end of file diff --git a/mo/tutorial/Lesson4/README.md b/mo/tutorial/Lesson4/README.md new file mode 100644 index 000000000..c416fbd1a --- /dev/null +++ b/mo/tutorial/Lesson4/README.md @@ -0,0 +1,67 @@ +# How to use Tabu Search +In this lesson, a simple tabu search is presented, using an order neighborhood based on a shift operator, to solve the Queen problem. +1. Tabu Search on the Queen problem. +2. Exercise + +## 1. Tabu Search (example on the Queen problem) + +First you have to define the representation of a Queen, how to initialize and how to evaluate it. So you have to declare three classes: +```c++ +queenFullEval fullEval; +eoInitPermutation init(vecSize); +Queen sol1; +``` + +Then, you have to ramdomly intialize a solution: +```c++ +init(sol1); +fullEval(sol1); +``` + +Let see the most simple constructor of a Tabu Search (in mo/src/algo/moTS.h). You need five parameters: + +* a neighborhood +```c++ +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); +``` +* a full evaluation function (declared before) +* a neighbor evaluation function* +```c++ +moFullEvalByCopy shiftEval(fullEval); +``` +* a time limit for the search (in seconds) +* a size for the tabu list + +You can now declare the Tabu Search: +```c++ +moTS localSearch1(orderShiftNH, fullEval, shiftEval, 2, 7); +// 2 is the time limit, 7 is the size of the tabu List +``` + +This simple constructor uses by default seven components: +* moTimeContinuator +* moNeighborComparator +* moSolNeighborComparator +* moNeighborVectorTabuList +* moDummyIntensification +* moDummyDiversification +* moBestImprAspiration + +More flexible constructors exist as you can change these components: +```c++ +moNeighborVectorTabuList tl(sizeTabuList,0); +moTS localSearch2(orderShiftNH, fullEval, shiftEval, 3, tl); +// 3 is the time limit +``` +In this one, the tabuList has been specified. +```c++ +moTS localSearch3(orderShiftNH, fullEval, shiftEval, + comparator, solComparator, continuator, tl, inten, div, asp); +``` +In this one, comparators, continuator, tabu list, intensification strategy, diversification strategy and aspiration criteria have been specified. + +You can test these three algorithms by changing problem sizes, time limit and the size of tabu list (use parameters file or the option --vecSize=X, --timeLimit=Y and --sizeTabuList=Z on command line to execute "testSimpleTS"). It prints the initial and final solutions. + +## 2. Exercise + +1. Try to implement and use a diversification strategy in 'testSimpleTS". You can also use a predifined strategy: moMonOpDiversification (in "memory" directory) \ No newline at end of file diff --git a/mo/tutorial/Lesson5/README.md b/mo/tutorial/Lesson5/README.md new file mode 100644 index 000000000..8a684df71 --- /dev/null +++ b/mo/tutorial/Lesson5/README.md @@ -0,0 +1,64 @@ +# How to use Iterated Local Search +In this lesson, an Iterated Local Search is presented. The Tabu Search of the Lesson 4 is used with an order neighborhood based on a shift operator, to solve the Queen problem. + +1. Iterated Tabu Search on the Queen problem. +2. Exercise + +## 1. Iterated Tabu Search (example on the Queen problem) + +As in Lesson 4, you have to define a Solution, the method to initialize and evaluate it. Then you have to define a Tabu Search. + +Declaration of the Tabu Search: +```c++ +moTS ts(orderShiftNH, fullEval, shiftEval, 1, 7); +``` + +To use a simple Iterated Local Search, a mutation operator is needed. So the swap mutation defined in EO is used: +```c++ +eoSwapMutation mut; +``` + +Now, a simple Iterated Tabu Search can be declared as follow: +```c++ +moILS localSearch1(ts, fullEval, mut, 3); +``` +This constructor has got 4 parameters: +1. a local search (ts) +2. a full evaluation function (fullEval) +3. a mutation operator (mut) +4. a number of iterations (3) + +**localSearch1** performs the Tabu Search 3 times. The first solution of each iteration(except the first one) is obtained by applying the mutation operator on the last visited solution. + +A constructor allows to specify the continuator. **_Be carefull_**, the continuator must be templatized by a "moDummyNeighbor": +```c++ +moIterContinuator > cont(4, false); +``` +The explorer of the Iterated local search don't use its own neighborhood. Here, the neighborhood of the Tabu Search is used. But to respect the conception, we create a "moDummyNeighbor" using as template for Iterated Local Search. + +An Iterated Tabu Search with this continuator can be declared as: +```c++ +moILS localSearch2(ts, fullEval, mut, cont); +``` + +A general constructor is available allowing to specify the perturbation operator and the acceptance criteria. First, you have to declare a perturbation operator: +```c++ +moMonOpPerturb perturb(mut, fullEval); +``` +And, the acceptance criteria: +```c++ +moSolComparator solComp; +moBetterAcceptCrit accept(solComp); +``` +Finally, the Iterated Local Search can be declared as: +```c++ +moILS localSearch3(ts, fullEval, cont, perturb, accept); +``` + +You can test these three algorithms by changing problem sizes(use parameter file or the option --vecSize=X on command line to execute "testILS"). It prints the initial and the final solutions. + +## 2. Exercise + +* Try to implement an Iterated Hill Climbing on the Queen problem with these caracteristics: + 1. Hill Climbing with a "moShiftNeighborhood" and a "moTrueContinuator" + 2. Iterated Local Search using a "moIterContinuator" and a "moNeighborhoodPerturb" with a "moSwapNeighborhood". \ No newline at end of file diff --git a/mo/tutorial/Lesson6/README.md b/mo/tutorial/Lesson6/README.md new file mode 100644 index 000000000..e8f4ba747 --- /dev/null +++ b/mo/tutorial/Lesson6/README.md @@ -0,0 +1,250 @@ +# How to perform a fitness analysis? + +![](multimodalFitnessLandscape.jpg) + +A lot of tools to perform the fitness landscapes analysis are defined in paradisEO-MO: +* Density Of States +* Fitness Distance Correlation +* Autocorrelation length and autocorrelation functions +* Sampling the local optima by adaptive walks +* Neutral degree distribution +* Evolvability of neutral networks by neutral walks +* Fitness Cloud + +With the same code (and effort ;-) ), you can make an apriori study of your problem with fitness landscapes analysis and use efficient solution-based metaheuristics. You can also make an aposteriori fitness landscapes analysis of your problem to explain why your metaheuristics works or not. + +This lesson will let you: +* Use the fitness analysis tools of MO library +* Learn to perform your own fitness landscapes analysis + +In lesson 1, you have learnt to define the fitness function. In lesson 2, you have learn to define a neighbor and a neighborhoods. This lesson will used those previous lessons. + +This tutorial is made to learn how to perform a fitness landscapes analysis with paradisEO-MO. It is not a course to learn fitness landscapes analysis. You can find some information about fitness landscapes analysis here: [tutorial GECCO 09 (pdf)](http://www.i3s.unice.fr/~verel/talks/tutorialFitnessLandscapes_gecco2009.pdf) or [tutorial WCCI-CEC 10 (pdf)](http://www.i3s.unice.fr/~verel/talks/tutorialCEC2010.pdf) + +## 1. I want to compute the Fitness Distance Correlation (FDC)! + +You can compute the FDC. From the "paradiseo-mo/build/tutorial/Lesson6" directory, type: +```shell +./fdc -V=20 -n=500 +``` + +Great! You have sample fitness and distance to global optimum of 500 random solutions on the oneMax problem (which maximizes the number of ones in the bit string) for the bit strings of size 20. On your output screen, you can see the fitness and distance of the first and last solution of the sample. For example: +```text +First values: +Fitness 8 +Distance 12 +Last values: +Fitness 6 +Distance 14 +``` + +In the file "out.dat", you have all the sample. First column is the fitness and the second column is the distance to global optimum of the 500 solutions. + +After you can compute the correlation coefficient with your best statistical software such as R (with this small script) or excel with this help (import data and correlation) or with this small awk script. + +I found -1 with my sample which means that it is very easy function, isn't it? + +## 2. The main principles of fitness landscapes analysis with MO + +The fitness landscapes analysis is based on a sampling of the search space. During this sampling, data are collected, and then some statistics can be computed to deduce the structure of the search space. + +The class to define a sampling is moSampling in the directory mo/src/sampling. All classes of the standard tools of fitness landscapes analysis inherit from this class (see documentation): +* moDensityOfStatesSampling : density of states (distribution of fitness values) +* moAutocorrelationSampling : autocorrelation length and functions +* moFDCsampling : fitness distance correlation +* moHillClimberSampling : adaptive walks +* moNeutralDegreeSampling : neutral degree +* moNeutralWalkSampling : evolvability of neutral networks +* moFitnessCloudSampling : evolvability of the operator, and the neighborhood + +The constructor of moSampling is: +```c++ +moSampling (eoInit< EOT > &_init, moLocalSearch< Neighbor > &_localSearch, moStat< EOT, ValueType > &_stat, bool _monitoring=true) +``` + +As usual in paradiseo, EOT is the typedef of the solution, and Neighbor is the typedef of the neighbor (see lesson 1). This constructor needs an initialization methods (see tutorial on paradiseo-eo), a local search which perform the sampling of the search space (see previous lessons to define it), and a object which able to compute a statistic. At each iteration of the local search, the given statistic is computed, and is saved if boolean monitoring is true. + +The statistics inherit from the class moStat. The include file can be found in mo/src/continuator directory. The pre-defined statistics are: +* moFitnessStat : the fitness of the current solution +* moDistanceStat : the distance between the current solution and a given solution +* moSolutionStat : the current solution +* moCounterStat : the number of iterations +* moBestSoFarStat : the best current solution found +* moNeighborBestStat : best fitness over k neighbors +* moNeighborhoodStat : to compute the statistics from the neighbors solutions : + * moAverageFitnessNeighborStat : average fitness in the neighborhood + * moStdFitnessNeighborStat : standard deviation of fitness + * moMaxNeighborStat : maximum fitness + * moMinNeighborStat : minimum fitness + * moSecondMomentNeighborStat : average and standard deviation + * moSizeNeighborStat : size of the neighborhood + * moNeutralDegreeNeighborStat : number of neighbors with equal fitness + * moNbInfNeighborStat : number of neighbors with lower fitness + * moNbSupNeighborStat : number of neighbor with higher fitness + +All those statistics can be used in the sampling. Of course you can define your own statistic class. Several statistics can be collected at each iteration: use the method add of the class moSampling to collect another statistic. + +For standard tools of fitness landscapes analysis, there is no need to give the sampling method, and the statistics objects. You only have to give which is specific to your problem such as the initialization method, the fitness function, the neighborhood, or the evaluation function of a neighbor. + +## 3. Browsing the code + +Please, open the file "mo/tutorial/Lesson6/fdc.cpp", and follow me in the code: + +### 1. The includes part: + +The general includes for the c++ stdlib streams: +```c++ +#include +#include +#include +#include +#include +``` + +This includes for eo which contains all include files of EO: +```c++ +#include +``` + +The first line to include the bit string representation defined in eo, and the second one to include the bit string neighbor representation. All classical problem-dependent part of MO are defined in the sub-directory "problems". How to define your representation is explained in EO tutorial, and how to design your neighbor is explained in the lesson 2. Here just use it. +```c++ +#include +#include +``` + +This includes the evaluation function of a solution (full evaluation). There is no evaluation function for the neighbor because there is no need in FDC. Some others tools such as autocorrelation neighbor evaluation is defined such as the lesson 1. +```c++ +#include +``` + +The fitness distance correlation is the correlation between the fitness of solution and the distance to global optimum (or at least to some best known solution). So, this include file uses the Hamming distance. +```c++ +#include +``` + +Now we can include the FDC tool. +```c++ +#include +``` + +### 2. The typedef part: + +EO can apply an evolutionary algorithm on any type of solution. So, all EO classes are parametrized by the type of solutions, and it is useful to use a synonym (with a typedef) of the solution's type. +MO can apply an local search algorithm on any type of solution and neighbor. So, for the same reason, all classes of MO are parametrized by the neighbor's type. In the neighbor class, the solution's type is defined. More precision on the neighbor design will be given in the lesson 2. +Here the solution representation is a bit string and the neighbor representation is related to a bit string solution and Hamming distance 1 (only 1 bit can be flipped), both using an "unsigned int" fitness value. +```c++ +typedef eoBit Indi; +typedef moBitNeighbor Neighbor; +``` + +### 3. Object definition part: + +Follows the main function "main_function" where all useful objects are defined.\\ +First, a code to parse the command line and a file. It gives the value of the random seed and the size of bit string. The lesson 3 of EO tutorial gives more precision on this code. Here we have only to understand that the variables "seed" and "vecSize" are initialized. +```c++ +eoParser parser(argc, argv); + +eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); +parser.processParam( seedParam ); +unsigned seed = seedParam.value(); + +// length of the bit string +eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); +parser.processParam( vecSizeParam, "Representation" ); +unsigned vecSize = vecSizeParam.value(); + +// the number of solution sampled +eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); +parser.processParam( solParam, "Representation" ); +unsigned nbSol = solParam.value(); + +// the name of the output file +string str_out = "out.dat"; // default value +eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); +``` + +To seed the random seed (see lesson 1 of EO tutorial for more precision): +```c++ +rng.reseed(seed); +``` + +The definition the initialization of solutions is not defined is MO but in EO. The "eoInitFixedLength" is a class that makes a random intialization of bit string of a given length. Each bit is true with 1/2 rate. You can see the lesson 1 of EO tutorial lesson 1 for more precision. +```c++ +eoUniformGenerator uGen; +eoInitFixedLength random(vecSize, uGen); +``` + +The fitness function of the oneMax problem is the number of 1 in the bit string. It is already defined in MO: +```c++ +oneMaxFullEval fullEval; +``` + +The distance used is the classical Hamming distance: +```c++ +eoHammingDistance distance; +``` + +For this analysis, the best solution is needed: the solution with all 1s. +```c++ +Indi bestSolution(vecSize, true); // global optimum +``` + +All representation-dependent part is now defined, so the FDC sampling can be defined. The constructor needs the initialization, the fitness function, the distance used, the reference solution, and the size of the sample: +```c++ +moFDCsampling sampling(random, fullEval, distance, bestSolution, nbSol); +``` + +### 4. The execution of sampling part: + +Now apply your sampling as follows: +```c++ +sampling(); +``` + +This sampling uses the initialization method to define a pure random search, and at each iteration the fitness and the distance are computed. + +4. The export part: + +To export your sample into a file: +```c++ +sampling.fileExport(str_out); +``` + +The first column of the file is the fitness and the second the distance from the global optimum. + +Maybe you may want to read the data from your c++ code. So it is possible to export the data into a vector: +```c++ +const std::vector & fitnessValues = sampling.getValues(0); +const std::vector & distValues = sampling.getValues(1); +``` + +Note that the indexes of the statistics (here 0 and 1) are in the same order of the declaration with the constructor and the "add" method of moSampling. + +After you can use the vector as you want: +```c++ +std::cout << "Fitness " << fitnessValues[0] << std::endl; +std::cout << "First values:" << std::endl; +std::cout << "Distance " << distValues[0] << std::endl; + +std::cout << "Last values:" << std::endl; +std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; +std::cout << "Distance " << distValues[distValues.size() - 1] << std::endl; + +``` + +Easy, isn't it? + +## 4. Others fitness landscapes tools + +The other tools can be used in the same way. For each tool, an example has been made. Please read the code of: + +* densityOfStates.cpp : density of states example +* autocorrelation.cpp : autocorrelation length and functions +* adaptiveWalks.cpp : sampling by hill-climbings, length of adaptative walks +* fdc.cpp : ;-) +* fitnessCloud.cpp : bivariate density of fitness of solutions and fitness of neighbors +* neutralDegree.cpp : number of neighbor with the same fitness +* neutralWalk.cpp : evolvability of the neutral networks +* sampling.cpp : general sampling method + +If you have some questions or remarks, please contact us! sebastien.verel aaattt unice.fr or member of the development team. \ No newline at end of file diff --git a/mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg b/mo/tutorial/Lesson6/multimodalFitnessLandscape.jpg new file mode 100755 index 0000000000000000000000000000000000000000..ad3b52ce09369b311417fc897bd6f3558978b935 GIT binary patch literal 19455 zcmdqJcR*9k);AguP?~fQkY1H4RRKXdh!mxF5vd_WdXNB0?^U|ed+(u!-kWp@Jrt!U zpb(^e@j2yt&U^2<@Bep_o&DQ0Yt~w`X7}1%QKt15m?$05?c{ zR&_;1OPyERD(Wwku?YYGKDpJqcTTvh0079@-BtCKys?q73G3~z09?Rb00{satgPMM z$?NF6_=BCn&NhF}{~1o_09Z}{z_h?0UjLc)zh2?LwQ;k?Qgvbvu$TKgcK`rK7>lWa zdao3*SP6^oTEBDs6R(HGkKejkgRnRX0Js(O&%D@Z0FA1RvyH2RHLI$tl{c%7E7;b- z>F>J!Z|Q${{IB7UZT>-Y^75}TaCVEy&Mm<>bWrSCSj6tBsqDtEbIdK>*0f1ESAFBqtezvMIDRzvGJF-t}6Oi{16*YKW8Z}<=84mR)3UwK^s9$4CcK+ z0tE02R}1e8=L^pZ9|+G1=U~xZ9D@h%yLZVk0j`z~))TQPEWbaJ|H1p;dH>?_N2`Bu zw#G{TZ(6!z)Bb4xcOB)idO88@u(2TQ;qX_w+dnn4!fNRTaL4}IV$+-f0)H=&t#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x`9XHQJE;3A>Qlk?Ci|$e%KHD?all6=3VoD@3%Xl zha{`HnDxG&THM48kz_c$LaQsdpqv$tv$VJp)yuh!g&HS*5yF5%ts*n!zz;I3_cqP4 zS@~1$+>kIaoCD1WhNr$!@O&uq+k%@mc`Uv2!=VXSvstPq#sB4x8dbB|kPhPtgM0<^ zJvsw&6RUVscJsIl(B=tfM-CUz!i-F0i@(fjuu2I)Fru#z$~)E`b4e-t0fz<>4u@_iX)nYrz*CXgHehzdMJ7=Pvt)mr|iYvq`dTIzU%=6O`0fDGatnJYGv$8NURGBg4)MLZ+dr_+lc zVIa~x(WEZT4&V=|I*`SRYbuw)M`J6C<09>8n`nm^v=I)v!6eU-B;&d3g(?4G7<>GcR(Mn!j0?u6a3rI#%F z)Fx8U9k^9S%EYb4Nd$nlW{Uewp~Cg61z6N?aM(4V2ZK>D*GsCtH)+a|*51i;U-tUv zNcnS(EUQAiLk5h%v0+%8{kY^tCy?yJHr9F^GGHgyem2)I*bfOPH2KLTK zUl$6uXj)6e4W~`p^xc%~0$wFDb5)MU7qt=d8%tI}b4EXh?M%Z|ip7Hu?IQ4BuJ~KA z8r;Xh-(*?bCu~Qs$1*y0jCQ1QreZJpEnBVoF zA;`e+3(24;S|kiJmZka8ard|^x%BDrlqQCwjGW`$m^--ltG1uw1;-&kSR2(?*IuI# zmrfBA#bFLx8h;uJJh?T)VtP?8a zDa!Tf{na1qA%ui4Zk~tEc$!K}Zj_sFozU9mUeN$oBX|iA{JwC$)#wUzr6IYlzU~g3Y@Fv~-UT}9&rqLn zhTWbf-lO%l8tGK^TUr}fsw)y+ug{F)@$8^pi5r;i0eRWI$0QMY7k;3@=<$cb|IYvB Hjd#BT_^tD& literal 0 HcmV?d00001 diff --git a/mo/tutorial/Lesson7/README.md b/mo/tutorial/Lesson7/README.md new file mode 100644 index 000000000..5f493a130 --- /dev/null +++ b/mo/tutorial/Lesson7/README.md @@ -0,0 +1,60 @@ +# How to hybrid an evolutionary algorithm and a local search +In this lesson, a hybridization between an evolutionary algorithm(EA) and a local search is presented. It will be illustrated by an example on the Queen problem. Here, the hybridization consists in replacing the mutation operator of the EA by a first improvement hill climber. + +1. hybridization +2. Exercise + +## 1. Hybridization (example on the Queen problem) + +First, you have to define the represenation of a Queen, how to initialize and how to evaluate a population of solutions: +```c++ +queenFullEval fullEval; + +eoInitPermutation init(vecSize); + +eoPop pop; +Queen tmp; +for(unsigned int i=0; i<20; i++){ //population size is fixed to 20 + init(tmp); + fullEval(tmp); + pop.push_back(tmp); +} +``` + +As in previous lessons, a local search is declared (first improvement hill climber): +```c++ +moFullEvalByCopy shiftEval(fullEval); + +orderShiftNeighborhood orderShiftNH(pow(vecSize-1, 2)); + +moFirstImprHC hc(orderShiftNH, fullEval, shiftEval); +``` +To hybrid this local search with an EA, you just have to use it instead of a classical mutation: +```c++ +eoOrderXover cross; +eoSGATransform transform(cross, 0.3, hc, 0.7); // cross and mutation probabilities are fixed +``` + +Others components of the "eoEasyEA" have to be declared: +```c++ +eoGenContinue EAcont(50); //nb generations is fixed to 50 +eoDetTournamentSelect selectOne(2); //size of tournament is fixed to 2 +eoSelectMany select(selectOne, 1); //rate of selection is fixed to 1 +eoGenerationalReplacement repl; +``` +More details are available in EO lessons. + +Finally, the hybrid algorithm is declared as: +```c++ +eoEasyEA hybridAlgo(EAcont, fullEval, select, transform, repl); +``` +and should be applied on the population with: +```c++ +hybridAlgo(pop); +``` + +You can test this hybrid algorithm by changing problem size (use parameters file or the option --vecSize=X on command line to execute "hybridAlgo"). It prints the initial and final population. + +## 2. Exercise + +Try to use a hybridization at the checkpointing step rather than at the mutation step. You have to implement an "eoUpdater" which applies a local search. This updater should be added in a "eoCheckpoint". \ No newline at end of file From ff09b4bcc75ee4a25daacecaac65abb56fe8b6b1 Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 31 Aug 2022 23:46:46 +0200 Subject: [PATCH 039/113] fix logo display in readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59ded2801..686b08334 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ It focus on the efficiency of the implementation of solvers, by providing: - tools for ***automated design and selection*** of algorithms, - a focus on ***speed*** and several ***parallelization*** options. -![Paradiseo logo](https://github.com/nojhan/paradiseo/blob/master/website/paradiseo_logo_200px_dark.png) +
      + Paradiseo logo +
      # Quick Start From 1a980c442d208d72d42d499c430268f8fcb5c7cf Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 31 Jan 2022 22:33:36 +0100 Subject: [PATCH 040/113] feat: add an eoForgeMap Same features than an eoForgeVector, but allowing to bind a string name to the instance. --- eo/src/eoForge.h | 138 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 133 insertions(+), 5 deletions(-) diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index bc2dbb67d..6fcccf811 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -192,13 +192,13 @@ class eoForgeOperator : public eoForgeInterface * with different parametrization (or not). * * @warning When passing a reference (as it is often the case within ParadisEO), - * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. - * This is is a source of bug which your compiler will to detect and that would - * disable any link between operators. + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will fail to detect and that would + * disable any link between operators. * * @warning You may want to enable instantiation cache to grab some performances. - * The default is set to disable the cache, because its use with operators - * which hold a state will lead to unwanted behaviour. + * The default is set to disable the cache, because its use with operators + * which hold a state will lead to unwanted behaviour. * * @code eoForgeVector> factories(false); @@ -320,6 +320,134 @@ class eoForgeVector : public std::vector*> bool _no_cache; }; +/** A map holding an operator (with deferred instantiation) at a given name. + * + * @note You can actually store several instances of the same class, + * with different parametrization (or not). + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will fail to detect and that would + * disable any link between operators. + * + * @warning You may want to enable instantiation cache to grab some performances. + * The default is set to disable the cache, because its use with operators + * which hold a state will lead to unwanted behaviour. + * + * @code + eoForgeMap> factories(false); + + // Capture constructor's parameters and defer instantiation. + factories.add>(1); + factories.setup>(0, 5); // Edit + + // Actually instantiate. + eoSelect& op = factories.instantiate(0); + + // Call. + op(); + * @endcode + * + * @ingroup Foundry + */ +template +class eoForgeMap : public std::map*> +{ + public: + using Interface = Itf; + + /** Default constructor do not cache instantiations. + * + * @warning + * You most probably want to disable caching for operators that hold a state. + * If you enable the cache, the last used instantiation will be used, + * at its last state. + * For example, continuators should most probably not be cached, + * as they very often hold a state in the form of a counter. + * At the end of a search, the continuator will be in the end state, + * and thus always ask for a stop. + * Reusing an instance in this state will de facto disable further searches. + * + * @param always_reinstantiate If false, will enable cache for the forges in this container. + */ + eoForgeMap( bool always_reinstantiate = true ) : + _no_cache(always_reinstantiate) + { } + + /** instantiate the operator managed at the given name. + */ + Itf& instantiate(const std::string& name) + { + return this->at(name)->instantiate(_no_cache); + } + + /** Add an operator to the list. + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will to detect and that would + * disable any link between operators. + * + */ + template + void add(const std::string& name, Args... args) + { + // We decay all args to ensure storing everything by value within the forge. + // The references should thus be wrapped in a std::ref. + auto pfo = new eoForgeOperator...>( + std::forward(args)...); + this->insert({name, pfo}); + } + + /** Specialization for operators with empty constructors. + */ + template + void add(const std::string& name) + { + eoForgeInterface* pfo = new eoForgeOperator; + this->insert({name, pfo}); + } + + /** Change the set up arguments to the constructor. + * + * @warning When passing a reference (as it is often the case within ParadisEO), + * it is MANDATORY to wrap it in `std::ref`, or else it will default to use copy. + * This is is a source of bug which your compiler will to detect and that would + * disable any link between operators. + * + * @warning The operator at `name` should have been added with eoForgeMap::add already.. + */ + template + void setup(const std::string& name, Args... args) + { + delete this->at(name); // Silent on nullptr. + auto pfo = new eoForgeOperator...>( + std::forward(args)...); + this->emplace({name, pfo}); + } + + /** Specialization for empty constructors. + */ + template + void setup(const std::string& name) + { + delete this->at(name); + auto pfo = new eoForgeOperator; + this->emplace({name, pfo}); + } + + virtual ~eoForgeMap() + { + for(auto kv : *this) { + delete kv.second; + } + } + + protected: + bool _no_cache; +}; + + /** A range holding a parameter value at a given index. * * This is essential a scalar numerical parameter, with bounds check From 843aa6fc373fa29f169691ef84750288ef5a1e63 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 10 Sep 2022 06:26:34 +0200 Subject: [PATCH 041/113] fix(mo): comment out unused parameters Removes -Wunused-parameters warnings. --- mo/src/acceptCrit/moAlwaysAcceptCrit.h | 2 +- mo/src/algo/eoDummyMonOp.h | 2 +- mo/src/continuator/moAverageFitnessNeighborStat.h | 4 ++-- mo/src/continuator/moBestNoImproveContinuator.h | 2 +- mo/src/continuator/moBooleanStat.h | 4 ++-- mo/src/continuator/moContinuator.h | 4 ++-- mo/src/continuator/moCounterStat.h | 4 ++-- mo/src/continuator/moEvalsContinuator.h | 4 ++-- mo/src/continuator/moFullEvalContinuator.h | 4 ++-- mo/src/continuator/moIterContinuator.h | 4 ++-- mo/src/continuator/moMaxNeighborStat.h | 4 ++-- mo/src/continuator/moMedianNeighborStat.h | 4 ++-- mo/src/continuator/moMinNeighborStat.h | 4 ++-- mo/src/continuator/moMinusOneCounterStat.h | 4 ++-- mo/src/continuator/moNbInfNeighborStat.h | 4 ++-- mo/src/continuator/moNbSupNeighborStat.h | 4 ++-- mo/src/continuator/moNeighborEvalContinuator.h | 4 ++-- mo/src/continuator/moNeutralDegreeNeighborStat.h | 4 ++-- mo/src/continuator/moQ1NeighborStat.h | 4 ++-- mo/src/continuator/moQ3NeighborStat.h | 4 ++-- mo/src/continuator/moSecondMomentNeighborStat.h | 4 ++-- mo/src/continuator/moSizeNeighborStat.h | 4 ++-- mo/src/continuator/moSolutionStat.h | 2 +- mo/src/continuator/moStatFromStat.h | 4 ++-- mo/src/continuator/moStdFitnessNeighborStat.h | 4 ++-- mo/src/continuator/moTimeContinuator.h | 4 ++-- mo/src/continuator/moTrueContinuator.h | 4 ++-- mo/src/continuator/moUnsignedStat.h | 4 ++-- mo/src/continuator/moValueStat.h | 4 ++-- mo/src/continuator/moVectorMonitor.h | 2 +- mo/src/coolingSchedule/moDynSpanCoolingSchedule.h | 4 ++-- mo/src/coolingSchedule/moSimpleCoolingSchedule.h | 4 ++-- mo/src/eval/moDoubleIncrEvaluation.h | 2 +- mo/src/eval/moDummyEval.h | 2 +- mo/src/explorer/moDummyExplorer.h | 14 +++++++------- mo/src/explorer/moFirstImprHCexplorer.h | 8 ++++---- mo/src/explorer/moILSexplorer.h | 4 ++-- mo/src/explorer/moMetropolisHastingExplorer.h | 8 ++++---- mo/src/explorer/moNeutralHCexplorer.h | 2 +- mo/src/explorer/moRandomBestHCexplorer.h | 8 ++++---- mo/src/explorer/moRandomNeutralWalkExplorer.h | 8 ++++---- mo/src/explorer/moRandomSearchExplorer.h | 12 ++++++------ mo/src/explorer/moRandomWalkExplorer.h | 8 ++++---- mo/src/explorer/moSAexplorer.h | 6 +++--- mo/src/explorer/moSimpleHCexplorer.h | 8 ++++---- mo/src/explorer/moTSexplorer.h | 4 ++-- mo/src/explorer/moVNSexplorer.h | 2 +- mo/src/memory/moBestImprAspiration.h | 4 ++-- mo/src/memory/moCountMoveMemory.h | 6 +++--- mo/src/memory/moDummyMemory.h | 6 +++--- mo/src/memory/moIndexedVectorTabuList.h | 8 ++++---- mo/src/memory/moNeighborVectorTabuList.h | 8 ++++---- mo/src/memory/moRndIndexedVectorTabuList.h | 2 +- mo/src/memory/moSolVectorTabuList.h | 6 +++--- mo/src/neighborhood/moBackwardVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moDummyNeighbor.h | 2 +- mo/src/neighborhood/moDummyNeighborhood.h | 8 ++++---- mo/src/neighborhood/moForwardVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moIndexNeighbor.h | 2 +- mo/src/neighborhood/moNeighbor.h | 2 +- mo/src/neighborhood/moOrderNeighborhood.h | 4 ++-- mo/src/neighborhood/moRndVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moRndWithReplNeighborhood.h | 4 ++-- mo/src/neighborhood/moRndWithoutReplNeighborhood.h | 4 ++-- mo/src/perturb/moNeighborhoodPerturb.h | 4 ++-- .../bitString/moBitsWithReplNeighborhood.h | 6 +++--- .../bitString/moBitsWithoutReplNeighborhood.h | 6 +++--- mo/src/problems/permutation/moSwapNeighborhood.h | 2 +- .../problems/permutation/moTwoOptExNeighborhood.h | 2 +- 69 files changed, 159 insertions(+), 159 deletions(-) diff --git a/mo/src/acceptCrit/moAlwaysAcceptCrit.h b/mo/src/acceptCrit/moAlwaysAcceptCrit.h index 777ef0b18..ef2541d2f 100644 --- a/mo/src/acceptCrit/moAlwaysAcceptCrit.h +++ b/mo/src/acceptCrit/moAlwaysAcceptCrit.h @@ -48,7 +48,7 @@ public: * @param _sol2 the new solution after local search * @return always true */ - bool operator()(EOT& _sol1, EOT& _sol2) { + bool operator()(EOT& /*_sol1*/, EOT& /*_sol2*/) { return true; } diff --git a/mo/src/algo/eoDummyMonOp.h b/mo/src/algo/eoDummyMonOp.h index dba88fa7f..bdb303844 100644 --- a/mo/src/algo/eoDummyMonOp.h +++ b/mo/src/algo/eoDummyMonOp.h @@ -47,7 +47,7 @@ public: * Do nothing on the solution * @param _solution the related solution */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return true; } }; diff --git a/mo/src/continuator/moAverageFitnessNeighborStat.h b/mo/src/continuator/moAverageFitnessNeighborStat.h index 7d12abc0a..130b96663 100644 --- a/mo/src/continuator/moAverageFitnessNeighborStat.h +++ b/mo/src/continuator/moAverageFitnessNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMean(); } @@ -69,7 +69,7 @@ public : * Set the average of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMean(); } diff --git a/mo/src/continuator/moBestNoImproveContinuator.h b/mo/src/continuator/moBestNoImproveContinuator.h index 86981bef4..d772180f3 100644 --- a/mo/src/continuator/moBestNoImproveContinuator.h +++ b/mo/src/continuator/moBestNoImproveContinuator.h @@ -93,7 +93,7 @@ public: * reset the counter of iteration * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { cpt = 0; } diff --git a/mo/src/continuator/moBooleanStat.h b/mo/src/continuator/moBooleanStat.h index a098efc23..10fa7008e 100644 --- a/mo/src/continuator/moBooleanStat.h +++ b/mo/src/continuator/moBooleanStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = *b; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = *b; } diff --git a/mo/src/continuator/moContinuator.h b/mo/src/continuator/moContinuator.h index cec268038..a58cad718 100644 --- a/mo/src/continuator/moContinuator.h +++ b/mo/src/continuator/moContinuator.h @@ -52,13 +52,13 @@ public: * Init Continuator parameters * @param _solution the related solution */ - virtual void init(EOT& _solution) {}; + virtual void init(EOT& /*_solution*/) {}; /** * Last Call to terminate the checkpoint * @param _solution the related solution */ - virtual void lastCall(EOT& _solution) {}; + virtual void lastCall(EOT& /*_solution*/) {}; }; #endif diff --git a/mo/src/continuator/moCounterStat.h b/mo/src/continuator/moCounterStat.h index 85534e67e..14b062784 100644 --- a/mo/src/continuator/moCounterStat.h +++ b/mo/src/continuator/moCounterStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = 0; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = value() + 1; } diff --git a/mo/src/continuator/moEvalsContinuator.h b/mo/src/continuator/moEvalsContinuator.h index 1a020da6c..7c9f4e902 100644 --- a/mo/src/continuator/moEvalsContinuator.h +++ b/mo/src/continuator/moEvalsContinuator.h @@ -65,7 +65,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxEvals */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals); } @@ -73,7 +73,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = fullEval.value() + neighborEval.value(); else diff --git a/mo/src/continuator/moFullEvalContinuator.h b/mo/src/continuator/moFullEvalContinuator.h index 5239c1dea..bf9a9ea96 100644 --- a/mo/src/continuator/moFullEvalContinuator.h +++ b/mo/src/continuator/moFullEvalContinuator.h @@ -63,7 +63,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxFullEval */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (eval.value() - nbEval_start < maxFullEval); } @@ -71,7 +71,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = eval.value(); else diff --git a/mo/src/continuator/moIterContinuator.h b/mo/src/continuator/moIterContinuator.h index f10db39f5..f9400254c 100644 --- a/mo/src/continuator/moIterContinuator.h +++ b/mo/src/continuator/moIterContinuator.h @@ -52,7 +52,7 @@ public: *@param _solution a solution *@return true if counter < maxIter */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { bool res; cpt++; res = (cpt < maxIter); @@ -65,7 +65,7 @@ public: * reset the counter of iteration * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { cpt = 0; } diff --git a/mo/src/continuator/moMaxNeighborStat.h b/mo/src/continuator/moMaxNeighborStat.h index f0b165d72..94f9cc137 100644 --- a/mo/src/continuator/moMaxNeighborStat.h +++ b/mo/src/continuator/moMaxNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the max fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMax(); } @@ -70,7 +70,7 @@ public : * Set the max fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMax(); } diff --git a/mo/src/continuator/moMedianNeighborStat.h b/mo/src/continuator/moMedianNeighborStat.h index 4c3cfb8f2..241c1adce 100644 --- a/mo/src/continuator/moMedianNeighborStat.h +++ b/mo/src/continuator/moMedianNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the median fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMedian(); } @@ -71,7 +71,7 @@ public : * Set the median fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMedian(); } diff --git a/mo/src/continuator/moMinNeighborStat.h b/mo/src/continuator/moMinNeighborStat.h index bd1cae1f9..f77d91973 100644 --- a/mo/src/continuator/moMinNeighborStat.h +++ b/mo/src/continuator/moMinNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the worst fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMin(); } @@ -70,7 +70,7 @@ public : * Set the worst fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMin(); } diff --git a/mo/src/continuator/moMinusOneCounterStat.h b/mo/src/continuator/moMinusOneCounterStat.h index dfb9be881..0d6fd1f3a 100644 --- a/mo/src/continuator/moMinusOneCounterStat.h +++ b/mo/src/continuator/moMinusOneCounterStat.h @@ -58,7 +58,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { counter = 0; value() = 0; } @@ -67,7 +67,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { counter++; if (counter > 0) value() = counter - 1; diff --git a/mo/src/continuator/moNbInfNeighborStat.h b/mo/src/continuator/moNbInfNeighborStat.h index e3bc27bb7..5699b5268 100644 --- a/mo/src/continuator/moNbInfNeighborStat.h +++ b/mo/src/continuator/moNbInfNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbInf(); } @@ -71,7 +71,7 @@ public : * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbInf(); } diff --git a/mo/src/continuator/moNbSupNeighborStat.h b/mo/src/continuator/moNbSupNeighborStat.h index 8febf94f8..d81e07591 100644 --- a/mo/src/continuator/moNbSupNeighborStat.h +++ b/mo/src/continuator/moNbSupNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the number of solutions in the neighborhood with better fitness than the current solution * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbSup(); } @@ -71,7 +71,7 @@ public : * Set the number of solutions in the neighborhood with better fitness than the current solution * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbSup(); } diff --git a/mo/src/continuator/moNeighborEvalContinuator.h b/mo/src/continuator/moNeighborEvalContinuator.h index ba3a41a9d..bcfd0563a 100644 --- a/mo/src/continuator/moNeighborEvalContinuator.h +++ b/mo/src/continuator/moNeighborEvalContinuator.h @@ -61,7 +61,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxNeighborEval */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (eval.value() - nbEval_start < maxNeighborEval); } @@ -69,7 +69,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = eval.value(); else diff --git a/mo/src/continuator/moNeutralDegreeNeighborStat.h b/mo/src/continuator/moNeutralDegreeNeighborStat.h index d46e99475..1cbe47321 100644 --- a/mo/src/continuator/moNeutralDegreeNeighborStat.h +++ b/mo/src/continuator/moNeutralDegreeNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbEqual(); } @@ -71,7 +71,7 @@ public : * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbEqual(); } diff --git a/mo/src/continuator/moQ1NeighborStat.h b/mo/src/continuator/moQ1NeighborStat.h index 4d74be68d..2ee9bd294 100644 --- a/mo/src/continuator/moQ1NeighborStat.h +++ b/mo/src/continuator/moQ1NeighborStat.h @@ -63,7 +63,7 @@ public : * Set the first quartile of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getQ1(); } @@ -71,7 +71,7 @@ public : * Set the first quartile of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getQ1(); } diff --git a/mo/src/continuator/moQ3NeighborStat.h b/mo/src/continuator/moQ3NeighborStat.h index 50426e65f..7e4768e57 100644 --- a/mo/src/continuator/moQ3NeighborStat.h +++ b/mo/src/continuator/moQ3NeighborStat.h @@ -63,7 +63,7 @@ public : * Set the third quartile of fitness in the neighborhood * @param _sol the third solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getQ3(); } @@ -71,7 +71,7 @@ public : * Set the third quartile of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getQ3(); } diff --git a/mo/src/continuator/moSecondMomentNeighborStat.h b/mo/src/continuator/moSecondMomentNeighborStat.h index 7c3a08fff..ba99c6d48 100644 --- a/mo/src/continuator/moSecondMomentNeighborStat.h +++ b/mo/src/continuator/moSecondMomentNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value().first = nhStat.getMean(); value().second = nhStat.getSD(); } @@ -70,7 +70,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value().first = nhStat.getMean(); value().second = nhStat.getSD(); } diff --git a/mo/src/continuator/moSizeNeighborStat.h b/mo/src/continuator/moSizeNeighborStat.h index 1a5b5b123..5ac3caf19 100644 --- a/mo/src/continuator/moSizeNeighborStat.h +++ b/mo/src/continuator/moSizeNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the number of solutions in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getSize(); } @@ -70,7 +70,7 @@ public : * Set the number of solutions in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getSize(); } diff --git a/mo/src/continuator/moSolutionStat.h b/mo/src/continuator/moSolutionStat.h index 93c4f57f5..90baafd44 100644 --- a/mo/src/continuator/moSolutionStat.h +++ b/mo/src/continuator/moSolutionStat.h @@ -52,7 +52,7 @@ public : * Constructor * @param _description a description of the parameter */ - moSolutionStat(std::string _description = "solution"): + moSolutionStat(std::string /*_description */= "solution"): moStat(EOT(), "fitness solution") { } /** diff --git a/mo/src/continuator/moStatFromStat.h b/mo/src/continuator/moStatFromStat.h index 962106eb0..2dea43ce1 100644 --- a/mo/src/continuator/moStatFromStat.h +++ b/mo/src/continuator/moStatFromStat.h @@ -57,7 +57,7 @@ public : * The value of this stat is a copy of the value of the initial stat * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = stat.value(); } @@ -65,7 +65,7 @@ public : * The value of this stat is a copy of the value of the initial stat * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = stat.value(); } diff --git a/mo/src/continuator/moStdFitnessNeighborStat.h b/mo/src/continuator/moStdFitnessNeighborStat.h index 649308f74..5e4098a8d 100644 --- a/mo/src/continuator/moStdFitnessNeighborStat.h +++ b/mo/src/continuator/moStdFitnessNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getSD(); } @@ -69,7 +69,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getSD(); } diff --git a/mo/src/continuator/moTimeContinuator.h b/mo/src/continuator/moTimeContinuator.h index 513928000..172fec933 100644 --- a/mo/src/continuator/moTimeContinuator.h +++ b/mo/src/continuator/moTimeContinuator.h @@ -88,7 +88,7 @@ public: * Returns false when the running time is reached. * @param _sol the current solution */ - virtual bool operator() (EOT& _sol) + virtual bool operator() (EOT& /*_sol*/) { bool res; time_t elapsed = (time_t) difftime(time(NULL), start); @@ -102,7 +102,7 @@ public: * reset the start time * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (!external) start = time(NULL); } diff --git a/mo/src/continuator/moTrueContinuator.h b/mo/src/continuator/moTrueContinuator.h index 88feb91a3..020e138a5 100644 --- a/mo/src/continuator/moTrueContinuator.h +++ b/mo/src/continuator/moTrueContinuator.h @@ -53,7 +53,7 @@ public: * @param _solution a solution * @return always true */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return true; } @@ -61,7 +61,7 @@ public: * NOTHING TO DO * @param _solution a solution */ - virtual void init(EOT & _solution) {} + virtual void init(EOT & /*_solution*/) {} }; diff --git a/mo/src/continuator/moUnsignedStat.h b/mo/src/continuator/moUnsignedStat.h index c1f8342cd..8c5122539 100644 --- a/mo/src/continuator/moUnsignedStat.h +++ b/mo/src/continuator/moUnsignedStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = *b; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = *b; } diff --git a/mo/src/continuator/moValueStat.h b/mo/src/continuator/moValueStat.h index 0d8d8877d..1e9bf06a9 100644 --- a/mo/src/continuator/moValueStat.h +++ b/mo/src/continuator/moValueStat.h @@ -60,7 +60,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { if (restart) value_start = valueParam.value(); else @@ -73,7 +73,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = (double) (valueParam.value() - value_start); } diff --git a/mo/src/continuator/moVectorMonitor.h b/mo/src/continuator/moVectorMonitor.h index 67535219d..30c331771 100644 --- a/mo/src/continuator/moVectorMonitor.h +++ b/mo/src/continuator/moVectorMonitor.h @@ -126,7 +126,7 @@ public: * @param _param unvalid Parameter */ template - moVectorMonitor(eoValueParam & _param) : doubleParam(NULL), intParam(NULL), intLongParam(NULL), intLongLongParam(NULL), eotParam(NULL) + moVectorMonitor(eoValueParam & /*_param*/) : doubleParam(NULL), intParam(NULL), intLongParam(NULL), intLongLongParam(NULL), eotParam(NULL) { std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl; } diff --git a/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h b/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h index 34b386312..e92992e87 100644 --- a/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h +++ b/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h @@ -63,7 +63,7 @@ public: * Initial temperature * @param _solution initial solution */ - virtual double init(EOT & _solution) { + virtual double init(EOT & /*_solution*/) { // number of tries since the last temperature change spanTries = 0; @@ -105,7 +105,7 @@ public: * @param _temp current temperature * @return true if the search can continue */ - virtual bool operator()(double _temp) { + virtual bool operator()(double /*_temp*/) { return nbSpan <= nbSpanMax; } diff --git a/mo/src/coolingSchedule/moSimpleCoolingSchedule.h b/mo/src/coolingSchedule/moSimpleCoolingSchedule.h index 5ff4f4920..940dd258a 100644 --- a/mo/src/coolingSchedule/moSimpleCoolingSchedule.h +++ b/mo/src/coolingSchedule/moSimpleCoolingSchedule.h @@ -59,7 +59,7 @@ public: * @param _solution initial solution * @return the initial temperature */ - virtual double init(EOT & _solution) { + virtual double init(EOT & /*_solution*/) { // number of iteration with the same temperature step = 0; @@ -71,7 +71,7 @@ public: * @param _temp current temperature to update * @param _acceptedMove true when the move is accepted, false otherwise */ - virtual void update(double& _temp, bool _acceptedMove) { + virtual void update(double& _temp, bool /*_acceptedMove*/) { if (step >= span) { _temp *= alpha; step = 0; diff --git a/mo/src/eval/moDoubleIncrEvaluation.h b/mo/src/eval/moDoubleIncrEvaluation.h index c7027e2b8..2f1ac305c 100644 --- a/mo/src/eval/moDoubleIncrEvaluation.h +++ b/mo/src/eval/moDoubleIncrEvaluation.h @@ -85,7 +85,7 @@ public: * * @param _solution the current solution */ - virtual void operator()(EOT & _solution) { + virtual void operator()(EOT & /*_solution*/) { } /** the delta of fitness for each neighbors diff --git a/mo/src/eval/moDummyEval.h b/mo/src/eval/moDummyEval.h index 2809f12a3..ac855e0fc 100644 --- a/mo/src/eval/moDummyEval.h +++ b/mo/src/eval/moDummyEval.h @@ -46,7 +46,7 @@ public: * @param _sol unused solution * @param _n unused neighbor */ - void operator()(EOT& _sol, Neighbor& _n) {} + void operator()(EOT& /*_sol*/, Neighbor& /*_n*/) {} }; diff --git a/mo/src/explorer/moDummyExplorer.h b/mo/src/explorer/moDummyExplorer.h index 3d58dbb08..ae6a293cb 100644 --- a/mo/src/explorer/moDummyExplorer.h +++ b/mo/src/explorer/moDummyExplorer.h @@ -54,20 +54,20 @@ public: * NOTHING TO DO * @param _solution unused solution */ - void initParam (EOT& _solution) { } ; + void initParam (EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution */ - void updateParam (EOT& _solution) { } ; + void updateParam (EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - bool isContinue(EOT& _solution) { + bool isContinue(EOT& /*_solution*/) { return false; } ; @@ -75,14 +75,14 @@ public: * NOTHING TO DO * @param _solution unused solution */ - void move(EOT& _solution) { } ; + void move(EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - virtual bool accept(EOT& _solution) { + virtual bool accept(EOT& /*_solution*/) { return false; } ; @@ -90,13 +90,13 @@ public: * NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT& _solution) { } ; + virtual void terminate(EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution */ - void operator()(EOT & _solution) { } + void operator()(EOT & /*_solution*/) { } /** * Return the class name diff --git a/mo/src/explorer/moFirstImprHCexplorer.h b/mo/src/explorer/moFirstImprHCexplorer.h index e341908d3..530f2953a 100644 --- a/mo/src/explorer/moFirstImprHCexplorer.h +++ b/mo/src/explorer/moFirstImprHCexplorer.h @@ -85,19 +85,19 @@ public: * initParam: NOTHING TO DO * @param _solution unused solution */ - virtual void initParam(EOT & _solution) {}; + virtual void initParam(EOT & /*_solution*/) {}; /** * updateParam: NOTHING TO DO * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) {}; + virtual void updateParam(EOT & /*_solution*/) {}; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution until an ameliorated neighbor is found @@ -135,7 +135,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { if (stop) return isAccept ; else diff --git a/mo/src/explorer/moILSexplorer.h b/mo/src/explorer/moILSexplorer.h index 761009005..49d74fea5 100644 --- a/mo/src/explorer/moILSexplorer.h +++ b/mo/src/explorer/moILSexplorer.h @@ -106,7 +106,7 @@ public: * terminate: NOTHING TO DO * @param _solution a solution (unused) */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Perturb and apply local search on a solution @@ -135,7 +135,7 @@ public: * @param _solution the solution * @return always true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return true; }; diff --git a/mo/src/explorer/moMetropolisHastingExplorer.h b/mo/src/explorer/moMetropolisHastingExplorer.h index 1989ff1c3..ea0913f1e 100644 --- a/mo/src/explorer/moMetropolisHastingExplorer.h +++ b/mo/src/explorer/moMetropolisHastingExplorer.h @@ -85,7 +85,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; isAccept = true; }; @@ -94,7 +94,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -102,7 +102,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -128,7 +128,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) ; }; diff --git a/mo/src/explorer/moNeutralHCexplorer.h b/mo/src/explorer/moNeutralHCexplorer.h index 40443de40..2eefa797d 100644 --- a/mo/src/explorer/moNeutralHCexplorer.h +++ b/mo/src/explorer/moNeutralHCexplorer.h @@ -105,7 +105,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) && isAccept ; }; diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index e96f6673b..92e690e37 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -85,7 +85,7 @@ public: * empty the vector of best solutions * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { // delete all the best solutions bestVector.clear(); }; @@ -94,7 +94,7 @@ public: * empty the vector of best solutions * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { // delete all the best solutions bestVector.clear(); }; @@ -103,7 +103,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -156,7 +156,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moRandomNeutralWalkExplorer.h b/mo/src/explorer/moRandomNeutralWalkExplorer.h index 95995c753..e8f9713bf 100644 --- a/mo/src/explorer/moRandomNeutralWalkExplorer.h +++ b/mo/src/explorer/moRandomNeutralWalkExplorer.h @@ -87,7 +87,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; isAccept = true; }; @@ -96,7 +96,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -104,7 +104,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -142,7 +142,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) && isAccept ; }; diff --git a/mo/src/explorer/moRandomSearchExplorer.h b/mo/src/explorer/moRandomSearchExplorer.h index 0b09da1d9..f8b81d00c 100644 --- a/mo/src/explorer/moRandomSearchExplorer.h +++ b/mo/src/explorer/moRandomSearchExplorer.h @@ -74,7 +74,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; }; @@ -82,7 +82,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -90,7 +90,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood with only one random solution @@ -111,7 +111,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) ; }; @@ -119,7 +119,7 @@ public: * move the solution with the best neighbor * @param _solution the solution to move */ - virtual void move(EOT & _solution) { + virtual void move(EOT & /*_solution*/) { // the solution is already move. So nothing to do ! }; @@ -128,7 +128,7 @@ public: * @param _solution the solution * @return true if the best neighbor ameliorate the fitness */ - virtual bool accept(EOT & _solution) { + virtual bool accept(EOT & /*_solution*/) { return true; }; diff --git a/mo/src/explorer/moRandomWalkExplorer.h b/mo/src/explorer/moRandomWalkExplorer.h index 78f1be303..889382a2b 100644 --- a/mo/src/explorer/moRandomWalkExplorer.h +++ b/mo/src/explorer/moRandomWalkExplorer.h @@ -82,7 +82,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { isAccept = true; }; @@ -90,14 +90,14 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { }; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood with only one random solution @@ -127,7 +127,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moSAexplorer.h b/mo/src/explorer/moSAexplorer.h index 08d859035..b774d5c57 100644 --- a/mo/src/explorer/moSAexplorer.h +++ b/mo/src/explorer/moSAexplorer.h @@ -95,7 +95,7 @@ public: * decrease the temperature if necessary * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { coolingSchedule.update(temperature, this->moveApplied()); }; @@ -103,7 +103,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore one random solution in the neighborhood @@ -129,7 +129,7 @@ public: * @param _solution the solution * @return true if the criteria from the cooling schedule is true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return coolingSchedule(temperature); }; diff --git a/mo/src/explorer/moSimpleHCexplorer.h b/mo/src/explorer/moSimpleHCexplorer.h index b4f235ae8..ee1cded53 100644 --- a/mo/src/explorer/moSimpleHCexplorer.h +++ b/mo/src/explorer/moSimpleHCexplorer.h @@ -76,19 +76,19 @@ public: * initParam: NOTHING TO DO * @param _solution unused solution */ - virtual void initParam(EOT & _solution) {}; + virtual void initParam(EOT & /*_solution*/) {}; /** * updateParam: NOTHING TO DO * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) {}; + virtual void updateParam(EOT & /*_solution*/) {}; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -130,7 +130,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moTSexplorer.h b/mo/src/explorer/moTSexplorer.h index 062af93cc..8438d58af 100644 --- a/mo/src/explorer/moTSexplorer.h +++ b/mo/src/explorer/moTSexplorer.h @@ -195,7 +195,7 @@ public: * @param _solution the solution * @return true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return true; }; @@ -204,7 +204,7 @@ public: * @param _solution the solution * @return true if the best neighbor ameliorate the fitness */ - virtual bool accept(EOT & _solution) { + virtual bool accept(EOT & /*_solution*/) { return isAccept; }; diff --git a/mo/src/explorer/moVNSexplorer.h b/mo/src/explorer/moVNSexplorer.h index 3c9c2ef27..b7633c26e 100644 --- a/mo/src/explorer/moVNSexplorer.h +++ b/mo/src/explorer/moVNSexplorer.h @@ -124,7 +124,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return !stop; }; diff --git a/mo/src/memory/moBestImprAspiration.h b/mo/src/memory/moBestImprAspiration.h index 7187ef666..b83c5d527 100644 --- a/mo/src/memory/moBestImprAspiration.h +++ b/mo/src/memory/moBestImprAspiration.h @@ -56,7 +56,7 @@ public: * @param _sol a solution * @param _neighbor a neighbor */ - void update(EOT & _sol, Neighbor & _neighbor) { + void update(EOT & _sol, Neighbor & /*_neighbor*/) { if (bestFoundSoFar.fitness() < _sol.fitness()) bestFoundSoFar = _sol; } @@ -68,7 +68,7 @@ public: * @param _neighbor a neighbor * @return true if _neighbor fitness is better than the "bestFoundSoFar" */ - bool operator()(EOT & _sol, Neighbor & _neighbor) { + bool operator()(EOT & /*_sol*/, Neighbor & _neighbor) { return (bestFoundSoFar.fitness() < _neighbor.fitness()); } diff --git a/mo/src/memory/moCountMoveMemory.h b/mo/src/memory/moCountMoveMemory.h index 22cbba5fd..eb6ae6825 100644 --- a/mo/src/memory/moCountMoveMemory.h +++ b/mo/src/memory/moCountMoveMemory.h @@ -45,7 +45,7 @@ public: * Init all the counters * @param _sol unused solution */ - void init(EOT & _sol) { + void init(EOT & /*_sol*/) { nbMove=0; nbNoMove=0; counter=0; @@ -55,7 +55,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - void add(EOT & _sol, Neighbor & _neighbor) { + void add(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { nbMove++; counter=0; } @@ -64,7 +64,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - void update(EOT & _sol, Neighbor & _neighbor) { + void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { nbNoMove++; counter++; } diff --git a/mo/src/memory/moDummyMemory.h b/mo/src/memory/moDummyMemory.h index c927a30f0..f176cb1bc 100644 --- a/mo/src/memory/moDummyMemory.h +++ b/mo/src/memory/moDummyMemory.h @@ -44,17 +44,17 @@ public: /** * Init : NOTHIING TO DO */ - void init(EOT & _sol) {} + void init(EOT & /*_sol*/) {} /** * Add : NOTHIING TO DO */ - void add(EOT & _sol, Neighbor & _neighbor) {} + void add(EOT & /*_sol*/, Neighbor & /*_neighbor*/) {} /** * Update : NOTHIING TO DO */ - void update(EOT & _sol, Neighbor & _neighbor) {} + void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) {} /** * ClearMemory : NOTHIING TO DO diff --git a/mo/src/memory/moIndexedVectorTabuList.h b/mo/src/memory/moIndexedVectorTabuList.h index e1ea94492..b56742602 100644 --- a/mo/src/memory/moIndexedVectorTabuList.h +++ b/mo/src/memory/moIndexedVectorTabuList.h @@ -73,7 +73,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -83,7 +83,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (_neighbor.index() < maxSize) { if (robust) // random value between min and max @@ -98,7 +98,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { for (unsigned int i = 0; i < maxSize; i++) if (tabuList[i] > 0) tabuList[i]--; @@ -110,7 +110,7 @@ public: * @param _neighbor the current neighbor * @return true if tabuList contains _sol */ - virtual bool check(EOT & _sol, Neighbor & _neighbor) { + virtual bool check(EOT & /*_sol*/, Neighbor & _neighbor) { return (tabuList[_neighbor.index()] > 0); } diff --git a/mo/src/memory/moNeighborVectorTabuList.h b/mo/src/memory/moNeighborVectorTabuList.h index dbf8edb0f..5e8f8eec7 100644 --- a/mo/src/memory/moNeighborVectorTabuList.h +++ b/mo/src/memory/moNeighborVectorTabuList.h @@ -57,7 +57,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -67,7 +67,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (tabuList.size() < maxSize) { std::pair tmp; @@ -87,7 +87,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { if (howlong > 0) for (unsigned int i=0; i 0) @@ -100,7 +100,7 @@ public: * @param _neighbor the current neighbor * @return true if tabuList contains _sol */ - virtual bool check(EOT & _sol, Neighbor & _neighbor) { + virtual bool check(EOT & /*_sol*/, Neighbor & _neighbor) { for (unsigned int i=0; i 0 && tabuList[i].second > 0 && tabuList[i].first.equals(_neighbor)) || (howlong==0 && tabuList[i].first.equals(_neighbor))) return true; diff --git a/mo/src/memory/moRndIndexedVectorTabuList.h b/mo/src/memory/moRndIndexedVectorTabuList.h index 82ffc0e04..dd6f11765 100644 --- a/mo/src/memory/moRndIndexedVectorTabuList.h +++ b/mo/src/memory/moRndIndexedVectorTabuList.h @@ -67,7 +67,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (_neighbor.index() < maxSize) tabuList[_neighbor.index()] = howlong + rng.uniform(howlongRnd) ; } diff --git a/mo/src/memory/moSolVectorTabuList.h b/mo/src/memory/moSolVectorTabuList.h index ba72ccc43..31c57c0f6 100644 --- a/mo/src/memory/moSolVectorTabuList.h +++ b/mo/src/memory/moSolVectorTabuList.h @@ -57,7 +57,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -67,7 +67,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & _sol, Neighbor & /*_neighbor*/) { if (tabuList.size() < maxSize) { std::pair tmp; @@ -87,7 +87,7 @@ public: * @param _sol the current solution * @param _neighbor the current neighbor (unused) */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { if (howlong > 0) for (unsigned int i=0; i 0) diff --git a/mo/src/neighborhood/moBackwardVectorVNSelection.h b/mo/src/neighborhood/moBackwardVectorVNSelection.h index b3050c439..a47b31e30 100644 --- a/mo/src/neighborhood/moBackwardVectorVNSelection.h +++ b/mo/src/neighborhood/moBackwardVectorVNSelection.h @@ -69,7 +69,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return (cycle || (current > 0)); } @@ -78,7 +78,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution){ + virtual void init(EOT& /*_solution*/){ current = LSvector.size() - 1; } @@ -87,7 +87,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ current = (current + LSvector.size() -1) % LSvector.size(); } diff --git a/mo/src/neighborhood/moDummyNeighbor.h b/mo/src/neighborhood/moDummyNeighbor.h index a8cd01087..e68b2b079 100644 --- a/mo/src/neighborhood/moDummyNeighbor.h +++ b/mo/src/neighborhood/moDummyNeighbor.h @@ -43,6 +43,6 @@ public: * NOTHING TO DO * @param _solution the related solution */ - virtual void move(EOT& _solution) {} + virtual void move(EOT& /*_solution*/) {} }; #endif diff --git a/mo/src/neighborhood/moDummyNeighborhood.h b/mo/src/neighborhood/moDummyNeighborhood.h index 26c62163c..eda0ae490 100644 --- a/mo/src/neighborhood/moDummyNeighborhood.h +++ b/mo/src/neighborhood/moDummyNeighborhood.h @@ -46,7 +46,7 @@ public: * @param _solution unused solution * @return always false */ - virtual bool hasNeighbor(EOT & _solution) { + virtual bool hasNeighbor(EOT & /*_solution*/) { return false; } @@ -55,21 +55,21 @@ public: * @param _solution unused solution * @param _current unused neighbor */ - virtual void init(EOT & _solution, Neighbor & _current) {} + virtual void init(EOT & /*_solution*/, Neighbor & /*_current*/) {} /** * NOTHING TO DO * @param _solution unused solution * @param _current unused neighbor */ - virtual void next(EOT & _solution, Neighbor & _current) {} + virtual void next(EOT & /*_solution*/, Neighbor & /*_current*/) {} /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return false; } diff --git a/mo/src/neighborhood/moForwardVectorVNSelection.h b/mo/src/neighborhood/moForwardVectorVNSelection.h index d7d3546cb..d469cf6be 100644 --- a/mo/src/neighborhood/moForwardVectorVNSelection.h +++ b/mo/src/neighborhood/moForwardVectorVNSelection.h @@ -69,7 +69,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return (cycle || (current <= (LSvector.size() - 2))); } @@ -78,7 +78,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution){ + virtual void init(EOT& /*_solution*/){ current = 0; } @@ -87,7 +87,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ current = (current + 1) % LSvector.size(); } diff --git a/mo/src/neighborhood/moIndexNeighbor.h b/mo/src/neighborhood/moIndexNeighbor.h index eaf302966..880c08812 100644 --- a/mo/src/neighborhood/moIndexNeighbor.h +++ b/mo/src/neighborhood/moIndexNeighbor.h @@ -109,7 +109,7 @@ public: * @param _solution solution from which the neighborhood is visited * @param _key index of the IndexNeighbor */ - virtual void index(EOT & _solution, unsigned int _key) { + virtual void index(EOT & /*_solution*/, unsigned int _key) { key = _key; } diff --git a/mo/src/neighborhood/moNeighbor.h b/mo/src/neighborhood/moNeighbor.h index 889dd6817..8186c2435 100644 --- a/mo/src/neighborhood/moNeighbor.h +++ b/mo/src/neighborhood/moNeighbor.h @@ -93,7 +93,7 @@ public: * @param _neighbor a neighbor * @return if _neighbor and this one are equals */ - virtual bool equals(moNeighbor & _neighbor) { + virtual bool equals(moNeighbor & /*_neighbor*/) { return false; } diff --git a/mo/src/neighborhood/moOrderNeighborhood.h b/mo/src/neighborhood/moOrderNeighborhood.h index 384d0dda7..316ba8cba 100644 --- a/mo/src/neighborhood/moOrderNeighborhood.h +++ b/mo/src/neighborhood/moOrderNeighborhood.h @@ -71,7 +71,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return getNeighborhoodSize() > 0; } @@ -102,7 +102,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return (currentIndex < getNeighborhoodSize() - 1); } diff --git a/mo/src/neighborhood/moRndVectorVNSelection.h b/mo/src/neighborhood/moRndVectorVNSelection.h index a460f2d45..af4ab22dd 100644 --- a/mo/src/neighborhood/moRndVectorVNSelection.h +++ b/mo/src/neighborhood/moRndVectorVNSelection.h @@ -72,7 +72,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return ( cycle || (currentOrder <= (order.size() - 2)) ); } @@ -81,7 +81,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution) { + virtual void init(EOT& /*_solution*/) { if(order.size() == 0) for(unsigned int i = 0; i < LSvector.size(); i++) order.push_back(i); @@ -98,7 +98,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ currentOrder = (currentOrder + 1) % order.size(); current = order[currentOrder]; diff --git a/mo/src/neighborhood/moRndWithReplNeighborhood.h b/mo/src/neighborhood/moRndWithReplNeighborhood.h index 89537bf09..d66b72ac8 100644 --- a/mo/src/neighborhood/moRndWithReplNeighborhood.h +++ b/mo/src/neighborhood/moRndWithReplNeighborhood.h @@ -68,7 +68,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return neighborhoodSize > 0; } @@ -97,7 +97,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { if (maxNeighbors == 0) return neighborhoodSize > 0; else diff --git a/mo/src/neighborhood/moRndWithoutReplNeighborhood.h b/mo/src/neighborhood/moRndWithoutReplNeighborhood.h index e51c6d6e7..dfa057a28 100644 --- a/mo/src/neighborhood/moRndWithoutReplNeighborhood.h +++ b/mo/src/neighborhood/moRndWithoutReplNeighborhood.h @@ -69,7 +69,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return neighborhoodSize > 0; } @@ -110,7 +110,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return (maxIndex > 0) ; } diff --git a/mo/src/perturb/moNeighborhoodPerturb.h b/mo/src/perturb/moNeighborhoodPerturb.h index 676f5a828..fe66bdbb9 100644 --- a/mo/src/perturb/moNeighborhoodPerturb.h +++ b/mo/src/perturb/moNeighborhoodPerturb.h @@ -79,7 +79,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor (always empty) */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & _sol, Neighbor & /*_neighbor*/) { (*this).init(_sol); } @@ -88,7 +88,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor (always empty) */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & _sol, Neighbor & /*_neighbor*/) { if (otherNeighborhood.cont(_sol)) otherNeighborhood.next(_sol, current); else diff --git a/mo/src/problems/bitString/moBitsWithReplNeighborhood.h b/mo/src/problems/bitString/moBitsWithReplNeighborhood.h index 8c833f1a2..34d2a9623 100644 --- a/mo/src/problems/bitString/moBitsWithReplNeighborhood.h +++ b/mo/src/problems/bitString/moBitsWithReplNeighborhood.h @@ -98,13 +98,13 @@ public: * @param _neighbor the first neighbor * @param _n Hamming distance of the neighbor */ - virtual void randomNeighbor(EOT & _solution, Neighbor & _neighbor, unsigned _n) { + virtual void randomNeighbor(EOT & /*_solution*/, Neighbor & _neighbor, unsigned _n) { _neighbor.bits.resize(_n); _neighbor.nBits = _n; unsigned i; unsigned b; - unsigned tmp; + // unsigned tmp; for(unsigned k = 0; k < _n; k++) { i = rng.random(length - k); @@ -167,7 +167,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore: population size larger or equals than 1 */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return nNeighbors < sampleSize ; } diff --git a/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h b/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h index 4584a791a..34dad414f 100644 --- a/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h +++ b/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h @@ -142,7 +142,7 @@ public: * @param _solution the solution to explore * @param _neighbor the first neighbor */ - virtual void init(EOT & _solution, Neighbor & _neighbor) { + virtual void init(EOT & /*_solution*/, Neighbor & _neighbor) { maxIndex = neighborhoodSize ; unsigned i = rng.random(maxIndex); @@ -163,7 +163,7 @@ public: * @param _solution the solution to explore (population of solutions) * @param _neighbor the next neighbor which in order of distance */ - virtual void next(EOT & _solution, Neighbor & _neighbor) { + virtual void next(EOT & /*_solution*/, Neighbor & _neighbor) { unsigned i = rng.random(maxIndex); key = indexVector[i]; @@ -180,7 +180,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore: population size larger or equals than 1 */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return neighborhoodSize - maxIndex < sampleSize ; } diff --git a/mo/src/problems/permutation/moSwapNeighborhood.h b/mo/src/problems/permutation/moSwapNeighborhood.h index 8354337e6..0ad0f1a2f 100644 --- a/mo/src/problems/permutation/moSwapNeighborhood.h +++ b/mo/src/problems/permutation/moSwapNeighborhood.h @@ -54,7 +54,7 @@ public: * @param _solution the solution to explore * @param _current the first neighbor */ - virtual void init(EOT& _solution, Neighbor& _current) { + virtual void init(EOT& /*_solution*/, Neighbor& _current) { indices.first=0; indices.second=1; _current.setIndices(0,1); diff --git a/mo/src/problems/permutation/moTwoOptExNeighborhood.h b/mo/src/problems/permutation/moTwoOptExNeighborhood.h index 9723946bb..886fbc3de 100755 --- a/mo/src/problems/permutation/moTwoOptExNeighborhood.h +++ b/mo/src/problems/permutation/moTwoOptExNeighborhood.h @@ -57,7 +57,7 @@ public: * @param _solution the solution to explore * @param _current the first neighbor */ - virtual void init(EOT& _solution, Neighbor& _current) { + virtual void init(EOT& /*_solution*/, Neighbor& _current) { indices.first=0; indices.second=1; _current.setIndices(0,1); From c2a3ed4e7f67772afb37ea325c9ef80fca2b008d Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 10 Sep 2022 06:26:34 +0200 Subject: [PATCH 042/113] fix(mo): comment out unused parameters Removes -Wunused-parameters warnings. --- mo/src/acceptCrit/moAlwaysAcceptCrit.h | 2 +- mo/src/algo/eoDummyMonOp.h | 2 +- mo/src/continuator/moAverageFitnessNeighborStat.h | 4 ++-- mo/src/continuator/moBestNoImproveContinuator.h | 2 +- mo/src/continuator/moBooleanStat.h | 4 ++-- mo/src/continuator/moContinuator.h | 4 ++-- mo/src/continuator/moCounterStat.h | 4 ++-- mo/src/continuator/moEvalsContinuator.h | 4 ++-- mo/src/continuator/moFullEvalContinuator.h | 4 ++-- mo/src/continuator/moIterContinuator.h | 4 ++-- mo/src/continuator/moMaxNeighborStat.h | 4 ++-- mo/src/continuator/moMedianNeighborStat.h | 4 ++-- mo/src/continuator/moMinNeighborStat.h | 4 ++-- mo/src/continuator/moMinusOneCounterStat.h | 4 ++-- mo/src/continuator/moNbInfNeighborStat.h | 4 ++-- mo/src/continuator/moNbSupNeighborStat.h | 4 ++-- mo/src/continuator/moNeighborEvalContinuator.h | 4 ++-- mo/src/continuator/moNeutralDegreeNeighborStat.h | 4 ++-- mo/src/continuator/moQ1NeighborStat.h | 4 ++-- mo/src/continuator/moQ3NeighborStat.h | 4 ++-- mo/src/continuator/moSecondMomentNeighborStat.h | 4 ++-- mo/src/continuator/moSizeNeighborStat.h | 4 ++-- mo/src/continuator/moSolutionStat.h | 2 +- mo/src/continuator/moStatFromStat.h | 4 ++-- mo/src/continuator/moStdFitnessNeighborStat.h | 4 ++-- mo/src/continuator/moTimeContinuator.h | 4 ++-- mo/src/continuator/moTrueContinuator.h | 4 ++-- mo/src/continuator/moUnsignedStat.h | 4 ++-- mo/src/continuator/moValueStat.h | 4 ++-- mo/src/continuator/moVectorMonitor.h | 2 +- mo/src/coolingSchedule/moDynSpanCoolingSchedule.h | 4 ++-- mo/src/coolingSchedule/moSimpleCoolingSchedule.h | 4 ++-- mo/src/eval/moDoubleIncrEvaluation.h | 2 +- mo/src/eval/moDummyEval.h | 2 +- mo/src/explorer/moDummyExplorer.h | 14 +++++++------- mo/src/explorer/moFirstImprHCexplorer.h | 8 ++++---- mo/src/explorer/moILSexplorer.h | 4 ++-- mo/src/explorer/moMetropolisHastingExplorer.h | 8 ++++---- mo/src/explorer/moNeutralHCexplorer.h | 2 +- mo/src/explorer/moRandomBestHCexplorer.h | 8 ++++---- mo/src/explorer/moRandomNeutralWalkExplorer.h | 8 ++++---- mo/src/explorer/moRandomSearchExplorer.h | 12 ++++++------ mo/src/explorer/moRandomWalkExplorer.h | 8 ++++---- mo/src/explorer/moSAexplorer.h | 6 +++--- mo/src/explorer/moSimpleHCexplorer.h | 8 ++++---- mo/src/explorer/moTSexplorer.h | 4 ++-- mo/src/explorer/moVNSexplorer.h | 2 +- mo/src/memory/moBestImprAspiration.h | 4 ++-- mo/src/memory/moCountMoveMemory.h | 6 +++--- mo/src/memory/moDummyMemory.h | 6 +++--- mo/src/memory/moIndexedVectorTabuList.h | 8 ++++---- mo/src/memory/moNeighborVectorTabuList.h | 8 ++++---- mo/src/memory/moRndIndexedVectorTabuList.h | 2 +- mo/src/memory/moSolVectorTabuList.h | 6 +++--- mo/src/neighborhood/moBackwardVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moDummyNeighbor.h | 2 +- mo/src/neighborhood/moDummyNeighborhood.h | 8 ++++---- mo/src/neighborhood/moForwardVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moIndexNeighbor.h | 2 +- mo/src/neighborhood/moNeighbor.h | 2 +- mo/src/neighborhood/moOrderNeighborhood.h | 4 ++-- mo/src/neighborhood/moRndVectorVNSelection.h | 6 +++--- mo/src/neighborhood/moRndWithReplNeighborhood.h | 4 ++-- mo/src/neighborhood/moRndWithoutReplNeighborhood.h | 4 ++-- mo/src/perturb/moNeighborhoodPerturb.h | 4 ++-- .../bitString/moBitsWithReplNeighborhood.h | 6 +++--- .../bitString/moBitsWithoutReplNeighborhood.h | 6 +++--- mo/src/problems/permutation/moSwapNeighborhood.h | 2 +- .../problems/permutation/moTwoOptExNeighborhood.h | 2 +- 69 files changed, 159 insertions(+), 159 deletions(-) diff --git a/mo/src/acceptCrit/moAlwaysAcceptCrit.h b/mo/src/acceptCrit/moAlwaysAcceptCrit.h index 777ef0b18..ef2541d2f 100644 --- a/mo/src/acceptCrit/moAlwaysAcceptCrit.h +++ b/mo/src/acceptCrit/moAlwaysAcceptCrit.h @@ -48,7 +48,7 @@ public: * @param _sol2 the new solution after local search * @return always true */ - bool operator()(EOT& _sol1, EOT& _sol2) { + bool operator()(EOT& /*_sol1*/, EOT& /*_sol2*/) { return true; } diff --git a/mo/src/algo/eoDummyMonOp.h b/mo/src/algo/eoDummyMonOp.h index dba88fa7f..bdb303844 100644 --- a/mo/src/algo/eoDummyMonOp.h +++ b/mo/src/algo/eoDummyMonOp.h @@ -47,7 +47,7 @@ public: * Do nothing on the solution * @param _solution the related solution */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return true; } }; diff --git a/mo/src/continuator/moAverageFitnessNeighborStat.h b/mo/src/continuator/moAverageFitnessNeighborStat.h index 7d12abc0a..130b96663 100644 --- a/mo/src/continuator/moAverageFitnessNeighborStat.h +++ b/mo/src/continuator/moAverageFitnessNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMean(); } @@ -69,7 +69,7 @@ public : * Set the average of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMean(); } diff --git a/mo/src/continuator/moBestNoImproveContinuator.h b/mo/src/continuator/moBestNoImproveContinuator.h index 86981bef4..d772180f3 100644 --- a/mo/src/continuator/moBestNoImproveContinuator.h +++ b/mo/src/continuator/moBestNoImproveContinuator.h @@ -93,7 +93,7 @@ public: * reset the counter of iteration * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { cpt = 0; } diff --git a/mo/src/continuator/moBooleanStat.h b/mo/src/continuator/moBooleanStat.h index a098efc23..10fa7008e 100644 --- a/mo/src/continuator/moBooleanStat.h +++ b/mo/src/continuator/moBooleanStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = *b; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = *b; } diff --git a/mo/src/continuator/moContinuator.h b/mo/src/continuator/moContinuator.h index cec268038..a58cad718 100644 --- a/mo/src/continuator/moContinuator.h +++ b/mo/src/continuator/moContinuator.h @@ -52,13 +52,13 @@ public: * Init Continuator parameters * @param _solution the related solution */ - virtual void init(EOT& _solution) {}; + virtual void init(EOT& /*_solution*/) {}; /** * Last Call to terminate the checkpoint * @param _solution the related solution */ - virtual void lastCall(EOT& _solution) {}; + virtual void lastCall(EOT& /*_solution*/) {}; }; #endif diff --git a/mo/src/continuator/moCounterStat.h b/mo/src/continuator/moCounterStat.h index 85534e67e..14b062784 100644 --- a/mo/src/continuator/moCounterStat.h +++ b/mo/src/continuator/moCounterStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = 0; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = value() + 1; } diff --git a/mo/src/continuator/moEvalsContinuator.h b/mo/src/continuator/moEvalsContinuator.h index 1a020da6c..7c9f4e902 100644 --- a/mo/src/continuator/moEvalsContinuator.h +++ b/mo/src/continuator/moEvalsContinuator.h @@ -65,7 +65,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxEvals */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals); } @@ -73,7 +73,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = fullEval.value() + neighborEval.value(); else diff --git a/mo/src/continuator/moFullEvalContinuator.h b/mo/src/continuator/moFullEvalContinuator.h index 5239c1dea..bf9a9ea96 100644 --- a/mo/src/continuator/moFullEvalContinuator.h +++ b/mo/src/continuator/moFullEvalContinuator.h @@ -63,7 +63,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxFullEval */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (eval.value() - nbEval_start < maxFullEval); } @@ -71,7 +71,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = eval.value(); else diff --git a/mo/src/continuator/moIterContinuator.h b/mo/src/continuator/moIterContinuator.h index f10db39f5..f9400254c 100644 --- a/mo/src/continuator/moIterContinuator.h +++ b/mo/src/continuator/moIterContinuator.h @@ -52,7 +52,7 @@ public: *@param _solution a solution *@return true if counter < maxIter */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { bool res; cpt++; res = (cpt < maxIter); @@ -65,7 +65,7 @@ public: * reset the counter of iteration * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { cpt = 0; } diff --git a/mo/src/continuator/moMaxNeighborStat.h b/mo/src/continuator/moMaxNeighborStat.h index f0b165d72..94f9cc137 100644 --- a/mo/src/continuator/moMaxNeighborStat.h +++ b/mo/src/continuator/moMaxNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the max fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMax(); } @@ -70,7 +70,7 @@ public : * Set the max fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMax(); } diff --git a/mo/src/continuator/moMedianNeighborStat.h b/mo/src/continuator/moMedianNeighborStat.h index 4c3cfb8f2..241c1adce 100644 --- a/mo/src/continuator/moMedianNeighborStat.h +++ b/mo/src/continuator/moMedianNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the median fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMedian(); } @@ -71,7 +71,7 @@ public : * Set the median fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMedian(); } diff --git a/mo/src/continuator/moMinNeighborStat.h b/mo/src/continuator/moMinNeighborStat.h index bd1cae1f9..f77d91973 100644 --- a/mo/src/continuator/moMinNeighborStat.h +++ b/mo/src/continuator/moMinNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the worst fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getMin(); } @@ -70,7 +70,7 @@ public : * Set the worst fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getMin(); } diff --git a/mo/src/continuator/moMinusOneCounterStat.h b/mo/src/continuator/moMinusOneCounterStat.h index dfb9be881..0d6fd1f3a 100644 --- a/mo/src/continuator/moMinusOneCounterStat.h +++ b/mo/src/continuator/moMinusOneCounterStat.h @@ -58,7 +58,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { counter = 0; value() = 0; } @@ -67,7 +67,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { counter++; if (counter > 0) value() = counter - 1; diff --git a/mo/src/continuator/moNbInfNeighborStat.h b/mo/src/continuator/moNbInfNeighborStat.h index e3bc27bb7..5699b5268 100644 --- a/mo/src/continuator/moNbInfNeighborStat.h +++ b/mo/src/continuator/moNbInfNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbInf(); } @@ -71,7 +71,7 @@ public : * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbInf(); } diff --git a/mo/src/continuator/moNbSupNeighborStat.h b/mo/src/continuator/moNbSupNeighborStat.h index 8febf94f8..d81e07591 100644 --- a/mo/src/continuator/moNbSupNeighborStat.h +++ b/mo/src/continuator/moNbSupNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the number of solutions in the neighborhood with better fitness than the current solution * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbSup(); } @@ -71,7 +71,7 @@ public : * Set the number of solutions in the neighborhood with better fitness than the current solution * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbSup(); } diff --git a/mo/src/continuator/moNeighborEvalContinuator.h b/mo/src/continuator/moNeighborEvalContinuator.h index ba3a41a9d..bcfd0563a 100644 --- a/mo/src/continuator/moNeighborEvalContinuator.h +++ b/mo/src/continuator/moNeighborEvalContinuator.h @@ -61,7 +61,7 @@ public: * @param _solution a solution * @return true if number of evaluations < maxNeighborEval */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return (eval.value() - nbEval_start < maxNeighborEval); } @@ -69,7 +69,7 @@ public: * Reset the number of evaluations * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (restartCounter) nbEval_start = eval.value(); else diff --git a/mo/src/continuator/moNeutralDegreeNeighborStat.h b/mo/src/continuator/moNeutralDegreeNeighborStat.h index d46e99475..1cbe47321 100644 --- a/mo/src/continuator/moNeutralDegreeNeighborStat.h +++ b/mo/src/continuator/moNeutralDegreeNeighborStat.h @@ -63,7 +63,7 @@ public : * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getNbEqual(); } @@ -71,7 +71,7 @@ public : * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getNbEqual(); } diff --git a/mo/src/continuator/moQ1NeighborStat.h b/mo/src/continuator/moQ1NeighborStat.h index 4d74be68d..2ee9bd294 100644 --- a/mo/src/continuator/moQ1NeighborStat.h +++ b/mo/src/continuator/moQ1NeighborStat.h @@ -63,7 +63,7 @@ public : * Set the first quartile of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getQ1(); } @@ -71,7 +71,7 @@ public : * Set the first quartile of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getQ1(); } diff --git a/mo/src/continuator/moQ3NeighborStat.h b/mo/src/continuator/moQ3NeighborStat.h index 50426e65f..7e4768e57 100644 --- a/mo/src/continuator/moQ3NeighborStat.h +++ b/mo/src/continuator/moQ3NeighborStat.h @@ -63,7 +63,7 @@ public : * Set the third quartile of fitness in the neighborhood * @param _sol the third solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getQ3(); } @@ -71,7 +71,7 @@ public : * Set the third quartile of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getQ3(); } diff --git a/mo/src/continuator/moSecondMomentNeighborStat.h b/mo/src/continuator/moSecondMomentNeighborStat.h index 7c3a08fff..ba99c6d48 100644 --- a/mo/src/continuator/moSecondMomentNeighborStat.h +++ b/mo/src/continuator/moSecondMomentNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value().first = nhStat.getMean(); value().second = nhStat.getSD(); } @@ -70,7 +70,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value().first = nhStat.getMean(); value().second = nhStat.getSD(); } diff --git a/mo/src/continuator/moSizeNeighborStat.h b/mo/src/continuator/moSizeNeighborStat.h index 1a5b5b123..5ac3caf19 100644 --- a/mo/src/continuator/moSizeNeighborStat.h +++ b/mo/src/continuator/moSizeNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the number of solutions in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getSize(); } @@ -70,7 +70,7 @@ public : * Set the number of solutions in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getSize(); } diff --git a/mo/src/continuator/moSolutionStat.h b/mo/src/continuator/moSolutionStat.h index 93c4f57f5..90baafd44 100644 --- a/mo/src/continuator/moSolutionStat.h +++ b/mo/src/continuator/moSolutionStat.h @@ -52,7 +52,7 @@ public : * Constructor * @param _description a description of the parameter */ - moSolutionStat(std::string _description = "solution"): + moSolutionStat(std::string /*_description */= "solution"): moStat(EOT(), "fitness solution") { } /** diff --git a/mo/src/continuator/moStatFromStat.h b/mo/src/continuator/moStatFromStat.h index 962106eb0..2dea43ce1 100644 --- a/mo/src/continuator/moStatFromStat.h +++ b/mo/src/continuator/moStatFromStat.h @@ -57,7 +57,7 @@ public : * The value of this stat is a copy of the value of the initial stat * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = stat.value(); } @@ -65,7 +65,7 @@ public : * The value of this stat is a copy of the value of the initial stat * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = stat.value(); } diff --git a/mo/src/continuator/moStdFitnessNeighborStat.h b/mo/src/continuator/moStdFitnessNeighborStat.h index 649308f74..5e4098a8d 100644 --- a/mo/src/continuator/moStdFitnessNeighborStat.h +++ b/mo/src/continuator/moStdFitnessNeighborStat.h @@ -61,7 +61,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = nhStat.getSD(); } @@ -69,7 +69,7 @@ public : * Set the average and the standard deviation of fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = nhStat.getSD(); } diff --git a/mo/src/continuator/moTimeContinuator.h b/mo/src/continuator/moTimeContinuator.h index 513928000..172fec933 100644 --- a/mo/src/continuator/moTimeContinuator.h +++ b/mo/src/continuator/moTimeContinuator.h @@ -88,7 +88,7 @@ public: * Returns false when the running time is reached. * @param _sol the current solution */ - virtual bool operator() (EOT& _sol) + virtual bool operator() (EOT& /*_sol*/) { bool res; time_t elapsed = (time_t) difftime(time(NULL), start); @@ -102,7 +102,7 @@ public: * reset the start time * @param _solution a solution */ - virtual void init(EOT & _solution) { + virtual void init(EOT & /*_solution*/) { if (!external) start = time(NULL); } diff --git a/mo/src/continuator/moTrueContinuator.h b/mo/src/continuator/moTrueContinuator.h index 88feb91a3..020e138a5 100644 --- a/mo/src/continuator/moTrueContinuator.h +++ b/mo/src/continuator/moTrueContinuator.h @@ -53,7 +53,7 @@ public: * @param _solution a solution * @return always true */ - virtual bool operator()(EOT & _solution) { + virtual bool operator()(EOT & /*_solution*/) { return true; } @@ -61,7 +61,7 @@ public: * NOTHING TO DO * @param _solution a solution */ - virtual void init(EOT & _solution) {} + virtual void init(EOT & /*_solution*/) {} }; diff --git a/mo/src/continuator/moUnsignedStat.h b/mo/src/continuator/moUnsignedStat.h index c1f8342cd..8c5122539 100644 --- a/mo/src/continuator/moUnsignedStat.h +++ b/mo/src/continuator/moUnsignedStat.h @@ -56,7 +56,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value() = *b; } @@ -64,7 +64,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = *b; } diff --git a/mo/src/continuator/moValueStat.h b/mo/src/continuator/moValueStat.h index 0d8d8877d..1e9bf06a9 100644 --- a/mo/src/continuator/moValueStat.h +++ b/mo/src/continuator/moValueStat.h @@ -60,7 +60,7 @@ public : * Init the number of iteration * @param _sol a solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { if (restart) value_start = valueParam.value(); else @@ -73,7 +73,7 @@ public : * Set the number of iteration * @param _sol a solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value() = (double) (valueParam.value() - value_start); } diff --git a/mo/src/continuator/moVectorMonitor.h b/mo/src/continuator/moVectorMonitor.h index 67535219d..30c331771 100644 --- a/mo/src/continuator/moVectorMonitor.h +++ b/mo/src/continuator/moVectorMonitor.h @@ -126,7 +126,7 @@ public: * @param _param unvalid Parameter */ template - moVectorMonitor(eoValueParam & _param) : doubleParam(NULL), intParam(NULL), intLongParam(NULL), intLongLongParam(NULL), eotParam(NULL) + moVectorMonitor(eoValueParam & /*_param*/) : doubleParam(NULL), intParam(NULL), intLongParam(NULL), intLongLongParam(NULL), eotParam(NULL) { std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl; } diff --git a/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h b/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h index 34b386312..e92992e87 100644 --- a/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h +++ b/mo/src/coolingSchedule/moDynSpanCoolingSchedule.h @@ -63,7 +63,7 @@ public: * Initial temperature * @param _solution initial solution */ - virtual double init(EOT & _solution) { + virtual double init(EOT & /*_solution*/) { // number of tries since the last temperature change spanTries = 0; @@ -105,7 +105,7 @@ public: * @param _temp current temperature * @return true if the search can continue */ - virtual bool operator()(double _temp) { + virtual bool operator()(double /*_temp*/) { return nbSpan <= nbSpanMax; } diff --git a/mo/src/coolingSchedule/moSimpleCoolingSchedule.h b/mo/src/coolingSchedule/moSimpleCoolingSchedule.h index 5ff4f4920..940dd258a 100644 --- a/mo/src/coolingSchedule/moSimpleCoolingSchedule.h +++ b/mo/src/coolingSchedule/moSimpleCoolingSchedule.h @@ -59,7 +59,7 @@ public: * @param _solution initial solution * @return the initial temperature */ - virtual double init(EOT & _solution) { + virtual double init(EOT & /*_solution*/) { // number of iteration with the same temperature step = 0; @@ -71,7 +71,7 @@ public: * @param _temp current temperature to update * @param _acceptedMove true when the move is accepted, false otherwise */ - virtual void update(double& _temp, bool _acceptedMove) { + virtual void update(double& _temp, bool /*_acceptedMove*/) { if (step >= span) { _temp *= alpha; step = 0; diff --git a/mo/src/eval/moDoubleIncrEvaluation.h b/mo/src/eval/moDoubleIncrEvaluation.h index c7027e2b8..2f1ac305c 100644 --- a/mo/src/eval/moDoubleIncrEvaluation.h +++ b/mo/src/eval/moDoubleIncrEvaluation.h @@ -85,7 +85,7 @@ public: * * @param _solution the current solution */ - virtual void operator()(EOT & _solution) { + virtual void operator()(EOT & /*_solution*/) { } /** the delta of fitness for each neighbors diff --git a/mo/src/eval/moDummyEval.h b/mo/src/eval/moDummyEval.h index 2809f12a3..ac855e0fc 100644 --- a/mo/src/eval/moDummyEval.h +++ b/mo/src/eval/moDummyEval.h @@ -46,7 +46,7 @@ public: * @param _sol unused solution * @param _n unused neighbor */ - void operator()(EOT& _sol, Neighbor& _n) {} + void operator()(EOT& /*_sol*/, Neighbor& /*_n*/) {} }; diff --git a/mo/src/explorer/moDummyExplorer.h b/mo/src/explorer/moDummyExplorer.h index 3d58dbb08..ae6a293cb 100644 --- a/mo/src/explorer/moDummyExplorer.h +++ b/mo/src/explorer/moDummyExplorer.h @@ -54,20 +54,20 @@ public: * NOTHING TO DO * @param _solution unused solution */ - void initParam (EOT& _solution) { } ; + void initParam (EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution */ - void updateParam (EOT& _solution) { } ; + void updateParam (EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - bool isContinue(EOT& _solution) { + bool isContinue(EOT& /*_solution*/) { return false; } ; @@ -75,14 +75,14 @@ public: * NOTHING TO DO * @param _solution unused solution */ - void move(EOT& _solution) { } ; + void move(EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - virtual bool accept(EOT& _solution) { + virtual bool accept(EOT& /*_solution*/) { return false; } ; @@ -90,13 +90,13 @@ public: * NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT& _solution) { } ; + virtual void terminate(EOT& /*_solution*/) { } ; /** * NOTHING TO DO * @param _solution unused solution */ - void operator()(EOT & _solution) { } + void operator()(EOT & /*_solution*/) { } /** * Return the class name diff --git a/mo/src/explorer/moFirstImprHCexplorer.h b/mo/src/explorer/moFirstImprHCexplorer.h index e341908d3..530f2953a 100644 --- a/mo/src/explorer/moFirstImprHCexplorer.h +++ b/mo/src/explorer/moFirstImprHCexplorer.h @@ -85,19 +85,19 @@ public: * initParam: NOTHING TO DO * @param _solution unused solution */ - virtual void initParam(EOT & _solution) {}; + virtual void initParam(EOT & /*_solution*/) {}; /** * updateParam: NOTHING TO DO * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) {}; + virtual void updateParam(EOT & /*_solution*/) {}; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution until an ameliorated neighbor is found @@ -135,7 +135,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { if (stop) return isAccept ; else diff --git a/mo/src/explorer/moILSexplorer.h b/mo/src/explorer/moILSexplorer.h index 761009005..49d74fea5 100644 --- a/mo/src/explorer/moILSexplorer.h +++ b/mo/src/explorer/moILSexplorer.h @@ -106,7 +106,7 @@ public: * terminate: NOTHING TO DO * @param _solution a solution (unused) */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Perturb and apply local search on a solution @@ -135,7 +135,7 @@ public: * @param _solution the solution * @return always true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return true; }; diff --git a/mo/src/explorer/moMetropolisHastingExplorer.h b/mo/src/explorer/moMetropolisHastingExplorer.h index 1989ff1c3..ea0913f1e 100644 --- a/mo/src/explorer/moMetropolisHastingExplorer.h +++ b/mo/src/explorer/moMetropolisHastingExplorer.h @@ -85,7 +85,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; isAccept = true; }; @@ -94,7 +94,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -102,7 +102,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -128,7 +128,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) ; }; diff --git a/mo/src/explorer/moNeutralHCexplorer.h b/mo/src/explorer/moNeutralHCexplorer.h index 40443de40..2eefa797d 100644 --- a/mo/src/explorer/moNeutralHCexplorer.h +++ b/mo/src/explorer/moNeutralHCexplorer.h @@ -105,7 +105,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) && isAccept ; }; diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index e96f6673b..92e690e37 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -85,7 +85,7 @@ public: * empty the vector of best solutions * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { // delete all the best solutions bestVector.clear(); }; @@ -94,7 +94,7 @@ public: * empty the vector of best solutions * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { // delete all the best solutions bestVector.clear(); }; @@ -103,7 +103,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -156,7 +156,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moRandomNeutralWalkExplorer.h b/mo/src/explorer/moRandomNeutralWalkExplorer.h index 95995c753..e8f9713bf 100644 --- a/mo/src/explorer/moRandomNeutralWalkExplorer.h +++ b/mo/src/explorer/moRandomNeutralWalkExplorer.h @@ -87,7 +87,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; isAccept = true; }; @@ -96,7 +96,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -104,7 +104,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -142,7 +142,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) && isAccept ; }; diff --git a/mo/src/explorer/moRandomSearchExplorer.h b/mo/src/explorer/moRandomSearchExplorer.h index 0b09da1d9..f8b81d00c 100644 --- a/mo/src/explorer/moRandomSearchExplorer.h +++ b/mo/src/explorer/moRandomSearchExplorer.h @@ -74,7 +74,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { step = 0; }; @@ -82,7 +82,7 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { step++; }; @@ -90,7 +90,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood with only one random solution @@ -111,7 +111,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return (step < nbStep) ; }; @@ -119,7 +119,7 @@ public: * move the solution with the best neighbor * @param _solution the solution to move */ - virtual void move(EOT & _solution) { + virtual void move(EOT & /*_solution*/) { // the solution is already move. So nothing to do ! }; @@ -128,7 +128,7 @@ public: * @param _solution the solution * @return true if the best neighbor ameliorate the fitness */ - virtual bool accept(EOT & _solution) { + virtual bool accept(EOT & /*_solution*/) { return true; }; diff --git a/mo/src/explorer/moRandomWalkExplorer.h b/mo/src/explorer/moRandomWalkExplorer.h index 78f1be303..889382a2b 100644 --- a/mo/src/explorer/moRandomWalkExplorer.h +++ b/mo/src/explorer/moRandomWalkExplorer.h @@ -82,7 +82,7 @@ public: * initialization of the number of step to be done * @param _solution unused solution */ - virtual void initParam(EOT & _solution) { + virtual void initParam(EOT & /*_solution*/) { isAccept = true; }; @@ -90,14 +90,14 @@ public: * increase the number of step * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { }; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood with only one random solution @@ -127,7 +127,7 @@ public: * @param _solution the solution * @return true there is some steps to do */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moSAexplorer.h b/mo/src/explorer/moSAexplorer.h index 08d859035..b774d5c57 100644 --- a/mo/src/explorer/moSAexplorer.h +++ b/mo/src/explorer/moSAexplorer.h @@ -95,7 +95,7 @@ public: * decrease the temperature if necessary * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) { + virtual void updateParam(EOT & /*_solution*/) { coolingSchedule.update(temperature, this->moveApplied()); }; @@ -103,7 +103,7 @@ public: * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore one random solution in the neighborhood @@ -129,7 +129,7 @@ public: * @param _solution the solution * @return true if the criteria from the cooling schedule is true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return coolingSchedule(temperature); }; diff --git a/mo/src/explorer/moSimpleHCexplorer.h b/mo/src/explorer/moSimpleHCexplorer.h index b4f235ae8..ee1cded53 100644 --- a/mo/src/explorer/moSimpleHCexplorer.h +++ b/mo/src/explorer/moSimpleHCexplorer.h @@ -76,19 +76,19 @@ public: * initParam: NOTHING TO DO * @param _solution unused solution */ - virtual void initParam(EOT & _solution) {}; + virtual void initParam(EOT & /*_solution*/) {}; /** * updateParam: NOTHING TO DO * @param _solution unused solution */ - virtual void updateParam(EOT & _solution) {}; + virtual void updateParam(EOT & /*_solution*/) {}; /** * terminate: NOTHING TO DO * @param _solution unused solution */ - virtual void terminate(EOT & _solution) {}; + virtual void terminate(EOT & /*_solution*/) {}; /** * Explore the neighborhood of a solution @@ -130,7 +130,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return isAccept ; }; diff --git a/mo/src/explorer/moTSexplorer.h b/mo/src/explorer/moTSexplorer.h index 062af93cc..8438d58af 100644 --- a/mo/src/explorer/moTSexplorer.h +++ b/mo/src/explorer/moTSexplorer.h @@ -195,7 +195,7 @@ public: * @param _solution the solution * @return true */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return true; }; @@ -204,7 +204,7 @@ public: * @param _solution the solution * @return true if the best neighbor ameliorate the fitness */ - virtual bool accept(EOT & _solution) { + virtual bool accept(EOT & /*_solution*/) { return isAccept; }; diff --git a/mo/src/explorer/moVNSexplorer.h b/mo/src/explorer/moVNSexplorer.h index 3c9c2ef27..b7633c26e 100644 --- a/mo/src/explorer/moVNSexplorer.h +++ b/mo/src/explorer/moVNSexplorer.h @@ -124,7 +124,7 @@ public: * @param _solution the solution * @return true if an ameliorated neighbor was be found */ - virtual bool isContinue(EOT & _solution) { + virtual bool isContinue(EOT & /*_solution*/) { return !stop; }; diff --git a/mo/src/memory/moBestImprAspiration.h b/mo/src/memory/moBestImprAspiration.h index 7187ef666..b83c5d527 100644 --- a/mo/src/memory/moBestImprAspiration.h +++ b/mo/src/memory/moBestImprAspiration.h @@ -56,7 +56,7 @@ public: * @param _sol a solution * @param _neighbor a neighbor */ - void update(EOT & _sol, Neighbor & _neighbor) { + void update(EOT & _sol, Neighbor & /*_neighbor*/) { if (bestFoundSoFar.fitness() < _sol.fitness()) bestFoundSoFar = _sol; } @@ -68,7 +68,7 @@ public: * @param _neighbor a neighbor * @return true if _neighbor fitness is better than the "bestFoundSoFar" */ - bool operator()(EOT & _sol, Neighbor & _neighbor) { + bool operator()(EOT & /*_sol*/, Neighbor & _neighbor) { return (bestFoundSoFar.fitness() < _neighbor.fitness()); } diff --git a/mo/src/memory/moCountMoveMemory.h b/mo/src/memory/moCountMoveMemory.h index 22cbba5fd..eb6ae6825 100644 --- a/mo/src/memory/moCountMoveMemory.h +++ b/mo/src/memory/moCountMoveMemory.h @@ -45,7 +45,7 @@ public: * Init all the counters * @param _sol unused solution */ - void init(EOT & _sol) { + void init(EOT & /*_sol*/) { nbMove=0; nbNoMove=0; counter=0; @@ -55,7 +55,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - void add(EOT & _sol, Neighbor & _neighbor) { + void add(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { nbMove++; counter=0; } @@ -64,7 +64,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - void update(EOT & _sol, Neighbor & _neighbor) { + void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { nbNoMove++; counter++; } diff --git a/mo/src/memory/moDummyMemory.h b/mo/src/memory/moDummyMemory.h index c927a30f0..f176cb1bc 100644 --- a/mo/src/memory/moDummyMemory.h +++ b/mo/src/memory/moDummyMemory.h @@ -44,17 +44,17 @@ public: /** * Init : NOTHIING TO DO */ - void init(EOT & _sol) {} + void init(EOT & /*_sol*/) {} /** * Add : NOTHIING TO DO */ - void add(EOT & _sol, Neighbor & _neighbor) {} + void add(EOT & /*_sol*/, Neighbor & /*_neighbor*/) {} /** * Update : NOTHIING TO DO */ - void update(EOT & _sol, Neighbor & _neighbor) {} + void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) {} /** * ClearMemory : NOTHIING TO DO diff --git a/mo/src/memory/moIndexedVectorTabuList.h b/mo/src/memory/moIndexedVectorTabuList.h index e1ea94492..b56742602 100644 --- a/mo/src/memory/moIndexedVectorTabuList.h +++ b/mo/src/memory/moIndexedVectorTabuList.h @@ -73,7 +73,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -83,7 +83,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (_neighbor.index() < maxSize) { if (robust) // random value between min and max @@ -98,7 +98,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { for (unsigned int i = 0; i < maxSize; i++) if (tabuList[i] > 0) tabuList[i]--; @@ -110,7 +110,7 @@ public: * @param _neighbor the current neighbor * @return true if tabuList contains _sol */ - virtual bool check(EOT & _sol, Neighbor & _neighbor) { + virtual bool check(EOT & /*_sol*/, Neighbor & _neighbor) { return (tabuList[_neighbor.index()] > 0); } diff --git a/mo/src/memory/moNeighborVectorTabuList.h b/mo/src/memory/moNeighborVectorTabuList.h index dbf8edb0f..5e8f8eec7 100644 --- a/mo/src/memory/moNeighborVectorTabuList.h +++ b/mo/src/memory/moNeighborVectorTabuList.h @@ -57,7 +57,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -67,7 +67,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (tabuList.size() < maxSize) { std::pair tmp; @@ -87,7 +87,7 @@ public: * @param _sol unused solution * @param _neighbor unused neighbor */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { if (howlong > 0) for (unsigned int i=0; i 0) @@ -100,7 +100,7 @@ public: * @param _neighbor the current neighbor * @return true if tabuList contains _sol */ - virtual bool check(EOT & _sol, Neighbor & _neighbor) { + virtual bool check(EOT & /*_sol*/, Neighbor & _neighbor) { for (unsigned int i=0; i 0 && tabuList[i].second > 0 && tabuList[i].first.equals(_neighbor)) || (howlong==0 && tabuList[i].first.equals(_neighbor))) return true; diff --git a/mo/src/memory/moRndIndexedVectorTabuList.h b/mo/src/memory/moRndIndexedVectorTabuList.h index 82ffc0e04..dd6f11765 100644 --- a/mo/src/memory/moRndIndexedVectorTabuList.h +++ b/mo/src/memory/moRndIndexedVectorTabuList.h @@ -67,7 +67,7 @@ public: * @param _sol unused solution * @param _neighbor the current neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & /*_sol*/, Neighbor & _neighbor) { if (_neighbor.index() < maxSize) tabuList[_neighbor.index()] = howlong + rng.uniform(howlongRnd) ; } diff --git a/mo/src/memory/moSolVectorTabuList.h b/mo/src/memory/moSolVectorTabuList.h index ba72ccc43..31c57c0f6 100644 --- a/mo/src/memory/moSolVectorTabuList.h +++ b/mo/src/memory/moSolVectorTabuList.h @@ -57,7 +57,7 @@ public: * init the tabuList by clearing the memory * @param _sol the current solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { clearMemory(); } @@ -67,7 +67,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & _sol, Neighbor & /*_neighbor*/) { if (tabuList.size() < maxSize) { std::pair tmp; @@ -87,7 +87,7 @@ public: * @param _sol the current solution * @param _neighbor the current neighbor (unused) */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & /*_sol*/, Neighbor & /*_neighbor*/) { if (howlong > 0) for (unsigned int i=0; i 0) diff --git a/mo/src/neighborhood/moBackwardVectorVNSelection.h b/mo/src/neighborhood/moBackwardVectorVNSelection.h index b3050c439..a47b31e30 100644 --- a/mo/src/neighborhood/moBackwardVectorVNSelection.h +++ b/mo/src/neighborhood/moBackwardVectorVNSelection.h @@ -69,7 +69,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return (cycle || (current > 0)); } @@ -78,7 +78,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution){ + virtual void init(EOT& /*_solution*/){ current = LSvector.size() - 1; } @@ -87,7 +87,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ current = (current + LSvector.size() -1) % LSvector.size(); } diff --git a/mo/src/neighborhood/moDummyNeighbor.h b/mo/src/neighborhood/moDummyNeighbor.h index a8cd01087..e68b2b079 100644 --- a/mo/src/neighborhood/moDummyNeighbor.h +++ b/mo/src/neighborhood/moDummyNeighbor.h @@ -43,6 +43,6 @@ public: * NOTHING TO DO * @param _solution the related solution */ - virtual void move(EOT& _solution) {} + virtual void move(EOT& /*_solution*/) {} }; #endif diff --git a/mo/src/neighborhood/moDummyNeighborhood.h b/mo/src/neighborhood/moDummyNeighborhood.h index 26c62163c..eda0ae490 100644 --- a/mo/src/neighborhood/moDummyNeighborhood.h +++ b/mo/src/neighborhood/moDummyNeighborhood.h @@ -46,7 +46,7 @@ public: * @param _solution unused solution * @return always false */ - virtual bool hasNeighbor(EOT & _solution) { + virtual bool hasNeighbor(EOT & /*_solution*/) { return false; } @@ -55,21 +55,21 @@ public: * @param _solution unused solution * @param _current unused neighbor */ - virtual void init(EOT & _solution, Neighbor & _current) {} + virtual void init(EOT & /*_solution*/, Neighbor & /*_current*/) {} /** * NOTHING TO DO * @param _solution unused solution * @param _current unused neighbor */ - virtual void next(EOT & _solution, Neighbor & _current) {} + virtual void next(EOT & /*_solution*/, Neighbor & /*_current*/) {} /** * NOTHING TO DO * @param _solution unused solution * @return always false */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return false; } diff --git a/mo/src/neighborhood/moForwardVectorVNSelection.h b/mo/src/neighborhood/moForwardVectorVNSelection.h index d7d3546cb..d469cf6be 100644 --- a/mo/src/neighborhood/moForwardVectorVNSelection.h +++ b/mo/src/neighborhood/moForwardVectorVNSelection.h @@ -69,7 +69,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return (cycle || (current <= (LSvector.size() - 2))); } @@ -78,7 +78,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution){ + virtual void init(EOT& /*_solution*/){ current = 0; } @@ -87,7 +87,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ current = (current + 1) % LSvector.size(); } diff --git a/mo/src/neighborhood/moIndexNeighbor.h b/mo/src/neighborhood/moIndexNeighbor.h index eaf302966..880c08812 100644 --- a/mo/src/neighborhood/moIndexNeighbor.h +++ b/mo/src/neighborhood/moIndexNeighbor.h @@ -109,7 +109,7 @@ public: * @param _solution solution from which the neighborhood is visited * @param _key index of the IndexNeighbor */ - virtual void index(EOT & _solution, unsigned int _key) { + virtual void index(EOT & /*_solution*/, unsigned int _key) { key = _key; } diff --git a/mo/src/neighborhood/moNeighbor.h b/mo/src/neighborhood/moNeighbor.h index 889dd6817..8186c2435 100644 --- a/mo/src/neighborhood/moNeighbor.h +++ b/mo/src/neighborhood/moNeighbor.h @@ -93,7 +93,7 @@ public: * @param _neighbor a neighbor * @return if _neighbor and this one are equals */ - virtual bool equals(moNeighbor & _neighbor) { + virtual bool equals(moNeighbor & /*_neighbor*/) { return false; } diff --git a/mo/src/neighborhood/moOrderNeighborhood.h b/mo/src/neighborhood/moOrderNeighborhood.h index 384d0dda7..316ba8cba 100644 --- a/mo/src/neighborhood/moOrderNeighborhood.h +++ b/mo/src/neighborhood/moOrderNeighborhood.h @@ -71,7 +71,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return getNeighborhoodSize() > 0; } @@ -102,7 +102,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return (currentIndex < getNeighborhoodSize() - 1); } diff --git a/mo/src/neighborhood/moRndVectorVNSelection.h b/mo/src/neighborhood/moRndVectorVNSelection.h index a460f2d45..af4ab22dd 100644 --- a/mo/src/neighborhood/moRndVectorVNSelection.h +++ b/mo/src/neighborhood/moRndVectorVNSelection.h @@ -72,7 +72,7 @@ public: * @param _solution the current solution * @return true if there is some heuristics */ - virtual bool cont(EOT& _solution){ + virtual bool cont(EOT& /*_solution*/){ return ( cycle || (currentOrder <= (order.size() - 2)) ); } @@ -81,7 +81,7 @@ public: * * @param _solution the current solution */ - virtual void init(EOT& _solution) { + virtual void init(EOT& /*_solution*/) { if(order.size() == 0) for(unsigned int i = 0; i < LSvector.size(); i++) order.push_back(i); @@ -98,7 +98,7 @@ public: * * @param _solution the current solution */ - virtual void next(EOT& _solution){ + virtual void next(EOT& /*_solution*/){ currentOrder = (currentOrder + 1) % order.size(); current = order[currentOrder]; diff --git a/mo/src/neighborhood/moRndWithReplNeighborhood.h b/mo/src/neighborhood/moRndWithReplNeighborhood.h index 89537bf09..d66b72ac8 100644 --- a/mo/src/neighborhood/moRndWithReplNeighborhood.h +++ b/mo/src/neighborhood/moRndWithReplNeighborhood.h @@ -68,7 +68,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return neighborhoodSize > 0; } @@ -97,7 +97,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { if (maxNeighbors == 0) return neighborhoodSize > 0; else diff --git a/mo/src/neighborhood/moRndWithoutReplNeighborhood.h b/mo/src/neighborhood/moRndWithoutReplNeighborhood.h index e51c6d6e7..dfa057a28 100644 --- a/mo/src/neighborhood/moRndWithoutReplNeighborhood.h +++ b/mo/src/neighborhood/moRndWithoutReplNeighborhood.h @@ -69,7 +69,7 @@ public: * @param _solution the solution to explore * @return true if the neighborhood was not empty */ - virtual bool hasNeighbor(EOT& _solution) { + virtual bool hasNeighbor(EOT& /*_solution*/) { return neighborhoodSize > 0; } @@ -110,7 +110,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return (maxIndex > 0) ; } diff --git a/mo/src/perturb/moNeighborhoodPerturb.h b/mo/src/perturb/moNeighborhoodPerturb.h index 676f5a828..fe66bdbb9 100644 --- a/mo/src/perturb/moNeighborhoodPerturb.h +++ b/mo/src/perturb/moNeighborhoodPerturb.h @@ -79,7 +79,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor (always empty) */ - virtual void add(EOT & _sol, Neighbor & _neighbor) { + virtual void add(EOT & _sol, Neighbor & /*_neighbor*/) { (*this).init(_sol); } @@ -88,7 +88,7 @@ public: * @param _sol the current solution * @param _neighbor unused neighbor (always empty) */ - virtual void update(EOT & _sol, Neighbor & _neighbor) { + virtual void update(EOT & _sol, Neighbor & /*_neighbor*/) { if (otherNeighborhood.cont(_sol)) otherNeighborhood.next(_sol, current); else diff --git a/mo/src/problems/bitString/moBitsWithReplNeighborhood.h b/mo/src/problems/bitString/moBitsWithReplNeighborhood.h index 8c833f1a2..34d2a9623 100644 --- a/mo/src/problems/bitString/moBitsWithReplNeighborhood.h +++ b/mo/src/problems/bitString/moBitsWithReplNeighborhood.h @@ -98,13 +98,13 @@ public: * @param _neighbor the first neighbor * @param _n Hamming distance of the neighbor */ - virtual void randomNeighbor(EOT & _solution, Neighbor & _neighbor, unsigned _n) { + virtual void randomNeighbor(EOT & /*_solution*/, Neighbor & _neighbor, unsigned _n) { _neighbor.bits.resize(_n); _neighbor.nBits = _n; unsigned i; unsigned b; - unsigned tmp; + // unsigned tmp; for(unsigned k = 0; k < _n; k++) { i = rng.random(length - k); @@ -167,7 +167,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore: population size larger or equals than 1 */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return nNeighbors < sampleSize ; } diff --git a/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h b/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h index 4584a791a..34dad414f 100644 --- a/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h +++ b/mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h @@ -142,7 +142,7 @@ public: * @param _solution the solution to explore * @param _neighbor the first neighbor */ - virtual void init(EOT & _solution, Neighbor & _neighbor) { + virtual void init(EOT & /*_solution*/, Neighbor & _neighbor) { maxIndex = neighborhoodSize ; unsigned i = rng.random(maxIndex); @@ -163,7 +163,7 @@ public: * @param _solution the solution to explore (population of solutions) * @param _neighbor the next neighbor which in order of distance */ - virtual void next(EOT & _solution, Neighbor & _neighbor) { + virtual void next(EOT & /*_solution*/, Neighbor & _neighbor) { unsigned i = rng.random(maxIndex); key = indexVector[i]; @@ -180,7 +180,7 @@ public: * @param _solution the solution to explore * @return true if there is again a neighbor to explore: population size larger or equals than 1 */ - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { return neighborhoodSize - maxIndex < sampleSize ; } diff --git a/mo/src/problems/permutation/moSwapNeighborhood.h b/mo/src/problems/permutation/moSwapNeighborhood.h index 8354337e6..0ad0f1a2f 100644 --- a/mo/src/problems/permutation/moSwapNeighborhood.h +++ b/mo/src/problems/permutation/moSwapNeighborhood.h @@ -54,7 +54,7 @@ public: * @param _solution the solution to explore * @param _current the first neighbor */ - virtual void init(EOT& _solution, Neighbor& _current) { + virtual void init(EOT& /*_solution*/, Neighbor& _current) { indices.first=0; indices.second=1; _current.setIndices(0,1); diff --git a/mo/src/problems/permutation/moTwoOptExNeighborhood.h b/mo/src/problems/permutation/moTwoOptExNeighborhood.h index 9723946bb..886fbc3de 100755 --- a/mo/src/problems/permutation/moTwoOptExNeighborhood.h +++ b/mo/src/problems/permutation/moTwoOptExNeighborhood.h @@ -57,7 +57,7 @@ public: * @param _solution the solution to explore * @param _current the first neighbor */ - virtual void init(EOT& _solution, Neighbor& _current) { + virtual void init(EOT& /*_solution*/, Neighbor& _current) { indices.first=0; indices.second=1; _current.setIndices(0,1); From 5e0e6fcd792d6c74c4179136f469e648f3ae79e8 Mon Sep 17 00:00:00 2001 From: BertheasLeo <108930465+BertheasLeo@users.noreply.github.com> Date: Wed, 10 Aug 2022 14:02:16 +0200 Subject: [PATCH 043/113] Update eoSIGContinue.h Correction sighandler is not defined on Windows --- eo/src/eoSIGContinue.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index 727c74a01..e30eeb24e 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -35,6 +35,8 @@ #include #include "eoContinue.h" +typedef void (*sighandler_t)(int); + /** @addtogroup Continuators * @{ */ From bad5d6cbb85a1267a878e625f8b2d508b3aff0b4 Mon Sep 17 00:00:00 2001 From: BertheasLeo <108930465+BertheasLeo@users.noreply.github.com> Date: Wed, 10 Aug 2022 14:03:44 +0200 Subject: [PATCH 044/113] Update edoEstimatorNormalAdaptive.h Correction aliasing errror on Eigen --- edo/src/edoEstimatorNormalAdaptive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edo/src/edoEstimatorNormalAdaptive.h b/edo/src/edoEstimatorNormalAdaptive.h index 8dd03af1f..a19e14b91 100644 --- a/edo/src/edoEstimatorNormalAdaptive.h +++ b/edo/src/edoEstimatorNormalAdaptive.h @@ -233,7 +233,7 @@ public: Matrix mD = eigensolver.eigenvalues().asDiagonal(); // from variance to standard deviations - mD.cwiseSqrt(); + mD=mD.cwiseSqrt(); d.scaling( mD.diagonal() ); d.coord_sys( eigensolver.eigenvectors() ); From 5a7fdf7ed34102621e5b45348169af43f9b60feb Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 09:47:58 +0100 Subject: [PATCH 045/113] feat(EO): allow overriding fitness accessors May be useful for debugging, by tracing when fitness assignement occurs. --- eo/src/EO.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index 490dd7d83..f0e5213ac 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -72,7 +72,7 @@ public: virtual ~EO() {}; /// Return fitness value. - const Fitness& fitness() const { + virtual const Fitness& fitness() const { if (invalid()) throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); return repFitness; @@ -86,12 +86,12 @@ public: } // Set fitness as invalid. - void invalidate() { invalidFitness = true; repFitness = Fitness(); } + virtual void invalidate() { invalidFitness = true; repFitness = Fitness(); } /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - void fitness(const Fitness& _fitness) + virtual void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From 9cb60e4b10d132530907dad4f738fd4b6fab78c8 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 09:51:56 +0100 Subject: [PATCH 046/113] refactor(mo): use clog instead of cout & use at accessors in Debug builds Should really use eo::log, but waiting for logger refactoring. --- .../continuator/moBestNoImproveContinuator.h | 2 +- mo/src/continuator/moIterContinuator.h | 2 +- mo/src/continuator/moNeighborFitnessStat.h | 2 +- mo/src/continuator/moTimeContinuator.h | 2 +- mo/src/eval/moFullEvalByModif.h | 4 ++- mo/src/explorer/moILSexplorer.h | 2 +- mo/src/explorer/moMetropolisHastingExplorer.h | 2 +- mo/src/explorer/moNeighborhoodExplorer.h | 6 ++--- mo/src/explorer/moRandomBestHCexplorer.h | 27 +++++++++++++++---- mo/src/explorer/moRandomNeutralWalkExplorer.h | 2 +- mo/src/explorer/moRandomWalkExplorer.h | 2 +- mo/src/explorer/moSAexplorer.h | 2 +- mo/src/sampling/moSampling.h | 2 +- 13 files changed, 38 insertions(+), 19 deletions(-) diff --git a/mo/src/continuator/moBestNoImproveContinuator.h b/mo/src/continuator/moBestNoImproveContinuator.h index d772180f3..c14c4b87d 100644 --- a/mo/src/continuator/moBestNoImproveContinuator.h +++ b/mo/src/continuator/moBestNoImproveContinuator.h @@ -84,7 +84,7 @@ public: bool res = (cpt < maxNoImprove); if (!res && verbose) - std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl; + std::clog << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl; return res; } diff --git a/mo/src/continuator/moIterContinuator.h b/mo/src/continuator/moIterContinuator.h index f9400254c..ff3056062 100644 --- a/mo/src/continuator/moIterContinuator.h +++ b/mo/src/continuator/moIterContinuator.h @@ -57,7 +57,7 @@ public: cpt++; res = (cpt < maxIter); if (!res && verbose) - std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl; + std::clog << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl; return res; } diff --git a/mo/src/continuator/moNeighborFitnessStat.h b/mo/src/continuator/moNeighborFitnessStat.h index ab0d3bcb9..5cbe3351d 100644 --- a/mo/src/continuator/moNeighborFitnessStat.h +++ b/mo/src/continuator/moNeighborFitnessStat.h @@ -62,7 +62,7 @@ public : neighborhood(_neighborhood), eval(_eval) { if (!neighborhood.isRandom()) { - std::cout << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl; + std::clog << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl; } } diff --git a/mo/src/continuator/moTimeContinuator.h b/mo/src/continuator/moTimeContinuator.h index 172fec933..67804dda9 100644 --- a/mo/src/continuator/moTimeContinuator.h +++ b/mo/src/continuator/moTimeContinuator.h @@ -94,7 +94,7 @@ public: time_t elapsed = (time_t) difftime(time(NULL), start); res = (elapsed < max); if (!res && verbose) - std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl; + std::clog << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl; return res; } diff --git a/mo/src/eval/moFullEvalByModif.h b/mo/src/eval/moFullEvalByModif.h index 80ee94d1c..a4cb9369a 100644 --- a/mo/src/eval/moFullEvalByModif.h +++ b/mo/src/eval/moFullEvalByModif.h @@ -40,7 +40,9 @@ /** * Full evaluation to use with a moBackableNeighbor - * !!!WARNING!!! Use only when your solution is composed by a fitness Value and a "genotype" + * + * @warning Use only when your solution is composed by a fitness Value and a "genotype", + * and no any other data structure. * */ template diff --git a/mo/src/explorer/moILSexplorer.h b/mo/src/explorer/moILSexplorer.h index 49d74fea5..89d7bfd47 100644 --- a/mo/src/explorer/moILSexplorer.h +++ b/mo/src/explorer/moILSexplorer.h @@ -126,7 +126,7 @@ public: //apply the local search on the copy ls(currentSol); -// std::cout << "(solution)\t" << current << std::endl; +// std::clog << "(solution)\t" << current << std::endl; }; diff --git a/mo/src/explorer/moMetropolisHastingExplorer.h b/mo/src/explorer/moMetropolisHastingExplorer.h index ea0913f1e..9716469b9 100644 --- a/mo/src/explorer/moMetropolisHastingExplorer.h +++ b/mo/src/explorer/moMetropolisHastingExplorer.h @@ -71,7 +71,7 @@ public: moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl; + std::clog << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl; } } diff --git a/mo/src/explorer/moNeighborhoodExplorer.h b/mo/src/explorer/moNeighborhoodExplorer.h index 8b4113b7a..2db8623ac 100644 --- a/mo/src/explorer/moNeighborhoodExplorer.h +++ b/mo/src/explorer/moNeighborhoodExplorer.h @@ -44,16 +44,16 @@ #include /** - * Explore the neighborhood according to the local search algorithm + * Explore the neighborhood according to the local search algorithm * * During this exploration, * the parameters are updated * one neighbor is selected * a comparason with the solution is made to acccept or not this new neighbor - * + * * The current neighbor (currentNeigbor) is the neighbor under consideration during the search (in operator()(EOT &)) * - * The selected neighbor (selectedNeighbor) is the neighbor selected in method operator()(EOT &). + * The selected neighbor (selectedNeighbor) is the neighbor selected in method operator()(EOT &). * If this neighbor is accepted, then the solution is moved on this neighbor (in move(EOT &)) * */ diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index 92e690e37..3e7218065 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -120,6 +120,7 @@ public: eval(_solution, currentNeighbor); //initialize the best neighbor + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); //test all others neighbors @@ -129,21 +130,37 @@ public: //eval eval(_solution, currentNeighbor); + assert(not currentNeighbor.invalid()); //if we found a better neighbor, update the best + #ifndef NDEBUG + assert(bestVector.size() > 0); + assert(not bestVector.at(0).invalid()); + if (neighborComparator(bestVector.at(0), currentNeighbor)) { + #else if (neighborComparator(bestVector[0], currentNeighbor)) { + #endif bestVector.clear(); + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); } - else if (neighborComparator.equals(currentNeighbor, bestVector[0])) //if the current is equals to previous best solutions then update vector of the best solution + //if the current is equals to previous best solutions + // then update vector of the best solution + #ifndef NDEBUG + else if (neighborComparator.equals(currentNeighbor, bestVector.at(0))) { + #else + else if (neighborComparator.equals(currentNeighbor, bestVector[0])) { + #endif + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); + } } - // choose randomly one of the best solutions - unsigned int i = rng.random(bestVector.size()); + // choose randomly one of the best solutions + unsigned int i = rng.random(bestVector.size()); - // the selected Neighbor - selectedNeighbor = bestVector[i]; + // the selected Neighbor + selectedNeighbor = bestVector[i]; } else { //if _solution hasn't neighbor, diff --git a/mo/src/explorer/moRandomNeutralWalkExplorer.h b/mo/src/explorer/moRandomNeutralWalkExplorer.h index e8f9713bf..521c357e6 100644 --- a/mo/src/explorer/moRandomNeutralWalkExplorer.h +++ b/mo/src/explorer/moRandomNeutralWalkExplorer.h @@ -73,7 +73,7 @@ public: nbStep(_nbStep) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; + std::clog << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; } } diff --git a/mo/src/explorer/moRandomWalkExplorer.h b/mo/src/explorer/moRandomWalkExplorer.h index 889382a2b..d0a84fe29 100644 --- a/mo/src/explorer/moRandomWalkExplorer.h +++ b/mo/src/explorer/moRandomWalkExplorer.h @@ -68,7 +68,7 @@ public: moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval) : moNeighborhoodExplorer(_neighborhood, _eval) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; + std::clog << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; } } diff --git a/mo/src/explorer/moSAexplorer.h b/mo/src/explorer/moSAexplorer.h index b774d5c57..132d584f9 100644 --- a/mo/src/explorer/moSAexplorer.h +++ b/mo/src/explorer/moSAexplorer.h @@ -72,7 +72,7 @@ public: isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl; + std::clog << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl; } } diff --git a/mo/src/sampling/moSampling.h b/mo/src/sampling/moSampling.h index 90dee4707..93ae19615 100644 --- a/mo/src/sampling/moSampling.h +++ b/mo/src/sampling/moSampling.h @@ -75,7 +75,7 @@ public: checkpoint = new moCheckpoint(*continuator); add(_stat, _monitoring); // precision of the output by default - precisionOutput = std::cout.precision(); + precisionOutput = std::clog.precision(); } /** From ff744aea7c6494476ad5ca36fd6ac7f07357ebe1 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:51:29 +0100 Subject: [PATCH 047/113] fix(eoStandardBitMutation): - Fix all operators in eoStandardBitMutation.h - Bitflip componennt was not bound, use explicit assignement of rates. - Fix normal and fast operators algorithms. Co-authored-by: Potalas --- eo/src/ga/eoStandardBitMutation.h | 174 +++++++++++++++++++----------- eo/test/t-eoFoundryFastGA.cpp | 14 +-- 2 files changed, 116 insertions(+), 72 deletions(-) diff --git a/eo/src/ga/eoStandardBitMutation.h b/eo/src/ga/eoStandardBitMutation.h index fd6e4263e..32ece1342 100644 --- a/eo/src/ga/eoStandardBitMutation.h +++ b/eo/src/ga/eoStandardBitMutation.h @@ -7,6 +7,8 @@ /** Standard bit mutation with mutation rate p: * choose k from the binomial distribution Bin(n,p) and apply flip_k(x). * + * If rate is null (the default), use 1/chrom.size(). + * * @ingroup Bitstrings * @ingroup Variators */ @@ -14,7 +16,11 @@ template class eoStandardBitMutation : public eoMonOp { public: - eoStandardBitMutation(double rate = 0.5) : + /** Constructor. + * + * @param rate mutation rate, 1/chrom.size() if ignored or zero (the default) + */ + eoStandardBitMutation(double rate = 0) : _rate(rate), _nb(1), _bitflip(_nb) @@ -22,9 +28,12 @@ class eoStandardBitMutation : public eoMonOp virtual bool operator()(EOT& chrom) { + assert(chrom.size()>0); + if(_rate == 0) { + _rate = (double) 1/chrom.size(); + } _nb = eo::rng.binomial(chrom.size(),_rate); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + _bitflip.number_bits(_nb); return _bitflip(chrom); } @@ -46,8 +55,7 @@ template class eoUniformBitMutation : public eoMonOp { public: - eoUniformBitMutation(double rate = 0.5) : - _rate(rate), + eoUniformBitMutation() : _nb(1), _bitflip(_nb) {} @@ -55,15 +63,13 @@ class eoUniformBitMutation : public eoMonOp virtual bool operator()(EOT& chrom) { _nb = eo::rng.random(chrom.size()); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + _bitflip.number_bits(_nb); return _bitflip(chrom); } virtual std::string className() const {return "eoUniformBitMutation";} protected: - double _rate; unsigned _nb; eoDetSingleBitFlip _bitflip; }; @@ -84,17 +90,21 @@ template class eoConditionalBitMutation : public eoStandardBitMutation { public: - eoConditionalBitMutation(double rate = 0.5) : + eoConditionalBitMutation(double rate = 0) : eoStandardBitMutation(rate) {} virtual bool operator()(EOT& chrom) { assert(chrom.size()>0); - this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); - this->_nb++; - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + if(this->_rate == 0) { + this->_rate = (double) 1/chrom.size(); + } + this->_nb = 0; + while(this->_nb < 1) { + this->_nb = eo::rng.binomial(chrom.size(),this->_rate); + } + this->_bitflip.number_bits(this->_nb); return this->_bitflip(chrom); } @@ -123,12 +133,14 @@ class eoShiftedBitMutation : public eoStandardBitMutation virtual bool operator()(EOT& chrom) { assert(chrom.size()>0); - this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); + if(this->_rate == 0) { + this->_rate = (double) 1/chrom.size(); + } + this->_nb = eo::rng.binomial(chrom.size(),this->_rate); if(this->_nb == 0) { this->_nb = 1; } - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + this->_bitflip.number_bits(this->_nb); return this->_bitflip(chrom); } @@ -142,7 +154,7 @@ class eoShiftedBitMutation : public eoStandardBitMutation * * From: * Furong Ye, Carola Doerr, and Thomas Back. - * Interpolating local and global search by controllingthe variance of standard bit mutation. + * Interpolating local and global search by controlling the variance of standard bit mutation. * In 2019 IEEE Congress on Evolutionary Computation(CEC), pages 2292–2299. * * In contrast to standard bit mutation, this operators allows to scale @@ -152,29 +164,40 @@ class eoShiftedBitMutation : public eoStandardBitMutation * @ingroup Variators */ template -class eoNormalBitMutation : public eoStandardBitMutation +class eoNormalBitMutation : public eoMonOp { public: - eoNormalBitMutation(double rate = 0.5, double variance = 1) : - eoStandardBitMutation(rate), - _variance(variance) + eoNormalBitMutation(double mean = 0, double variance = 0) : + _mean(mean), + _variance(variance), + _nb(1), + _bitflip(_nb) {} virtual bool operator()(EOT& chrom) { - this->_nb = eo::rng.normal(this->_rate * chrom.size(), _variance); - if(this->_nb >= chrom.size()) { - this->_nb = eo::rng.random(chrom.size()); + assert(chrom.size() > 0); + if(_mean == 0) { + _mean = (double) 1/chrom.size(); } - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + if(_variance == 0) { + _variance = std::log(chrom.size()); + } + _nb = eo::rng.normal(_mean, _variance); + if(_nb >= chrom.size()) { + _nb = eo::rng.random(chrom.size()); + } + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoNormalBitMutation";} protected: + double _mean; double _variance; + unsigned _nb; + eoDetSingleBitFlip _bitflip; }; /** Fast mutation which size is sampled from an adaptive power law. @@ -188,11 +211,10 @@ class eoNormalBitMutation : public eoStandardBitMutation * @ingroup Variators */ template -class eoFastBitMutation : public eoStandardBitMutation +class eoFastBitMutation : public eoMonOp { public: - eoFastBitMutation(double rate = 0.5, double beta = 1.5) : - eoStandardBitMutation(rate), + eoFastBitMutation(double beta = 1.5) : _beta(beta) { assert(beta > 1); @@ -200,74 +222,96 @@ class eoFastBitMutation : public eoStandardBitMutation virtual bool operator()(EOT& chrom) { - this->_nb = powerlaw(chrom.size(),_beta); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + _nb = powerlaw(chrom.size(),_beta); + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoFastBitMutation";} protected: - - double powerlaw(unsigned n, double beta) + double powerlaw(unsigned int n, double beta) { double cnb = 0; - for(unsigned i=1; i= trigger) { + rate = static_cast(i) / static_cast(n); + break; + } + } + return eo::rng.binomial(n,rate); } + // double powerlaw(unsigned n, double beta) + // { + // double cnb = 0; + // for(unsigned i=1; i _bitflip; }; /** Bucket mutation which assign probability for each bucket + * + * @warning Highly untested code, use with caution. * * From: - * Carola Doerr, Johann Dréo, Alexis Robbes + * Carola Doerr, Johann Dreo, Alexis Robbes */ template -class eoBucketBitMutation : public eoStandardBitMutation +class eoBucketBitMutation : public eoMonOp { public: - eoBucketBitMutation(std::vector bucketsSizes, std::vector bucketValues) : - _bucketsSizes(bucketsSizes), - _bucketValues(bucketValues) - + eoBucketBitMutation(std::vector> buckets, std::vector bucketsValues) : + _buckets(buckets), + _bucketsValues(bucketsValues) { - assert(bucketsSizes.size() != bucketValues.size()); + assert(buckets.size() == bucketsValues.size()); } virtual bool operator()(EOT& chrom) { - - this->_nb = customlaw(chrom.size(), _bucketsSizes, _bucketValues); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + _nb = customlaw(chrom.size(), _buckets, _bucketsValues); + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoBucketBitMutation";} protected: - double customlaw(unsigned n, std::vector bucketsSizes, std::vector bucketValues) + double customlaw(unsigned n, std::vector> buckets, std::vector bucketsValues) { - int targetBucketIndex = eo::rng.roulette_wheel(bucketValues); - int nb = 0; - int bucketIndex = 0; - while (nb < n && bucketIndex <= targetBucketIndex) - { - if (bucketIndex < targetBucketIndex) nb += int(n*bucketsSizes[bucketIndex]); - else nb += int(eo::rng.uniform(1, n*bucketsSizes[targetBucketIndex])); - } - if (nb > n) nb = n; - - return nb; - } + int bucketIndex = eo::rng.roulette_wheel(bucketsValues); + int startBit = buckets[bucketIndex][0]; + int endBit = buckets[bucketIndex][1]; + int gapBit = endBit - startBit; - std::vector _bucketsSizes; - std::vector _bucketValues; + int nbBits; + if (gapBit > 0) { + nbBits = rand() % gapBit + startBit; + } else { + nbBits = endBit; + } + return nbBits; + } + std::vector _bucketsValues; + std::vector> _buckets; + + unsigned _nb; + eoDetSingleBitFlip _bitflip; }; + #endif // _eoStandardBitMutation_h_ diff --git a/eo/test/t-eoFoundryFastGA.cpp b/eo/test/t-eoFoundryFastGA.cpp index 6a6ee0322..24231d639 100644 --- a/eo/test/t-eoFoundryFastGA.cpp +++ b/eo/test/t-eoFoundryFastGA.cpp @@ -30,13 +30,13 @@ eoAlgoFoundryFastGA& make_foundry(eoFunctorStore& store, eoInit& ini foundry.crossovers.add< eo1PtBitXover >(); /***** Mutations ****/ - double p = 1.0; // Probability of flipping eath bit. - foundry.mutations.add< eoUniformBitMutation >(p); // proba of flipping k bits, k drawn in uniform distrib - foundry.mutations.add< eoStandardBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib - foundry.mutations.add< eoConditionalBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib, minus zero - foundry.mutations.add< eoShiftedBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one - foundry.mutations.add< eoNormalBitMutation >(p); // proba of flipping k bits, k drawn in normal distrib - foundry.mutations.add< eoFastBitMutation >(p); // proba of flipping k bits, k drawn in powerlaw distrib + // Use defaults for all operators (usually falls back to p=1/chrom.size()). + foundry.mutations.add< eoUniformBitMutation >(); // proba of flipping k bits, k drawn in uniform distrib + foundry.mutations.add< eoStandardBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib + foundry.mutations.add< eoConditionalBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib, minus zero + foundry.mutations.add< eoShiftedBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one + foundry.mutations.add< eoNormalBitMutation >(); // proba of flipping k bits, k drawn in normal distrib + foundry.mutations.add< eoFastBitMutation >(); // proba of flipping k bits, k drawn in powerlaw distrib for(size_t i=1; i < 11; i+=1) { foundry.mutations.add< eoDetSingleBitFlip >(i); // mutate k bits without duplicates } From f30240cb44dcc0c18f0086999a5a43858c2ff2c3 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:54:18 +0100 Subject: [PATCH 048/113] fix(mo): missing include --- mo/src/explorer/moRandomBestHCexplorer.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index 3e7218065..bac6cc66b 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -35,11 +35,13 @@ #ifndef _moRandomBestHCexplorer_h #define _moRandomBestHCexplorer_h +#include +#include + #include #include #include #include -#include #include /** From e643468de8816858eb0948672f8066770b52c587 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:54:45 +0100 Subject: [PATCH 049/113] revert 399b22266 (virtual fitness interface temptative) Incompatible with MOEO's change of interface. --- eo/src/EO.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index f0e5213ac..a2c3b490a 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -72,7 +72,9 @@ public: virtual ~EO() {}; /// Return fitness value. - virtual const Fitness& fitness() const { + // virtual const Fitness& fitness() const { // This would be impossible with MOEO. + // virtual Fitness fitness() const { // Cannot do that either, MOEO changes the interface. + Fitness fitness() const { if (invalid()) throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); return repFitness; @@ -91,7 +93,7 @@ public: /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - virtual void fitness(const Fitness& _fitness) + void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From 55b2f57d19db2b6095ce1d664eb14fff5fd71fc9 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 19 Aug 2024 09:49:08 +0200 Subject: [PATCH 050/113] fix!(eoBit): defaults to `char` for scalar type Since STL's vector of bool is not a vector of bool, `swap`ing bool elements in an eoBit can lead to errors. Using `char` is a saner default. Potential BREAKING CHANGE. --- eo/contrib/MGE/eoInitVirus.h | 8 ++++---- eo/src/ga/eoBit.h | 4 ++-- eo/src/ga/make_genotype_ga.h | 2 +- eo/src/utils/eoRndGenerators.h | 2 +- mo/test/t-moNKlandscapesIncrEval.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eo/contrib/MGE/eoInitVirus.h b/eo/contrib/MGE/eoInitVirus.h index f4cb53072..f114f1a3b 100644 --- a/eo/contrib/MGE/eoInitVirus.h +++ b/eo/contrib/MGE/eoInitVirus.h @@ -41,7 +41,7 @@ template class eoInitVirus: public eoInit< eoVirus > { public: - eoInitVirus(unsigned _combien, eoRndGenerator& _generator ) + eoInitVirus(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} virtual void operator()( eoVirus& chrom) @@ -58,7 +58,7 @@ public: private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics - eoSTLF generator; + eoSTLF generator; }; /// Inits the virus with one bit to the left set to one @@ -66,7 +66,7 @@ template class eoInitVirus1bit: public eoInit< eoVirus > { public: - eoInitVirus1bit(unsigned _combien, eoRndGenerator& _generator ) + eoInitVirus1bit(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} virtual void operator()( eoVirus& chrom) @@ -81,6 +81,6 @@ public: private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics - eoSTLF generator; + eoSTLF generator; }; #endif diff --git a/eo/src/ga/eoBit.h b/eo/src/ga/eoBit.h index 320a5b7d1..3333099b4 100644 --- a/eo/src/ga/eoBit.h +++ b/eo/src/ga/eoBit.h @@ -60,12 +60,12 @@ Example of a complete test program that use various bitstrings operators: Based on STL's std::vector specialization. */ -template +template class eoBit: public eoVector { public: - using ScalarType = ScalarT; + using ScalarType = ScalarT; using eoVector< FitT, ScalarType >::begin; using eoVector< FitT, ScalarType >::end; diff --git a/eo/src/ga/make_genotype_ga.h b/eo/src/ga/make_genotype_ga.h index 3a1afaa84..fd877f02d 100644 --- a/eo/src/ga/make_genotype_ga.h +++ b/eo/src/ga/make_genotype_ga.h @@ -68,7 +68,7 @@ eoInit & do_make_genotype(eoParser& _parser, eoState& _state, EOT, float _b // Then we can built a bitstring random initializer // based on boolean_generator class (see utils/rnd_generator.h) - eoBooleanGenerator * gen = new eoBooleanGenerator(_bias); + eoBooleanGenerator * gen = new eoBooleanGenerator(_bias); _state.storeFunctor(gen); eoInitFixedLength* init = new eoInitFixedLength(theSize, *gen); // store in state diff --git a/eo/src/utils/eoRndGenerators.h b/eo/src/utils/eoRndGenerators.h index e1168dcd2..48cd82af1 100644 --- a/eo/src/utils/eoRndGenerators.h +++ b/eo/src/utils/eoRndGenerators.h @@ -115,7 +115,7 @@ inline bool eoUniformGenerator::operator()(void) to easily generate random booleans with a specified bias \ingroup bitstring */ -template +template class eoBooleanGenerator : public eoRndGenerator { public : diff --git a/mo/test/t-moNKlandscapesIncrEval.cpp b/mo/test/t-moNKlandscapesIncrEval.cpp index cf9df9de1..f9a76662b 100644 --- a/mo/test/t-moNKlandscapesIncrEval.cpp +++ b/mo/test/t-moNKlandscapesIncrEval.cpp @@ -56,7 +56,7 @@ int main() { nkLandscapesEval eval(N, K); // init - eoUniformGenerator uGen; + eoUniformGenerator uGen; eoInitFixedLength init(N, uGen); // verif constructor From 6f7d505a2aa876004bad6353395a039924ffd548 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 19 Aug 2024 11:02:15 +0200 Subject: [PATCH 051/113] fix(rnd): use STL's rand gen for shuffles Previous implementation used Paradiseo's own random generator system, now superseeded by the STL's one. --- eo/src/eoInit.h | 6 +++-- eo/src/eoPop.h | 2 +- eo/src/utils/rnd_generators.h | 9 ++++--- .../src/selection/moeoNumberUnvisitedSelect.h | 27 ++++++++++--------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 58eef63e0..5230b2982 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -29,11 +29,12 @@ #include #include +#include #include "eoOp.h" #include "eoSTLFunctor.h" #include "utils/eoRndGenerators.h" -#include "utils/rnd_generators.h" // for shuffle method +// #include "utils/rnd_generators.h" // for shuffle method #include "eoExceptions.h" @@ -197,7 +198,8 @@ class eoInitPermutation: public eoInit // FIXME inherit from eoInitWithDim chrom[idx] = idx+startFrom; } - UF_random_generator gen(chrom.size()); + std::random_device rd; + std::mt19937 gen(rd()); std::shuffle(chrom.begin(), chrom.end(), gen); chrom.invalidate(); } diff --git a/eo/src/eoPop.h b/eo/src/eoPop.h index fe84aa365..fe91102b3 100644 --- a/eo/src/eoPop.h +++ b/eo/src/eoPop.h @@ -45,7 +45,7 @@ Authors: #include "eoOp.h" // for eoInit #include "eoPersistent.h" #include "eoInit.h" -#include "utils/rnd_generators.h" // for shuffle method +// #include "utils/rnd_generators.h" // for shuffle method #include "eoExceptions.h" /** A std::vector of EO object, to be used in all algorithms diff --git a/eo/src/utils/rnd_generators.h b/eo/src/utils/rnd_generators.h index 01b682b67..aae3e0000 100644 --- a/eo/src/utils/rnd_generators.h +++ b/eo/src/utils/rnd_generators.h @@ -124,6 +124,7 @@ inline bool random_generator::operator()(void) function (see eoPop::shuffle): its operator() takes an unsigned argument m and must return an unsigned uniformly distributed in [0,m} */ +// FIXME this is probably deprecated by the new STL way of managing random generators. template class UF_random_generator { @@ -134,11 +135,11 @@ class UF_random_generator : _max(max), _random(_rng) {} - T operator()() { return _random.random(_max); } - T operator()(T m) { return _random.random(m); } + T operator()() const { return _random.random(_max); } + T operator()(T m) const { return _random.random(m); } - T min() { return 0; } - T max() { return _max; } + T min() const { return 0; } + T max() const { return _max; } private : T _max; diff --git a/moeo/src/selection/moeoNumberUnvisitedSelect.h b/moeo/src/selection/moeoNumberUnvisitedSelect.h index d31fb2ef2..5a23843f7 100644 --- a/moeo/src/selection/moeoNumberUnvisitedSelect.h +++ b/moeo/src/selection/moeoNumberUnvisitedSelect.h @@ -39,6 +39,8 @@ #ifndef _MOEONUMBERUNVISITEDSELECT_H #define _MOEONUMBERUNVISITEDSELECT_H +#include + #include #include @@ -51,10 +53,10 @@ class moeoNumberUnvisitedSelect : public moeoUnvisitedSelect < MOEOT > public: - /** - * Constructor - * @param _number the number of individuals to select - */ + /** + * Constructor + * @param _number the number of individuals to select + */ moeoNumberUnvisitedSelect(unsigned int _number): number(_number){} /** @@ -64,24 +66,25 @@ public: */ std::vector operator()(eoPop < MOEOT > & _src) { - std::vector res; - res.resize(0); + std::vector res; + res.resize(0); for (unsigned int i=0; i<_src.size(); i++) { if (_src[i].flag() == 0) - res.push_back(i); + res.push_back(i); } if(number < res.size()){ - UF_random_generator rndGen(res.size()); - std::random_shuffle(res.begin(), res.end(), rndGen); - res.resize(number); + std::random_device rd; + std::mt19937 gen(rd()); + std::shuffle(res.begin(), res.end(), gen); + res.resize(number); } return res; } private: - /** number of individuals to select */ - unsigned int number; + /** number of individuals to select */ + unsigned int number; }; From ec1a0f0c629eba300437c4114f8be5f21bd998ae Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 22 Aug 2024 22:21:57 +0200 Subject: [PATCH 052/113] fix(eoForgeVector): use shared_ptr insteadof raw ones + adds instantiate_ptr interface --- eo/src/eoForge.h | 76 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index 6fcccf811..a9507e9c7 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -74,6 +74,7 @@ class eoForgeInterface { public: virtual Itf& instantiate(bool no_cache = true) = 0; + virtual std::shared_ptr instantiate_ptr(bool no_cache = true) = 0; virtual ~eoForgeInterface() {} }; @@ -123,20 +124,33 @@ class eoForgeOperator : public eoForgeInterface * * @param no_cache If false, will enable caching previous instances. */ - Itf& instantiate(bool no_cache = true) + Itf& instantiate(bool no_cache = true) override { if(no_cache or not _instantiated) { - if(_instantiated) { - delete _instantiated; - } + // if(_instantiated) { + // delete _instantiated; + // } _instantiated = op_constructor(_args); + // _instantiated = op_constructor(_args); } return *_instantiated; } - virtual ~eoForgeOperator() + std::shared_ptr instantiate_ptr(bool no_cache = true) override { - delete _instantiated; + if(no_cache or not _instantiated) { + if(_instantiated) { + // delete _instantiated; + } + _instantiated = op_constructor(_args); + // _instantiated = op_constructor(_args); + } + return _instantiated; + } + + virtual ~eoForgeOperator() override + { + // delete _instantiated; } protected: @@ -145,15 +159,18 @@ class eoForgeOperator : public eoForgeInterface private: /** Metaprogramming machinery which deals with arguments lists @{ */ template - Op* op_constructor(T& args) + std::shared_ptr op_constructor(T& args) + // Op* op_constructor(T& args) { // FIXME double-check that the copy-constructor is a good idea to make_from_tuple with dynamic storage duration. - return new Op(std::make_from_tuple(args)); + return std::make_shared(std::make_from_tuple(args)); + // return new Op(std::make_from_tuple(args)); } /** @} */ protected: - Itf* _instantiated; + std::shared_ptr _instantiated; + // Itf* _instantiated; }; /** Partial specialization for constructors without any argument. @@ -166,24 +183,38 @@ class eoForgeOperator : public eoForgeInterface _instantiated(nullptr) { } - Itf& instantiate( bool no_cache = true ) + Itf& instantiate( bool no_cache = true ) override { if(no_cache or not _instantiated) { - if(_instantiated) { - delete _instantiated; - } - _instantiated = new Op; + // if(_instantiated) { + // delete _instantiated; + // } + _instantiated = std::shared_ptr(); + // _instantiated = new Op; } return *_instantiated; } - virtual ~eoForgeOperator() + std::shared_ptr instantiate_ptr( bool no_cache = true ) override { - delete _instantiated; + if(no_cache or not _instantiated) { + // if(_instantiated) { + // delete _instantiated; + // } + _instantiated = std::shared_ptr(); + // _instantiated = new Op; + } + return _instantiated; + } + + virtual ~eoForgeOperator() override + { + // delete _instantiated; } protected: - Itf* _instantiated; + std::shared_ptr _instantiated; + // Itf* _instantiated; }; /** A vector holding an operator (with deferred instantiation) at a given index. @@ -252,6 +283,17 @@ class eoForgeVector : public std::vector*> return this->at(static_cast(index))->instantiate(_no_cache); } + std::shared_ptr instantiate_ptr(double index) + { + double frac_part, int_part; + frac_part = std::modf(index, &int_part); + if(frac_part != 0) { + eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl; + assert(frac_part != 0); + } + return this->at(static_cast(index))->instantiate_ptr(_no_cache); + } + /** Add an operator to the list. * * @warning When passing a reference (as it is often the case within ParadisEO), From 93e89828b8ee4137ee78e1adc0019e31da2c1080 Mon Sep 17 00:00:00 2001 From: Jxtopher <39927513+Jxtopher@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:08:30 +0200 Subject: [PATCH 053/113] Fix CI: random class issue, t-eoRoulette and update the workflow --- .github/workflows/build_ubuntu_debug.yml | 7 +------ eo/src/eoProportionalSelect.h | 8 ++------ eo/src/ga/eoBitOp.h | 8 ++++---- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml index d6d5cad4b..b68744cb2 100644 --- a/.github/workflows/build_ubuntu_debug.yml +++ b/.github/workflows/build_ubuntu_debug.yml @@ -1,10 +1,5 @@ name: Build Debug (Ubuntu) - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) diff --git a/eo/src/eoProportionalSelect.h b/eo/src/eoProportionalSelect.h index 65188bfe4..7329724ad 100644 --- a/eo/src/eoProportionalSelect.h +++ b/eo/src/eoProportionalSelect.h @@ -68,16 +68,12 @@ public: } assert(not _pop[0].invalid()); - const typename EOT::Fitness min_fit - = std::min_element( std::begin(_pop), std::end(_pop) ) - ->fitness(); - cumulative.clear(); - cumulative.push_back(_pop[0].fitness() - min_fit); + cumulative.push_back(_pop[0].fitness() ); for (unsigned i = 1; i < _pop.size(); ++i) { assert(not _pop[i].invalid()); - cumulative.push_back(cumulative.back() + _pop[i].fitness() - min_fit); + cumulative.push_back(cumulative.back() + _pop[i].fitness()); } assert(cumulative.size() == _pop.size()); } diff --git a/eo/src/ga/eoBitOp.h b/eo/src/ga/eoBitOp.h index b3e33efec..50e23207d 100644 --- a/eo/src/ga/eoBitOp.h +++ b/eo/src/ga/eoBitOp.h @@ -361,10 +361,10 @@ template class eoUBitXover: public eoQuadOp { if (chrom1[i] != chrom2[i] && eo::rng.flip(preference)) { - // bool tmp = chrom1[i]; - // chrom1[i]=chrom2[i]; - // chrom2[i] = tmp; - std::swap(chrom1[i], chrom2[i]); + bool tmp = chrom1[i]; + chrom1[i]=chrom2[i]; + chrom2[i] = tmp; + // std::swap(chrom1[i], chrom2[i]); changed = true; } } From c442d8a0a2bded5c1088be3f9cc231e447bb4107 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 08:57:38 +0200 Subject: [PATCH 054/113] Revert "fix!(eoBit): defaults to `char` for scalar type" This reverts commit 06e0cc0162b6f753d92076c510d7124d82a3def1. --- eo/contrib/MGE/eoInitVirus.h | 8 ++++---- eo/src/ga/eoBit.h | 4 ++-- eo/src/ga/make_genotype_ga.h | 2 +- eo/src/utils/eoRndGenerators.h | 2 +- mo/test/t-moNKlandscapesIncrEval.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eo/contrib/MGE/eoInitVirus.h b/eo/contrib/MGE/eoInitVirus.h index f114f1a3b..f4cb53072 100644 --- a/eo/contrib/MGE/eoInitVirus.h +++ b/eo/contrib/MGE/eoInitVirus.h @@ -41,7 +41,7 @@ template class eoInitVirus: public eoInit< eoVirus > { public: - eoInitVirus(unsigned _combien, eoRndGenerator& _generator ) + eoInitVirus(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} virtual void operator()( eoVirus& chrom) @@ -58,7 +58,7 @@ public: private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics - eoSTLF generator; + eoSTLF generator; }; /// Inits the virus with one bit to the left set to one @@ -66,7 +66,7 @@ template class eoInitVirus1bit: public eoInit< eoVirus > { public: - eoInitVirus1bit(unsigned _combien, eoRndGenerator& _generator ) + eoInitVirus1bit(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} virtual void operator()( eoVirus& chrom) @@ -81,6 +81,6 @@ public: private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics - eoSTLF generator; + eoSTLF generator; }; #endif diff --git a/eo/src/ga/eoBit.h b/eo/src/ga/eoBit.h index 3333099b4..320a5b7d1 100644 --- a/eo/src/ga/eoBit.h +++ b/eo/src/ga/eoBit.h @@ -60,12 +60,12 @@ Example of a complete test program that use various bitstrings operators: Based on STL's std::vector specialization. */ -template +template class eoBit: public eoVector { public: - using ScalarType = ScalarT; + using ScalarType = ScalarT; using eoVector< FitT, ScalarType >::begin; using eoVector< FitT, ScalarType >::end; diff --git a/eo/src/ga/make_genotype_ga.h b/eo/src/ga/make_genotype_ga.h index fd877f02d..3a1afaa84 100644 --- a/eo/src/ga/make_genotype_ga.h +++ b/eo/src/ga/make_genotype_ga.h @@ -68,7 +68,7 @@ eoInit & do_make_genotype(eoParser& _parser, eoState& _state, EOT, float _b // Then we can built a bitstring random initializer // based on boolean_generator class (see utils/rnd_generator.h) - eoBooleanGenerator * gen = new eoBooleanGenerator(_bias); + eoBooleanGenerator * gen = new eoBooleanGenerator(_bias); _state.storeFunctor(gen); eoInitFixedLength* init = new eoInitFixedLength(theSize, *gen); // store in state diff --git a/eo/src/utils/eoRndGenerators.h b/eo/src/utils/eoRndGenerators.h index 48cd82af1..e1168dcd2 100644 --- a/eo/src/utils/eoRndGenerators.h +++ b/eo/src/utils/eoRndGenerators.h @@ -115,7 +115,7 @@ inline bool eoUniformGenerator::operator()(void) to easily generate random booleans with a specified bias \ingroup bitstring */ -template +template class eoBooleanGenerator : public eoRndGenerator { public : diff --git a/mo/test/t-moNKlandscapesIncrEval.cpp b/mo/test/t-moNKlandscapesIncrEval.cpp index f9a76662b..cf9df9de1 100644 --- a/mo/test/t-moNKlandscapesIncrEval.cpp +++ b/mo/test/t-moNKlandscapesIncrEval.cpp @@ -56,7 +56,7 @@ int main() { nkLandscapesEval eval(N, K); // init - eoUniformGenerator uGen; + eoUniformGenerator uGen; eoInitFixedLength init(N, uGen); // verif constructor From 4bbb4a595e87ff829e9dc901157de83ff10c986e Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 10:02:22 +0200 Subject: [PATCH 055/113] fix(mpi): fix some namespaces issues with mpi --- eo/src/mpi/eoMpi.h | 9 +++++---- eo/src/mpi/eoMpiNode.cpp | 6 +++--- eo/src/mpi/eoMpiNode.h | 6 +++--- eo/src/mpi/eoMultiStart.h | 4 ++-- eo/src/mpi/eoParallelApply.h | 2 +- eo/src/mpi/implMpi.cpp | 5 ++++- eo/src/mpi/implMpi.h | 12 +++++++++++- eo/test/mpi/t-mpi-distrib-exp.cpp | 2 +- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/eo/src/mpi/eoMpi.h b/eo/src/mpi/eoMpi.h index 0bef5fea8..1038078ee 100644 --- a/eo/src/mpi/eoMpi.h +++ b/eo/src/mpi/eoMpi.h @@ -29,6 +29,7 @@ Authors: # include "../eoFunctor.h" # include "../eoExceptions.h" +# include "mpi/implMpi.h" # include "eoMpiNode.h" # include "eoMpiAssignmentAlgorithm.h" @@ -669,7 +670,7 @@ namespace eo timerStat.start("master_wait_for_all_responses"); while( assignmentAlgo.availableWorkers() != totalWorkers ) { - bmpi::status status = comm.probe( bmpi::any_source, eo::mpi::Channel::Messages ); + eo::mpi::status status = comm.probe( eo::mpi::any_source, eo::mpi::Channel::Messages ); int wrkRank = status.source(); that.handleResponse( wrkRank ); comm.send( wrkRank, Channel::Commands, Message::Finish ); @@ -686,7 +687,7 @@ namespace eo AssignmentAlgorithm& assignmentAlgo; Job< JobData > & that; - bmpi::communicator & comm; + eo::mpi::communicator & comm; }; /** @@ -713,7 +714,7 @@ namespace eo { eo::log << eo::debug << "[M" << comm.rank() << "] Waitin' for node..." << std::endl; - bmpi::status status = comm.probe( bmpi::any_source, eo::mpi::Channel::Messages ); + eo::mpi::status status = comm.probe( eo::mpi::any_source, eo::mpi::Channel::Messages ); int wrkRank = status.source(); eo::log << eo::debug << "[M" << comm.rank() << "] Node " << wrkRank << " just terminated." << std::endl; @@ -797,7 +798,7 @@ namespace eo AssignmentAlgorithm& assignmentAlgo; int masterRank; const int workerStopCondition; - bmpi::communicator& comm; + eo::mpi::communicator& comm; JobStore& store; SendTaskFunction & sendTask; diff --git a/eo/src/mpi/eoMpiNode.cpp b/eo/src/mpi/eoMpiNode.cpp index ba6424bc4..d2ed436a3 100644 --- a/eo/src/mpi/eoMpiNode.cpp +++ b/eo/src/mpi/eoMpiNode.cpp @@ -27,14 +27,14 @@ namespace eo { void Node::init( int argc, char** argv ) { - static bmpi::environment env( argc, argv ); + static eo::mpi::environment env( argc, argv ); } - bmpi::communicator& Node::comm() + eo::mpi::communicator& Node::comm() { return _comm; } - bmpi::communicator Node::_comm; + eo::mpi::communicator Node::_comm; } } diff --git a/eo/src/mpi/eoMpiNode.h b/eo/src/mpi/eoMpiNode.h index c370e1c0b..268d89690 100644 --- a/eo/src/mpi/eoMpiNode.h +++ b/eo/src/mpi/eoMpiNode.h @@ -23,7 +23,7 @@ Authors: # define __MPI_NODE_H__ # include "implMpi.h" -namespace bmpi = mpi; +// namespace bmpi = mpi; namespace eo { @@ -54,10 +54,10 @@ namespace eo /** * @brief Returns the global mpi::communicator */ - static bmpi::communicator& comm(); + static eo::mpi::communicator& comm(); protected: - static bmpi::communicator _comm; + static eo::mpi::communicator _comm; }; } } diff --git a/eo/src/mpi/eoMultiStart.h b/eo/src/mpi/eoMultiStart.h index 71e084bb4..dd8c1fa29 100644 --- a/eo/src/mpi/eoMultiStart.h +++ b/eo/src/mpi/eoMultiStart.h @@ -54,7 +54,7 @@ namespace eo typedef eoUF< eoPop&, void> ResetAlgo; MultiStartData( - bmpi::communicator& _comm, + eo::mpi::communicator& _comm, eoAlgo& _algo, int _masterRank, ResetAlgo & _resetAlgo ) @@ -87,7 +87,7 @@ namespace eo /** * @brief Communicator, used to send and retrieve messages. */ - bmpi::communicator& comm; + eo::mpi::communicator& comm; /** * @brief Algorithm which will be performed by the worker. diff --git a/eo/src/mpi/eoParallelApply.h b/eo/src/mpi/eoParallelApply.h index c85e5f7a8..6ee01c81d 100644 --- a/eo/src/mpi/eoParallelApply.h +++ b/eo/src/mpi/eoParallelApply.h @@ -137,7 +137,7 @@ namespace eo std::vector tempArray; int masterRank; - bmpi::communicator& comm; + eo::mpi::communicator& comm; }; /** diff --git a/eo/src/mpi/implMpi.cpp b/eo/src/mpi/implMpi.cpp index 16b9ea2ce..2dd1ca0d5 100644 --- a/eo/src/mpi/implMpi.cpp +++ b/eo/src/mpi/implMpi.cpp @@ -21,6 +21,8 @@ Authors: */ #include "implMpi.h" +namespace eo +{ namespace mpi { const int any_source = MPI_ANY_SOURCE; @@ -163,4 +165,5 @@ namespace mpi { MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD ); } -} +} // namespace mpi +} // namespace eo diff --git a/eo/src/mpi/implMpi.h b/eo/src/mpi/implMpi.h index c55cff6f8..d52b84b26 100644 --- a/eo/src/mpi/implMpi.h +++ b/eo/src/mpi/implMpi.h @@ -41,7 +41,8 @@ Authors: * The entities are here shortly described, if you need further details, don't hesitate * to visit the boost URL. */ - +namespace eo +{ namespace mpi { /** @@ -83,6 +84,14 @@ namespace mpi ~environment(); }; + struct MPI_Status { + int count; + int cancelled; + int MPI_SOURCE; + int MPI_TAG; + int MPI_ERROR; + }; + /** * @brief Wrapper class for MPI_Status * @@ -318,5 +327,6 @@ namespace mpi * @} */ } // namespace mpi +} // namespace eo # endif //__EO_IMPL_MPI_HPP__ diff --git a/eo/test/mpi/t-mpi-distrib-exp.cpp b/eo/test/mpi/t-mpi-distrib-exp.cpp index d3278fcad..905b8702c 100644 --- a/eo/test/mpi/t-mpi-distrib-exp.cpp +++ b/eo/test/mpi/t-mpi-distrib-exp.cpp @@ -382,7 +382,7 @@ class Experiment : public eoserial::Persistent void run() { - mpi::communicator& comm = eo::mpi::Node::comm(); + communicator& comm = eo::mpi::Node::comm(); // reinits every objects eo::rng.reseed( _seed ); eo::rng.clearCache(); // trick for repeatable sequences of normal numbers, cf eo::rng From 09a26fdc621d1353b0bc655aa51b446bbb0e9884 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 10:02:52 +0200 Subject: [PATCH 056/113] fix(eoForge): missing header --- eo/src/eoForge.h | 1 + 1 file changed, 1 insertion(+) diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index a9507e9c7..c7cf912ea 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -27,6 +27,7 @@ #include #include #include +#include // In case you want to debug arguments captured in tuples: // template From b4e89d8f51f141846488f6bc9f4e9ef7781f128d Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 14:28:34 +0200 Subject: [PATCH 057/113] fix(deprecated): guard from bind and *_function Deprecated since C++11, removed in C++17. --- eo/contrib/MGE/eoVirus.h | 5 +++++ eo/src/eoFunctor.h | 10 ++++++++++ eo/src/eoSTLFunctor.h | 10 ++++++++++ 3 files changed, 25 insertions(+) diff --git a/eo/contrib/MGE/eoVirus.h b/eo/contrib/MGE/eoVirus.h index a7c6aaeea..37b1daf4d 100644 --- a/eo/contrib/MGE/eoVirus.h +++ b/eo/contrib/MGE/eoVirus.h @@ -108,7 +108,12 @@ public: if (is) { virus.resize(bits.size()); std::transform(bits.begin(), bits.end(), virus.begin(), +#if __cplusplus >= 201103L + std::bind(std::equal_to(), std::placeholders::_1, '1')); +#else + // Deprecated since C++11. std::bind2nd(std::equal_to(), '1')); +#endif } } diff --git a/eo/src/eoFunctor.h b/eo/src/eoFunctor.h index 5ccf2e676..7a81252f1 100644 --- a/eo/src/eoFunctor.h +++ b/eo/src/eoFunctor.h @@ -114,7 +114,12 @@ eoFunctorBase::procedure_tag functor_category(const eoF&) result_type **/ template +#if __cplusplus >= 201103L +class eoUF : public eoFunctorBase, public std::function +#else +// Deprecated in C++11 class eoUF : public eoFunctorBase, public std::unary_function +#endif { public : @@ -151,7 +156,12 @@ eoFunctorBase::unary_function_tag functor_category(const eoUF&) result_type **/ template +#if __cplusplus >= 201103L +class eoBF : public eoFunctorBase, public std::function +#else +// Deprecated in C++11 class eoBF : public eoFunctorBase, public std::binary_function +#endif { public : /// virtual dtor here so there is no need to define it in derived classes diff --git a/eo/src/eoSTLFunctor.h b/eo/src/eoSTLFunctor.h index 04f96f9ca..856fd2bfb 100644 --- a/eo/src/eoSTLFunctor.h +++ b/eo/src/eoSTLFunctor.h @@ -79,7 +79,12 @@ void eoSTLF::operator()(void) respectively */ template +#if __cplusplus >= 201103L +class eoSTLUF : public std::function +#else +// Deprecated since C++11 class eoSTLUF : public std::unary_function +#endif { public: eoSTLUF(eoUF& _f) : f(_f) {} @@ -102,7 +107,12 @@ class eoSTLUF : public std::unary_function respectively */ template +#if __cplusplus >= 201103L +class eoSTLBF : public std::function +#else +// Deprecated since C++11 class eoSTLBF : public std::binary_function +#endif { public: eoSTLBF(eoUF& _f) : f(_f) {} From 3cc374ce5c192a60eddf12b53fd7361cf9fefa8a Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 14:30:25 +0200 Subject: [PATCH 058/113] fix(warnings): do not ignore return from system --- eo/test/t-eoSelect.cpp | 2 +- eo/test/t-eoSharing.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eo/test/t-eoSelect.cpp b/eo/test/t-eoSelect.cpp index 400f6725d..cab2f89e3 100644 --- a/eo/test/t-eoSelect.cpp +++ b/eo/test/t-eoSelect.cpp @@ -126,7 +126,7 @@ eoValueParam tournamentSizeParam = parser.createParam(unsigned(2), "to } // hard-coded directory name ... - system("mkdir ResSelect"); + const int ignored = system("mkdir ResSelect"); std::cout << "Testing the Selections\nParents size = " << pSize << ", offspring rate = " << oRate; std::cout << " and putting rsulting files in dir ResSelect" << std::endl; diff --git a/eo/test/t-eoSharing.cpp b/eo/test/t-eoSharing.cpp index fee072b75..8f3155fc9 100644 --- a/eo/test/t-eoSharing.cpp +++ b/eo/test/t-eoSharing.cpp @@ -193,7 +193,7 @@ int the_main(int argc, char **argv) std::cout << "The resulting file (in dir ResSelect), contains \n"; std::cout << " the empirical proba. for each indi to be selected." << std::endl; - system("mkdir ResSelect"); + const int ignored = system("mkdir ResSelect"); // initialize parent population parentsOrg.resize(pSize); From fefb2af4dd08c7ddf3edad7806749ae23c8251e1 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 14:31:01 +0200 Subject: [PATCH 059/113] REFACTOR!eoForge*): separate raw pointres from shared ones - Move the instantiate(double) interfaces of eoForgeVector as instantiate_from. - Adds two separated sets members for instantiation. BREAKING CHANGE --- eo/src/eoForge.h | 95 +++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/eo/src/eoForge.h b/eo/src/eoForge.h index c7cf912ea..394071565 100644 --- a/eo/src/eoForge.h +++ b/eo/src/eoForge.h @@ -114,6 +114,7 @@ class eoForgeOperator : public eoForgeInterface template eoForgeOperator(Args2... args) : _args(std::forward(args)...), + _instantiated_ptr(nullptr), _instantiated(nullptr) { } @@ -127,31 +128,30 @@ class eoForgeOperator : public eoForgeInterface */ Itf& instantiate(bool no_cache = true) override { - if(no_cache or not _instantiated) { - // if(_instantiated) { - // delete _instantiated; - // } + if(no_cache or _instantiated == nullptr) { + if(_instantiated) { + delete _instantiated; + } _instantiated = op_constructor(_args); - // _instantiated = op_constructor(_args); } return *_instantiated; } std::shared_ptr instantiate_ptr(bool no_cache = true) override { - if(no_cache or not _instantiated) { - if(_instantiated) { + if(no_cache or _instantiated == nullptr) { + // if(_instantiated) { // delete _instantiated; - } - _instantiated = op_constructor(_args); + // } + _instantiated_ptr = op_constructor_ptr(_args); // _instantiated = op_constructor(_args); } - return _instantiated; + return _instantiated_ptr; } virtual ~eoForgeOperator() override { - // delete _instantiated; + delete _instantiated; } protected: @@ -160,18 +160,22 @@ class eoForgeOperator : public eoForgeInterface private: /** Metaprogramming machinery which deals with arguments lists @{ */ template - std::shared_ptr op_constructor(T& args) - // Op* op_constructor(T& args) + Op* op_constructor(T& args) { // FIXME double-check that the copy-constructor is a good idea to make_from_tuple with dynamic storage duration. - return std::make_shared(std::make_from_tuple(args)); - // return new Op(std::make_from_tuple(args)); + return new Op(std::make_from_tuple(args)); + } + + template + std::shared_ptr op_constructor_ptr(T& args) + { + return std::make_shared( std::make_from_tuple(args) ); } /** @} */ protected: - std::shared_ptr _instantiated; - // Itf* _instantiated; + std::shared_ptr _instantiated_ptr; + Itf* _instantiated; }; /** Partial specialization for constructors without any argument. @@ -181,41 +185,37 @@ class eoForgeOperator : public eoForgeInterface { public: eoForgeOperator() : + _instantiated_ptr(nullptr), _instantiated(nullptr) { } Itf& instantiate( bool no_cache = true ) override { - if(no_cache or not _instantiated) { - // if(_instantiated) { - // delete _instantiated; - // } - _instantiated = std::shared_ptr(); - // _instantiated = new Op; + if(no_cache or _instantiated == nullptr) { + if(_instantiated) { + delete _instantiated; + } + _instantiated = new Op; } return *_instantiated; } std::shared_ptr instantiate_ptr( bool no_cache = true ) override { - if(no_cache or not _instantiated) { - // if(_instantiated) { - // delete _instantiated; - // } - _instantiated = std::shared_ptr(); - // _instantiated = new Op; + if(no_cache or _instantiated == nullptr) { + _instantiated_ptr = std::shared_ptr(); } - return _instantiated; + return _instantiated_ptr; } virtual ~eoForgeOperator() override { - // delete _instantiated; + delete _instantiated; } protected: - std::shared_ptr _instantiated; - // Itf* _instantiated; + std::shared_ptr _instantiated_ptr; + Itf* _instantiated; }; /** A vector holding an operator (with deferred instantiation) at a given index. @@ -273,7 +273,7 @@ class eoForgeVector : public std::vector*> /** instantiate the operator managed at the given index. */ - Itf& instantiate(double index) + Itf& instantiate_from(double index) { double frac_part, int_part; frac_part = std::modf(index, &int_part); @@ -281,20 +281,33 @@ class eoForgeVector : public std::vector*> eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl; assert(frac_part != 0); } + return instantiate(index); + } + + std::shared_ptr instantiate_ptr_from(double index) + { + double frac_part, int_part; + frac_part = std::modf(index, &int_part); + if(frac_part != 0) { + eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl; + assert(frac_part != 0); + } + return instantiate_ptr(index); + } + + /** instantiate the operator managed at the given index. + */ + Itf& instantiate(size_t index) + { return this->at(static_cast(index))->instantiate(_no_cache); } - std::shared_ptr instantiate_ptr(double index) + std::shared_ptr instantiate_ptr(size_t index) { - double frac_part, int_part; - frac_part = std::modf(index, &int_part); - if(frac_part != 0) { - eo::log << eo::errors << "there is a fractional part in the given index (" << index << ")" << std::endl; - assert(frac_part != 0); - } return this->at(static_cast(index))->instantiate_ptr(_no_cache); } + /** Add an operator to the list. * * @warning When passing a reference (as it is often the case within ParadisEO), From 22b74e9c076d4e630499f90e5c5e7074129ca196 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 14:33:35 +0200 Subject: [PATCH 060/113] fix(eoEvalFoundryEA): reorder members to avoid warning --- eo/src/eoEvalFoundryEA.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eo/src/eoEvalFoundryEA.h b/eo/src/eoEvalFoundryEA.h index e28645b73..355d0efaa 100644 --- a/eo/src/eoEvalFoundryEA.h +++ b/eo/src/eoEvalFoundryEA.h @@ -71,13 +71,6 @@ public: i_repl(foundry.replacements.index()) { } -protected: - const size_t i_cont; - const size_t i_cros; - const size_t i_muta; - const size_t i_sele; - const size_t i_repl; - public: /** Decode the high-level problem encoding as an array of indices. @@ -156,6 +149,13 @@ protected: eoAlgoFoundryEA& _foundry; const typename EOT::Fitness _penalization; const size_t _pop_size; + + const size_t i_cont; + const size_t i_cros; + const size_t i_muta; + const size_t i_sele; + const size_t i_repl; + }; /** Helper function to instanciate an eoEvalFoundryEA without having to indicate the template for the sub-problem encoding. From a5d3bf86014df535ddd11ec0845e5ac872528f3d Mon Sep 17 00:00:00 2001 From: Eremey Valetov Date: Sun, 11 Aug 2024 11:29:02 -0400 Subject: [PATCH 061/113] docs: add accelerator physics paper to publications list --- docs/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/index.html b/docs/index.html index f64f8b94a..ab5ee5cd8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -998,6 +998,11 @@ undiscovered knowledge.
    • Johann Dreo, Using Performance Fronts for Parameter Setting of Stochastic Metaheuristics, Genetic and Evolutionary Computation Conference, (2009).
    +

    Accelerator Physics

    + +
    From dde057b12b7aa5ebec589ef462396efe99e0d766 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 15:22:17 +0200 Subject: [PATCH 062/113] feat(doc): mention partial evaluation for combinatorics --- docs/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index ab5ee5cd8..7654ac870 100644 --- a/docs/index.html +++ b/docs/index.html @@ -302,7 +302,7 @@

    Efficient

    -

    is the fastest framework on the market, which is a crucial feature for modern and robust approach to solver design and validation.

    +

    is the fastest framework on the market, which is a crucial feature for modern and robust approach to solver design and validation (especially on combinatorial problems).

    @@ -311,6 +311,7 @@

    Another classical criticism against is that C++ is hard and that a fast language is useless because speed is not a concern when your objective function is dominating all the runtime.

    However, we argue that:

    -

    Metaheuristics Design

    - - -

    Accelerator Physics

    - -
    From 84148824e08e0fd289c696eeb53f32111d5578dd Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 23 Aug 2024 17:59:49 +0200 Subject: [PATCH 064/113] fix: remove a lot of trivial warnings --- edo/src/utils/edoFileSnapshot.cpp | 3 +- eo/src/eoPartiallyMappedXover.h | 8 ++-- eo/src/gp/eoParseTreeDepthInit.h | 4 ++ eo/test/t-eoCheckpointing.cpp | 2 - eo/test/t-eoSelect.cpp | 2 +- eo/test/t-eoSharing.cpp | 2 +- eo/test/t-eoStateAndParser.cpp | 2 - mo/src/continuator/moFullEvalContinuator.h | 6 ++- mo/src/continuator/moNeighborhoodStat.h | 2 +- mo/src/continuator/moQuartilesNeighborStat.h | 4 +- mo/src/neighborhood/moNeighbor.h | 4 +- mo/src/problems/eval/moNKlandscapesIncrEval.h | 2 +- mo/src/sampling/moAdaptiveWalkSampling.h | 26 ++++++------ mo/src/sampling/moNeutralWalkSampling.h | 2 +- mo/test/moTestClass.h | 16 +++---- moeo/src/archive/moeoEpsilonHyperboxArchive.h | 4 +- moeo/src/core/moeoBitVector.h | 4 ++ moeo/src/distance/moeoDistance.h | 6 +-- .../moeoCrowdingDiversityAssignment.h | 2 +- ...oFrontByFrontCrowdingDiversityAssignment.h | 2 +- ...eoFrontByFrontSharingDiversityAssignment.h | 2 +- .../moeoNearestNeighborDiversityAssignment.h | 2 +- .../moeoSharingDiversityAssignment.h | 2 +- .../moeoAggregationFitnessAssignment.h | 4 +- .../fitness/moeoConstraintFitnessAssignment.h | 4 +- .../moeoDominanceCountFitnessAssignment.h | 2 +- ...eoDominanceCountRankingFitnessAssignment.h | 2 +- .../moeoDominanceRankFitnessAssignment.h | 2 +- moeo/src/fitness/moeoDummyFitnessAssignment.h | 2 +- moeo/src/hybridization/moeoDMLSMonOp.h | 4 +- moeo/src/metric/moeoHyperVolumeMetric.h | 4 +- .../archive/moeoQuickUnboundedArchiveIndex.h | 12 ++++++ .../moeoAchievementFitnessAssignment.h | 2 +- ...alarizingFunctionMetricFitnessAssignment.h | 4 +- ...alarizingFunctionMetricFitnessAssignment.h | 4 +- ...WeightedChebychevMetricFitnessAssignment.h | 4 +- ...WeightedChebychevMetricFitnessAssignment.h | 4 +- moeo/src/selection/moeoDetArchiveSelect.h | 9 ++-- moeo/test/moeoTestClass.h | 4 +- moeo/test/t-moeo.cpp | 4 +- moeo/test/t-moeoASEEA.cpp | 4 +- moeo/test/t-moeoASFAMetric.cpp | 6 +-- moeo/test/t-moeoASFAOrMetric.cpp | 6 +-- .../t-moeoAchievementFitnessAssignment.cpp | 4 +- .../t-moeoAggregationFitnessAssignment.cpp | 4 +- moeo/test/t-moeoBitVector.cpp | 4 +- moeo/test/t-moeoChebyshevMetric.cpp | 6 +-- moeo/test/t-moeoChebyshevOrientedMetric.cpp | 6 +-- .../t-moeoConstraintFitnessAssignment.cpp | 6 +-- .../t-moeoCrowdingDiversityAssignment.cpp | 4 +- moeo/test/t-moeoDetArchiveSelect.cpp | 4 +- .../t-moeoDominanceCountFitnessAssignment.cpp | 4 +- ...DominanceCountRankingFitnessAssignment.cpp | 4 +- .../t-moeoDominanceDepthFitnessAssignment.cpp | 4 +- moeo/test/t-moeoDominanceMatrix.cpp | 4 +- .../t-moeoDominanceRankFitnessAssignment.cpp | 4 +- moeo/test/t-moeoEasyEA.cpp | 4 +- moeo/test/t-moeoEpsilonHyperboxArchive.cpp | 10 ++--- ...t-moeoEpsilonObjectiveVectorComparator.cpp | 4 +- ...pBinaryIndicatorBasedFitnessAssignment.cpp | 4 +- moeo/test/t-moeoFitDivBoundedArchive.cpp | 4 +- .../t-moeoHyperVolumeDifferenceMetric.cpp | 8 ++-- moeo/test/t-moeoHyperVolumeMetric.cpp | 8 ++-- moeo/test/t-moeoHypervolumeBinaryMetric.cpp | 4 +- moeo/test/t-moeoIBEA.cpp | 4 +- moeo/test/t-moeoImprOnlyBoundedArchive.cpp | 4 +- moeo/test/t-moeoIntVector.cpp | 4 +- moeo/test/t-moeoMax3Obj.cpp | 4 +- moeo/test/t-moeoNSGA.cpp | 4 +- moeo/test/t-moeoNSGAII.cpp | 4 +- ...moeoNearestNeighborDiversityAssignment.cpp | 4 +- .../t-moeoParetoObjectiveVectorComparator.cpp | 4 +- moeo/test/t-moeoRealVector.cpp | 4 +- moeo/test/t-moeoSEEA.cpp | 4 +- moeo/test/t-moeoSPEA2.cpp | 4 +- moeo/test/t-moeoSPEA2Archive.cpp | 4 +- .../test/t-moeoSharingDiversityAssignment.cpp | 4 +- .../t-moeoStrictObjectiveVectorComparator.cpp | 4 +- moeo/test/t-moeoUnboundedArchive.cpp | 4 +- ...oeoVecVsVecAdditiveEpsilonBinaryMetric.cpp | 4 +- ...VsVecMultiplicativeEpsilonBinaryMetric.cpp | 4 +- .../t-moeoWeakObjectiveVectorComparator.cpp | 4 +- problems/eval/nkLandscapesEval.h | 42 +++++++++---------- 83 files changed, 218 insertions(+), 196 deletions(-) diff --git a/edo/src/utils/edoFileSnapshot.cpp b/edo/src/utils/edoFileSnapshot.cpp index 32107b409..7628f934c 100644 --- a/edo/src/utils/edoFileSnapshot.cpp +++ b/edo/src/utils/edoFileSnapshot.cpp @@ -76,8 +76,7 @@ edoFileSnapshot::edoFileSnapshot(std::string dirname, s = " "; } - int dummy; - dummy = system(s.c_str()); + (void)/*ignore returned*/ system(s.c_str()); // all done _descOfFiles = new std::ofstream( std::string(dirname + "/list_of_files.txt").c_str() ); diff --git a/eo/src/eoPartiallyMappedXover.h b/eo/src/eoPartiallyMappedXover.h index 992fbcf77..b10a03ca3 100644 --- a/eo/src/eoPartiallyMappedXover.h +++ b/eo/src/eoPartiallyMappedXover.h @@ -82,9 +82,9 @@ public: // replace if necessary for(i = 0; i < i1; i++) { - while (p1[ _solution1[i] ] != -1) + while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values! _solution1[i] = p1[_solution1[i]]; - while (p2[ _solution2[i] ] != -1) + while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values! _solution2[i] = p2[_solution2[i]]; } @@ -96,9 +96,9 @@ public: // replace if necessary for(i = i2 + 1; i < _solution1.size(); i++) { - while (p1[ _solution1[i] ] != -1) + while (p1[ _solution1[i] ] != -1) // FIXME as an unsigned int, p1 cannot hold negative values! _solution1[i] = p1[_solution1[i]]; - while (p2[ _solution2[i] ] != -1) + while (p2[ _solution2[i] ] != -1) // FIXME as an unsigned int, p2 cannot hold negative values! _solution2[i] = p2[_solution2[i]]; } diff --git a/eo/src/gp/eoParseTreeDepthInit.h b/eo/src/gp/eoParseTreeDepthInit.h index ba1cf1f5a..8eaa8c3a9 100644 --- a/eo/src/gp/eoParseTreeDepthInit.h +++ b/eo/src/gp/eoParseTreeDepthInit.h @@ -50,7 +50,11 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree > protected: // a binary predicate for sorting // hopefully this will work with M$VC++ 6.0 +#if __cplusplus >= 201103L + struct lt_arity:public std::function +#else struct lt_arity:public std::binary_function +#endif { bool operator()(const Node &_node1, const Node &_node2) { return (_node1.arity() < _node2.arity());}; }; diff --git a/eo/test/t-eoCheckpointing.cpp b/eo/test/t-eoCheckpointing.cpp index 134b05cc4..84c8e7fd9 100644 --- a/eo/test/t-eoCheckpointing.cpp +++ b/eo/test/t-eoCheckpointing.cpp @@ -31,8 +31,6 @@ public : int the_main(int argc, char **argv) { // ok, we have a command line parser and a state - typedef eoBit Chrom; - eoParser parser(argc, argv); // Define Parameters diff --git a/eo/test/t-eoSelect.cpp b/eo/test/t-eoSelect.cpp index cab2f89e3..1e37f785c 100644 --- a/eo/test/t-eoSelect.cpp +++ b/eo/test/t-eoSelect.cpp @@ -126,7 +126,7 @@ eoValueParam tournamentSizeParam = parser.createParam(unsigned(2), "to } // hard-coded directory name ... - const int ignored = system("mkdir ResSelect"); + (void) system("mkdir ResSelect"); std::cout << "Testing the Selections\nParents size = " << pSize << ", offspring rate = " << oRate; std::cout << " and putting rsulting files in dir ResSelect" << std::endl; diff --git a/eo/test/t-eoSharing.cpp b/eo/test/t-eoSharing.cpp index 8f3155fc9..f074e1031 100644 --- a/eo/test/t-eoSharing.cpp +++ b/eo/test/t-eoSharing.cpp @@ -193,7 +193,7 @@ int the_main(int argc, char **argv) std::cout << "The resulting file (in dir ResSelect), contains \n"; std::cout << " the empirical proba. for each indi to be selected." << std::endl; - const int ignored = system("mkdir ResSelect"); + (void) system("mkdir ResSelect"); // initialize parent population parentsOrg.resize(pSize); diff --git a/eo/test/t-eoStateAndParser.cpp b/eo/test/t-eoStateAndParser.cpp index a851cb595..09bd3cbda 100644 --- a/eo/test/t-eoStateAndParser.cpp +++ b/eo/test/t-eoStateAndParser.cpp @@ -37,8 +37,6 @@ struct Dummy : public EO int the_main(int argc, char **argv) { // ok, we have a command line parser and a state - typedef eoBit Chrom; - eoParser parser(argc, argv); // Define Parameters diff --git a/mo/src/continuator/moFullEvalContinuator.h b/mo/src/continuator/moFullEvalContinuator.h index bf9a9ea96..168eb5bc1 100644 --- a/mo/src/continuator/moFullEvalContinuator.h +++ b/mo/src/continuator/moFullEvalContinuator.h @@ -54,7 +54,11 @@ public: * @param _maxFullEval number maximum of iterations * @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative */ - moFullEvalContinuator(eoEvalFuncCounter & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) { + moFullEvalContinuator(eoEvalFuncCounter & _eval, unsigned int _maxFullEval, bool _restartCounter = true): + eval(_eval), + restartCounter(_restartCounter), + maxFullEval(_maxFullEval) + { nbEval_start = eval.value(); } diff --git a/mo/src/continuator/moNeighborhoodStat.h b/mo/src/continuator/moNeighborhoodStat.h index 3ce7d3757..6a6e506cc 100644 --- a/mo/src/continuator/moNeighborhoodStat.h +++ b/mo/src/continuator/moNeighborhoodStat.h @@ -167,7 +167,7 @@ public : if (nb > 1) { sd = 0; - for(int i = 0; i < nb; i++) + for(unsigned i = 0; i < nb; i++) sd += (neighborFitness[i] - mean) * (neighborFitness[i] - mean) ; sd = sqrt( sd / (nb - 1.0) ); // becareful: could be infinite when large values //sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) ); // becareful: could be negative due to approximation of large values diff --git a/mo/src/continuator/moQuartilesNeighborStat.h b/mo/src/continuator/moQuartilesNeighborStat.h index 69f6af68a..77ba3e3b7 100644 --- a/mo/src/continuator/moQuartilesNeighborStat.h +++ b/mo/src/continuator/moQuartilesNeighborStat.h @@ -62,7 +62,7 @@ public : * Set the first and the third quartile of fitness in the neighborhood * @param _sol the first solution */ - virtual void init(EOT & _sol) { + virtual void init(EOT & /*_sol*/) { value().first = nhStat.getQ1(); value().second = nhStat.getQ3(); } @@ -71,7 +71,7 @@ public : * Set the first and the third quartile fitness in the neighborhood * @param _sol the corresponding solution */ - virtual void operator()(EOT & _sol) { + virtual void operator()(EOT & /*_sol*/) { value().first = nhStat.getQ1(); value().second = nhStat.getQ3(); } diff --git a/mo/src/neighborhood/moNeighbor.h b/mo/src/neighborhood/moNeighbor.h index 8186c2435..707a6a126 100644 --- a/mo/src/neighborhood/moNeighbor.h +++ b/mo/src/neighborhood/moNeighbor.h @@ -72,7 +72,7 @@ public: * @param _neighbor the neighbor to assign * @return a neighbor equal to the other */ - virtual moNeighbor& operator=( + moNeighbor& operator=( const moNeighbor& _neighbor) { if (!(_neighbor.invalid())) fitness(_neighbor.fitness()); @@ -93,7 +93,7 @@ public: * @param _neighbor a neighbor * @return if _neighbor and this one are equals */ - virtual bool equals(moNeighbor & /*_neighbor*/) { + bool equals(moNeighbor & /*_neighbor*/) { return false; } diff --git a/mo/src/problems/eval/moNKlandscapesIncrEval.h b/mo/src/problems/eval/moNKlandscapesIncrEval.h index 6635c0de0..a253c7c14 100644 --- a/mo/src/problems/eval/moNKlandscapesIncrEval.h +++ b/mo/src/problems/eval/moNKlandscapesIncrEval.h @@ -112,7 +112,7 @@ private: nonSig = 0; unsigned int n = 1; - for(int j = 0; j < nk.K + 1; j++) { + for(unsigned j = 0; j < nk.K + 1; j++) { if (_solution[ nk.links[i][j] ] == 1) sig = sig | n; diff --git a/mo/src/sampling/moAdaptiveWalkSampling.h b/mo/src/sampling/moAdaptiveWalkSampling.h index 04dafe876..b87b36f49 100644 --- a/mo/src/sampling/moAdaptiveWalkSampling.h +++ b/mo/src/sampling/moAdaptiveWalkSampling.h @@ -84,10 +84,10 @@ public: moEval& _eval, unsigned int _nbAdaptWalk) : moSampling(initHC, * new moRandomSearch(initHC, _fullEval, _nbAdaptWalk), copyStat), - neighborEvalCount(_eval), - nEvalStat(neighborEvalCount, true), - copyStat(lengthStat), // copy is used to report the statistic of the first walk + neighborEvalCount(_eval), + nEvalStat(neighborEvalCount, true), copyEvalStat(nEvalStat), + copyStat(lengthStat), // copy is used to report the statistic of the first walk checkpoint(trueCont), hc(_neighborhood, _fullEval, neighborEvalCount, checkpoint), initHC(_init, hc) @@ -95,15 +95,15 @@ public: // to count the number of step in the HC checkpoint.add(lengthStat); - // set the long name of this statistic which is the length of the walk - copyStat.setLongName("length"); + // set the long name of this statistic which is the length of the walk + copyStat.setLongName("length"); - // to count the number of evaluations + // to count the number of evaluations checkpoint.add(nEvalStat); - // set the long name of this statistic which is the number of neighbor evaluation - copyEvalStat.setLongName("ngheval"); - + // set the long name of this statistic which is the number of neighbor evaluation + copyEvalStat.setLongName("ngheval"); + // add the solution into statistics this->add(copyEvalStat); this->add(solStat); @@ -118,10 +118,10 @@ public: } protected: - /* count the number of evaluations */ - moEvalCounter neighborEvalCount; - moValueStat nEvalStat; - moStatFromStat copyEvalStat; + /* count the number of evaluations */ + moEvalCounter neighborEvalCount; + moValueStat nEvalStat; + moStatFromStat copyEvalStat; moSolutionStat solStat; moMinusOneCounterStat lengthStat; diff --git a/mo/src/sampling/moNeutralWalkSampling.h b/mo/src/sampling/moNeutralWalkSampling.h index 0db5f6c06..73eddbb9c 100644 --- a/mo/src/sampling/moNeutralWalkSampling.h +++ b/mo/src/sampling/moNeutralWalkSampling.h @@ -192,9 +192,9 @@ protected: moSolutionStat solutionStat; moDistanceStat distStat; moNeighborhoodStat< Neighbor > neighborhoodStat; - moMinNeighborStat< Neighbor > minStat; moAverageFitnessNeighborStat< Neighbor > averageStat; moStdFitnessNeighborStat< Neighbor > stdStat; + moMinNeighborStat< Neighbor > minStat; moMaxNeighborStat< Neighbor > maxStat; moNbSupNeighborStat< Neighbor > nbSupStat; moNbInfNeighborStat< Neighbor > nbInfStat; diff --git a/mo/test/moTestClass.h b/mo/test/moTestClass.h index a04a42272..8e79f174f 100644 --- a/mo/test/moTestClass.h +++ b/mo/test/moTestClass.h @@ -71,15 +71,15 @@ typedef EO Solution; class moDummyNeighborTest: public moNeighbor { public: - virtual void move(Solution & _solution) { + virtual void move(Solution & /*_solution*/) { } }; class moDummyBackableNeighbor: public moBackableNeighbor { public: - virtual void move(Solution & _solution) { + virtual void move(Solution & /*_solution*/) { } - virtual void moveBack(Solution & _solution) { + virtual void moveBack(Solution & /*_solution*/) { } }; @@ -91,7 +91,7 @@ public: i(0), j(0) { } - virtual bool hasNeighbor(EOT & _solution) { + virtual bool hasNeighbor(EOT & /*_solution*/) { bool res; if (i % 3 == 0 || i == 1) res = false; @@ -100,11 +100,11 @@ public: i++; return res; } - virtual void init(EOT & _solution, Neighbor & _current) { + virtual void init(EOT & /*_solution*/, Neighbor & /*_current*/) { } - virtual void next(EOT & _solution, Neighbor & _current) { + virtual void next(EOT & /*_solution*/, Neighbor & /*_current*/) { } - virtual bool cont(EOT & _solution) { + virtual bool cont(EOT & /*_solution*/) { j++; return (j % 10 != 0); } @@ -227,7 +227,7 @@ private: class dummyInit: public eoInit { public: - void operator()(bitVector& sol) { + void operator()(bitVector& /*sol*/) { } }; diff --git a/moeo/src/archive/moeoEpsilonHyperboxArchive.h b/moeo/src/archive/moeoEpsilonHyperboxArchive.h index 7a773e0c8..7ea2e1f42 100644 --- a/moeo/src/archive/moeoEpsilonHyperboxArchive.h +++ b/moeo/src/archive/moeoEpsilonHyperboxArchive.h @@ -258,9 +258,9 @@ public: void filtre(){ eoPop pop; - for(int i=0; i= 201103L + std::transform(bits.begin(), bits.end(), begin(), std::bind(std::equal_to(), std::placeholders::_1, '1')); +#else std::transform(bits.begin(), bits.end(), begin(), std::bind2nd(std::equal_to(), '1')); +#endif } } diff --git a/moeo/src/distance/moeoDistance.h b/moeo/src/distance/moeoDistance.h index d5cf75c75..a78593c64 100644 --- a/moeo/src/distance/moeoDistance.h +++ b/moeo/src/distance/moeoDistance.h @@ -52,7 +52,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type > * Nothing to do * @param _pop the population */ - virtual void setup(const eoPop < MOEOT > & _pop) + virtual void setup(const eoPop < MOEOT > & /*_pop*/) {} @@ -62,7 +62,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type > * @param _max upper bound * @param _obj the objective index */ - virtual void setup(double _min, double _max, unsigned int _obj) + virtual void setup(double /*_min*/, double /*_max*/, unsigned int /*_obj*/) {} @@ -71,7 +71,7 @@ class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type > * @param _realInterval the eoRealInterval object * @param _obj the objective index */ - virtual void setup(eoRealInterval _realInterval, unsigned int _obj) + virtual void setup(eoRealInterval /*_realInterval*/, unsigned int /*_obj*/) {} }; diff --git a/moeo/src/diversity/moeoCrowdingDiversityAssignment.h b/moeo/src/diversity/moeoCrowdingDiversityAssignment.h index 3a37f2db9..8f9b55417 100644 --- a/moeo/src/diversity/moeoCrowdingDiversityAssignment.h +++ b/moeo/src/diversity/moeoCrowdingDiversityAssignment.h @@ -100,7 +100,7 @@ class moeoCrowdingDiversityAssignment : public moeoDiversityAssignment < MOEOT > * @param _objVec the objective vector * @warning NOT IMPLEMENTED, DO NOTHING ! */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoCrowdingDiversityAssignment" << std::endl; } diff --git a/moeo/src/diversity/moeoFrontByFrontCrowdingDiversityAssignment.h b/moeo/src/diversity/moeoFrontByFrontCrowdingDiversityAssignment.h index c90a7ac91..7f85876cc 100644 --- a/moeo/src/diversity/moeoFrontByFrontCrowdingDiversityAssignment.h +++ b/moeo/src/diversity/moeoFrontByFrontCrowdingDiversityAssignment.h @@ -66,7 +66,7 @@ public: * @param _objVec the objective vector * @warning NOT IMPLEMENTED, DO NOTHING ! */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoFrontByFrontCrowdingDistanceDiversityAssignment" << std::endl; } diff --git a/moeo/src/diversity/moeoFrontByFrontSharingDiversityAssignment.h b/moeo/src/diversity/moeoFrontByFrontSharingDiversityAssignment.h index 56b4cedca..62e3b65c8 100644 --- a/moeo/src/diversity/moeoFrontByFrontSharingDiversityAssignment.h +++ b/moeo/src/diversity/moeoFrontByFrontSharingDiversityAssignment.h @@ -78,7 +78,7 @@ class moeoFrontByFrontSharingDiversityAssignment : public moeoSharingDiversityAs * @param _objVec the objective vector * @warning NOT IMPLEMENTED, DO NOTHING ! */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoSharingDiversityAssignment" << std::endl; } diff --git a/moeo/src/diversity/moeoNearestNeighborDiversityAssignment.h b/moeo/src/diversity/moeoNearestNeighborDiversityAssignment.h index 5b5680eef..434bb0b15 100644 --- a/moeo/src/diversity/moeoNearestNeighborDiversityAssignment.h +++ b/moeo/src/diversity/moeoNearestNeighborDiversityAssignment.h @@ -143,7 +143,7 @@ public: * @param _objVec the objective vector * @warning NOT IMPLEMENTED, DOES NOTHING ! */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoNearestNeighborDiversityAssignment" << std::endl; } diff --git a/moeo/src/diversity/moeoSharingDiversityAssignment.h b/moeo/src/diversity/moeoSharingDiversityAssignment.h index 6fa66193a..4a0142e70 100644 --- a/moeo/src/diversity/moeoSharingDiversityAssignment.h +++ b/moeo/src/diversity/moeoSharingDiversityAssignment.h @@ -102,7 +102,7 @@ class moeoSharingDiversityAssignment : public moeoDiversityAssignment < MOEOT > * @param _objVec the objective vector * @warning NOT IMPLEMENTED, DO NOTHING ! */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoSharingDiversityAssignment" << std::endl; } diff --git a/moeo/src/fitness/moeoAggregationFitnessAssignment.h b/moeo/src/fitness/moeoAggregationFitnessAssignment.h index 7b9c809e4..deb5d9043 100644 --- a/moeo/src/fitness/moeoAggregationFitnessAssignment.h +++ b/moeo/src/fitness/moeoAggregationFitnessAssignment.h @@ -113,12 +113,12 @@ class moeoAggregationFitnessAssignment : public moeoSingleObjectivization < MOEO * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){} private: class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){} + void operator()(MOEOT &/*moeo*/){} }defaultEval; //the vector of weight diff --git a/moeo/src/fitness/moeoConstraintFitnessAssignment.h b/moeo/src/fitness/moeoConstraintFitnessAssignment.h index c87ee3514..daaada5e9 100644 --- a/moeo/src/fitness/moeoConstraintFitnessAssignment.h +++ b/moeo/src/fitness/moeoConstraintFitnessAssignment.h @@ -135,7 +135,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { //std::cout << "WARNING : updateByDeleting not implemented in moeoAssignmentFitnessAssignment" << std::endl; } @@ -144,7 +144,7 @@ class moeoConstraintFitnessAssignment : public moeoSingleObjectivization < MOEOT //dummy evaluation function class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ + void operator()(MOEOT &/*moeo*/){ } } defaultEval; diff --git a/moeo/src/fitness/moeoDominanceCountFitnessAssignment.h b/moeo/src/fitness/moeoDominanceCountFitnessAssignment.h index 2de727d7e..a991d34d9 100644 --- a/moeo/src/fitness/moeoDominanceCountFitnessAssignment.h +++ b/moeo/src/fitness/moeoDominanceCountFitnessAssignment.h @@ -119,7 +119,7 @@ public: * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountFitnessAssignment" << std::endl; } diff --git a/moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h b/moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h index 562823703..1129f2c1c 100644 --- a/moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h +++ b/moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h @@ -123,7 +123,7 @@ public: * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountRankingFitnessAssignment" << std::endl; } diff --git a/moeo/src/fitness/moeoDominanceRankFitnessAssignment.h b/moeo/src/fitness/moeoDominanceRankFitnessAssignment.h index e265b94c1..de3272411 100644 --- a/moeo/src/fitness/moeoDominanceRankFitnessAssignment.h +++ b/moeo/src/fitness/moeoDominanceRankFitnessAssignment.h @@ -123,7 +123,7 @@ public: * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceRankFitnessAssignment" << std::endl; } diff --git a/moeo/src/fitness/moeoDummyFitnessAssignment.h b/moeo/src/fitness/moeoDummyFitnessAssignment.h index be80edb57..fbe506740 100644 --- a/moeo/src/fitness/moeoDummyFitnessAssignment.h +++ b/moeo/src/fitness/moeoDummyFitnessAssignment.h @@ -74,7 +74,7 @@ class moeoDummyFitnessAssignment : public moeoFitnessAssignment < MOEOT > * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { // nothing to do... ;-) } diff --git a/moeo/src/hybridization/moeoDMLSMonOp.h b/moeo/src/hybridization/moeoDMLSMonOp.h index a9c52d4c8..7840e8a8c 100644 --- a/moeo/src/hybridization/moeoDMLSMonOp.h +++ b/moeo/src/hybridization/moeoDMLSMonOp.h @@ -108,8 +108,8 @@ class moeoDMLSMonOp : public eoMonOp < typename Neighbor::EOT > tmp = rng.random(dmlsArchive.size()); _moeo = dmlsArchive[tmp]; defaultContinuator.totalGenerations(defaultContinuator.totalGenerations()); - if(verbose) - std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; + if(verbose) { + std::cout << "moeoDMLSMonOp: dmls stop" << std::endl << std::endl; } return false; } diff --git a/moeo/src/metric/moeoHyperVolumeMetric.h b/moeo/src/metric/moeoHyperVolumeMetric.h index b79dbc558..dc65ac4c9 100644 --- a/moeo/src/metric/moeoHyperVolumeMetric.h +++ b/moeo/src/metric/moeoHyperVolumeMetric.h @@ -318,8 +318,8 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d //if there are less than 3 objectifs take the fisrt objectif of the first point of front to begin computation of hypervolume if(_no_objectives < 3){ - if(_no_objectives < 1) - throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); + if(_no_objectives < 1) { + throw("Error in moeoHyperVolumeUnaryMetric::calc_hypervolume -> argument3: _no_objectives must be greater than 0"); } temp_vol=_front[0][0]; } //else if there at least 3 objectives, a recursive computation of hypervolume starts with _no_objectives -1 on the filter_nondominated_set calculating previously. diff --git a/moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h b/moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h index a40add6ae..22694d2af 100644 --- a/moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h +++ b/moeo/src/scalarStuffs/archive/moeoQuickUnboundedArchiveIndex.h @@ -54,7 +54,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT > * equivalent to "number one element should be on top of number two element" in the list by looking to the first obj */ struct CompareByFirst +#if __cplusplus >= 201103L + : std::function< bool(entree, entree) > { +#else : std::binary_function< bool, entree, entree > { +#endif bool operator ()( const entree& elem1, const entree& elem2 @@ -71,7 +75,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT > * equivalent to "number one element should be on top of number two element" in the list by looking to the 2nd obj */ struct CompareByLast +#if __cplusplus >= 201103L + : std::function< bool(entree, entree) > { +#else : std::binary_function< bool, entree, entree > { +#endif bool operator ()( const entree& elem1, const entree& elem2 @@ -87,7 +95,11 @@ class moeoQuickUnboundedArchiveIndex : public moeoArchiveIndex < MOEOT > struct CompareByLast2 +#if __cplusplus >= 201103L + : std::function< bool(MOEOT, MOEOT) > { +#else : std::binary_function< bool, MOEOT, MOEOT > { +#endif bool operator ()( const MOEOT& elem1, const MOEOT& elem2 diff --git a/moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h b/moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h index b77355bb1..2c8b873fb 100644 --- a/moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h +++ b/moeo/src/scalarStuffs/fitness/moeoAchievementFitnessAssignment.h @@ -111,7 +111,7 @@ class moeoAchievementFitnessAssignment : public moeoScalarFitnessAssignment < MO * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { // nothing to do ;-) } diff --git a/moeo/src/scalarStuffs/fitness/moeoAchievementScalarizingFunctionMetricFitnessAssignment.h b/moeo/src/scalarStuffs/fitness/moeoAchievementScalarizingFunctionMetricFitnessAssignment.h index e396a798b..7546092a7 100644 --- a/moeo/src/scalarStuffs/fitness/moeoAchievementScalarizingFunctionMetricFitnessAssignment.h +++ b/moeo/src/scalarStuffs/fitness/moeoAchievementScalarizingFunctionMetricFitnessAssignment.h @@ -127,12 +127,12 @@ class moeoAchievementScalarizingFunctionMetricFitnessAssignment : public moeoSin * @param _pop the populing * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){} private: class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ + void operator()(MOEOT &/*moeo*/){ } } defaultEval; diff --git a/moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h b/moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h index b0a1499bd..02a1c8293 100644 --- a/moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h +++ b/moeo/src/scalarStuffs/fitness/moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment.h @@ -138,7 +138,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi * @param _pop the populing * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec) + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/) { } @@ -146,7 +146,7 @@ class moeoAugmentedAchievementScalarizingFunctionMetricFitnessAssignment : publi private: class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ + void operator()(MOEOT &/*moeo*/){ } } defaultEval; diff --git a/moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h b/moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h index 356ac2144..4f6a27fb6 100644 --- a/moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h +++ b/moeo/src/scalarStuffs/fitness/moeoAugmentedWeightedChebychevMetricFitnessAssignment.h @@ -124,12 +124,12 @@ class moeoAugmentedWeightedChebychevMetricFitnessAssignment : public moeoSingleO * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){} private: class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ + void operator()(MOEOT &/*moeo*/){ } } defaultEval; diff --git a/moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h b/moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h index 382d4e2ef..da7b3e56a 100644 --- a/moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h +++ b/moeo/src/scalarStuffs/fitness/moeoWeightedChebychevMetricFitnessAssignment.h @@ -129,12 +129,12 @@ class moeoWeightedChebychevMetricFitnessAssignment : public moeoSingleObjectiviz * @param _pop the population * @param _objVec the objective vector */ - void updateByDeleting(eoPop < MOEOT > & _pop, ObjectiveVector & _objVec){} + void updateByDeleting(eoPop < MOEOT > & /*_pop*/, ObjectiveVector & /*_objVec*/){} private: class DummyEval: public eoEvalFunc{ - void operator()(MOEOT &moeo){ + void operator()(MOEOT &/*moeo*/){ } } defaultEval; diff --git a/moeo/src/selection/moeoDetArchiveSelect.h b/moeo/src/selection/moeoDetArchiveSelect.h index 78b69a06e..c3f94d018 100644 --- a/moeo/src/selection/moeoDetArchiveSelect.h +++ b/moeo/src/selection/moeoDetArchiveSelect.h @@ -57,7 +57,7 @@ class moeoDetArchiveSelect : public eoSelect * @param _source compatibility parameter, not used * @param _dest destination population, selected from archive */ - void operator()(const eoPop < MOEOT > & _source, eoPop < MOEOT > & _dest) + void operator()(const eoPop < MOEOT > & /*_source*/, eoPop < MOEOT > & _dest) { if(max < min){ std::cout << "Warning! moeoDetArchiveSelect: min value > max value!!! Nothing is done." << std::endl; @@ -74,8 +74,11 @@ class moeoDetArchiveSelect : public eoSelect std::vector permutation; for(unsigned int i=0; i < archive_size; i++) permutation.push_back(i); - UF_random_generator rndGen(permutation.size()); - random_shuffle(permutation.begin(), permutation.end(), rndGen); + // UF_random_generator rndGen(permutation.size()); + // random_shuffle(permutation.begin(), permutation.end(), rndGen); + std::random_device rd; + std::mt19937 gen(rd()); + std::shuffle(permutation.begin(), permutation.end(), gen); for (unsigned int i=0; i ObjectiveVector; typedef MOEO < ObjectiveVector, double, double > Solution; class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ + void operator()(Solution &/*moeo*/){ } } eval; //----------------------------------------------------------------------------- diff --git a/moeo/test/t-moeoASFAOrMetric.cpp b/moeo/test/t-moeoASFAOrMetric.cpp index 9ca8d2e67..d0dca6dde 100644 --- a/moeo/test/t-moeoASFAOrMetric.cpp +++ b/moeo/test/t-moeoASFAOrMetric.cpp @@ -48,11 +48,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } @@ -67,7 +67,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; typedef MOEO < ObjectiveVector, double, double > Solution; class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ + void operator()(Solution &/*moeo*/){ } } eval; //----------------------------------------------------------------------------- diff --git a/moeo/test/t-moeoAchievementFitnessAssignment.cpp b/moeo/test/t-moeoAchievementFitnessAssignment.cpp index 2bf553350..c8a7c3060 100644 --- a/moeo/test/t-moeoAchievementFitnessAssignment.cpp +++ b/moeo/test/t-moeoAchievementFitnessAssignment.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoAggregationFitnessAssignment.cpp b/moeo/test/t-moeoAggregationFitnessAssignment.cpp index 93990e1c5..294397aed 100644 --- a/moeo/test/t-moeoAggregationFitnessAssignment.cpp +++ b/moeo/test/t-moeoAggregationFitnessAssignment.cpp @@ -48,11 +48,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return false; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return true; } diff --git a/moeo/test/t-moeoBitVector.cpp b/moeo/test/t-moeoBitVector.cpp index 5420efdb1..0673f68cc 100644 --- a/moeo/test/t-moeoBitVector.cpp +++ b/moeo/test/t-moeoBitVector.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoChebyshevMetric.cpp b/moeo/test/t-moeoChebyshevMetric.cpp index 5037847ea..583043bb6 100644 --- a/moeo/test/t-moeoChebyshevMetric.cpp +++ b/moeo/test/t-moeoChebyshevMetric.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return false; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return true; } @@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; typedef MOEO < ObjectiveVector, double, double > Solution; class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ + void operator()(Solution &/*moeo*/){ } } eval; //----------------------------------------------------------------------------- diff --git a/moeo/test/t-moeoChebyshevOrientedMetric.cpp b/moeo/test/t-moeoChebyshevOrientedMetric.cpp index 9d82d18da..28f372619 100644 --- a/moeo/test/t-moeoChebyshevOrientedMetric.cpp +++ b/moeo/test/t-moeoChebyshevOrientedMetric.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } @@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; typedef MOEO < ObjectiveVector, double, double > Solution; class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ + void operator()(Solution &/*moeo*/){ } } eval; //----------------------------------------------------------------------------- diff --git a/moeo/test/t-moeoConstraintFitnessAssignment.cpp b/moeo/test/t-moeoConstraintFitnessAssignment.cpp index 8a0e0a573..3df48532b 100644 --- a/moeo/test/t-moeoConstraintFitnessAssignment.cpp +++ b/moeo/test/t-moeoConstraintFitnessAssignment.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } @@ -66,7 +66,7 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; typedef MOEO < ObjectiveVector, double, double > Solution; class DummyEval: public eoEvalFunc{ - void operator()(Solution &moeo){ + void operator()(Solution &/*moeo*/){ } } defaultEval; //----------------------------------------------------------------------------- diff --git a/moeo/test/t-moeoCrowdingDiversityAssignment.cpp b/moeo/test/t-moeoCrowdingDiversityAssignment.cpp index 5aa17bcad..c126fe2ae 100644 --- a/moeo/test/t-moeoCrowdingDiversityAssignment.cpp +++ b/moeo/test/t-moeoCrowdingDiversityAssignment.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDetArchiveSelect.cpp b/moeo/test/t-moeoDetArchiveSelect.cpp index b85085d58..4bbbf8fa4 100644 --- a/moeo/test/t-moeoDetArchiveSelect.cpp +++ b/moeo/test/t-moeoDetArchiveSelect.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDominanceCountFitnessAssignment.cpp b/moeo/test/t-moeoDominanceCountFitnessAssignment.cpp index e71c70bf1..d4ff9d6d5 100644 --- a/moeo/test/t-moeoDominanceCountFitnessAssignment.cpp +++ b/moeo/test/t-moeoDominanceCountFitnessAssignment.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp b/moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp index 265aaf0dc..09bf7eef0 100644 --- a/moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp +++ b/moeo/test/t-moeoDominanceCountRankingFitnessAssignment.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDominanceDepthFitnessAssignment.cpp b/moeo/test/t-moeoDominanceDepthFitnessAssignment.cpp index 71fae12dc..1282bcdc8 100644 --- a/moeo/test/t-moeoDominanceDepthFitnessAssignment.cpp +++ b/moeo/test/t-moeoDominanceDepthFitnessAssignment.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDominanceMatrix.cpp b/moeo/test/t-moeoDominanceMatrix.cpp index cf533d645..0c837fd97 100644 --- a/moeo/test/t-moeoDominanceMatrix.cpp +++ b/moeo/test/t-moeoDominanceMatrix.cpp @@ -48,11 +48,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoDominanceRankFitnessAssignment.cpp b/moeo/test/t-moeoDominanceRankFitnessAssignment.cpp index c59c9510c..f392f82ed 100644 --- a/moeo/test/t-moeoDominanceRankFitnessAssignment.cpp +++ b/moeo/test/t-moeoDominanceRankFitnessAssignment.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoEasyEA.cpp b/moeo/test/t-moeoEasyEA.cpp index b378f9f9a..0210cb5de 100644 --- a/moeo/test/t-moeoEasyEA.cpp +++ b/moeo/test/t-moeoEasyEA.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoEpsilonHyperboxArchive.cpp b/moeo/test/t-moeoEpsilonHyperboxArchive.cpp index 071f278a4..2106e76fc 100644 --- a/moeo/test/t-moeoEpsilonHyperboxArchive.cpp +++ b/moeo/test/t-moeoEpsilonHyperboxArchive.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } @@ -88,7 +88,7 @@ int main() - for(int i=0; i< pop.size()/2; i++){ + for(unsigned i=0; i< pop.size()/2; i++){ // tmp=rng.uniform()*100; obj[0]=o1; obj[1]=o2; @@ -132,10 +132,10 @@ int main() std::cout << "nadir: " << nadir << std::endl; std::cout << "ideal: " << ideal << std::endl; - for(int i=0; i ObjectiveVector; class ObjectiveVectorTraits2 : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoHyperVolumeMetric.cpp b/moeo/test/t-moeoHyperVolumeMetric.cpp index 1ff7cb9d5..455af0f6c 100644 --- a/moeo/test/t-moeoHyperVolumeMetric.cpp +++ b/moeo/test/t-moeoHyperVolumeMetric.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } @@ -66,11 +66,11 @@ typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector; class ObjectiveVectorTraits2 : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoHypervolumeBinaryMetric.cpp b/moeo/test/t-moeoHypervolumeBinaryMetric.cpp index 083804537..605affe6b 100644 --- a/moeo/test/t-moeoHypervolumeBinaryMetric.cpp +++ b/moeo/test/t-moeoHypervolumeBinaryMetric.cpp @@ -44,11 +44,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoIBEA.cpp b/moeo/test/t-moeoIBEA.cpp index 89b05fc4f..564157c5d 100644 --- a/moeo/test/t-moeoIBEA.cpp +++ b/moeo/test/t-moeoIBEA.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoImprOnlyBoundedArchive.cpp b/moeo/test/t-moeoImprOnlyBoundedArchive.cpp index 449166cac..483e3eaa3 100644 --- a/moeo/test/t-moeoImprOnlyBoundedArchive.cpp +++ b/moeo/test/t-moeoImprOnlyBoundedArchive.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoIntVector.cpp b/moeo/test/t-moeoIntVector.cpp index 70e580529..51f3f105a 100644 --- a/moeo/test/t-moeoIntVector.cpp +++ b/moeo/test/t-moeoIntVector.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoMax3Obj.cpp b/moeo/test/t-moeoMax3Obj.cpp index f0ff1471e..c638d0ed6 100644 --- a/moeo/test/t-moeoMax3Obj.cpp +++ b/moeo/test/t-moeoMax3Obj.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return false; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return true; } diff --git a/moeo/test/t-moeoNSGA.cpp b/moeo/test/t-moeoNSGA.cpp index 16b994712..779681e24 100644 --- a/moeo/test/t-moeoNSGA.cpp +++ b/moeo/test/t-moeoNSGA.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoNSGAII.cpp b/moeo/test/t-moeoNSGAII.cpp index d1139468e..3827e2800 100644 --- a/moeo/test/t-moeoNSGAII.cpp +++ b/moeo/test/t-moeoNSGAII.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoNearestNeighborDiversityAssignment.cpp b/moeo/test/t-moeoNearestNeighborDiversityAssignment.cpp index d4e0e5ed5..58969730b 100644 --- a/moeo/test/t-moeoNearestNeighborDiversityAssignment.cpp +++ b/moeo/test/t-moeoNearestNeighborDiversityAssignment.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoParetoObjectiveVectorComparator.cpp b/moeo/test/t-moeoParetoObjectiveVectorComparator.cpp index 143e3b70e..a37b3eb8c 100644 --- a/moeo/test/t-moeoParetoObjectiveVectorComparator.cpp +++ b/moeo/test/t-moeoParetoObjectiveVectorComparator.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoRealVector.cpp b/moeo/test/t-moeoRealVector.cpp index 1d17853f6..58d29a491 100644 --- a/moeo/test/t-moeoRealVector.cpp +++ b/moeo/test/t-moeoRealVector.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoSEEA.cpp b/moeo/test/t-moeoSEEA.cpp index 1e58ba972..648ca0585 100644 --- a/moeo/test/t-moeoSEEA.cpp +++ b/moeo/test/t-moeoSEEA.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoSPEA2.cpp b/moeo/test/t-moeoSPEA2.cpp index 3e2a27183..861977c55 100644 --- a/moeo/test/t-moeoSPEA2.cpp +++ b/moeo/test/t-moeoSPEA2.cpp @@ -48,11 +48,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoSPEA2Archive.cpp b/moeo/test/t-moeoSPEA2Archive.cpp index 8fb094510..df3af2d3a 100644 --- a/moeo/test/t-moeoSPEA2Archive.cpp +++ b/moeo/test/t-moeoSPEA2Archive.cpp @@ -46,11 +46,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoSharingDiversityAssignment.cpp b/moeo/test/t-moeoSharingDiversityAssignment.cpp index 1dd3973fa..81232617a 100644 --- a/moeo/test/t-moeoSharingDiversityAssignment.cpp +++ b/moeo/test/t-moeoSharingDiversityAssignment.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoStrictObjectiveVectorComparator.cpp b/moeo/test/t-moeoStrictObjectiveVectorComparator.cpp index b36302f80..f23ac84f2 100644 --- a/moeo/test/t-moeoStrictObjectiveVectorComparator.cpp +++ b/moeo/test/t-moeoStrictObjectiveVectorComparator.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoUnboundedArchive.cpp b/moeo/test/t-moeoUnboundedArchive.cpp index 5c4d8f180..1193b5f23 100644 --- a/moeo/test/t-moeoUnboundedArchive.cpp +++ b/moeo/test/t-moeoUnboundedArchive.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoVecVsVecAdditiveEpsilonBinaryMetric.cpp b/moeo/test/t-moeoVecVsVecAdditiveEpsilonBinaryMetric.cpp index db2500f97..99901beb2 100644 --- a/moeo/test/t-moeoVecVsVecAdditiveEpsilonBinaryMetric.cpp +++ b/moeo/test/t-moeoVecVsVecAdditiveEpsilonBinaryMetric.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoVecVsVecMultiplicativeEpsilonBinaryMetric.cpp b/moeo/test/t-moeoVecVsVecMultiplicativeEpsilonBinaryMetric.cpp index cd22abfcd..880794e01 100644 --- a/moeo/test/t-moeoVecVsVecMultiplicativeEpsilonBinaryMetric.cpp +++ b/moeo/test/t-moeoVecVsVecMultiplicativeEpsilonBinaryMetric.cpp @@ -47,11 +47,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/moeo/test/t-moeoWeakObjectiveVectorComparator.cpp b/moeo/test/t-moeoWeakObjectiveVectorComparator.cpp index 9ff0f89ab..f193b1ee7 100644 --- a/moeo/test/t-moeoWeakObjectiveVectorComparator.cpp +++ b/moeo/test/t-moeoWeakObjectiveVectorComparator.cpp @@ -45,11 +45,11 @@ class ObjectiveVectorTraits : public moeoObjectiveVectorTraits { public: - static bool minimizing (int i) + static bool minimizing (int /*i*/) { return true; } - static bool maximizing (int i) + static bool maximizing (int /*i*/) { return false; } diff --git a/problems/eval/nkLandscapesEval.h b/problems/eval/nkLandscapesEval.h index cfdaab60a..73d490876 100644 --- a/problems/eval/nkLandscapesEval.h +++ b/problems/eval/nkLandscapesEval.h @@ -114,7 +114,7 @@ public: void deleteTables() { if (links != NULL) { - for(int i = 0; i < N; i++) { + for(unsigned i = 0; i < N; i++) { delete [] (links[i]); } delete [] links; @@ -122,7 +122,7 @@ public: } if (tables != NULL) { - for(int i = 0; i < N; i++) { + for(unsigned i = 0; i < N; i++) { delete [] (tables[i]); } delete [] tables; @@ -210,8 +210,8 @@ public: * @param file the file to read */ void loadLinks(std::fstream & file) { - for(int j = 0; j < K+1; j++) - for(int i = 0; i < N; i++) { + for(unsigned j = 0; j < K+1; j++) + for(unsigned i = 0; i < N; i++) { file >> links[i][j]; } } @@ -222,8 +222,8 @@ public: * @param file the file to read */ void loadTables(std::fstream & file) { - for(int j = 0; j < (1<<(K+1)); j++) - for(int i = 0; i < N; i++) + for(unsigned j = 0; j < (1<<(K+1)); j++) + for(unsigned i = 0; i < N; i++) file >> tables[i][j]; } @@ -241,13 +241,13 @@ public: file << "p NK " << N << " " << K < Date: Wed, 4 Sep 2024 08:55:48 +0200 Subject: [PATCH 065/113] fix(doc): use current source dir and not the root one. Allow Paradiseo to be built as a Git submodule of another project. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abe421bb6..5bec9ae43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ set(MPI "false" CACHE BOOL "Build the MPI module") ## EO Module set(MODULE_NAME "Paradiseo") -set(DOXYGEN_CONFIG_DIR ${CMAKE_SOURCE_DIR}/doxygen) +set(DOXYGEN_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doxygen) # set(EO_MODULE_NAME "Evolving Objects") set(CMAKE_SOURCE_DIR ${EO_SRC_DIR}) add_subdirectory(${EO_SRC_DIR}) From 51be7e324b07c90d9b1b4b93c7fa9f8d668f76b5 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 5 Sep 2024 14:42:40 +0200 Subject: [PATCH 066/113] fix(moRndVectorVNSelection): use shuffle for modern compilers --- mo/src/neighborhood/moRndVectorVNSelection.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mo/src/neighborhood/moRndVectorVNSelection.h b/mo/src/neighborhood/moRndVectorVNSelection.h index af4ab22dd..86a9d00b7 100644 --- a/mo/src/neighborhood/moRndVectorVNSelection.h +++ b/mo/src/neighborhood/moRndVectorVNSelection.h @@ -52,7 +52,7 @@ public: /** * Default constructor with first search heuristics * - * @param _firstLS first local search + * @param _firstLS first local search * @param _firstShake first heuristic which perturbs the solution * @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop. */ @@ -67,7 +67,7 @@ public: } /** - * test if there is still some heuristics + * test if there is still some heuristics * * @param _solution the current solution * @return true if there is some heuristics @@ -83,11 +83,17 @@ public: */ virtual void init(EOT& /*_solution*/) { if(order.size() == 0) - for(unsigned int i = 0; i < LSvector.size(); i++) - order.push_back(i); - + for(unsigned int i = 0; i < LSvector.size(); i++) { + order.push_back(i); } + +#if __cplusplus >= 201103L + std::random_device rd; + std::mt19937 gen(rd()); + std::shuffle(order.begin(), order.end(), gen); +#else UF_random_generator gen(order.size()); std::random_shuffle(order.begin(), order.end(), gen); +#endif currentOrder = 0; current = order[currentOrder]; From 8dd4f529f27147d216cafb311e1d82537373e2d2 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 09:21:15 +0200 Subject: [PATCH 067/113] fix(eoExceptions): do not return a ref from a temp --- eo/src/eoExceptions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index b91bd6207..a41a7e4a9 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -45,7 +45,7 @@ public: const char* what() const throw() { - return message().c_str(); + return _msg.c_str(); } ~eoException() throw() {} From 1a61cd1f1c5346977148c0616c518527139ef64c Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 09:21:51 +0200 Subject: [PATCH 068/113] fix(eoGnuplot): get rid of warnings about unused variables --- eo/src/utils/eoGnuplot.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/eo/src/utils/eoGnuplot.cpp b/eo/src/utils/eoGnuplot.cpp index 2a7fe5229..ae34e6c79 100644 --- a/eo/src/utils/eoGnuplot.cpp +++ b/eo/src/utils/eoGnuplot.cpp @@ -56,22 +56,24 @@ eoGnuplot::~eoGnuplot() } - +#ifdef HAVE_GNUPLOT void eoGnuplot::gnuplotCommand(const char *_command) { -#ifdef HAVE_GNUPLOT if(gpCom) { PipeComSend( gpCom, _command ); PipeComSend( gpCom, "\n" ); } -#endif } +#else +void eoGnuplot::gnuplotCommand(const char *) +{ } +#endif +#ifdef HAVE_GNUPLOT void eoGnuplot::initGnuPlot(std::string _title, std::string _extra) { -#ifdef HAVE_GNUPLOT std::ostringstream os; os << "250x150-0+" << 170 * numWindow++; char *args[6]; @@ -89,8 +91,12 @@ void eoGnuplot::initGnuPlot(std::string _title, std::string _extra) PipeComSend( gpCom, _extra.c_str() ); PipeComSend( gpCom, "\n" ); } -#endif + } +#else +void eoGnuplot::initGnuPlot(std::string, std::string) +{ } +#endif From c23b9c160a8dbf3227ced2538a572e1235661940 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 09:22:16 +0200 Subject: [PATCH 069/113] fix(selectors): correctly initialize rawTotal --- eo/src/utils/selectors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eo/src/utils/selectors.h b/eo/src/utils/selectors.h index 7f0f571ed..b97a08fbf 100644 --- a/eo/src/utils/selectors.h +++ b/eo/src/utils/selectors.h @@ -179,7 +179,8 @@ double sum_fitness(const eoPop& _pop) template double sum_fitness(const eoPop& _pop, std::pair& _minmax) { - double rawTotal, scaledTotal; + double rawTotal = 0; + double scaledTotal; typename eoPop::const_iterator it = _pop.begin(); From 32195a480b1792de8502bebb2f2dd386563a1fc3 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 09:26:00 +0200 Subject: [PATCH 070/113] fix(selectors): comment out unused variable --- eo/src/utils/selectors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eo/src/utils/selectors.h b/eo/src/utils/selectors.h index b97a08fbf..fda0633ca 100644 --- a/eo/src/utils/selectors.h +++ b/eo/src/utils/selectors.h @@ -179,7 +179,7 @@ double sum_fitness(const eoPop& _pop) template double sum_fitness(const eoPop& _pop, std::pair& _minmax) { - double rawTotal = 0; + // double rawTotal = 0; double scaledTotal; typename eoPop::const_iterator it = _pop.begin(); @@ -194,7 +194,7 @@ double sum_fitness(const eoPop& _pop, std::pair& _minmax) _minmax.first = std::min(_minmax.first, v); _minmax.second = std::max(_minmax.second, v); - rawTotal += v; + // rawTotal += v; } if (minimizing_fitness()) From 867b1c289b85f123cc543723c65592b888cf3d66 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 09:28:55 +0200 Subject: [PATCH 071/113] fix(eoEvalUserTimeThrowException): preprocessor test for POSIX and UNIX --- eo/src/eoEvalUserTimeThrowException.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eo/src/eoEvalUserTimeThrowException.h b/eo/src/eoEvalUserTimeThrowException.h index 1e2edda6f..a11748491 100644 --- a/eo/src/eoEvalUserTimeThrowException.h +++ b/eo/src/eoEvalUserTimeThrowException.h @@ -21,9 +21,9 @@ Authors: Johann Dréo */ -#if !defined(__unix__) && !defined(_WINDOWS) +#if !defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS) #warning "Warning: class 'eoEvalUserTimeThrowException' is only available under UNIX (defining 'rusage' in 'sys/resource.h') or Win32 (defining 'GetProcessTimes' in 'WinBase.h') systems, contributions for other systems are welcomed." -#else //!defined(__unix__) && !defined(_WINDOWS) +#else // defined(_POSIX_VERSION) || defined(__unix__) || defined(_WINDOWS) #ifndef __EOEVALUSERTIMETHROWEXCEPTION_H__ #define __EOEVALUSERTIMETHROWEXCEPTION_H__ @@ -40,7 +40,7 @@ Johann Dréo #include "eoExceptions.h" -#ifdef __unix__ +#if defined(_POSIX_VERSION) || defined(__unix__) #include #include @@ -106,6 +106,6 @@ protected: }; #endif // _WINDOWS -#endif //__unix__ +#endif // defined(_POSIX_VERSION) || defined(__unix__) #endif // __EOEVALUSERTIMETHROWEXCEPTION_H__ -#endif //!defined(__unix__) && !defined(_WINDOWS) +#endif //!defined(_POSIX_VERSION) && !defined(__unix__) && !defined(_WINDOWS) From df8c457f7588581610f0c57213ec90bb934467c1 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 10:45:18 +0200 Subject: [PATCH 072/113] fix(moeoSPEA2Archive): correct members init order --- moeo/src/archive/moeoSPEA2Archive.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/moeo/src/archive/moeoSPEA2Archive.h b/moeo/src/archive/moeoSPEA2Archive.h index f5b60e63f..d2c64b83a 100644 --- a/moeo/src/archive/moeoSPEA2Archive.h +++ b/moeo/src/archive/moeoSPEA2Archive.h @@ -81,7 +81,7 @@ public: * Default ctor. * @param _maxSize the size of archive (must be smaller or equal to the population size) */ - moeoSPEA2Archive(unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(defaultDistance) + moeoSPEA2Archive(unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), defaultDistance(), distance(defaultDistance) {} @@ -90,7 +90,7 @@ public: * @param _dist the distance used * @param _maxSize the size of archive (must be smaller or egal to the population size) */ - moeoSPEA2Archive(moeoDistance & _dist, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(_dist) + moeoSPEA2Archive(moeoDistance & _dist, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), distance(_dist) {} @@ -99,7 +99,7 @@ public: * @param _comparator the functor used to compare objective vectors * @param _maxSize the size of archive (must be smaller or egal to the population size) */ - moeoSPEA2Archive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(defaultDistance) + moeoSPEA2Archive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), defaultDistance(), distance(defaultDistance) {} @@ -108,7 +108,7 @@ public: * @param _indiComparator the functor used to compare MOEOT * @param _maxSize the size of archive (must be smaller or egal to the population size) */ - moeoSPEA2Archive(moeoComparator & _indiComparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(_indiComparator), distance(defaultDistance) + moeoSPEA2Archive(moeoComparator & _indiComparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(_indiComparator), defaultDistance(), distance(defaultDistance) {} @@ -119,7 +119,7 @@ public: * @param _comparator the functor used to compare objective vectors * @param _maxSize the size of archive (must be smaller or egal to the population size) */ - moeoSPEA2Archive(moeoComparator & _indiComparator, moeoDistance & _dist, moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100) : moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), indiComparator(_indiComparator), distance(_dist) + moeoSPEA2Archive(moeoComparator & _indiComparator, moeoDistance & _dist, moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100) : moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(_indiComparator), distance(_dist) {} @@ -283,11 +283,12 @@ public: private: - /** archive max size */ unsigned int maxSize; /** archive size */ unsigned int borne; + /** default moeoComparator*/ + moeoFitnessThenDiversityComparator < MOEOT > defaultComparator; /** * Wrapper which allow to used an moeoComparator in std::sort * @param _comp the comparator to used @@ -314,12 +315,10 @@ private: moeoComparator < MOEOT > & comp; } indiComparator; - /** default moeoComparator*/ - moeoFitnessThenDiversityComparator < MOEOT > defaultComparator; - /** distance */ - moeoDistance & distance; /** default distance */ moeoEuclideanDistance < MOEOT > defaultDistance; + /** distance */ + moeoDistance & distance; /** From a6a3f799e77a874849fac500db4921da23c030d0 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 10:57:50 +0200 Subject: [PATCH 073/113] fix(eoParallel): declutch _t_start under _OPENMP --- eo/src/utils/eoParallel.cpp | 6 ++++-- eo/src/utils/eoParallel.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eo/src/utils/eoParallel.cpp b/eo/src/utils/eoParallel.cpp index cae5e8c41..41704c54b 100644 --- a/eo/src/utils/eoParallel.cpp +++ b/eo/src/utils/eoParallel.cpp @@ -39,8 +39,10 @@ eoParallel::eoParallel() : _nthreads( 0, "parallelize-nthreads", "Define the number of threads you want to use, nthreads = 0 means you want to use all threads available", '\0' ), _enableResults( false, "parallelize-enable-results", "Enable the generation of results", '\0' ), _doMeasure( false, "parallelize-do-measure", "Do some measures during execution", '\0' ), - _packetSize( 1U, "parallelize-packet-size", "Number of elements which should be sent in a single message during a parallel evaluation based on message passing.", '\0'), - _t_start(0) + _packetSize( 1U, "parallelize-packet-size", "Number of elements which should be sent in a single message during a parallel evaluation based on message passing.", '\0') +#ifdef _OPENMP + , _t_start(0) +#endif { } diff --git a/eo/src/utils/eoParallel.h b/eo/src/utils/eoParallel.h index 6608706dc..929d955d6 100644 --- a/eo/src/utils/eoParallel.h +++ b/eo/src/utils/eoParallel.h @@ -71,7 +71,9 @@ private: eoValueParam _enableResults; eoValueParam _doMeasure; eoValueParam _packetSize; +#ifdef _OPENMP double _t_start; +#endif }; void make_parallel(eoParser&); From 11f49e58d77afc3cd9cbf46fa57bc25d6872918a Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 12 Sep 2022 15:20:05 +0200 Subject: [PATCH 074/113] feat: prepare the use of binary partitions for signatures --- mo/src/problems/partition/moBinaryPartition.h | 107 +++++++++++++++++ .../partition/moBinaryPartitionSwapNeighbor.h | 89 +++++++++++++++ .../moBinaryPartitionSwapNeighborhood.h | 108 ++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 mo/src/problems/partition/moBinaryPartition.h create mode 100644 mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h create mode 100644 mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h new file mode 100644 index 000000000..2fedb50ef --- /dev/null +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -0,0 +1,107 @@ +#pragma once + +#include + +#include + +template +class moBinaryPartition : public EO +{ + public: + using AtomType = size_t; + using ContainerType = std::set; + + ContainerType selected; + ContainerType rejected; + + /** Constructor + * + * @param total_nb_genes Total number of possible genes from whith to select. + */ + moBinaryPartition( const size_t total_nb_genes ) + { + // Fill the rejected list with all possible gene indices, + // starting from zero. + for(size_t i = 0; i < total_nb_genes; ++i) { + rejected.insert(i); + } + // No selected. + } + + void select(const size_t atom) { + assert(not selected.contains(atom)); + + #ifndef NDEBUG + size_t has_erased = + #endif + this->rejected.erase(atom); + assert(has_erased == 1); + + #ifndef NDEBUG + auto [where, has_inserted] = + #endif + this->selected.insert(atom); + assert(has_inserted); + } + + void reject(const size_t atom) { + assert(not rejected.contains(atom)); + + #ifndef NDEBUG + size_t has_erased = + #endif + this->selected.erase(atom); + assert(has_erased == 1); + + #ifndef NDEBUG + auto [where, has_inserted] = + #endif + this->rejected.insert(atom); + assert(has_inserted); + } + + /** Serialization of the `selected` atoms. */ + virtual void printOn(std::ostream& out) const + { + EO::printOn(out); // Fitness. + // Trailing space already inserted. + out << selected.size() << " "; // Size. + std::copy(std::begin(selected), std::end(selected), + std::ostream_iterator(out, " ")); // Values. + out << " "; + out << rejected.size() << " "; // Size. + std::copy(std::begin(rejected), std::end(rejected), + std::ostream_iterator(out, " ")); // Values. + } + + /** Deserialization of the `selected` atoms. */ + virtual void readFrom(std::istream& in) + { + EO::readFrom(in); // Fitness. + unsigned size; + in >> size; // Size. + for(size_t i = 0; i < size; ++i) { + AtomType atom; + in >> atom; // Value. + selected.insert(atom); + } + assert(selected.size() == size); + in >> size; // Size. + for(size_t i = 0; i < size; ++i) { + AtomType atom; + in >> atom; // Value. + rejected.insert(atom); + } + assert(rejected.size() == size); + } + + bool operator==(const moBinaryPartition& other) { + return this->selected == other.selected + and this->rejected == other.rejected; + } + + virtual std::string className() const + { + return "moBinaryPartition"; + } +}; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h new file mode 100644 index 000000000..86e97a74d --- /dev/null +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -0,0 +1,89 @@ +#pragma once + +#include + +#include + +#include "moBinaryPartition.h" + +template +class moBinaryPartitionSwapNeighbor : + public moBackableNeighbor//, + // public moIndexNeighbor +{ + public: + using AtomType = typename EOT::AtomType; + using ContainerType = typename EOT::ContainerType; + using moBackableNeighbor::fitness; + // using moIndexNeighbor::key; + // using moIndexNeighbor::index; + + moBinaryPartitionSwapNeighbor( const size_t _selected_nb ) : + selected_nb(_selected_nb), + is_set(false) + { + assert(selected_nb > 0); + } + + virtual void move(EOT& solution) override { + assert(is_set); + // Swap the two atoms. + solution.reject(this->reject); + solution.select(this->select); + assert(solution.selected.size() == this->selected_nb); + + solution.invalidate(); + } + + virtual void moveBack(EOT& solution) override { + assert(is_set); + solution.reject(this->select); + solution.select(this->reject); + assert(solution.selected.size() == this->selected_nb); + + solution.invalidate(); + } + + void set(AtomType in, AtomType out) { + this->select = in; + this->reject = out; + #ifndef NDEBUG + is_set = true; + #endif + } + + std::pair get() { + assert(is_set); + return std::make_pair(select, reject); + } + + virtual bool equals(moBinaryPartitionSwapNeighbor& neighbor) { + auto [in, out] = neighbor.get(); + return this->select == in and this->reject == out; + } + + virtual std::string className() const override { + return "moBinaryPartitionSwapNeighbor"; + } + + virtual void printOn(std::ostream& out) const override { + assert(is_set); + out << selected_nb + << " -" << reject + << " +" << select; + } + +#ifndef NDEBUG + public: +#else + protected: +#endif + const size_t selected_nb; + AtomType select; + AtomType reject; + #ifndef NDEBUG + bool is_set; + #endif +}; + + diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h new file mode 100644 index 000000000..e92382357 --- /dev/null +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -0,0 +1,108 @@ +#pragma once + +#include + +#include +#include "moBinaryPartition.h" + +template +class moBinaryPartitionSwapNeighborhood : public moNeighborhood > +{ + public: + using Neighbor = moBinaryPartitionSwapNeighbor; + using AtomType = typename EOT::AtomType; + + AtomType selected(EOT& from, const size_t i_select) { + typename EOT::ContainerType::iterator + it = std::begin(from.rejected); + std::advance(it, i_select); + return *it; + } + + AtomType rejected(EOT& from, const size_t j_reject) { + typename EOT::ContainerType::iterator + it = std::begin(from.selected); + std::advance(it, j_reject); + return *it; + } + + virtual void init(EOT& from, Neighbor& to) override { + i_select = 0; + j_reject = 0; + + // std::clog << "Init neighborhood:" + // << " -" << rejected(from, j_reject) + // << " +" << selected(from, i_select) + // << std::endl; + + // First item in both lists. + AtomType in = selected(from, i_select); + AtomType out = rejected(from, j_reject); + to.set(in, out); + } + + virtual void next(EOT& from, Neighbor& to) override { + // If last item of the inner loop. + if( i_select == from.rejected.size()-1 ) { + i_select = 0; // Reset inner loop. + j_reject++; // Next outer loop. + } else { + i_select++; // Next inner loop. + } + + // std::clog << "Next in neighborhood:" + // << " -" << rejected(from, j_reject) + // << " +" << selected(from, i_select) + // << std::endl; + + assert( from.rejected.contains(selected(from,i_select)) ); + assert( from.selected.contains(rejected(from,j_reject)) ); + assert( selected(from,i_select) != rejected(from,j_reject) ); + + // Implant this move in the neighbor. + to.set( + selected(from, i_select), + rejected(from, j_reject) + ); + } + + virtual bool cont(EOT& from) override { + // Outer loop on selected, + // inner loop on rejected. + // std::clog << "cont neighborhood?" + // << " " << j_reject << "(-" << rejected(from, j_reject) << ")/" << from.selected.size() + // << " " << i_select << "(-" << selected(from, i_select) << ")/" << from.rejected.size() + // << std::endl; + + // If reached the last item of the outer loop. + if( i_select == from.rejected.size()-1 + and j_reject == from.selected.size()-1) { + // We should also have reached the end of the inner loop, + // and have set the inner loop to zero. + // std::clog << "\tnope" << std::endl; + return false; + + } else { // There is still some items in the outer loop. + // and thus also in the inner loop. + // std::clog << "\tyes" << std::endl; + assert( j_reject < from.selected.size() ); + return true; + } + } + + virtual bool hasNeighbor(EOT& solution) override { + return solution.rejected.size() > 0; + } + + virtual std::string className() const override { + return "moBinaryPartitionSwapNeighborhood"; + } + +#ifndef NDEBUG + public: +#else + protected: +#endif + size_t i_select; + size_t j_reject; +}; From 2accb17599025618c4be9a18884e2d77640742a2 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 13 Sep 2022 15:25:33 +0200 Subject: [PATCH 075/113] document everything and remove dead code --- mo/src/problems/partition/moBinaryPartition.h | 64 +++++++++++++++++-- .../partition/moBinaryPartitionSwapNeighbor.h | 60 ++++++++++++++++- .../moBinaryPartitionSwapNeighborhood.h | 36 ++++++++++- 3 files changed, 150 insertions(+), 10 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 2fedb50ef..7fd53bce0 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -4,30 +4,76 @@ #include +/** A partition of a binary space. + * + * This data structure defines a grouping of the elements of a multi-dimensional + * set in a space of boolean numbers. + * \f[ + * \mathrm{1}^n = \bigcup_{i=1}^n \{0,1\}_i + * \f] + * Elements of the set may be either "selected" (in the set S) or "rejected" (in the set R). + * \f[ + * (S \in \mathrm{1}^m) \cup (R \in \mathrm{1}^k) \in \mathrm{1}^n,\; n=m+k + * \f] + * Elements are referred to by their index in the set (hereby named "atoms"). + * + * This representation is useful if your problem can be defined has selecting + * a subset of elements that optimize some objective function. + * + * The core data structures are two ordered sets of unique atoms, + * the union of which is guaranteed to have the correct dimension. + */ template class moBinaryPartition : public EO { public: + /** The type for indices. */ using AtomType = size_t; + + /** The data structures holding the indices. */ using ContainerType = std::set; + /** The set of selected atoms. */ ContainerType selected; + + /** The set of not-selected atoms. */ ContainerType rejected; - /** Constructor + /** Consistent constructor * - * @param total_nb_genes Total number of possible genes from whith to select. + * Put all `total_nb_atoms` indices in the @ref rejected set. + * Indices starts at zero and fill the set in increasing order. + * + * @param total_nb_atoms Total number of possible atoms from whith to select. */ - moBinaryPartition( const size_t total_nb_genes ) + moBinaryPartition( const size_t total_nb_atoms ) { // Fill the rejected list with all possible gene indices, // starting from zero. - for(size_t i = 0; i < total_nb_genes; ++i) { + for(size_t i = 0; i < total_nb_atoms; ++i) { rejected.insert(i); } - // No selected. + // None selected. } + /** Empty constructor + * + * Do not fill the @ref rejected set. + * You are responsible for making it consistent after instantiation. + * + * @warning If you do not fill at least the @ref rejected set, + * errors will be raised whe trying to @ref select or @ref reject. + */ + moBinaryPartition() + { } + + /** Move one atom in the @ref selected set. + * + * That is: erase the atom from @ref rejected, + * insert it in @ref selected. + * + * @note In debug mode, double check that elements were actually moved. + */ void select(const size_t atom) { assert(not selected.contains(atom)); @@ -44,6 +90,13 @@ class moBinaryPartition : public EO assert(has_inserted); } + /** Move one atom in the @ref rejected set. + * + * That is: insert the atom in @ref rejected, + * erase it from @ref selected. + * + * @note In debug mode, double check that elements were actually moved. + */ void reject(const size_t atom) { assert(not rejected.contains(atom)); @@ -95,6 +148,7 @@ class moBinaryPartition : public EO assert(rejected.size() == size); } + /** Returns true if all sets are equals. */ bool operator==(const moBinaryPartition& other) { return this->selected == other.selected and this->rejected == other.rejected; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index 86e97a74d..af7449398 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -6,25 +6,53 @@ #include "moBinaryPartition.h" +/** Stable neighbor for a binary partition. + * + * Models how to move from a solution to a neighbor, + * by swaping one selected atom for one rejected atom. + * The number of selected atoms is thus guaranteed to be stable. + * + * The core data structure is two atoms: + * - the selected one, + * - the rejected one. + */ template class moBinaryPartitionSwapNeighbor : public moBackableNeighbor//, - // public moIndexNeighbor + // public moIndexNeighbor // FIXME see if we can model that. { public: + /** Shortcut for Atom’s type. */ using AtomType = typename EOT::AtomType; + + /** Shortcut for container’s type. */ using ContainerType = typename EOT::ContainerType; + + /** Shortcut for fitness. */ using moBackableNeighbor::fitness; + // using moIndexNeighbor::key; // using moIndexNeighbor::index; + /** Consistent constructor. + * + * Will ensure that the dimension of the partition does not change. + * + * @param _selected_nb Number of selected atoms to maintain. + */ moBinaryPartitionSwapNeighbor( const size_t _selected_nb ) : - selected_nb(_selected_nb), - is_set(false) + selected_nb(_selected_nb) + #ifndef NDEBUG + , is_set(false) + #endif { assert(selected_nb > 0); } + /** Apply the currently stored move. + * + * That is: reject one atom and select one other. + */ virtual void move(EOT& solution) override { assert(is_set); // Swap the two atoms. @@ -35,6 +63,10 @@ class moBinaryPartitionSwapNeighbor : solution.invalidate(); } + /** Apply the opposite of the currently stored move. + * + * That is: reject the selected atom, and select the rejected one. + */ virtual void moveBack(EOT& solution) override { assert(is_set); solution.reject(this->select); @@ -44,6 +76,11 @@ class moBinaryPartitionSwapNeighbor : solution.invalidate(); } + /** Set the considered atoms. + * + * @param in The selected atom. + * @param out The rejected atom. + */ void set(AtomType in, AtomType out) { this->select = in; this->reject = out; @@ -52,11 +89,16 @@ class moBinaryPartitionSwapNeighbor : #endif } + /** Get the considered atom. + * + * @returns A pair of atoms, the first being the selected atom, the second being the rejected one. + */ std::pair get() { assert(is_set); return std::make_pair(select, reject); } + /** Returns true if this neighbor has the same selected & rejected atoms than the given neighbor. */ virtual bool equals(moBinaryPartitionSwapNeighbor& neighbor) { auto [in, out] = neighbor.get(); return this->select == in and this->reject == out; @@ -66,6 +108,7 @@ class moBinaryPartitionSwapNeighbor : return "moBinaryPartitionSwapNeighbor"; } + /** Fancy print. */ virtual void printOn(std::ostream& out) const override { assert(is_set); out << selected_nb @@ -78,10 +121,21 @@ class moBinaryPartitionSwapNeighbor : #else protected: #endif + /** Fixed dimension of the handled solutions. */ const size_t selected_nb; + + /** Selected atom. */ AtomType select; + + /** Rejected atom. */ AtomType reject; + #ifndef NDEBUG + /** Sanity flag. + * + * Used in debug builds to ensure that the neighbor + * have been set before being used. + */ bool is_set; #endif }; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index e92382357..694576732 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -5,13 +5,32 @@ #include #include "moBinaryPartition.h" +/** Stable neighborhood for binary partitions. + * + * This generates all neighbors of a binary partition + * that have the same dimension than the considered solution. + * I.e. it enumerates all the swaps of two atoms + * between the selected and rejected sets. + * + * The core data structure is two indices: + * - one for the position within the selected set of a binary partition, + * - the other for the position within the rejected set. + * + * The neighborhood is defined as enumerating the neighbors, + * first by going over the rejected atoms (outer loop), + * then by iterating over the selected atoms (inner loop). + */ template class moBinaryPartitionSwapNeighborhood : public moNeighborhood > { public: + /** Shortcut for neighbor's type. */ using Neighbor = moBinaryPartitionSwapNeighbor; + + /** Shortcut for Atom’s type. */ using AtomType = typename EOT::AtomType; + /** Get the currently pointed selected atom. */ AtomType selected(EOT& from, const size_t i_select) { typename EOT::ContainerType::iterator it = std::begin(from.rejected); @@ -19,6 +38,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood 0; } @@ -103,6 +132,9 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood Date: Mon, 3 Oct 2022 16:11:37 +0200 Subject: [PATCH 076/113] feat: adds partial eval and tests --- mo/src/problems/partition/moBinaryPartition.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 7fd53bce0..e74d0ea64 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -118,7 +118,7 @@ class moBinaryPartition : public EO { EO::printOn(out); // Fitness. // Trailing space already inserted. - out << selected.size() << " "; // Size. + out << selected.size() << " "; // Size. std::copy(std::begin(selected), std::end(selected), std::ostream_iterator(out, " ")); // Values. out << " "; From bfce997ce800fec9d565a79f05481779afd976a1 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 18 Oct 2022 11:12:38 +0200 Subject: [PATCH 077/113] first part of partial signature evaluation --- .../partition/moBinaryPartitionSwapNeighbor.h | 56 ++++++++++++++++++- .../moBinaryPartitionSwapNeighborhood.h | 2 + 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index af7449398..dd65b9c0d 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -49,6 +49,43 @@ class moBinaryPartitionSwapNeighbor : assert(selected_nb > 0); } + /** Default constructor. + * + * Will NOT ensure that the dimension of the partition does not change. + */ + moBinaryPartitionSwapNeighbor() : + selected_nb(0) + #ifndef NDEBUG + , is_set(false) + #endif + { + // Invalid fitness by default. + } + + /** Copy constructor. + */ + moBinaryPartitionSwapNeighbor( const moBinaryPartitionSwapNeighbor& other) : + selected_nb(other.selected_nb ) + #ifndef NDEBUG + , is_set(other.is_set) + #endif + { + this->fitness(other.fitness()); + } + + /** Default assignment operator. + */ + moBinaryPartitionSwapNeighbor& operator=( + const moBinaryPartitionSwapNeighbor& other) + { + this->fitness(other.fitness()); + this->selected_nb = other.selected_nb; + #ifndef NDEBUG + this->is_set = other.is_set; + #endif + return *this; + } + /** Apply the currently stored move. * * That is: reject one atom and select one other. @@ -58,7 +95,9 @@ class moBinaryPartitionSwapNeighbor : // Swap the two atoms. solution.reject(this->reject); solution.select(this->select); - assert(solution.selected.size() == this->selected_nb); + #ifndef NDEBUG + assert(solution.selected.size() == this->selected_nb); + #endif solution.invalidate(); } @@ -71,7 +110,9 @@ class moBinaryPartitionSwapNeighbor : assert(is_set); solution.reject(this->select); solution.select(this->reject); - assert(solution.selected.size() == this->selected_nb); + #ifndef NDEBUG + assert(solution.selected.size() == this->selected_nb); + #endif solution.invalidate(); } @@ -116,13 +157,22 @@ class moBinaryPartitionSwapNeighbor : << " +" << select; } + void size(size_t _selected_nb) { + assert(_selected_nb > 0); + this->selected_nb = _selected_nb; + } + + size_t size() const { + return this->selected_nb; + } + #ifndef NDEBUG public: #else protected: #endif /** Fixed dimension of the handled solutions. */ - const size_t selected_nb; + size_t selected_nb; /** Selected atom. */ AtomType select; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index 694576732..cf4845478 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -64,6 +64,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood Date: Wed, 18 Jan 2023 11:14:13 +0100 Subject: [PATCH 078/113] more doc --- mo/src/problems/partition/moBinaryPartition.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index e74d0ea64..c91c2848b 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -113,12 +113,16 @@ class moBinaryPartition : public EO assert(has_inserted); } - /** Serialization of the `selected` atoms. */ + /** Serialization of the `selected` and `rejected` atoms. + * + * Output a string of the form (spaces replaced with period here, to show their count): + * `.........` + */ virtual void printOn(std::ostream& out) const { EO::printOn(out); // Fitness. // Trailing space already inserted. - out << selected.size() << " "; // Size. + out << " " << selected.size() << " "; // Size. std::copy(std::begin(selected), std::end(selected), std::ostream_iterator(out, " ")); // Values. out << " "; @@ -127,7 +131,11 @@ class moBinaryPartition : public EO std::ostream_iterator(out, " ")); // Values. } - /** Deserialization of the `selected` atoms. */ + /** Deserialization of the `selected` and `rejected` atoms. + * + * Expects a string of the form (spaces replaced with period here, to show their count): + * `.........` + */ virtual void readFrom(std::istream& in) { EO::readFrom(in); // Fitness. From 36fe6e6f7d8be2aa95c65c5ce68faf2ea80ca1b5 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Wed, 18 Jan 2023 11:28:50 +0100 Subject: [PATCH 079/113] fix a warning --- mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index dd65b9c0d..8dca43d53 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -144,6 +144,11 @@ class moBinaryPartitionSwapNeighbor : auto [in, out] = neighbor.get(); return this->select == in and this->reject == out; } + private: + // Disable access to `equals(moNeighbor<…>&)` (removes the related overloaded-virtual warning). + using moBackableNeighbor::equals; + + public: virtual std::string className() const override { return "moBinaryPartitionSwapNeighbor"; From 237426a6b40a049617eb1106bc9736ce262cfa54 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 26 Jan 2023 11:48:44 +0100 Subject: [PATCH 080/113] refactor while hunting a bug --- mo/src/problems/partition/moBinaryPartition.h | 9 ++++ .../partition/moBinaryPartitionSwapNeighbor.h | 41 ++++++++++++++----- .../moBinaryPartitionSwapNeighborhood.h | 37 ++++++++++------- 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index c91c2848b..768cf3bd1 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -166,4 +166,13 @@ class moBinaryPartition : public EO { return "moBinaryPartition"; } + + void fitness(const FitT& fit) { + CLUTCHLOG(debug, "Fitness assignment -- solution: " << *this << " gets fitness: " << fit); + EO::fitness(fit); + } + + FitT fitness() const { + return EO::fitness(); + } }; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index 8dca43d53..dd9a93a3a 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -65,7 +65,9 @@ class moBinaryPartitionSwapNeighbor : /** Copy constructor. */ moBinaryPartitionSwapNeighbor( const moBinaryPartitionSwapNeighbor& other) : - selected_nb(other.selected_nb ) + selected_nb(other.selected_nb), + select(other.select), + reject(other.reject) #ifndef NDEBUG , is_set(other.is_set) #endif @@ -78,11 +80,13 @@ class moBinaryPartitionSwapNeighbor : moBinaryPartitionSwapNeighbor& operator=( const moBinaryPartitionSwapNeighbor& other) { - this->fitness(other.fitness()); this->selected_nb = other.selected_nb; + this->select = other.select; + this->reject = other.reject; #ifndef NDEBUG this->is_set = other.is_set; #endif + this->fitness(other.fitness()); return *this; } @@ -95,10 +99,7 @@ class moBinaryPartitionSwapNeighbor : // Swap the two atoms. solution.reject(this->reject); solution.select(this->select); - #ifndef NDEBUG - assert(solution.selected.size() == this->selected_nb); - #endif - + assert(solution.selected.size() == this->selected_nb); solution.invalidate(); } @@ -110,10 +111,7 @@ class moBinaryPartitionSwapNeighbor : assert(is_set); solution.reject(this->select); solution.select(this->reject); - #ifndef NDEBUG - assert(solution.selected.size() == this->selected_nb); - #endif - + assert(solution.selected.size() == this->selected_nb); solution.invalidate(); } @@ -128,6 +126,15 @@ class moBinaryPartitionSwapNeighbor : #ifndef NDEBUG is_set = true; #endif + this->invalidate(); + } + + /** Set the considered atoms. + * + * @param in_out A pair of {selected,rejected} atoms. + */ + void set(std::pair in_out) { + this->set(in_out.first, in_out.second); } /** Get the considered atom. @@ -157,7 +164,9 @@ class moBinaryPartitionSwapNeighbor : /** Fancy print. */ virtual void printOn(std::ostream& out) const override { assert(is_set); - out << selected_nb + EO::printOn(out); // Fitness. + out << " " + << selected_nb << " -" << reject << " +" << select; } @@ -165,12 +174,22 @@ class moBinaryPartitionSwapNeighbor : void size(size_t _selected_nb) { assert(_selected_nb > 0); this->selected_nb = _selected_nb; + this->invalidate(); } size_t size() const { return this->selected_nb; } + void fitness(const Fitness& fit) { + CLUTCHLOG(debug, "Fitness assignment -- neighbor: " << *this << " gets fitness: " << fit); + EO::fitness(fit); + } + + Fitness fitness() const { + return EO::fitness(); + } + #ifndef NDEBUG public: #else diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index cf4845478..50702be9a 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -55,16 +55,20 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood Date: Thu, 2 Feb 2023 14:48:02 +0100 Subject: [PATCH 081/113] refactor(fitness): store cache with the fitness to allow rollback with minimal mem footprint --- mo/src/problems/partition/moBinaryPartition.h | 20 ++++++--- .../partition/moBinaryPartitionSwapNeighbor.h | 14 ++++--- .../moBinaryPartitionSwapNeighborhood.h | 42 +++++++++---------- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 768cf3bd1..b1b698ab8 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -118,7 +118,7 @@ class moBinaryPartition : public EO * Output a string of the form (spaces replaced with period here, to show their count): * `.........` */ - virtual void printOn(std::ostream& out) const + virtual void printOn(std::ostream& out) const override { EO::printOn(out); // Fitness. // Trailing space already inserted. @@ -136,7 +136,7 @@ class moBinaryPartition : public EO * Expects a string of the form (spaces replaced with period here, to show their count): * `.........` */ - virtual void readFrom(std::istream& in) + virtual void readFrom(std::istream& in) override { EO::readFrom(in); // Fitness. unsigned size; @@ -162,17 +162,25 @@ class moBinaryPartition : public EO and this->rejected == other.rejected; } - virtual std::string className() const + virtual std::string className() const override { return "moBinaryPartition"; } - void fitness(const FitT& fit) { - CLUTCHLOG(debug, "Fitness assignment -- solution: " << *this << " gets fitness: " << fit); + virtual void fitness(const FitT& fit) override + { + // std::clog << "Fitness assignment -- solution: " << *this << " gets fitness: " << fit << std::endl; EO::fitness(fit); } - FitT fitness() const { + virtual const FitT& fitness() const override + { return EO::fitness(); } + + virtual void invalidate() override + { + // this->fitness().clear(); + EO::invalidate(); + } }; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index dd9a93a3a..2fe5d3a55 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -18,7 +18,7 @@ */ template class moBinaryPartitionSwapNeighbor : - public moBackableNeighbor//, + public moBackableNeighbor//, // public moIndexNeighbor // FIXME see if we can model that. { public: @@ -100,6 +100,7 @@ class moBinaryPartitionSwapNeighbor : solution.reject(this->reject); solution.select(this->select); assert(solution.selected.size() == this->selected_nb); + // this->fitness( Fitness(solution.fitness()) ); // For the cache. solution.invalidate(); } @@ -112,6 +113,7 @@ class moBinaryPartitionSwapNeighbor : solution.reject(this->select); solution.select(this->reject); assert(solution.selected.size() == this->selected_nb); + // this->fitness( Fitness(solution.fitness()) ); // For the cache. solution.invalidate(); } @@ -153,7 +155,7 @@ class moBinaryPartitionSwapNeighbor : } private: // Disable access to `equals(moNeighbor<…>&)` (removes the related overloaded-virtual warning). - using moBackableNeighbor::equals; + using moBackableNeighbor::equals; public: @@ -181,12 +183,14 @@ class moBinaryPartitionSwapNeighbor : return this->selected_nb; } - void fitness(const Fitness& fit) { - CLUTCHLOG(debug, "Fitness assignment -- neighbor: " << *this << " gets fitness: " << fit); + virtual void fitness(const Fitness& fit) override + { + // std::clog << "Fitness assignment -- neighbor: " << *this << " gets fitness: " << fit << std::endl; EO::fitness(fit); } - Fitness fitness() const { + virtual const Fitness& fitness() const override + { return EO::fitness(); } diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index 50702be9a..ca40fa551 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -55,13 +55,13 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood Date: Fri, 3 Feb 2023 10:35:10 +0100 Subject: [PATCH 082/113] refactor(app): separate main exe and datatester better log --- mo/src/problems/partition/moBinaryPartition.h | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index b1b698ab8..598de79c6 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -113,6 +113,27 @@ class moBinaryPartition : public EO assert(has_inserted); } + /** Serialization of the `selected`. + * + * Output a string of the form (spaces replaced with period here, to show their count): + * `....` + */ + virtual void printSelectedOn(std::ostream& out) const + { + EO::printOn(out); // Fitness. + // Trailing space already inserted. + out << " " << selected.size() << " "; // Size. + std::copy(std::begin(selected), std::end(selected), + std::ostream_iterator(out, " ")); // Values. + } + + std::string str() const + { + std::ostringstream msg; + this->printSelectedOn(msg); + return msg.str(); + } + /** Serialization of the `selected` and `rejected` atoms. * * Output a string of the form (spaces replaced with period here, to show their count): @@ -120,11 +141,7 @@ class moBinaryPartition : public EO */ virtual void printOn(std::ostream& out) const override { - EO::printOn(out); // Fitness. - // Trailing space already inserted. - out << " " << selected.size() << " "; // Size. - std::copy(std::begin(selected), std::end(selected), - std::ostream_iterator(out, " ")); // Values. + this->printSelectedOn(out); out << " "; out << rejected.size() << " "; // Size. std::copy(std::begin(rejected), std::end(rejected), From e57b504cd693d2490b859ddc0de44e61cdd7d468 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 3 Feb 2023 11:46:17 +0100 Subject: [PATCH 083/113] refactor(app): usable output --- mo/src/problems/partition/moBinaryPartition.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 598de79c6..36d1136fa 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -127,6 +127,7 @@ class moBinaryPartition : public EO std::ostream_iterator(out, " ")); // Values. } + //! Convenience function to only render the fitess and the selected atoms (and not the rejected ones). std::string str() const { std::ostringstream msg; From d64f2b38ed1294709e26fcfae89e44dcb7dc0df0 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 6 Feb 2023 23:12:36 +0100 Subject: [PATCH 084/113] refactor: put cache in lib + clean doc --- mo/src/problems/partition/moBinaryPartition.h | 32 +++++++++++-------- .../partition/moBinaryPartitionSwapNeighbor.h | 21 ++++++------ .../moBinaryPartitionSwapNeighborhood.h | 1 + 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 36d1136fa..253c838c6 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -180,25 +180,29 @@ class moBinaryPartition : public EO and this->rejected == other.rejected; } + //! Class name for state management. virtual std::string className() const override { return "moBinaryPartition"; } - virtual void fitness(const FitT& fit) override - { - // std::clog << "Fitness assignment -- solution: " << *this << " gets fitness: " << fit << std::endl; - EO::fitness(fit); - } + // //! Accessor to set fitness. + // virtual void fitness(const FitT& fit) override + // { + // // std::clog << "Fitness assignment -- solution: " << *this << " gets fitness: " << fit << std::endl; + // EO::fitness(fit); + // } - virtual const FitT& fitness() const override - { - return EO::fitness(); - } + // //! Accessor to get fitness. + // virtual const FitT& fitness() const override + // { + // return EO::fitness(); + // } - virtual void invalidate() override - { - // this->fitness().clear(); - EO::invalidate(); - } + // //! Accessor to invalidate fitness. + // virtual void invalidate() override + // { + // // this->fitness().clear(); + // EO::invalidate(); + // } }; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index 2fe5d3a55..915831122 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -159,6 +159,7 @@ class moBinaryPartitionSwapNeighbor : public: + //! Class name for state management. virtual std::string className() const override { return "moBinaryPartitionSwapNeighbor"; } @@ -173,26 +174,28 @@ class moBinaryPartitionSwapNeighbor : << " +" << select; } + //! Accessor to set the size. void size(size_t _selected_nb) { assert(_selected_nb > 0); this->selected_nb = _selected_nb; this->invalidate(); } + //! Accessor to get the size. size_t size() const { return this->selected_nb; } - virtual void fitness(const Fitness& fit) override - { - // std::clog << "Fitness assignment -- neighbor: " << *this << " gets fitness: " << fit << std::endl; - EO::fitness(fit); - } + // virtual void fitness(const Fitness& fit) override + // { + // // std::clog << "Fitness assignment -- neighbor: " << *this << " gets fitness: " << fit << std::endl; + // EO::fitness(fit); + // } - virtual const Fitness& fitness() const override - { - return EO::fitness(); - } + // virtual const Fitness& fitness() const override + // { + // return EO::fitness(); + // } #ifndef NDEBUG public: diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index ca40fa551..be677d0e2 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -134,6 +134,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood 0; } + //! Class name for state management. virtual std::string className() const override { return "moBinaryPartitionSwapNeighborhood"; } From a376921f075d88861a1b19d59fa23bbff57d5cf8 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 28 Mar 2023 18:58:51 +0200 Subject: [PATCH 085/113] add save-sol to output all solutions to a file --- mo/src/problems/partition/moBinaryPartition.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 253c838c6..3b3f478e9 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -143,10 +143,12 @@ class moBinaryPartition : public EO virtual void printOn(std::ostream& out) const override { this->printSelectedOn(out); - out << " "; - out << rejected.size() << " "; // Size. - std::copy(std::begin(rejected), std::end(rejected), - std::ostream_iterator(out, " ")); // Values. + // Printing the rejected atom should not be necessary, + // as this is the complementary set of the selected. + // out << " "; + // out << rejected.size() << " "; // Size. + // std::copy(std::begin(rejected), std::end(rejected), + // std::ostream_iterator(out, " ")); // Values. } /** Deserialization of the `selected` and `rejected` atoms. From b96b537ed137c4c6b291c3e71ea0c064d6e00ed3 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Tue, 10 Sep 2024 16:47:28 +0200 Subject: [PATCH 086/113] fix(nbhood): make accessors const --- mo/src/problems/partition/moBinaryPartition.h | 4 ++-- mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index 3b3f478e9..df5fed9fa 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -62,7 +62,7 @@ class moBinaryPartition : public EO * You are responsible for making it consistent after instantiation. * * @warning If you do not fill at least the @ref rejected set, - * errors will be raised whe trying to @ref select or @ref reject. + * errors will be raised when trying to @ref select or @ref reject. */ moBinaryPartition() { } @@ -127,7 +127,7 @@ class moBinaryPartition : public EO std::ostream_iterator(out, " ")); // Values. } - //! Convenience function to only render the fitess and the selected atoms (and not the rejected ones). + //! Convenience function to only render the fitness and the selected atoms (and not the rejected ones). std::string str() const { std::ostringstream msg; diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index be677d0e2..f91b252da 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -31,7 +31,7 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood Date: Mon, 12 Sep 2022 15:20:05 +0200 Subject: [PATCH 087/113] feat: prepare the use of binary partitions for signatures --- mo/test/t-moBinaryPartition.cpp | 90 +++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 mo/test/t-moBinaryPartition.cpp diff --git a/mo/test/t-moBinaryPartition.cpp b/mo/test/t-moBinaryPartition.cpp new file mode 100644 index 000000000..873d245bb --- /dev/null +++ b/mo/test/t-moBinaryPartition.cpp @@ -0,0 +1,90 @@ + +#include +#include +#include + +int main() +{ + using Signature = moBinaryPartition; + const size_t genes_nb = 4; + + /********************************************** + * Test if neighborhood has all neighbors. + **********************************************/ + Signature geneset(genes_nb); + std::clog << "Available genes:"; + for(size_t g : geneset.rejected) { + std::clog << " " << g; + } + std::clog << std::endl; + + const size_t n = 2; + for(size_t i=0; i < n; ++i) { + geneset.select(i); + } + + std::clog << "Init geneset: " << geneset << std::endl; + std::clog << std::endl; + + moBinaryPartitionSwapNeighborhood neighborhood; + + // Save generated solutions for testing. + std::vector solutions; + + // Follows the framework's workflow (see moRandomBestHCexplorer): + // 1) if hasNeighbor() + // 2) neighborhood.init(…) + // 3) [eval] + // 4) while neighborhood.cont(…) + // 5) neighborhood.next(…) + // 6) [eval] + // … loop. + if(neighborhood.hasNeighbor(geneset)) { + + moBinaryPartitionSwapNeighbor neighbor(n); + neighborhood.init(geneset, neighbor); + std::clog << "Init neighbor: " << neighbor << std::endl; + + // Print what it looks like. + std::clog << "Current geneset: " << geneset << std::endl; + Signature new_geneset = geneset; + neighbor.move(new_geneset); + std::clog << "Moved to solution: " << new_geneset << std::endl; + solutions.push_back(new_geneset); + std::clog << std::endl; + + while(neighborhood.cont(geneset)) { + // Generate next neighbor. + neighborhood.next(geneset, neighbor); + std::clog << "New neighbor: " << neighbor << std::endl; + + // Print what it looks like. + std::clog << "Current geneset: " << geneset << std::endl; + Signature new_geneset = geneset; + neighbor.move(new_geneset); + std::clog << "Moved to solution: " << new_geneset << std::endl; + solutions.push_back(new_geneset); + + // Double check that one can moveBack and get the same solution. + neighbor.moveBack(new_geneset); + assert(new_geneset == geneset); + std::clog << std::endl; + } + } + + std::clog << "Generated " << solutions.size() << " neighbors of: " << geneset << std::endl; + for(Signature s : solutions) { + std::clog << "\t" << s << std::endl; + } + assert(solutions.size() == 4); + + /********************************************** + * Test if a full solution does not have neighbor. + **********************************************/ + Signature full(genes_nb); + for(size_t i=0; i < genes_nb; ++i) { + full.select(i); + } + assert(not neighborhood.hasNeighbor(full)); + +} From 7b8e3936705a18c0212d7155ef1e10ade10471c7 Mon Sep 17 00:00:00 2001 From: BertheasLeo <108930465+BertheasLeo@users.noreply.github.com> Date: Wed, 10 Aug 2022 14:02:16 +0200 Subject: [PATCH 088/113] Update eoSIGContinue.h Correction sighandler is not defined on Windows --- eo/src/eoSIGContinue.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index 727c74a01..e30eeb24e 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -35,6 +35,8 @@ #include #include "eoContinue.h" +typedef void (*sighandler_t)(int); + /** @addtogroup Continuators * @{ */ From afa0d18d1e3515dcdc608fbb81836a41e780d86b Mon Sep 17 00:00:00 2001 From: BertheasLeo <108930465+BertheasLeo@users.noreply.github.com> Date: Wed, 10 Aug 2022 14:03:44 +0200 Subject: [PATCH 089/113] Update edoEstimatorNormalAdaptive.h Correction aliasing errror on Eigen --- edo/src/edoEstimatorNormalAdaptive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edo/src/edoEstimatorNormalAdaptive.h b/edo/src/edoEstimatorNormalAdaptive.h index 8dd03af1f..a19e14b91 100644 --- a/edo/src/edoEstimatorNormalAdaptive.h +++ b/edo/src/edoEstimatorNormalAdaptive.h @@ -233,7 +233,7 @@ public: Matrix mD = eigensolver.eigenvalues().asDiagonal(); // from variance to standard deviations - mD.cwiseSqrt(); + mD=mD.cwiseSqrt(); d.scaling( mD.diagonal() ); d.coord_sys( eigensolver.eigenvectors() ); From 399b22266199cf9a9c37ea97c5a287c0fd3c98a6 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 09:47:58 +0100 Subject: [PATCH 090/113] feat(EO): allow overriding fitness accessors May be useful for debugging, by tracing when fitness assignement occurs. --- eo/src/EO.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index 490dd7d83..f0e5213ac 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -72,7 +72,7 @@ public: virtual ~EO() {}; /// Return fitness value. - const Fitness& fitness() const { + virtual const Fitness& fitness() const { if (invalid()) throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); return repFitness; @@ -86,12 +86,12 @@ public: } // Set fitness as invalid. - void invalidate() { invalidFitness = true; repFitness = Fitness(); } + virtual void invalidate() { invalidFitness = true; repFitness = Fitness(); } /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - void fitness(const Fitness& _fitness) + virtual void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From ab375d55ac9327598333a37386ad144b5298566b Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 09:51:56 +0100 Subject: [PATCH 091/113] refactor(mo): use clog instead of cout & use at accessors in Debug builds Should really use eo::log, but waiting for logger refactoring. --- .../continuator/moBestNoImproveContinuator.h | 2 +- mo/src/continuator/moIterContinuator.h | 2 +- mo/src/continuator/moNeighborFitnessStat.h | 2 +- mo/src/continuator/moTimeContinuator.h | 2 +- mo/src/eval/moFullEvalByModif.h | 4 ++- mo/src/explorer/moILSexplorer.h | 2 +- mo/src/explorer/moMetropolisHastingExplorer.h | 2 +- mo/src/explorer/moNeighborhoodExplorer.h | 6 ++--- mo/src/explorer/moRandomBestHCexplorer.h | 27 +++++++++++++++---- mo/src/explorer/moRandomNeutralWalkExplorer.h | 2 +- mo/src/explorer/moRandomWalkExplorer.h | 2 +- mo/src/explorer/moSAexplorer.h | 2 +- mo/src/sampling/moSampling.h | 2 +- 13 files changed, 38 insertions(+), 19 deletions(-) diff --git a/mo/src/continuator/moBestNoImproveContinuator.h b/mo/src/continuator/moBestNoImproveContinuator.h index d772180f3..c14c4b87d 100644 --- a/mo/src/continuator/moBestNoImproveContinuator.h +++ b/mo/src/continuator/moBestNoImproveContinuator.h @@ -84,7 +84,7 @@ public: bool res = (cpt < maxNoImprove); if (!res && verbose) - std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl; + std::clog << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl; return res; } diff --git a/mo/src/continuator/moIterContinuator.h b/mo/src/continuator/moIterContinuator.h index f9400254c..ff3056062 100644 --- a/mo/src/continuator/moIterContinuator.h +++ b/mo/src/continuator/moIterContinuator.h @@ -57,7 +57,7 @@ public: cpt++; res = (cpt < maxIter); if (!res && verbose) - std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl; + std::clog << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl; return res; } diff --git a/mo/src/continuator/moNeighborFitnessStat.h b/mo/src/continuator/moNeighborFitnessStat.h index ab0d3bcb9..5cbe3351d 100644 --- a/mo/src/continuator/moNeighborFitnessStat.h +++ b/mo/src/continuator/moNeighborFitnessStat.h @@ -62,7 +62,7 @@ public : neighborhood(_neighborhood), eval(_eval) { if (!neighborhood.isRandom()) { - std::cout << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl; + std::clog << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl; } } diff --git a/mo/src/continuator/moTimeContinuator.h b/mo/src/continuator/moTimeContinuator.h index 172fec933..67804dda9 100644 --- a/mo/src/continuator/moTimeContinuator.h +++ b/mo/src/continuator/moTimeContinuator.h @@ -94,7 +94,7 @@ public: time_t elapsed = (time_t) difftime(time(NULL), start); res = (elapsed < max); if (!res && verbose) - std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl; + std::clog << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl; return res; } diff --git a/mo/src/eval/moFullEvalByModif.h b/mo/src/eval/moFullEvalByModif.h index 80ee94d1c..a4cb9369a 100644 --- a/mo/src/eval/moFullEvalByModif.h +++ b/mo/src/eval/moFullEvalByModif.h @@ -40,7 +40,9 @@ /** * Full evaluation to use with a moBackableNeighbor - * !!!WARNING!!! Use only when your solution is composed by a fitness Value and a "genotype" + * + * @warning Use only when your solution is composed by a fitness Value and a "genotype", + * and no any other data structure. * */ template diff --git a/mo/src/explorer/moILSexplorer.h b/mo/src/explorer/moILSexplorer.h index 49d74fea5..89d7bfd47 100644 --- a/mo/src/explorer/moILSexplorer.h +++ b/mo/src/explorer/moILSexplorer.h @@ -126,7 +126,7 @@ public: //apply the local search on the copy ls(currentSol); -// std::cout << "(solution)\t" << current << std::endl; +// std::clog << "(solution)\t" << current << std::endl; }; diff --git a/mo/src/explorer/moMetropolisHastingExplorer.h b/mo/src/explorer/moMetropolisHastingExplorer.h index ea0913f1e..9716469b9 100644 --- a/mo/src/explorer/moMetropolisHastingExplorer.h +++ b/mo/src/explorer/moMetropolisHastingExplorer.h @@ -71,7 +71,7 @@ public: moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl; + std::clog << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl; } } diff --git a/mo/src/explorer/moNeighborhoodExplorer.h b/mo/src/explorer/moNeighborhoodExplorer.h index 8b4113b7a..2db8623ac 100644 --- a/mo/src/explorer/moNeighborhoodExplorer.h +++ b/mo/src/explorer/moNeighborhoodExplorer.h @@ -44,16 +44,16 @@ #include /** - * Explore the neighborhood according to the local search algorithm + * Explore the neighborhood according to the local search algorithm * * During this exploration, * the parameters are updated * one neighbor is selected * a comparason with the solution is made to acccept or not this new neighbor - * + * * The current neighbor (currentNeigbor) is the neighbor under consideration during the search (in operator()(EOT &)) * - * The selected neighbor (selectedNeighbor) is the neighbor selected in method operator()(EOT &). + * The selected neighbor (selectedNeighbor) is the neighbor selected in method operator()(EOT &). * If this neighbor is accepted, then the solution is moved on this neighbor (in move(EOT &)) * */ diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index 92e690e37..3e7218065 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -120,6 +120,7 @@ public: eval(_solution, currentNeighbor); //initialize the best neighbor + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); //test all others neighbors @@ -129,21 +130,37 @@ public: //eval eval(_solution, currentNeighbor); + assert(not currentNeighbor.invalid()); //if we found a better neighbor, update the best + #ifndef NDEBUG + assert(bestVector.size() > 0); + assert(not bestVector.at(0).invalid()); + if (neighborComparator(bestVector.at(0), currentNeighbor)) { + #else if (neighborComparator(bestVector[0], currentNeighbor)) { + #endif bestVector.clear(); + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); } - else if (neighborComparator.equals(currentNeighbor, bestVector[0])) //if the current is equals to previous best solutions then update vector of the best solution + //if the current is equals to previous best solutions + // then update vector of the best solution + #ifndef NDEBUG + else if (neighborComparator.equals(currentNeighbor, bestVector.at(0))) { + #else + else if (neighborComparator.equals(currentNeighbor, bestVector[0])) { + #endif + assert(not currentNeighbor.invalid()); bestVector.push_back(currentNeighbor); + } } - // choose randomly one of the best solutions - unsigned int i = rng.random(bestVector.size()); + // choose randomly one of the best solutions + unsigned int i = rng.random(bestVector.size()); - // the selected Neighbor - selectedNeighbor = bestVector[i]; + // the selected Neighbor + selectedNeighbor = bestVector[i]; } else { //if _solution hasn't neighbor, diff --git a/mo/src/explorer/moRandomNeutralWalkExplorer.h b/mo/src/explorer/moRandomNeutralWalkExplorer.h index e8f9713bf..521c357e6 100644 --- a/mo/src/explorer/moRandomNeutralWalkExplorer.h +++ b/mo/src/explorer/moRandomNeutralWalkExplorer.h @@ -73,7 +73,7 @@ public: nbStep(_nbStep) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; + std::clog << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; } } diff --git a/mo/src/explorer/moRandomWalkExplorer.h b/mo/src/explorer/moRandomWalkExplorer.h index 889382a2b..d0a84fe29 100644 --- a/mo/src/explorer/moRandomWalkExplorer.h +++ b/mo/src/explorer/moRandomWalkExplorer.h @@ -68,7 +68,7 @@ public: moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval) : moNeighborhoodExplorer(_neighborhood, _eval) { isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; + std::clog << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random (" << neighborhood.className() << ")" << std::endl; } } diff --git a/mo/src/explorer/moSAexplorer.h b/mo/src/explorer/moSAexplorer.h index b774d5c57..132d584f9 100644 --- a/mo/src/explorer/moSAexplorer.h +++ b/mo/src/explorer/moSAexplorer.h @@ -72,7 +72,7 @@ public: isAccept = false; if (!neighborhood.isRandom()) { - std::cout << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl; + std::clog << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl; } } diff --git a/mo/src/sampling/moSampling.h b/mo/src/sampling/moSampling.h index 90dee4707..93ae19615 100644 --- a/mo/src/sampling/moSampling.h +++ b/mo/src/sampling/moSampling.h @@ -75,7 +75,7 @@ public: checkpoint = new moCheckpoint(*continuator); add(_stat, _monitoring); // precision of the output by default - precisionOutput = std::cout.precision(); + precisionOutput = std::clog.precision(); } /** From e5c387b5671e23e2425e45d734f047fa0417dc50 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:51:29 +0100 Subject: [PATCH 092/113] fix(eoStandardBitMutation): - Fix all operators in eoStandardBitMutation.h - Bitflip componennt was not bound, use explicit assignement of rates. - Fix normal and fast operators algorithms. Co-authored-by: Potalas --- eo/src/ga/eoStandardBitMutation.h | 174 +++++++++++++++++++----------- eo/test/t-eoFoundryFastGA.cpp | 14 +-- 2 files changed, 116 insertions(+), 72 deletions(-) diff --git a/eo/src/ga/eoStandardBitMutation.h b/eo/src/ga/eoStandardBitMutation.h index fd6e4263e..32ece1342 100644 --- a/eo/src/ga/eoStandardBitMutation.h +++ b/eo/src/ga/eoStandardBitMutation.h @@ -7,6 +7,8 @@ /** Standard bit mutation with mutation rate p: * choose k from the binomial distribution Bin(n,p) and apply flip_k(x). * + * If rate is null (the default), use 1/chrom.size(). + * * @ingroup Bitstrings * @ingroup Variators */ @@ -14,7 +16,11 @@ template class eoStandardBitMutation : public eoMonOp { public: - eoStandardBitMutation(double rate = 0.5) : + /** Constructor. + * + * @param rate mutation rate, 1/chrom.size() if ignored or zero (the default) + */ + eoStandardBitMutation(double rate = 0) : _rate(rate), _nb(1), _bitflip(_nb) @@ -22,9 +28,12 @@ class eoStandardBitMutation : public eoMonOp virtual bool operator()(EOT& chrom) { + assert(chrom.size()>0); + if(_rate == 0) { + _rate = (double) 1/chrom.size(); + } _nb = eo::rng.binomial(chrom.size(),_rate); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + _bitflip.number_bits(_nb); return _bitflip(chrom); } @@ -46,8 +55,7 @@ template class eoUniformBitMutation : public eoMonOp { public: - eoUniformBitMutation(double rate = 0.5) : - _rate(rate), + eoUniformBitMutation() : _nb(1), _bitflip(_nb) {} @@ -55,15 +63,13 @@ class eoUniformBitMutation : public eoMonOp virtual bool operator()(EOT& chrom) { _nb = eo::rng.random(chrom.size()); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + _bitflip.number_bits(_nb); return _bitflip(chrom); } virtual std::string className() const {return "eoUniformBitMutation";} protected: - double _rate; unsigned _nb; eoDetSingleBitFlip _bitflip; }; @@ -84,17 +90,21 @@ template class eoConditionalBitMutation : public eoStandardBitMutation { public: - eoConditionalBitMutation(double rate = 0.5) : + eoConditionalBitMutation(double rate = 0) : eoStandardBitMutation(rate) {} virtual bool operator()(EOT& chrom) { assert(chrom.size()>0); - this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); - this->_nb++; - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + if(this->_rate == 0) { + this->_rate = (double) 1/chrom.size(); + } + this->_nb = 0; + while(this->_nb < 1) { + this->_nb = eo::rng.binomial(chrom.size(),this->_rate); + } + this->_bitflip.number_bits(this->_nb); return this->_bitflip(chrom); } @@ -123,12 +133,14 @@ class eoShiftedBitMutation : public eoStandardBitMutation virtual bool operator()(EOT& chrom) { assert(chrom.size()>0); - this->_nb = eo::rng.binomial(chrom.size()-1,this->_rate); + if(this->_rate == 0) { + this->_rate = (double) 1/chrom.size(); + } + this->_nb = eo::rng.binomial(chrom.size(),this->_rate); if(this->_nb == 0) { this->_nb = 1; } - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. + this->_bitflip.number_bits(this->_nb); return this->_bitflip(chrom); } @@ -142,7 +154,7 @@ class eoShiftedBitMutation : public eoStandardBitMutation * * From: * Furong Ye, Carola Doerr, and Thomas Back. - * Interpolating local and global search by controllingthe variance of standard bit mutation. + * Interpolating local and global search by controlling the variance of standard bit mutation. * In 2019 IEEE Congress on Evolutionary Computation(CEC), pages 2292–2299. * * In contrast to standard bit mutation, this operators allows to scale @@ -152,29 +164,40 @@ class eoShiftedBitMutation : public eoStandardBitMutation * @ingroup Variators */ template -class eoNormalBitMutation : public eoStandardBitMutation +class eoNormalBitMutation : public eoMonOp { public: - eoNormalBitMutation(double rate = 0.5, double variance = 1) : - eoStandardBitMutation(rate), - _variance(variance) + eoNormalBitMutation(double mean = 0, double variance = 0) : + _mean(mean), + _variance(variance), + _nb(1), + _bitflip(_nb) {} virtual bool operator()(EOT& chrom) { - this->_nb = eo::rng.normal(this->_rate * chrom.size(), _variance); - if(this->_nb >= chrom.size()) { - this->_nb = eo::rng.random(chrom.size()); + assert(chrom.size() > 0); + if(_mean == 0) { + _mean = (double) 1/chrom.size(); } - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + if(_variance == 0) { + _variance = std::log(chrom.size()); + } + _nb = eo::rng.normal(_mean, _variance); + if(_nb >= chrom.size()) { + _nb = eo::rng.random(chrom.size()); + } + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoNormalBitMutation";} protected: + double _mean; double _variance; + unsigned _nb; + eoDetSingleBitFlip _bitflip; }; /** Fast mutation which size is sampled from an adaptive power law. @@ -188,11 +211,10 @@ class eoNormalBitMutation : public eoStandardBitMutation * @ingroup Variators */ template -class eoFastBitMutation : public eoStandardBitMutation +class eoFastBitMutation : public eoMonOp { public: - eoFastBitMutation(double rate = 0.5, double beta = 1.5) : - eoStandardBitMutation(rate), + eoFastBitMutation(double beta = 1.5) : _beta(beta) { assert(beta > 1); @@ -200,74 +222,96 @@ class eoFastBitMutation : public eoStandardBitMutation virtual bool operator()(EOT& chrom) { - this->_nb = powerlaw(chrom.size(),_beta); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + _nb = powerlaw(chrom.size(),_beta); + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoFastBitMutation";} protected: - - double powerlaw(unsigned n, double beta) + double powerlaw(unsigned int n, double beta) { double cnb = 0; - for(unsigned i=1; i= trigger) { + rate = static_cast(i) / static_cast(n); + break; + } + } + return eo::rng.binomial(n,rate); } + // double powerlaw(unsigned n, double beta) + // { + // double cnb = 0; + // for(unsigned i=1; i _bitflip; }; /** Bucket mutation which assign probability for each bucket + * + * @warning Highly untested code, use with caution. * * From: - * Carola Doerr, Johann Dréo, Alexis Robbes + * Carola Doerr, Johann Dreo, Alexis Robbes */ template -class eoBucketBitMutation : public eoStandardBitMutation +class eoBucketBitMutation : public eoMonOp { public: - eoBucketBitMutation(std::vector bucketsSizes, std::vector bucketValues) : - _bucketsSizes(bucketsSizes), - _bucketValues(bucketValues) - + eoBucketBitMutation(std::vector> buckets, std::vector bucketsValues) : + _buckets(buckets), + _bucketsValues(bucketsValues) { - assert(bucketsSizes.size() != bucketValues.size()); + assert(buckets.size() == bucketsValues.size()); } virtual bool operator()(EOT& chrom) { - - this->_nb = customlaw(chrom.size(), _bucketsSizes, _bucketValues); - // BitFlip operator is bound to the _nb reference, - // thus one don't need to re-instantiate. - return this->_bitflip(chrom); + _nb = customlaw(chrom.size(), _buckets, _bucketsValues); + _bitflip.number_bits(_nb); + return _bitflip(chrom); } virtual std::string className() const {return "eoBucketBitMutation";} protected: - double customlaw(unsigned n, std::vector bucketsSizes, std::vector bucketValues) + double customlaw(unsigned n, std::vector> buckets, std::vector bucketsValues) { - int targetBucketIndex = eo::rng.roulette_wheel(bucketValues); - int nb = 0; - int bucketIndex = 0; - while (nb < n && bucketIndex <= targetBucketIndex) - { - if (bucketIndex < targetBucketIndex) nb += int(n*bucketsSizes[bucketIndex]); - else nb += int(eo::rng.uniform(1, n*bucketsSizes[targetBucketIndex])); - } - if (nb > n) nb = n; - - return nb; - } + int bucketIndex = eo::rng.roulette_wheel(bucketsValues); + int startBit = buckets[bucketIndex][0]; + int endBit = buckets[bucketIndex][1]; + int gapBit = endBit - startBit; - std::vector _bucketsSizes; - std::vector _bucketValues; + int nbBits; + if (gapBit > 0) { + nbBits = rand() % gapBit + startBit; + } else { + nbBits = endBit; + } + return nbBits; + } + std::vector _bucketsValues; + std::vector> _buckets; + + unsigned _nb; + eoDetSingleBitFlip _bitflip; }; + #endif // _eoStandardBitMutation_h_ diff --git a/eo/test/t-eoFoundryFastGA.cpp b/eo/test/t-eoFoundryFastGA.cpp index 6a6ee0322..24231d639 100644 --- a/eo/test/t-eoFoundryFastGA.cpp +++ b/eo/test/t-eoFoundryFastGA.cpp @@ -30,13 +30,13 @@ eoAlgoFoundryFastGA& make_foundry(eoFunctorStore& store, eoInit& ini foundry.crossovers.add< eo1PtBitXover >(); /***** Mutations ****/ - double p = 1.0; // Probability of flipping eath bit. - foundry.mutations.add< eoUniformBitMutation >(p); // proba of flipping k bits, k drawn in uniform distrib - foundry.mutations.add< eoStandardBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib - foundry.mutations.add< eoConditionalBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib, minus zero - foundry.mutations.add< eoShiftedBitMutation >(p); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one - foundry.mutations.add< eoNormalBitMutation >(p); // proba of flipping k bits, k drawn in normal distrib - foundry.mutations.add< eoFastBitMutation >(p); // proba of flipping k bits, k drawn in powerlaw distrib + // Use defaults for all operators (usually falls back to p=1/chrom.size()). + foundry.mutations.add< eoUniformBitMutation >(); // proba of flipping k bits, k drawn in uniform distrib + foundry.mutations.add< eoStandardBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib + foundry.mutations.add< eoConditionalBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib, minus zero + foundry.mutations.add< eoShiftedBitMutation >(); // proba of flipping k bits, k drawn in binomial distrib, changing zeros to one + foundry.mutations.add< eoNormalBitMutation >(); // proba of flipping k bits, k drawn in normal distrib + foundry.mutations.add< eoFastBitMutation >(); // proba of flipping k bits, k drawn in powerlaw distrib for(size_t i=1; i < 11; i+=1) { foundry.mutations.add< eoDetSingleBitFlip >(i); // mutate k bits without duplicates } From dcac78cdf5ef27ddb33902ae8e94e651e2679fa7 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:54:18 +0100 Subject: [PATCH 093/113] fix(mo): missing include --- mo/src/explorer/moRandomBestHCexplorer.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mo/src/explorer/moRandomBestHCexplorer.h b/mo/src/explorer/moRandomBestHCexplorer.h index 3e7218065..bac6cc66b 100644 --- a/mo/src/explorer/moRandomBestHCexplorer.h +++ b/mo/src/explorer/moRandomBestHCexplorer.h @@ -35,11 +35,13 @@ #ifndef _moRandomBestHCexplorer_h #define _moRandomBestHCexplorer_h +#include +#include + #include #include #include #include -#include #include /** From 1c853ecdb95f9c99b42c6fcb62725d79487371ea Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:54:45 +0100 Subject: [PATCH 094/113] revert 399b22266 (virtual fitness interface temptative) Incompatible with MOEO's change of interface. --- eo/src/EO.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index f0e5213ac..a2c3b490a 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -72,7 +72,9 @@ public: virtual ~EO() {}; /// Return fitness value. - virtual const Fitness& fitness() const { + // virtual const Fitness& fitness() const { // This would be impossible with MOEO. + // virtual Fitness fitness() const { // Cannot do that either, MOEO changes the interface. + Fitness fitness() const { if (invalid()) throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); return repFitness; @@ -91,7 +93,7 @@ public: /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - virtual void fitness(const Fitness& _fitness) + void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From cf086ea9b9ed235b9703cb870bc7dad2fa38d1fe Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Sep 2024 20:26:36 +0200 Subject: [PATCH 095/113] fix(moBinaryPartition): finalize integration in --- mo/src/mo.h | 5 ++++- mo/src/problems/partition/moBinaryPartition.h | 12 ++++++++++-- .../partition/moBinaryPartitionSwapNeighbor.h | 1 - .../partition/moBinaryPartitionSwapNeighborhood.h | 9 +++++++-- mo/test/CMakeLists.txt | 1 + mo/test/t-moBinaryPartition.cpp | 4 +--- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mo/src/mo.h b/mo/src/mo.h index 3f44d2df7..f936b646d 100755 --- a/mo/src/mo.h +++ b/mo/src/mo.h @@ -184,6 +184,10 @@ #include #include +#include +#include +#include + //#include //#include //#include @@ -193,7 +197,6 @@ //#include //#include - #include #include #include diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index df5fed9fa..7feaef0b3 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -75,7 +75,11 @@ class moBinaryPartition : public EO * @note In debug mode, double check that elements were actually moved. */ void select(const size_t atom) { - assert(not selected.contains(atom)); + #if __cplusplus >= 202002L + assert(not selected.contains(atom)); + #else + assert(selected.count(atom) == 0); + #endif #ifndef NDEBUG size_t has_erased = @@ -98,7 +102,11 @@ class moBinaryPartition : public EO * @note In debug mode, double check that elements were actually moved. */ void reject(const size_t atom) { - assert(not rejected.contains(atom)); + #if __cplusplus >= 202002L + assert(not rejected.contains(atom)); + #else + assert(rejected.count(atom) == 0); + #endif #ifndef NDEBUG size_t has_erased = diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index 915831122..8f6bc601c 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -3,7 +3,6 @@ #include #include - #include "moBinaryPartition.h" /** Stable neighbor for a binary partition. diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index f91b252da..d51325b26 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -87,8 +87,13 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood= 202002L + assert( from.rejected.contains(selected(from,i_select)) ); + assert( from.selected.contains(rejected(from,j_reject)) ); + #else + assert( from.rejected.count(selected(from,i_select)) > 0 ); + assert( from.selected.count(rejected(from,j_reject)) > 0 ); + #endif assert( selected(from,i_select) != rejected(from,j_reject) ); // Implant this move in the neighbor. diff --git a/mo/test/CMakeLists.txt b/mo/test/CMakeLists.txt index a27f97db9..184cdb651 100644 --- a/mo/test/CMakeLists.txt +++ b/mo/test/CMakeLists.txt @@ -96,6 +96,7 @@ set (TEST_LIST t-moIndexedVectorTabuList # t-moRndIndexedVectorTabuList t-moDynSpanCoolingSchedule + t-moBinaryPartition ) ###################################################################################### diff --git a/mo/test/t-moBinaryPartition.cpp b/mo/test/t-moBinaryPartition.cpp index 873d245bb..3300c83bf 100644 --- a/mo/test/t-moBinaryPartition.cpp +++ b/mo/test/t-moBinaryPartition.cpp @@ -1,7 +1,5 @@ -#include -#include -#include +#include int main() { From db24e611b776c3c21fea23475039da1779d7e738 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Wed, 11 Sep 2024 11:03:38 +0200 Subject: [PATCH 096/113] refactor(tests): reduce runtime for foundry tests --- eo/test/t-eoAlgoFoundryFastGA.cpp | 18 +++++++++--------- eo/test/t-forge-FastGA.cpp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eo/test/t-eoAlgoFoundryFastGA.cpp b/eo/test/t-eoAlgoFoundryFastGA.cpp index fa97ca1b8..4513cdf6f 100644 --- a/eo/test/t-eoAlgoFoundryFastGA.cpp +++ b/eo/test/t-eoAlgoFoundryFastGA.cpp @@ -25,7 +25,7 @@ int main(int /*argc*/, char** /*argv*/) /***** Crossovers ****/ foundry.crossovers.add< eo1PtBitXover >(); - foundry.crossovers.add< eoUBitXover >(0.5); // preference over 1 + // foundry.crossovers.add< eoUBitXover >(0.5); // preference over 1 for(size_t i=1; i < 11; i+=4) { foundry.crossovers.add< eoNPtsBitXover >(i); // nb of points } @@ -43,9 +43,9 @@ int main(int /*argc*/, char** /*argv*/) std::ref(foundry.mutation_selectors) }) { ops.add< eoRandomSelect >(); - ops.add< eoStochTournamentSelect >(0.5); - ops.add< eoSequentialSelect >(); - ops.add< eoProportionalSelect >(); + // ops.add< eoStochTournamentSelect >(0.5); + // ops.add< eoSequentialSelect >(); + // ops.add< eoProportionalSelect >(); for(size_t i=2; i < 10; i+=4) { ops.add< eoDetTournamentSelect >(i); } @@ -53,16 +53,16 @@ int main(int /*argc*/, char** /*argv*/) /***** Replacements ****/ foundry.replacements.add< eoCommaReplacement >(); - foundry.replacements.add< eoPlusReplacement >(); - foundry.replacements.add< eoSSGAWorseReplacement >(); - foundry.replacements.add< eoSSGAStochTournamentReplacement >(0.51); + // foundry.replacements.add< eoPlusReplacement >(); + // foundry.replacements.add< eoSSGAWorseReplacement >(); + // foundry.replacements.add< eoSSGAStochTournamentReplacement >(0.51); for(size_t i=2; i < 10; i+=4) { foundry.replacements.add< eoSSGADetTournamentReplacement >(i); } /***** Continuators ****/ - for(size_t i=10; i < 30; i+=10 ) { - foundry.continuators.add< eoSteadyFitContinue >(10,i); + for(size_t i=3; i < 5; i+=1 ) { + foundry.continuators.add< eoGenContinue >(i); } diff --git a/eo/test/t-forge-FastGA.cpp b/eo/test/t-forge-FastGA.cpp index e4f713cff..52af1129f 100644 --- a/eo/test/t-forge-FastGA.cpp +++ b/eo/test/t-forge-FastGA.cpp @@ -19,7 +19,7 @@ int main(int /*argc*/, char** /*argv*/) eoBooleanGenerator gen(0.5); eoInitFixedLength init(dim, gen); - eoGenContinue common_cont(100); + eoGenContinue common_cont(5); eoForgeVector< eoContinue > continuators; continuators.add< eoSteadyFitContinue >(10,10); From 846006c613478e00550ef192fd76dc549c41fac1 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Sat, 21 Sep 2024 10:22:47 +0200 Subject: [PATCH 097/113] feat(moSA): adds a constructor without cool but with cont --- mo/src/algo/moSA.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mo/src/algo/moSA.h b/mo/src/algo/moSA.h index c126f31fc..5748f020a 100644 --- a/mo/src/algo/moSA.h +++ b/mo/src/algo/moSA.h @@ -79,6 +79,20 @@ public: explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool) {} + /** + * Constructor without cooling schedule, but with a continuator. + * + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + */ + moSA(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + defaultCool(0, 0, 0, 0), + explorer(_neighborhood, _eval, defaultSolNeighborComp, defaultCool) + {} + /** * General constructor for a simulated annealing * @param _neighborhood the neighborhood From 19ec4c4ff760b5470163f0e940d1148449b6f3ad Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 26 Sep 2024 13:24:10 +0200 Subject: [PATCH 098/113] feat(eo): wrap ops on float vecs into ops on int vecs Adds wrapper classes to make any MonOp or QuadOp that operates on eoReal embbedable in any operator needing an eoInt. --- eo/src/eo | 4 ++ eo/src/eoInt.h | 5 +- eo/src/eoRealToIntMonOp.h | 73 +++++++++++++++++++++++++ eo/src/eoRealToIntQuadOp.h | 94 +++++++++++++++++++++++++++++++++ eo/src/es/eoReal.h | 1 + eo/test/CMakeLists.txt | 2 + eo/test/t-eoRealToIntMonOp.cpp | 28 ++++++++++ eo/test/t-eoRealToIntQuadOp.cpp | 35 ++++++++++++ 8 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 eo/src/eoRealToIntMonOp.h create mode 100644 eo/src/eoRealToIntQuadOp.h create mode 100644 eo/test/t-eoRealToIntMonOp.cpp create mode 100644 eo/test/t-eoRealToIntQuadOp.cpp diff --git a/eo/src/eo b/eo/src/eo index 55c070857..77a65e249 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -224,6 +224,10 @@ #include "utils/eoLogger.h" #include "utils/eoParallel.h" +#include "eoInt.h" +#include "eoRealToIntMonOp.h" +#include "eoRealToIntQuadOp.h" + #endif // Local Variables: diff --git a/eo/src/eoInt.h b/eo/src/eoInt.h index 0f0feb3e1..efeba4a62 100644 --- a/eo/src/eoInt.h +++ b/eo/src/eoInt.h @@ -36,9 +36,12 @@ * * @ingroup Representations */ -template class eoInt: public eoVector +template +class eoInt: public eoVector { public: + using AtomType = size_t; + using FitnessType = FitT; /** * (Default) Constructor. diff --git a/eo/src/eoRealToIntMonOp.h b/eo/src/eoRealToIntMonOp.h new file mode 100644 index 000000000..47207a185 --- /dev/null +++ b/eo/src/eoRealToIntMonOp.h @@ -0,0 +1,73 @@ +#ifndef eoRealToIntMonOp_h_INCLUDED +#define eoRealToIntMonOp_h_INCLUDED + +#include "es/eoReal.h" +#include "utils/eoIntBounds.h" + +template> +class eoRealToIntMonOp : public eoMonOp +{ +public: + + using EOTreal = EOTREAL; + + enum Repair { + folds, + truncate + }; + + eoRealToIntMonOp( eoMonOp& monop ) : + _whenout(Repair::truncate), + _nobounds(), + _bounds(_nobounds), + _monop(monop) + { } + + eoRealToIntMonOp( eoMonOp& monop, eoIntBounds& bounds, Repair whenout = Repair::truncate ) : + _whenout(whenout), + _nobounds(), + _bounds(bounds), + _monop(monop) + { } + + bool operator()(EOTINT& intsol) + { + #ifndef NDEBUG + for(size_t i=0; i < intsol.size(); ++i) { + assert(_bounds.isInBounds(intsol[i])); + } + #endif + + EOTreal floatsol; + std::copy( std::begin(intsol), std::end(intsol), std::back_inserter(floatsol) ); + + bool changed = _monop(floatsol); + + if(changed) { + for(size_t i=0; i < floatsol.size(); ++i) { + typename EOTreal::AtomType rounded = std::round(floatsol[i]); + if( not _bounds.isInBounds(rounded) ) { + switch(_whenout) { + case Repair::truncate: + _bounds.truncate(rounded); + break; + case Repair::folds: + _bounds.foldsInBounds(rounded); + break; + } + } + intsol[i] = static_cast(rounded); + } + } + return changed; + } + +protected: + Repair _whenout; + eoIntNoBounds _nobounds; + + eoIntBounds& _bounds; + eoMonOp& _monop; +}; + +#endif // eoRealToIntMonOp_h_INCLUDED diff --git a/eo/src/eoRealToIntQuadOp.h b/eo/src/eoRealToIntQuadOp.h new file mode 100644 index 000000000..7a5e02044 --- /dev/null +++ b/eo/src/eoRealToIntQuadOp.h @@ -0,0 +1,94 @@ +#ifndef eoRealToIntQuadOp_h_INCLUDED +#define eoRealToIntQuadOp_h_INCLUDED + +#include "es/eoReal.h" +#include "utils/eoIntBounds.h" + +template> +class eoRealToIntQuadOp : public eoQuadOp +{ +public: + + using EOTreal = EOTREAL; + + enum Repair { + folds, + truncate + }; + + eoRealToIntQuadOp( eoQuadOp& quadop ) : + _whenout(Repair::truncate), + _nobounds(), + _bounds(_nobounds), + _quadop(quadop) + { } + + eoRealToIntQuadOp( eoQuadOp& quadop, eoIntBounds& bounds, Repair whenout = Repair::truncate ) : + _whenout(whenout), + _nobounds(), + _bounds(bounds), + _quadop(quadop) + { } + + bool operator()(EOTINT& intsol1, EOTINT& intsol2) + { + #ifndef NDEBUG + for(size_t i=0; i < intsol1.size(); ++i) { + assert(_bounds.isInBounds(intsol1[i])); + } + for(size_t i=0; i < intsol2.size(); ++i) { + assert(_bounds.isInBounds(intsol2[i])); + } + #endif + + EOTreal floatsol1; + std::copy( std::begin(intsol1), std::end(intsol1), std::back_inserter(floatsol1) ); + + EOTreal floatsol2; + std::copy( std::begin(intsol2), std::end(intsol2), std::back_inserter(floatsol2) ); + + bool changed = _quadop(floatsol1, floatsol2); + + if(changed) { + for(size_t i=0; i < floatsol1.size(); ++i) { + typename EOTreal::AtomType rounded = std::round(floatsol1[i]); + if( not _bounds.isInBounds(rounded) ) { + switch(_whenout) { + case Repair::truncate: + _bounds.truncate(rounded); + break; + case Repair::folds: + _bounds.foldsInBounds(rounded); + break; + } + } + intsol1[i] = static_cast(rounded); + } + for(size_t i=0; i < floatsol2.size(); ++i) { + typename EOTreal::AtomType rounded = std::round(floatsol2[i]); + if( not _bounds.isInBounds(rounded) ) { + switch(_whenout) { + case Repair::truncate: + _bounds.truncate(rounded); + break; + case Repair::folds: + _bounds.foldsInBounds(rounded); + break; + } + } + intsol2[i] = static_cast(rounded); + } + } + return changed; + } + +protected: + Repair _whenout; + eoIntNoBounds _nobounds; + + eoIntBounds& _bounds; + eoQuadOp& _quadop; +}; + + +#endif // eoRealToIntQuadOp_h_INCLUDED diff --git a/eo/src/es/eoReal.h b/eo/src/es/eoReal.h index 440234f60..a611df3b6 100644 --- a/eo/src/es/eoReal.h +++ b/eo/src/es/eoReal.h @@ -39,6 +39,7 @@ template class eoReal: public eoVector { public: + using AtomType = double; using FitnessType = FitT; /** diff --git a/eo/test/CMakeLists.txt b/eo/test/CMakeLists.txt index b6b9afee6..8f8000890 100644 --- a/eo/test/CMakeLists.txt +++ b/eo/test/CMakeLists.txt @@ -80,6 +80,8 @@ set (TEST_LIST t-forge-FastGA t-eoFoundryFastGA t-eoAlgoFoundryFastGA + t-eoRealToIntMonOp + t-eoRealToIntQuadOp ) diff --git a/eo/test/t-eoRealToIntMonOp.cpp b/eo/test/t-eoRealToIntMonOp.cpp new file mode 100644 index 000000000..0aee0481a --- /dev/null +++ b/eo/test/t-eoRealToIntMonOp.cpp @@ -0,0 +1,28 @@ +#include + +#include +#include + +using namespace std; + +int main(int, char**) +{ + eoIntInterval bounds(1,5); + + using Chrom = eoInt; + using MutWrapper = eoRealToIntMonOp; + + eoDetUniformMutation< typename MutWrapper::EOTreal > mutreal(/*range*/6, /*nb*/5); + + MutWrapper mutint(mutreal, bounds); + + Chrom sol({1,2,3,4,5}); + + bool changed = mutint(sol); + assert(changed); + + for(auto& x : sol) { + assert(bounds.isInBounds(x)); + } +} + diff --git a/eo/test/t-eoRealToIntQuadOp.cpp b/eo/test/t-eoRealToIntQuadOp.cpp new file mode 100644 index 000000000..0ddfe7846 --- /dev/null +++ b/eo/test/t-eoRealToIntQuadOp.cpp @@ -0,0 +1,35 @@ +#include + +#include +#include + +using namespace std; + +int main(int, char**) +{ + eoIntInterval intbounds(1,5); + eoRealInterval rb(1,5); + eoRealVectorBounds realbounds(5, rb); + + using Chrom = eoInt; + using CrossWrapper = eoRealToIntQuadOp; + + eoSegmentCrossover< typename CrossWrapper::EOTreal > crossreal(realbounds, /*alpha*/0); + + CrossWrapper crossint(crossreal, intbounds); + + Chrom sol1({1,2,3,4,5}); + Chrom sol2({1,2,3,4,5}); + + bool changed = crossint(sol1, sol2); + assert(changed); + + for(auto& x : sol1) { + assert(intbounds.isInBounds(x)); + } + for(auto& x : sol2) { + assert(intbounds.isInBounds(x)); + } +} + + From 8ea6e2b680d00f82655584fcc199f90803f00fa2 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 27 Sep 2024 12:20:10 +0200 Subject: [PATCH 099/113] feat(eo): adds eoRealToIntInit --- eo/src/eo | 1 + eo/src/eoRealToIntInit.h | 74 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 eo/src/eoRealToIntInit.h diff --git a/eo/src/eo b/eo/src/eo index 77a65e249..0f6f133d3 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -227,6 +227,7 @@ #include "eoInt.h" #include "eoRealToIntMonOp.h" #include "eoRealToIntQuadOp.h" +#include "eoRealToIntInit.h" #endif diff --git a/eo/src/eoRealToIntInit.h b/eo/src/eoRealToIntInit.h new file mode 100644 index 000000000..4b79ca641 --- /dev/null +++ b/eo/src/eoRealToIntInit.h @@ -0,0 +1,74 @@ +#ifndef eoRealToIntInit_h_INCLUDED +#define eoRealToIntInit_h_INCLUDED + +#include "es/eoReal.h" +#include "utils/eoIntBounds.h" + +template> +class eoRealToIntInit : public eoInit +{ +public: + + using EOTreal = EOTREAL; + + enum Repair { + folds, + truncate + }; + + eoRealToIntInit( eoInit& init ) : + _whenout(Repair::truncate), + _nobounds(), + _bounds(_nobounds), + _init(init) + { } + + eoRealToIntInit( eoInit& init, eoIntBounds& bounds, Repair whenout = Repair::truncate ) : + _whenout(whenout), + _nobounds(), + _bounds(bounds), + _init(init) + { } + + virtual void operator()(EOTINT& intsol) override + { + #ifndef NDEBUG + for(size_t i=0; i < intsol.size(); ++i) { + assert(_bounds.isInBounds(intsol[i])); + } + #endif + + EOTreal floatsol; + std::copy( std::begin(intsol), std::end(intsol), std::back_inserter(floatsol) ); + + _init(floatsol); + + intsol.resize(floatsol.size()); + + for(size_t i=0; i < floatsol.size(); ++i) { + typename EOTreal::AtomType rounded = std::round(floatsol[i]); + if( not _bounds.isInBounds(rounded) ) { + switch(_whenout) { + case Repair::truncate: + _bounds.truncate(rounded); + break; + case Repair::folds: + _bounds.foldsInBounds(rounded); + break; + } + } + intsol[i] = static_cast(rounded); + } + } + +protected: + Repair _whenout; + eoIntNoBounds _nobounds; + + eoIntBounds& _bounds; + eoInit& _init; +}; + + + +#endif // eoRealToIntInit_h_INCLUDED From 190a30495e2d9af10a6b4a4f70bc51c68847ad1a Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 30 Sep 2024 20:42:20 +0200 Subject: [PATCH 100/113] fix(EO): allow readFrom to work on std::cin + invalidTag - std::cin does not allow seekg/tellg, so instead one wrap the read string in a istringstream, and then read from it. This allows to read from any istream, with or without seekg. - Adds an EO::invalidTag member, in case someone would need to use it (for instance as a regexp to sanitize inputs). --- eo/src/EO.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index a2c3b490a..09bb2d20d 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -64,6 +64,8 @@ template class EO: public eoObject, public eoPersistent public: typedef F Fitness; + static constexpr const char* invalidTag = "INVALID"; + /** Default constructor. */ EO(): repFitness(Fitness()), invalidFitness(true) { } @@ -124,25 +126,21 @@ public: * The read and print methods should be compatible and have the same format. * In principle, format is "plain": they just print a number * @param _is a std::istream. - * @throw eoInvalidFitnessError If a valid object can't be read. */ - virtual void readFrom(std::istream& _is) { - - // the new version of the reafFrom function. - // It can distinguish between valid and invalid fitness values. + virtual void readFrom(std::istream& _is) + { std::string fitness_str; - int pos = _is.tellg(); _is >> fitness_str; - if (fitness_str == "INVALID") + if (fitness_str == invalidTag) { invalidFitness = true; } else { invalidFitness = false; - _is.seekg(pos); // rewind - _is >> repFitness; + std::istringstream iss(fitness_str); + iss >> repFitness; } } @@ -150,12 +148,11 @@ public: * Write object. Called printOn since it prints the object _on_ a stream. * @param _os A std::ostream. */ - virtual void printOn(std::ostream& _os) const { - - - // the latest version of the code. Very similar to the old code - if (invalid()) { - _os << "INVALID "; + virtual void printOn(std::ostream& _os) const + { + if (invalid()) + { + _os << invalidTag << ' '; } else { From d3a2ab5e843c22c864c6ed25119ca057c300240e Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 3 Oct 2024 10:08:00 +0200 Subject: [PATCH 101/113] fix(EDO): constructor declarations without templates --- edo/src/edoEstimatorAdaptive.h | 2 +- edo/src/edoEstimatorAdaptiveReset.h | 4 ++-- edo/src/edoEstimatorCombined.h | 8 ++++---- edo/src/edoRepairerModulo.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/edo/src/edoEstimatorAdaptive.h b/edo/src/edoEstimatorAdaptive.h index dfd9eb53a..01bb9c83c 100644 --- a/edo/src/edoEstimatorAdaptive.h +++ b/edo/src/edoEstimatorAdaptive.h @@ -45,7 +45,7 @@ class edoEstimatorAdaptive : public edoEstimator public: typedef typename D::EOType EOType; - edoEstimatorAdaptive( D& distrib ) : _distrib(distrib) {} + edoEstimatorAdaptive( D& distrib ) : _distrib(distrib) {} // virtual D operator() ( eoPop< EOT >& )=0 (provided by eoUF< A1, R >) diff --git a/edo/src/edoEstimatorAdaptiveReset.h b/edo/src/edoEstimatorAdaptiveReset.h index c7dfd4939..b3d518dca 100644 --- a/edo/src/edoEstimatorAdaptiveReset.h +++ b/edo/src/edoEstimatorAdaptiveReset.h @@ -41,12 +41,12 @@ class edoEstimatorAdaptiveReset : public edoEstimatorAdaptive public: typedef typename D::EOType EOType; - edoEstimatorAdaptiveReset( D& distrib ) : + edoEstimatorAdaptiveReset( D& distrib ) : edoEstimatorAdaptive(distrib), _dim(0) { } - edoEstimatorAdaptiveReset( D& distrib, size_t dim ) : + edoEstimatorAdaptiveReset( D& distrib, size_t dim ) : edoEstimatorAdaptive(distrib), _dim(dim) { } diff --git a/edo/src/edoEstimatorCombined.h b/edo/src/edoEstimatorCombined.h index f884f38f1..3c546bd6a 100644 --- a/edo/src/edoEstimatorCombined.h +++ b/edo/src/edoEstimatorCombined.h @@ -43,12 +43,12 @@ class edoEstimatorCombinedAdaptive : public edoEstimatorAdaptive, public std: public: typedef typename D::EOType EOType; - edoEstimatorCombinedAdaptive( D& distrib, edoEstimator& estim) : + edoEstimatorCombinedAdaptive( D& distrib, edoEstimator& estim) : edoEstimatorAdaptive(distrib), std::vector*>(1,&estim) {} - edoEstimatorCombinedAdaptive( D& distrib, std::vector*> estims) : + edoEstimatorCombinedAdaptive( D& distrib, std::vector*> estims) : edoEstimatorAdaptive(distrib), std::vector*>(estims) {} @@ -78,11 +78,11 @@ class edoEstimatorCombinedStateless : public edoEstimatorCombinedAdaptive public: typedef typename D::EOType EOType; - edoEstimatorCombinedStateless( edoEstimator& estim ) : + edoEstimatorCombinedStateless( edoEstimator& estim ) : edoEstimatorCombinedAdaptive(*(new D), estim) {} - edoEstimatorCombinedStateless( std::vector*> estims) : + edoEstimatorCombinedStateless( std::vector*> estims) : edoEstimatorCombinedAdaptive(*(new D), estims) {} diff --git a/edo/src/edoRepairerModulo.h b/edo/src/edoRepairerModulo.h index 1bc7e7682..54b823de7 100644 --- a/edo/src/edoRepairerModulo.h +++ b/edo/src/edoRepairerModulo.h @@ -39,7 +39,7 @@ template < typename EOT > class edoRepairerModulo: public edoRepairerApplyBinary { public: - edoRepairerModulo( double denominator ) : edoRepairerApplyBinary( std::fmod, denominator ) {} + edoRepairerModulo( double denominator ) : edoRepairerApplyBinary( std::fmod, denominator ) {} }; From 77148b5a972fb76cfc66a4ed3cbbc72ce1440d9e Mon Sep 17 00:00:00 2001 From: Alessandro Sidero <75628365+Alessandro624@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:07:10 +0100 Subject: [PATCH 102/113] fix(MPI): resolved cyclic inclusion and MPI issue --- eo/src/mpi/implMpi.h | 474 +++++++++++++++++++++---------------------- 1 file changed, 236 insertions(+), 238 deletions(-) diff --git a/eo/src/mpi/implMpi.h b/eo/src/mpi/implMpi.h index d52b84b26..0efb89a75 100644 --- a/eo/src/mpi/implMpi.h +++ b/eo/src/mpi/implMpi.h @@ -22,7 +22,7 @@ Authors: #ifndef __EO_IMPL_MPI_HPP__ #define __EO_IMPL_MPI_HPP__ -#include "eoMpi.h" +#include #include "../serial/eoSerial.h" /** @@ -43,290 +43,288 @@ Authors: */ namespace eo { -namespace mpi -{ - /** - * @ingroup Parallel - * @{ - */ - - /** - * @brief Constant indicating that a message can come from any process. - */ - extern const int any_source; - - /** - * @brief Constant indicating that a message can come from any tag (channel). - */ - extern const int any_tag; - - /** - * @brief Wrapper class to have a MPI environment. - * - * Instead of calling MPI_Init and MPI_Finalize, it is only necessary to instantiate - * this class once, in the global context. - */ - class environment + namespace mpi { - public: + /** + * @ingroup Parallel + * @{ + */ /** - * @brief Inits MPI context. + * @brief Constant indicating that a message can come from any process. + */ + extern const int any_source; + + /** + * @brief Constant indicating that a message can come from any tag (channel). + */ + extern const int any_tag; + + /** + * @brief Wrapper class to have a MPI environment. * - * @param argc Number of params in command line (same as one in main) - * @param argv Strings containing params (same as one in main) + * Instead of calling MPI_Init and MPI_Finalize, it is only necessary to instantiate + * this class once, in the global context. */ - environment(int argc, char**argv); - - /** - * @brief Closes MPI context. - */ - ~environment(); - }; - - struct MPI_Status { - int count; - int cancelled; - int MPI_SOURCE; - int MPI_TAG; - int MPI_ERROR; - }; - - /** - * @brief Wrapper class for MPI_Status - * - * Consists only in a C++ wrapper class, giving getters on status attributes. - */ - class status - { + class environment + { public: + /** + * @brief Inits MPI context. + * + * @param argc Number of params in command line (same as one in main) + * @param argv Strings containing params (same as one in main) + */ + environment(int argc, char **argv); + + /** + * @brief Closes MPI context. + */ + ~environment(); + }; + + /* struct MPI_Status + { + int count; + int cancelled; + int MPI_SOURCE; + int MPI_TAG; + int MPI_ERROR; + }; */ /** - * @brief Converts a MPI_Status into a status. + * @brief Wrapper class for MPI_Status + * + * Consists only in a C++ wrapper class, giving getters on status attributes. */ - status( const MPI_Status & s ); + class status + { + public: + /** + * @brief Converts a MPI_Status into a status. + */ + status(const MPI_Status &s); - /** - * @brief Returns the tag of the associated communication. - */ - int tag() { return _tag; } + /** + * @brief Returns the tag of the associated communication. + */ + int tag() { return _tag; } - /** - * @brief Indicates which error number we obtained in the associated communication. - */ - int error() { return _error; } + /** + * @brief Indicates which error number we obtained in the associated communication. + */ + int error() { return _error; } - /** - * @brief Returns the MPI rank of the source of the associated communication. - */ - int source() { return _source; } + /** + * @brief Returns the MPI rank of the source of the associated communication. + */ + int source() { return _source; } private: int _source; int _tag; int _error; - }; + }; - /** - * @brief Main object, used to send / receive messages, get informations about the rank and the size of the world, - * etc. - */ - class communicator - { + /** + * @brief Main object, used to send / receive messages, get informations about the rank and the size of the world, + * etc. + */ + class communicator + { public: + /** + * Creates the communicator, using the whole world as a MPI_Comm. + * + * @todo Allow the user to precise which MPI_Comm to use + */ + communicator(); - /** - * Creates the communicator, using the whole world as a MPI_Comm. - * - * @todo Allow the user to precise which MPI_Comm to use - */ - communicator( ); + ~communicator(); - ~communicator(); + /** + * @brief Returns the MPI rank of the current process. + */ + int rank(); - /** - * @brief Returns the MPI rank of the current process. - */ - int rank(); + /** + * @brief Returns the size of the MPI cluster. + */ + int size(); - /** - * @brief Returns the size of the MPI cluster. - */ - int size(); + /* + * SEND / RECV INT + */ - /* - * SEND / RECV INT - */ + /** + * @brief Sends an integer to dest on channel "tag". + * + * @param dest MPI rank of the receiver + * @param tag MPI tag of message + * @param n The integer to send + */ + void send(int dest, int tag, int n); - /** - * @brief Sends an integer to dest on channel "tag". - * - * @param dest MPI rank of the receiver - * @param tag MPI tag of message - * @param n The integer to send - */ - void send( int dest, int tag, int n ); + /* + * @brief Receives an integer from src on channel "tag". + * + * @param src MPI rank of the sender + * @param tag MPI tag of message + * @param n Where to save the received integer + */ + void recv(int src, int tag, int &n); - /* - * @brief Receives an integer from src on channel "tag". - * - * @param src MPI rank of the sender - * @param tag MPI tag of message - * @param n Where to save the received integer - */ - void recv( int src, int tag, int& n ); + /* + * SEND / RECV STRING + */ - /* - * SEND / RECV STRING - */ + /** + * @brief Sends a string to dest on channel "tag". + * + * @param dest MPI rank of the receiver + * @param tag MPI tag of message + * @param str The std::string to send + */ + void send(int dest, int tag, const std::string &str); - /** - * @brief Sends a string to dest on channel "tag". - * - * @param dest MPI rank of the receiver - * @param tag MPI tag of message - * @param str The std::string to send - */ - void send( int dest, int tag, const std::string& str ); + /* + * @brief Receives a string from src on channel "tag". + * + * @param src MPI rank of the sender + * @param tag MPI tag of message + * @param std::string Where to save the received string + */ + void recv(int src, int tag, std::string &str); - /* - * @brief Receives a string from src on channel "tag". - * - * @param src MPI rank of the sender - * @param tag MPI tag of message - * @param std::string Where to save the received string - */ - void recv( int src, int tag, std::string& str ); + /* + * SEND / RECV Objects + */ - /* - * SEND / RECV Objects - */ + /** + * @brief Sends an eoserial::Persistent to dest on channel "tag". + * + * @param dest MPI rank of the receiver + * @param tag MPI tag of message + * @param persistent The object to send (it must absolutely implement eoserial::Persistent) + */ + void send(int dest, int tag, const eoserial::Persistent &persistent); - /** - * @brief Sends an eoserial::Persistent to dest on channel "tag". - * - * @param dest MPI rank of the receiver - * @param tag MPI tag of message - * @param persistent The object to send (it must absolutely implement eoserial::Persistent) - */ - void send( int dest, int tag, const eoserial::Persistent & persistent ); - - /** - * @brief Sends an array of eoserial::Persistent to dest on channel "tag". - * - * @param dest MPI rank of the receiver - * @param tag MPI tag of message - * @param table The array of eoserial::Persistent objects - * @param size The number of elements to send (no check is done, the user has to be sure that the size won't - * overflow!) - */ - template< class T > - void send( int dest, int tag, T* table, int size ) - { - // Puts all the values into an array - eoserial::Array* array = new eoserial::Array; - - for( int i = 0; i < size; ++i ) + /** + * @brief Sends an array of eoserial::Persistent to dest on channel "tag". + * + * @param dest MPI rank of the receiver + * @param tag MPI tag of message + * @param table The array of eoserial::Persistent objects + * @param size The number of elements to send (no check is done, the user has to be sure that the size won't + * overflow!) + */ + template + void send(int dest, int tag, T *table, int size) { - array->push_back( table[i].pack() ); + // Puts all the values into an array + eoserial::Array *array = new eoserial::Array; + + for (int i = 0; i < size; ++i) + { + array->push_back(table[i].pack()); + } + + // Encapsulates the array into an object + eoserial::Object *obj = new eoserial::Object; + obj->add("array", array); + std::stringstream ss; + obj->print(ss); + delete obj; + + // Sends the object as a string + send(dest, tag, ss.str()); } - // Encapsulates the array into an object - eoserial::Object* obj = new eoserial::Object; - obj->add( "array", array ); - std::stringstream ss; - obj->print( ss ); - delete obj; + /* + * @brief Receives an eoserial::Persistent object from src on channel "tag". + * + * @param src MPI rank of the sender + * @param tag MPI tag of message + * @param persistent Where to unpack the serialized object? + */ + void recv(int src, int tag, eoserial::Persistent &persistent); - // Sends the object as a string - send( dest, tag, ss.str() ); - } - - /* - * @brief Receives an eoserial::Persistent object from src on channel "tag". - * - * @param src MPI rank of the sender - * @param tag MPI tag of message - * @param persistent Where to unpack the serialized object? - */ - void recv( int src, int tag, eoserial::Persistent & persistent ); - - /* - * @brief Receives an array of eoserial::Persistent from src on channel "tag". - * - * @param src MPI rank of the sender - * @param tag MPI tag of message - * @param table The table in which we're saving the received objects. It must have been allocated by the user, - * as no allocation is performed here. - * @param size The number of elements to receive (no check is done, the user has to be sure that the size won't - * overflow!) - */ - template< class T > - void recv( int src, int tag, T* table, int size ) - { - // Receives the string which contains the object - std::string asText; - recv( src, tag, asText ); - - // Parses the object and retrieves the table - eoserial::Object* obj = eoserial::Parser::parse( asText ); - eoserial::Array* array = static_cast( (*obj)["array"] ); - - // Retrieves all the values from the array - for( int i = 0; i < size; ++i ) + /* + * @brief Receives an array of eoserial::Persistent from src on channel "tag". + * + * @param src MPI rank of the sender + * @param tag MPI tag of message + * @param table The table in which we're saving the received objects. It must have been allocated by the user, + * as no allocation is performed here. + * @param size The number of elements to receive (no check is done, the user has to be sure that the size won't + * overflow!) + */ + template + void recv(int src, int tag, T *table, int size) { - eoserial::unpackObject( *array, i, table[i] ); + // Receives the string which contains the object + std::string asText; + recv(src, tag, asText); + + // Parses the object and retrieves the table + eoserial::Object *obj = eoserial::Parser::parse(asText); + eoserial::Array *array = static_cast((*obj)["array"]); + + // Retrieves all the values from the array + for (int i = 0; i < size; ++i) + { + eoserial::unpackObject(*array, i, table[i]); + } + delete obj; } - delete obj; - } - /* - * Other methods - */ + /* + * Other methods + */ - /** - * @brief Wrapper for MPI_Probe - * - * Waits for a message to come from process having rank src, on the channel - * tag. - * - * @param src MPI rank of the sender (any_source if it can be any sender) - * @param tag MPI tag of the expected message (any_tag if it can be any tag) - */ - status probe( int src = any_source, int tag = any_tag ); + /** + * @brief Wrapper for MPI_Probe + * + * Waits for a message to come from process having rank src, on the channel + * tag. + * + * @param src MPI rank of the sender (any_source if it can be any sender) + * @param tag MPI tag of the expected message (any_tag if it can be any tag) + */ + status probe(int src = any_source, int tag = any_tag); - /** - * @brief Wrapper for MPI_Barrier - * - * - */ - void barrier(); + /** + * @brief Wrapper for MPI_Barrier + * + * + */ + void barrier(); private: int _rank; int _size; - char* _buf; // temporary buffer for sending and receiving strings. Avoids reallocations + char *_buf; // temporary buffer for sending and receiving strings. Avoids reallocations int _bufsize; // size of the above temporary buffer - }; + }; - /** - * @brief Wrapper for MPI_Bcast - * - * Broadcasts an integer value on the communicator comm, from the process having the MPI rank root. - * - * @param comm The communicator on which to broadcast - * @param value The integer value to send - * @param root The MPI rank of the broadcaster - * - * @todo Actually comm isn't used and broadcast is performed on the whole MPI_COMM_WORLD. TODO: Use comm instead - */ - void broadcast( communicator & comm, int value, int root ); + /** + * @brief Wrapper for MPI_Bcast + * + * Broadcasts an integer value on the communicator comm, from the process having the MPI rank root. + * + * @param comm The communicator on which to broadcast + * @param value The integer value to send + * @param root The MPI rank of the broadcaster + * + * @todo Actually comm isn't used and broadcast is performed on the whole MPI_COMM_WORLD. TODO: Use comm instead + */ + void broadcast(communicator &comm, int value, int root); - /** - * @} - */ -} // namespace mpi + /** + * @} + */ + } // namespace mpi } // namespace eo -# endif //__EO_IMPL_MPI_HPP__ +#endif //__EO_IMPL_MPI_HPP__ From 7c88ec4fa7af22bd485c7e446c7d07ff2838475d Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 09:47:58 +0100 Subject: [PATCH 103/113] feat(EO): allow overriding fitness accessors May be useful for debugging, by tracing when fitness assignement occurs. --- eo/src/EO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index 09bb2d20d..9c29dbbce 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -95,7 +95,7 @@ public: /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - void fitness(const Fitness& _fitness) + virtual void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From 172798a637ffa66878fb96f34cc2eefc1369fb57 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 10 Feb 2023 11:54:45 +0100 Subject: [PATCH 104/113] revert 399b22266 (virtual fitness interface temptative) Incompatible with MOEO's change of interface. --- eo/src/EO.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index 9c29dbbce..09bb2d20d 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -95,7 +95,7 @@ public: /** Set fitness. At the same time, validates it. * @param _fitness New fitness value. */ - virtual void fitness(const Fitness& _fitness) + void fitness(const Fitness& _fitness) { repFitness = _fitness; invalidFitness = false; From cfcd6e22bb2081fa9f730c4ee0e07d04b1c8fe55 Mon Sep 17 00:00:00 2001 From: Jxtopher <39927513+Jxtopher@users.noreply.github.com> Date: Fri, 28 Mar 2025 22:30:30 +0100 Subject: [PATCH 105/113] Ccache setup The goal is to speed up recompilation using ccache. Ccache is a tool that speeds up recompilation of C/C++ code. It does this by caching the results of previous compilations. When you recompile code, ccache checks if it has already compiled the same code with the same compiler flags. If so, it uses the cached result instead of recompiling. --- .github/workflows/build_ubuntu_debug.yml | 9 ++++++++- CMakeLists.txt | 11 +++++++++++ README.md | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml index b68744cb2..58aac6a42 100644 --- a/.github/workflows/build_ubuntu_debug.yml +++ b/.github/workflows/build_ubuntu_debug.yml @@ -16,8 +16,15 @@ jobs: compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Caching objects + id: cache-objects + uses: actions/cache@v4 + with: + path: ~/.cache/ccache + key: ${{ runner.os }}-${{env.BUILD_TYPE}}-${{ matrix.compiler }}-objects + - name: Install Dependencies shell: bash run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bec9ae43..1b364f35f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,17 @@ project("ParadisEO" ## Language set(CMAKE_CXX_STANDARD 17) +## ccache +find_program(CCACHE_PROGRAM ccache) + +if (CCACHE_PROGRAM) + message(NOTICE "-- ccache is enabled (found here: ${CCACHE_PROGRAM})") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "\"${CCACHE_PROGRAM}\"") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "\"${CCACHE_PROGRAM}\"") +else () + message(NOTICE "-- ccache has not been found") +endif () + ###################################################################################### ### 2) Check dependencies diff --git a/README.md b/README.md index 686b08334..ff158606d 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ If you `ENABLE_CMAKE_EXAMPLE`, it will also build the examples. If may want to make build scripts more verbose (especially when building the doc) by enabling `CMAKE_VERBOSE_MAKEFILE`. +If `ccache` installed in your environment, library recompilation times can be significantly reduced. To clear all cached objects, execute `ccache -C`. ## Licenses From 22275e434b078bfb5bc480c77f74685aecb4395b Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Mon, 7 Apr 2025 14:16:37 +0200 Subject: [PATCH 106/113] fix several warnings Probably fixes a bug in es/CMA, which has been deprecated for a long time in favor of the EDO module anyway. --- eo/src/eoEasyPSO.h | 16 ++++++------- eo/src/eoSyncEasyPSO.h | 30 ++++++++++++------------- eo/src/es/CMAParams.cpp | 3 +++ eo/src/gp/parse_tree.h | 7 ++++++ eo/src/mpi/implMpi.cpp | 2 +- eo/src/utils/pipecom.cpp | 6 ++--- eo/src/utils/pipecom.h | 4 ++-- moeo/src/do/make_checkpoint_moeo.h | 2 +- moeo/src/do/make_ea_moeo.h | 2 +- moeo/src/metric/moeoHyperVolumeMetric.h | 4 ++-- moeo/tutorial/Lesson1/Sch1.cpp | 4 ++-- smp/src/PPExpander.h | 2 +- smp/src/island.cpp | 4 ++++ smp/src/island.h | 3 ++- smp/tutorial/Lesson1/QAPGA.h | 2 ++ 15 files changed, 53 insertions(+), 38 deletions(-) diff --git a/eo/src/eoEasyPSO.h b/eo/src/eoEasyPSO.h index 87c27cad3..25f030595 100644 --- a/eo/src/eoEasyPSO.h +++ b/eo/src/eoEasyPSO.h @@ -174,18 +174,18 @@ protected: // if the flight does not need to be used, use the dummy flight instance class eoDummyFlight:public eoFlight < POT > { - public: - eoDummyFlight () {} - void operator () (POT &) {} - }dummyFlight; + public: + eoDummyFlight () {} + void operator() (POT &) override {} + } dummyFlight; // if the initializer does not need to be used, use the dummy one instead class eoDummyInitializer:public eoInitializerBase < POT > { - public: - eoDummyInitializer () {} - void operator () (POT &) {} - }dummyInit; + public: + eoDummyInitializer () {} + void operator() () override {} + } dummyInit; }; /** diff --git a/eo/src/eoSyncEasyPSO.h b/eo/src/eoSyncEasyPSO.h index 11640af53..183148896 100644 --- a/eo/src/eoSyncEasyPSO.h +++ b/eo/src/eoSyncEasyPSO.h @@ -230,27 +230,25 @@ protected: // if the eval does not need to be used, use the dummy eval instance class eoDummyEval : public eoEvalFunc - { - public: - void operator()(POT &) - {} - } - dummyEval; - - class eoDummyFlight:public eoFlight < POT > { - public: - eoDummyFlight () {} - void operator () (POT &) {} - }dummyFlight; + public: + void operator()(POT &) override {} + } dummyEval; + + class eoDummyFlight:public eoFlight < POT > + { + public: + eoDummyFlight () {} + void operator() (POT &) override {} + } dummyFlight; // if the initializer does not need to be used, use the dummy one instead class eoDummyInitializer:public eoInitializerBase < POT > { - public: - eoDummyInitializer () {} - void operator () (POT &) {} - }dummyInit; + public: + eoDummyInitializer () {} + void operator() () override {} + } dummyInit; }; /** @example t-eoSyncEasyPSO.cpp diff --git a/eo/src/es/CMAParams.cpp b/eo/src/es/CMAParams.cpp index 2862cdd1a..d27204f97 100644 --- a/eo/src/es/CMAParams.cpp +++ b/eo/src/es/CMAParams.cpp @@ -113,16 +113,19 @@ CMAParams::CMAParams(eoParser& parser, unsigned dimensionality) { for (unsigned i = 0; i < weights.size(); ++i) { weights[i] = mu - i; } + break; } case 2: { weights = 1.; + break; } default : { for (unsigned i = 0; i < weights.size(); ++i) { weights[i] = log(mu+1.)-log(i+1.); } + break; } } diff --git a/eo/src/gp/parse_tree.h b/eo/src/gp/parse_tree.h index 84ec04d35..6b9ab80ae 100644 --- a/eo/src/gp/parse_tree.h +++ b/eo/src/gp/parse_tree.h @@ -468,8 +468,11 @@ private : switch(new_arity) { case 3 : args[2].copy(s.args[2]); args[2].parent = this; // no break! + [[fallthrough]]; case 2 : args[1].copy(s.args[1]); args[1].parent = this; + [[fallthrough]]; case 1 : args[0].copy(s.args[0]); args[0].parent = this; + [[fallthrough]]; case 0 : break; default : { @@ -523,7 +526,9 @@ private : switch(arity()) { case 3 : args[2].parent = 0; // no break! + [[fallthrough]]; case 2 : args[1].parent = 0; + [[fallthrough]]; case 1 : args[0].parent = 0; break; case 0 : break; default : @@ -542,7 +547,9 @@ private : switch(arity()) { case 3 : args[2].parent = this; // no break! + [[fallthrough]]; case 2 : args[1].parent = this; + [[fallthrough]]; case 1 : args[0].parent = this; break; case 0 : break; default : diff --git a/eo/src/mpi/implMpi.cpp b/eo/src/mpi/implMpi.cpp index 2dd1ca0d5..d045da3ac 100644 --- a/eo/src/mpi/implMpi.cpp +++ b/eo/src/mpi/implMpi.cpp @@ -161,7 +161,7 @@ namespace mpi MPI_Barrier( MPI_COMM_WORLD ); } - void broadcast( communicator & comm, int value, int root ) + void broadcast( communicator & /*comm*/, int value, int root ) { MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD ); } diff --git a/eo/src/utils/pipecom.cpp b/eo/src/utils/pipecom.cpp index a175112f9..bef9ae2ce 100644 --- a/eo/src/utils/pipecom.cpp +++ b/eo/src/utils/pipecom.cpp @@ -42,16 +42,16 @@ int Check( PCom *com ) } -PCom * PipeComOpen( char *prog ) +PCom * PipeComOpen( const char *prog ) { char *args[2]; - args[0] = prog; + args[0] = strdup( prog ); args[1] = NULL; return PipeComOpenArgv( prog, args ); } -PCom * PipeComOpenArgv( char *prog, char *argv[] ) +PCom * PipeComOpenArgv( const char *prog, char *argv[] ) { int toFils[2]; int toPere[2]; diff --git a/eo/src/utils/pipecom.h b/eo/src/utils/pipecom.h index 56b031708..16685225c 100644 --- a/eo/src/utils/pipecom.h +++ b/eo/src/utils/pipecom.h @@ -23,8 +23,8 @@ typedef struct PipeCommunication { } PCom; -extern PCom *PipeComOpen( char *prog ); -extern PCom *PipeComOpenArgv( char *prog, char *argv[] ); +extern PCom *PipeComOpen( const char *prog ); +extern PCom *PipeComOpenArgv( const char *prog, char *argv[] ); extern int PipeComSend( PCom *to, const char *line ); extern int PipeComSendn( PCom *to, const char *data, int n ); diff --git a/moeo/src/do/make_checkpoint_moeo.h b/moeo/src/do/make_checkpoint_moeo.h index 188c340ea..98bb1e2a1 100644 --- a/moeo/src/do/make_checkpoint_moeo.h +++ b/moeo/src/do/make_checkpoint_moeo.h @@ -66,7 +66,7 @@ bool testDirRes(std::string _dirName, bool _erase); * @param _archive the archive of non-dominated solutions */ template < class MOEOT > -eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoEvalFuncCounter < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive) +eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoEvalFuncCounter < MOEOT > & /*_eval*/, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive) { eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue)); /* the objective vector type */ diff --git a/moeo/src/do/make_ea_moeo.h b/moeo/src/do/make_ea_moeo.h index aee4dcd0d..76559e198 100644 --- a/moeo/src/do/make_ea_moeo.h +++ b/moeo/src/do/make_ea_moeo.h @@ -85,7 +85,7 @@ * @param _archive the archive of non-dominated solutions */ template < class MOEOT > -moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive) +moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & /*_archive*/) { /* the objective vector type */ diff --git a/moeo/src/metric/moeoHyperVolumeMetric.h b/moeo/src/metric/moeoHyperVolumeMetric.h index dc65ac4c9..ce1ee0c1c 100644 --- a/moeo/src/metric/moeoHyperVolumeMetric.h +++ b/moeo/src/metric/moeoHyperVolumeMetric.h @@ -55,7 +55,7 @@ class moeoHyperVolumeMetric : public moeoVectorUnaryMetric < ObjectiveVector , d * @param _normalize allow to normalize data (default true) * @param _rho coefficient to determine the reference point. */ - moeoHyperVolumeMetric(bool _normalize=true, double _rho=1.1): normalize(_normalize), rho(_rho), ref_point(NULL){ + moeoHyperVolumeMetric(bool _normalize=true, double _rho=1.1): normalize(_normalize), rho(_rho) { bounds.resize(ObjectiveVector::Traits::nObjectives()); // initialize bounds in case someone does not want to use them for (unsigned int i=0; i } template - U& findValueImpl(T& t, Arg&... arg, std::true_type) + U& findValueImpl(T& t, Arg&... /*arg*/, std::true_type) { return t; } diff --git a/smp/src/island.cpp b/smp/src/island.cpp index 783d42d75..eb8fa85ca 100644 --- a/smp/src/island.cpp +++ b/smp/src/island.cpp @@ -59,6 +59,10 @@ paradiseo::smp::Island::Island(eoPop& _pop, IntPolicy _pop, _intPolicy, _migPolicy, args...) { } +template