From 2be4dcf2c028eeaa0b99bf778532dae2ce2f341d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szynkiewicz?= Date: Sat, 24 Mar 2018 23:58:19 +0100 Subject: [PATCH 01/28] java build fix: include path and java 10 support (javah deprecated) --- code-experiments/tools/cocoutils.py | 8 ++++++++ do.py | 28 ++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/code-experiments/tools/cocoutils.py b/code-experiments/tools/cocoutils.py index b3a94baa9..348e68c9b 100644 --- a/code-experiments/tools/cocoutils.py +++ b/code-experiments/tools/cocoutils.py @@ -9,6 +9,7 @@ import sys import os +from distutils.spawn import find_executable from shutil import copyfile, copytree, rmtree from subprocess import CalledProcessError, call, STDOUT @@ -225,3 +226,10 @@ def expand_file(source, destination, dictionary): content = Template(fd.read()) with open(destination, "w") as outfd: outfd.write(content.safe_substitute(dictionary)) + + +def executable_path(name): + p = find_executable(name) + if p: + return os.path.realpath(p) + diff --git a/do.py b/do.py index 54ca15ae2..1ea1651ad 100755 --- a/do.py +++ b/do.py @@ -6,7 +6,7 @@ import sys import os -from os.path import join +from os.path import join, abspath, realpath import shutil import tempfile import subprocess @@ -24,6 +24,7 @@ from amalgamate import amalgamate from cocoutils import make, run, python, check_output from cocoutils import copy_file, expand_file, write_file +from cocoutils import executable_path from cocoutils import git_version, git_revision CORE_FILES = ['code-experiments/src/coco_random.c', @@ -631,8 +632,17 @@ def build_java(): {'COCO_VERSION': git_version(pep440=True)}) write_file(git_revision(), "code-experiments/build/java/REVISION") write_file(git_version(), "code-experiments/build/java/VERSION") - run('code-experiments/build/java', ['javac', 'CocoJNI.java'], verbose=_verbosity) - run('code-experiments/build/java', ['javah', 'CocoJNI'], verbose=_verbosity) + + javacpath = executable_path('javac') + javahpath = executable_path('javah') + if javacpath and javahpath: + run('code-experiments/build/java', ['javac', 'CocoJNI.java'], verbose=_verbosity) + run('code-experiments/build/java', ['javah', 'CocoJNI'], verbose=_verbosity) + elif javacpath: + run('code-experiments/build/java', ['javac', '-h', '.', 'CocoJNI.java'], verbose=_verbosity) + else: + raise RuntimeError('Can not find javac path!') + # Finds the path to the headers jni.h and jni_md.h (platform-dependent) # and compiles the CocoJNI library (compiler-dependent). So far, only @@ -671,9 +681,15 @@ def build_java(): # 4. Linux elif 'linux' in sys.platform: - jdkpath = check_output(['locate', 'jni.h'], stderr=STDOUT, - env=os.environ, universal_newlines=True) - jdkpath1 = jdkpath.split("jni.h")[0] + # bad bad bad... + #jdkpath = check_output(['locate', 'jni.h'], stderr=STDOUT, + # env=os.environ, universal_newlines=True) + #jdkpath1 = jdkpath.split("jni.h")[0] + # better + javapath = executable_path('java') + if not javapath: + raise RuntimeError('Can not find Java executable') + jdkpath1 = abspath(join(javapath, os.pardir, os.pardir, 'include')) jdkpath2 = jdkpath1 + '/linux' run('code-experiments/build/java', ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-c', 'CocoJNI.c'], From f00c56bafea5b6dac627cf1a8018bcd5efbde0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szynkiewicz?= Date: Wed, 18 Apr 2018 23:54:50 +0200 Subject: [PATCH 02/28] respect JAVA_HOME or JDK_HOME envs fix java executable in two possible places problem --- do.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/do.py b/do.py index 1ea1651ad..83b115c8d 100755 --- a/do.py +++ b/do.py @@ -686,10 +686,16 @@ def build_java(): # env=os.environ, universal_newlines=True) #jdkpath1 = jdkpath.split("jni.h")[0] # better - javapath = executable_path('java') - if not javapath: - raise RuntimeError('Can not find Java executable') - jdkpath1 = abspath(join(javapath, os.pardir, os.pardir, 'include')) + jdkhome = os.environ['JAVA_HOME'] or os.environ['JDK_HOME'] + if not jdkhome: + javapath = executable_path('java') + if not javapath: + raise RuntimeError('Can not find Java executable') + jdkhome = abspath(join(javapath, os.pardir, os.pardir)) + if os.path.dirname(jdkhome) == 'jre': + jdkhome = join(jdkhome, os.pardir) + + jdkpath1 = join(jdkhome, 'include') jdkpath2 = jdkpath1 + '/linux' run('code-experiments/build/java', ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-c', 'CocoJNI.c'], From cc19d92975438ce841e0295e3d6e119111212be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szynkiewicz?= Date: Thu, 19 Apr 2018 00:05:48 +0200 Subject: [PATCH 03/28] empty envs fix --- do.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do.py b/do.py index 83b115c8d..2e369920f 100755 --- a/do.py +++ b/do.py @@ -686,7 +686,7 @@ def build_java(): # env=os.environ, universal_newlines=True) #jdkpath1 = jdkpath.split("jni.h")[0] # better - jdkhome = os.environ['JAVA_HOME'] or os.environ['JDK_HOME'] + jdkhome = os.environ.get('JAVA_HOME') or os.environ.get('JDK_HOME') if not jdkhome: javapath = executable_path('java') if not javapath: From c19a05cf882356722be826b1c746242076ae16e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szynkiewicz?= Date: Thu, 19 Apr 2018 00:45:09 +0200 Subject: [PATCH 04/28] dirname -> basename fix --- do.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do.py b/do.py index 2e369920f..cf2f6192f 100755 --- a/do.py +++ b/do.py @@ -692,7 +692,7 @@ def build_java(): if not javapath: raise RuntimeError('Can not find Java executable') jdkhome = abspath(join(javapath, os.pardir, os.pardir)) - if os.path.dirname(jdkhome) == 'jre': + if os.path.basename(jdkhome) == 'jre': jdkhome = join(jdkhome, os.pardir) jdkpath1 = join(jdkhome, 'include') From 41bffe8aa327f744fa531e3d958b30eeaf54f862 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Fri, 15 Mar 2019 16:08:59 +0100 Subject: [PATCH 05/28] added zenodo batch to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b99b15be2..81a2c9fac 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ numbbo/coco: Comparing Continuous Optimizers [![CircleCI](https://circleci.com/gh/numbbo/coco/tree/master.svg?style=shield)](https://circleci.com/gh/numbbo/coco/tree/master) [![Appveyor](https://ci.appveyor.com/api/projects/status/4dawpqr7aq2ioici/branch/master?svg=true)](https://ci.appveyor.com/project/nikohansen/coco-j53aywshl8udzvb/branch/master) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2594848.svg)](https://doi.org/10.5281/zenodo.2594848) +[[BibTeX](https://zenodo.org/record/2594848/export/hx#.XIu-BxP0nRY)] cite as: +> Nikolaus Hansen, Dimo Brockhoff, Olaf Mersmann, Tea Tusar, Dejan Tusar, Ouassim Ait ElHara, Phillipe R. Sampaio, Asma Atamna, Konstantinos Varelas, Umut Batu, Duc Manh Nguyen, Filip Matzner, Anne Auger. (2019, March 15). COmparing Continuous Optimizers: numbbo/COCO on Github. Zenodo, [DOI:10.5281/zenodo.2594847](https://doi.org/10.5281/zenodo.2594847), March 2019. [This code](https://github.com/numbbo/coco) reimplements the original Comparing Continous Optimizer platform, now rewritten fully in `ANSI C` and `Python` with From d83cbb794894d644462faad869435eed67dd921e Mon Sep 17 00:00:00 2001 From: nikohansen Date: Fri, 15 Mar 2019 16:12:03 +0100 Subject: [PATCH 06/28] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81a2c9fac..d2335b8c1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ numbbo/coco: Comparing Continuous Optimizers [![Appveyor](https://ci.appveyor.com/api/projects/status/4dawpqr7aq2ioici/branch/master?svg=true)](https://ci.appveyor.com/project/nikohansen/coco-j53aywshl8udzvb/branch/master) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2594848.svg)](https://doi.org/10.5281/zenodo.2594848) [[BibTeX](https://zenodo.org/record/2594848/export/hx#.XIu-BxP0nRY)] cite as: -> Nikolaus Hansen, Dimo Brockhoff, Olaf Mersmann, Tea Tusar, Dejan Tusar, Ouassim Ait ElHara, Phillipe R. Sampaio, Asma Atamna, Konstantinos Varelas, Umut Batu, Duc Manh Nguyen, Filip Matzner, Anne Auger. (2019, March 15). COmparing Continuous Optimizers: numbbo/COCO on Github. Zenodo, [DOI:10.5281/zenodo.2594847](https://doi.org/10.5281/zenodo.2594847), March 2019. +> Nikolaus Hansen, Dimo Brockhoff, Olaf Mersmann, Tea Tusar, Dejan Tusar, Ouassim Ait ElHara, Phillipe R. Sampaio, Asma Atamna, Konstantinos Varelas, Umut Batu, Duc Manh Nguyen, Filip Matzner, Anne Auger. COmparing Continuous Optimizers: numbbo/COCO on Github. Zenodo, [DOI:10.5281/zenodo.2594847](https://doi.org/10.5281/zenodo.2594847), March 2019. +--- [This code](https://github.com/numbbo/coco) reimplements the original Comparing Continous Optimizer platform, now rewritten fully in `ANSI C` and `Python` with From b7fea8c6ffe046b2b0365014471d4400ba25d6c2 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Fri, 15 Mar 2019 16:57:41 +0100 Subject: [PATCH 07/28] refer to example_experiment2.py in readme replacing the rather complex example_experiment.py --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d2335b8c1..f245016d3 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Getting Started 4. **Copy** the folder `code-experiments/build/YOUR-FAVORITE-LANGUAGE` and its content to another location. In Python it is sufficient to copy the file [`example_experiment_for_beginners.py`](./code-experiments/build/python/example_experiment_for_beginners.py) - or `example_experiment.py`. + or [`example_experiment2.py`](./code-experiments/build/python/example_experiment2.py). Run the example experiment (it already is compiled). As the details vary, see the respective read-me's and/or example experiment files: @@ -134,7 +134,7 @@ Getting Started - `Matlab/Octave` [read me](./code-experiments/build/matlab/README.md) and [example experiment](./code-experiments/build/matlab/exampleexperiment.m) - `Python` [read me](./code-experiments/build/python/README.md) - and [example experiment](./code-experiments/build/python/example_experiment.py) + and [example experiment2](./code-experiments/build/python/example_experiment2.py) If the example experiment runs, **connect** your favorite algorithm to Coco: replace the call to the random search optimizer in the @@ -209,7 +209,7 @@ Getting Started 8. The experiments can be **parallelized** with any re-distribution of single problem instances to batches (see - [`example_experiment.py`](./code-experiments/build/python/example_experiment.py#L235) + [`example_experiment2.py`](./code-experiments/build/python/example_experiment2.py#L100) for an example). Each batch must write in a different target folder (this should happen automatically). Results of each batch must be kept under their separate folder as is. These folders then must be moved/copied into a single @@ -646,7 +646,7 @@ Comprehensive List of Documentations - ``C`` experiments code: http://numbbo.github.io/coco-doc/C - Python experiments code `cocoex`: http://coco.gforge.inria.fr/apidocs-cocoex/cocoex.html - Python short [beginners example experiment](code-experiments/build/python/example_experiment_for_beginners.py) - - Python `example_experiment.py`: http://coco.gforge.inria.fr/apidocs-example_experiment/example_experiment.html + - Python `example_experiment2.py`: http://coco.gforge.inria.fr/apidocs-example_experiment/example_experiment2.html - Postprocessing code: http://coco.gforge.inria.fr/apidocs-cocopp/cocopp.html * Somewhat outdated documents: From 5c7d24e9d6645bb0f21b89857875594ed44fc548 Mon Sep 17 00:00:00 2001 From: Konstantinos Varelas Date: Sat, 16 Mar 2019 18:23:08 +0100 Subject: [PATCH 08/28] Update LS latex template and reference --- code-postprocessing/latex-templates/bbob.bib | 16 ++++++++++------ .../latex-templates/templateBBOBLSarticle.tex | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code-postprocessing/latex-templates/bbob.bib b/code-postprocessing/latex-templates/bbob.bib index 8e1fedf7f..8b5432bd0 100644 --- a/code-postprocessing/latex-templates/bbob.bib +++ b/code-postprocessing/latex-templates/bbob.bib @@ -1,12 +1,16 @@ % This file was created with JabRef 2.7.2. % Encoding: MacRoman -@ARTICLE{bbobls2019func, - author = {}, - title = {}, - journal = {}, - volume = {}, - year = 2019 +@unpublished{elhara:hal-02068407, + TITLE = {{COCO: The Large Scale Black-Box Optimization Benchmarking (bbob-largescale) Test Suite}}, + AUTHOR = {Elhara, Ouassim Ait and Varelas, Konstantinos and Nguyen, Duc Hung and Tusar, Tea and Brockhoff, Dimo and Hansen, Nikolaus and Auger, Anne}, + URL = {https://hal.inria.fr/hal-02068407}, + NOTE = {working paper or preprint}, + YEAR = {2019}, + MONTH = Mar, + PDF = {https://hal.inria.fr/hal-02068407/file/bbob-largescale-functions.pdf}, + HAL_ID = {hal-02068407}, + HAL_VERSION = {v1}, } @ARTICLE{hansen2016perfass, diff --git a/code-postprocessing/latex-templates/templateBBOBLSarticle.tex b/code-postprocessing/latex-templates/templateBBOBLSarticle.tex index 3a00bf6ad..aab296477 100644 --- a/code-postprocessing/latex-templates/templateBBOBLSarticle.tex +++ b/code-postprocessing/latex-templates/templateBBOBLSarticle.tex @@ -227,7 +227,7 @@ \section{CPU Timing} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % note that the following text is just a proposal and can/should be changed to your needs: -In order to evaluate the CPU timing of the algorithm, we have run the \change{\algorithmA} with restarts on the entire \bbobls test suite \cite{bbobls2019func} for $2 D$ function evaluations according to \cite{hansen2016exp}. The \change{C/Java/Matlab/Octave/Python} code was run on a \change{Mac Intel(R) Core(TM) i5-2400S CPU @ 2.50GHz} with \change{1} processor and \change{4} cores \change{and (compile) options xxx}. The time per function evaluation for dimensions 20, 40, 80, 160, 320\change{, 640} equals \change{$x.x$}, \change{$x.x$}, \change{$x.x$}, \change{$xx$}, \change{$xxx$}\change{, and $xxx$} seconds respectively. +In order to evaluate the CPU timing of the algorithm, we have run the \change{\algorithmA} with restarts on the entire \bbobls test suite \cite{elhara:hal-02068407} for $2 D$ function evaluations according to \cite{hansen2016exp}. The \change{C/Java/Matlab/Octave/Python} code was run on a \change{Mac Intel(R) Core(TM) i5-2400S CPU @ 2.50GHz} with \change{1} processor and \change{4} cores \change{and (compile) options xxx}. The time per function evaluation for dimensions 20, 40, 80, 160, 320\change{, 640} equals \change{$x.x$}, \change{$x.x$}, \change{$x.x$}, \change{$xx$}, \change{$xxx$}\change{, and $xxx$} seconds respectively. \ifthenelse{\equal{\numofalgs}{1}}{}{ \change{repeat the above for any algorithm tested} @@ -238,7 +238,7 @@ \section{Results} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Results from experiments according to \cite{hansen2016exp} and \cite{hansen2016perfass} on the -benchmark functions given in \cite{bbobls2019func} are +benchmark functions given in \cite{elhara:hal-02068407} are presented in %% \ifthenelse{\equal{\numofalgs}{1}}{ From 2a6e8ee43782a18a9d26d654f96b8d195c6a6a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tea=20Tus=CC=8Car?= Date: Fri, 22 Mar 2019 15:35:45 +0100 Subject: [PATCH 09/28] Modified comments to show that the extended bi-objective suite is not entirely supported yet --- code-experiments/build/c/example_experiment.c | 2 +- code-experiments/build/java/ExampleExperiment.java | 2 +- code-experiments/build/matlab/exampleexperiment.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code-experiments/build/c/example_experiment.c b/code-experiments/build/c/example_experiment.c index 18f64f330..0c69e65a1 100644 --- a/code-experiments/build/c/example_experiment.c +++ b/code-experiments/build/c/example_experiment.c @@ -120,7 +120,7 @@ int main(void) { * example one of the following: * bbob 24 unconstrained noiseless single-objective functions * bbob-biobj 55 unconstrained noiseless bi-objective functions - * bbob-biobj-ext 92 unconstrained noiseless bi-objective functions + * [bbob-biobj-ext 92 unconstrained noiseless bi-objective functions] * [bbob-constrained* 48 constrained noiseless single-objective functions] * bbob-largescale 24 unconstrained noiseless single-objective functions in large dimension * bbob-mixint 24 unconstrained noiseless single-objective functions with mixed-integer variables diff --git a/code-experiments/build/java/ExampleExperiment.java b/code-experiments/build/java/ExampleExperiment.java index b2869ce7b..d28c1f67c 100644 --- a/code-experiments/build/java/ExampleExperiment.java +++ b/code-experiments/build/java/ExampleExperiment.java @@ -69,7 +69,7 @@ public static void main(String[] args) { * * bbob 24 unconstrained noiseless single-objective functions * bbob-biobj 55 unconstrained noiseless bi-objective functions - * bbob-biobj-ext 92 unconstrained noiseless bi-objective functions + * [bbob-biobj-ext 92 unconstrained noiseless bi-objective functions] * bbob-largescale 24 unconstrained noiseless single-objective functions in large dimension * [bbob-constrained* 48 constrained noiseless single-objective functions] * bbob-mixint 24 unconstrained noiseless single-objective functions with mixed-integer variables diff --git a/code-experiments/build/matlab/exampleexperiment.m b/code-experiments/build/matlab/exampleexperiment.m index 384404b5b..978e0473d 100644 --- a/code-experiments/build/matlab/exampleexperiment.m +++ b/code-experiments/build/matlab/exampleexperiment.m @@ -28,7 +28,7 @@ % % bbob 24 unconstrained noiseless single-objective functions % bbob-biobj 55 unconstrained noiseless bi-objective functions -% bbob-biobj-ext 92 unconstrained noiseless bi-objective functions +% [bbob-biobj-ext 92 unconstrained noiseless bi-objective functions] % bbob-largescale 24 unconstrained noiseless single-objective functions in large dimensions % [bbob-constrained* 48 constrained noiseless single-objective functions] % bbob-mixint 24 unconstrained noiseless single-objective functions with mixed-integer variables From 65fcd763fbcfe1f146efa81864deecabc68c0c5d Mon Sep 17 00:00:00 2001 From: brockhof Date: Sat, 23 Mar 2019 08:29:41 +0100 Subject: [PATCH 10/28] split `with InfolderGoneWithTheWind()` into smaller pieces to hopefully use less space and let the nightly build pass again --- code-postprocessing/cocopp/test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code-postprocessing/cocopp/test.py b/code-postprocessing/cocopp/test.py index d4759e33b..0d649343f 100644 --- a/code-postprocessing/cocopp/test.py +++ b/code-postprocessing/cocopp/test.py @@ -356,6 +356,7 @@ def main(arguments): print('** subtest 10 finished in ', time.time() - t0, ' seconds') assert result == 0, 'Test failed: rungeneric on newly generated random search data on `bbob`.' + with InfolderGoneWithTheWind(): t0 = time.time() result = os.system(python + command + join_path(recent_data_path, 'RS-bi')) @@ -369,24 +370,28 @@ def main(arguments): # assert result == 0, 'Test failed: rungeneric on newly generated random search data on `bbob-constrained`.' # delete_files(all_files=True) + with InfolderGoneWithTheWind(): t0 = time.time() result = os.system(python + command + data_archive_get( 'test/RS-4.zip')) print('** subtest 13 finished in ', time.time() - t0, ' seconds') assert result == 0, 'Test failed: rungeneric on RS-4.zip.' + with InfolderGoneWithTheWind(): t0 = time.time() result = os.system(python + command + join_path(recent_data_path, 'RS-la')) print('** subtest 14 finished in ', time.time() - t0, ' seconds') assert result == 0, 'Test failed: rungeneric on newly generated random search data on `bbob-largescale`.' + with InfolderGoneWithTheWind(): t0 = time.time() result = os.system(python + command + join_path(recent_data_path, 'RS-mi')) print('** subtest 15 finished in ', time.time() - t0, ' seconds') assert result == 0, 'Test failed: rungeneric on newly generated random search data on `bbob-mixint`.' + with InfolderGoneWithTheWind(): t0 = time.time() result = os.system(python + command + join_path(recent_data_path, 'RS-bi-mi')) From f6a1acc799585e63c0b0991f0a61a22a138d09e3 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Sat, 23 Mar 2019 12:31:46 +0100 Subject: [PATCH 11/28] added year as filter proposal in example_experiment2.py --- code-experiments/build/python/example_experiment2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/code-experiments/build/python/example_experiment2.py b/code-experiments/build/python/example_experiment2.py index ca519e6a1..9a5d089ac 100755 --- a/code-experiments/build/python/example_experiment2.py +++ b/code-experiments/build/python/example_experiment2.py @@ -63,6 +63,7 @@ def random_search(f, lbounds, ubounds, evals): suite_name = "bbob" # see cocoex.known_suite_names budget_multiplier = 2 # times dimension, increase to 10, 100, ... suite_filter_options = (# "dimensions: 2,3,5,10,20 " + # skip dimension 40 + # "year:2019 " + # select instances by year # "instance_indices: 1-5 " + # relative to suite instances "") # without filtering a suite has instance_indices 1-15 batches = 1 # number of batches, batch=3/32 works to set both, current_batch and batches From dc578a9f13d9701aff36ac53c05d40bc7742898b Mon Sep 17 00:00:00 2001 From: nikohansen Date: Tue, 26 Mar 2019 19:45:30 +0100 Subject: [PATCH 12/28] moving solver to add part up in example_experiment2.py prevents to introduce a bug in case a previous if close is still True --- code-experiments/build/python/example_experiment2.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code-experiments/build/python/example_experiment2.py b/code-experiments/build/python/example_experiment2.py index 9a5d089ac..c6d6d69c3 100755 --- a/code-experiments/build/python/example_experiment2.py +++ b/code-experiments/build/python/example_experiment2.py @@ -6,7 +6,7 @@ features restarts, timings and recording termination conditions. To benchmark a different solver, `fmin` must be re-assigned and another -`elif` block added around line 136 to account for the solver-specific +`elif` block added around line 119 to account for the solver-specific call. When calling the script, previously assigned variables can be re-assigned @@ -38,7 +38,7 @@ import time # output some timings per evaluation from collections import defaultdict import os, webbrowser # to show post-processed results in the browser -import numpy as np # for np.median +import numpy as np # for median, zeros, random, asarray import cocoex # experimentation module try: import cocopp # post-processing module except: pass @@ -115,8 +115,10 @@ def random_search(f, lbounds, ubounds, evals): while evalsleft() > 0 and not problem.final_target_hit: irestart += 1 - # here we assume that `fmin` evaluates the final/returned solution: - if fmin is scipy.optimize.fmin: + # here we assume that `fmin` evaluates the final/returned solution + if 11 < 3: # add solver to investigate here + pass + elif fmin is scipy.optimize.fmin: output = fmin(problem, propose_x0(), maxfun=evalsleft(), disp=False, full_output=True) stoppings[problem.index].append(output[4]) elif fmin is scipy.optimize.fmin_slsqp: @@ -133,8 +135,6 @@ def random_search(f, lbounds, ubounds, evals): elif fmin is scipy.optimize.fmin_cobyla: fmin(problem, propose_x0(), lambda x: -problem.constraint(x), maxfun=evalsleft(), disp=0, rhoend=1e-9) - else: # add another solver here - raise NotImplementedError timings[problem.dimension].append((time.time() - time1) / problem.evaluations if problem.evaluations else 0) From 1a3553c2351fb57276bcb60160254ce786633f20 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Tue, 26 Mar 2019 19:47:23 +0100 Subject: [PATCH 13/28] change default name of archiving definition file --- code-postprocessing/cocopp/archiving.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code-postprocessing/cocopp/archiving.py b/code-postprocessing/cocopp/archiving.py index 9ddeb8b1b..569806082 100644 --- a/code-postprocessing/cocopp/archiving.py +++ b/code-postprocessing/cocopp/archiving.py @@ -27,7 +27,7 @@ publish it together with the URL, such that everyone can use the archive on the fly like ->>> remote_def = 'http://my-coco-online-archive/archive_definition.txt' +>>> remote_def = 'http://my-coco-online-archive/coco_archive_definition.txt' >>> new_archive = create_from_remote('~/.cocopp/new-archives/unique-name', ... remote_def) # doctest:+SKIP @@ -59,7 +59,7 @@ except ImportError: from urllib import urlretrieve -default_definition_filename = 'archive_definition.txt' +default_definition_filename = 'coco_archive_definition.txt' def _abs_path(path): @@ -133,7 +133,7 @@ def read_definition_file(local_path_or_definition_file): return ast.literal_eval(file_.read()) def create_from_remote(local_path, url_definition_file): - """copy a definition file from url to ``local_path/archive_definition.txt``. + """copy a definition file from url to ``local_path/coco_archive_definition.txt``. `local_path` is the storage location and should (better) be empty. It is created if it does not exist. From 23a99fe85ad1dd2a184837a28dbdd89a30a10b55 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Wed, 3 Apr 2019 18:41:12 +0200 Subject: [PATCH 14/28] Update release-howto.md --- howtos/release-howto.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/howtos/release-howto.md b/howtos/release-howto.md index 10ab19abc..60b3506d9 100644 --- a/howtos/release-howto.md +++ b/howtos/release-howto.md @@ -18,7 +18,8 @@ Simple Version (without documentation) Advanced Version (with documentation) ------------------------------------- - 1. Draft a release (under the Code / releases tabs). Consider previous releases to see what to write. + 1. Draft a release (under the Code / releases tabs). Consider previous releases to see what to write. + 2. check that instance numbers are up-to-date and `"year: this-year"` is implemented as suite option 2. check that README.md is up-to-date 3. clean and test the development branch 4. Run tests by pushing the development branch to the `devel-test1` and `test-nightly` branches, which From ae6ada72c2721708f16640eda6cc98de7e521604 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Thu, 4 Apr 2019 17:36:12 +0200 Subject: [PATCH 15/28] fix bug finding '.t' in filename to extract now use last rather than first appearance --- code-postprocessing/cocopp/findfiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-postprocessing/cocopp/findfiles.py b/code-postprocessing/cocopp/findfiles.py index c6526820e..1b13106c6 100644 --- a/code-postprocessing/cocopp/findfiles.py +++ b/code-postprocessing/cocopp/findfiles.py @@ -97,7 +97,7 @@ def get_directory(directory, extract_files): print(' archive extracted to folder', dir_name, '...') directory = dir_name else: # i.e. either directory or .tar or zipped .tar - head, tail = os.path.split(directory[:directory.find('.t')]) + head, tail = os.path.split(directory[:directory.rfind('.t')]) dir_name = os.path.join(head, genericsettings.extraction_folder_prefix + tail) # extract only if extracted folder does not exist yet or if it was # extracted earlier than last change of archive: From c64e5b746443118b5bee5634a189dabad4e28637 Mon Sep 17 00:00:00 2001 From: brockhof Date: Fri, 12 Apr 2019 14:10:16 +0200 Subject: [PATCH 16/28] Introduced a filter of data sets to the Testbed class(es) to allow to compare bbob-biobj and bbob-biobj-ext data sets with the postprocessing (by removing all data with function id above 55). --- code-postprocessing/cocopp/rungenericmany.py | 5 + code-postprocessing/cocopp/testbedsettings.py | 104 +++++++++++++++--- 2 files changed, 96 insertions(+), 13 deletions(-) diff --git a/code-postprocessing/cocopp/rungenericmany.py b/code-postprocessing/cocopp/rungenericmany.py index f92ddf97c..11a4e70bf 100644 --- a/code-postprocessing/cocopp/rungenericmany.py +++ b/code-postprocessing/cocopp/rungenericmany.py @@ -289,6 +289,11 @@ def main(argv=None): print(" loading data...") dsList, sortedAlgs, dictAlg = processInputArgs(args, True) + # filter data set lists to be compliant with all suites + # (useful right now only for bbob-biobj and bbob-biobj-ext data) + dsList = testbedsettings.current_testbed.filter(dsList) + dictAlg = testbedsettings.current_testbed.filter(dictAlg) + if not dsList: sys.exit() diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 5257be3d1..28de8040f 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import os import numpy as np import warnings @@ -193,6 +195,20 @@ def instantiate_attributes(self, class_, suffix_list=['target_values', 'targetsO if name.endswith(suffix): setattr(self, name, class_(getattr(self, name))) + def filter(self, dsl): + """ + Returns a new DataSetList from DataSetList dsl that is + consistent with the Testbed class. Works in the same manner + for a dictionary dsl of DataSetLists by directly removing + the corresponding entries from the DataSetLists. + + Right now only used for making bbob-biobj and bbob-biobj-ext suites + consistent. Here implemented as a stub. + """ + if type(dsl) is list: + return dsl + + class GECCOBBOBTestbed(Testbed): """Testbed used in the GECCO BBOB workshops 2009, 2010, 2012, 2013, 2015, @@ -438,6 +454,68 @@ def __init__(self, targetValues): # self.short_names = get_short_names(self.shortinfo_filename) self.instancesOfInterest = {1: 1, 2: 1, 3: 1, 4: 1, 5: 1} + def filter(self, dsl): + """ Returns a new DataSetList from DataSetList dsl that does only have the + first 55 functions, in case the original data is from either + the bbob-biobj or the bbob-biobj-ext suite. Filters in a similar + manner by removing directly from dsl if dsl is an algorithm dictionary. + + Gives an error if the data is not compatible. + """ + + if type(dsl) is list: + new_dsl = [] + for ds in dsl: + if not ds.get_suite() in ['bbob-biobj', 'bbob-biobj-ext']: + raise ValueError("Data from %s suite is not " + "compatible with other data from " + "the bbob-biobj and/or bbob-biobj-ext " + "suites" % str(ds.suite)) + else: + if ds.funcId <= 55: + new_dsl.append(ds) + return new_dsl + elif type(dsl) is dict: + for algname in dsl: + for i in range(len(dsl[algname]) - 1, -1, -1): + if not (dsl[algname])[i].get_suite() in ['bbob-biobj', 'bbob-biobj-ext']: + raise ValueError("Data from %s suite is not " + "compatible with other data from " + "the bbob-biobj and/or bbob-biobj-ext " + "suites" % str((dsl[algname])[i].suite)) + else: + print(str((dsl[algname])[i])) + if ((dsl[algname])[i]).funcId > 55: + print(str((dsl[algname])[i]) + ' removed') + + print('--------------------------------------') + print(dsl) + print('now popping...........................') + + dsl[algname].pop(i) + + print(dsl) + print('--------------------------------------') + + + return dsl + + #new_dsl = {} + #for algname in dsl: + # new_ds = DataSetList() + # for d in dsl[algname]: + # if not d.get_suite() in ['bbob-biobj', 'bbob-biobj-ext']: + # raise ValueError("Data from %s suite is not " + # "compatible with other data from " + # "the bbob-biobj and/or bbob-biobj-ext " + # "suites" % str(ds.suite)) + # else: + # if d.funcId <= 55: + # new_ds.append(d) + # new_dsl[algname] = new_ds + # + #return new_dsl + class GECCOBiObjExtBBOBTestbed(GECCOBiObjBBOBTestbed): """Biobjective testbed to display data sets run on the `bbob-biobj-ext` @@ -446,19 +524,19 @@ class GECCOBiObjExtBBOBTestbed(GECCOBiObjBBOBTestbed): shortinfo_filename = 'bbob-biobj-benchmarkshortinfos.txt' - settings = dict( - info_filename='bbob-biobj-benchmarkinfos.txt', - shortinfo_filename=shortinfo_filename, - name=testbed_name_bi_ext, - short_names=get_short_names(shortinfo_filename), - functions_with_legend=(1, 30, 31, 60, 61, 92), - first_function_number=1, - last_function_number=92, - scenario=scenario_biobjextfixed, - reference_algorithm_filename='', # TODO produce correct best2017 algo and delete this line - reference_algorithm_displayname='', # TODO: should be read in from data set in reference_algorithm_filename - instancesOfInterest={1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1}, # None:consider all instances - ) + settings = {} # dict( +# info_filename='bbob-biobj-benchmarkinfos.txt', +# shortinfo_filename=shortinfo_filename, +# name=testbed_name_bi_ext, +# short_names=get_short_names(shortinfo_filename), +# functions_with_legend=(1, 30, 31, 60, 61, 92), +# first_function_number=1, +# last_function_number=92, +# scenario=scenario_biobjextfixed, +# reference_algorithm_filename='', # TODO produce correct best2017 algo and delete this line +# reference_algorithm_displayname='', # TODO: should be read in from data set in reference_algorithm_filename +# instancesOfInterest={1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1}, # None:consider all instances +# ) def __init__(self, targetValues): super(GECCOBiObjExtBBOBTestbed, self).__init__(targetValues) From 5375183c0348662aabb1e9bb4d75eb21ddcb0a30 Mon Sep 17 00:00:00 2001 From: brockhof Date: Fri, 12 Apr 2019 14:20:34 +0200 Subject: [PATCH 17/28] added the missing cocoProblemGetLargestFValuesOfInterest.m file of the C code wrapper --- .../build/matlab/cocoProblemGetLargestFValuesOfInterest.m | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 code-experiments/build/matlab/cocoProblemGetLargestFValuesOfInterest.m diff --git a/code-experiments/build/matlab/cocoProblemGetLargestFValuesOfInterest.m b/code-experiments/build/matlab/cocoProblemGetLargestFValuesOfInterest.m new file mode 100644 index 000000000..3cb6eee72 --- /dev/null +++ b/code-experiments/build/matlab/cocoProblemGetLargestFValuesOfInterest.m @@ -0,0 +1,8 @@ +% For multi-objective problems, returns a vector of largest values of +% interest in each objective. Currently, this equals the nadir point. +% For single-objective problems it raises an error.. +% +% Parameters: +% problem The given problem. +function ub = cocoProblemGetLargestFValuesOfInterest(problem) +ub = cocoCall('cocoProblemGetLargestFValuesOfInterest', problem); \ No newline at end of file From 66c8ae4da3350305ecf84fd11ee4e403afef001e Mon Sep 17 00:00:00 2001 From: brockhof Date: Sat, 13 Apr 2019 09:10:02 +0200 Subject: [PATCH 18/28] created a new `goto-dimension` attribute of the Testbed class to specify on which dimension the html shall focus when clicking on a link that shows data with more than one dimension --- code-postprocessing/cocopp/ppfig.py | 6 +++--- code-postprocessing/cocopp/testbedsettings.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code-postprocessing/cocopp/ppfig.py b/code-postprocessing/cocopp/ppfig.py index 11a30aa1e..5890c3ecd 100644 --- a/code-postprocessing/cocopp/ppfig.py +++ b/code-postprocessing/cocopp/ppfig.py @@ -266,15 +266,15 @@ def get_rld_link(current_dir): file_name = '%s.html' % genericsettings.pprldmany_file_name links += add_link(current_dir, folder, file_name, - pprldmany_per_func_dim_header, dimension=20) + pprldmany_per_func_dim_header, dimension=testbedsettings.current_testbed.goto_dimension) file_name = '%s.html' % genericsettings.pprldmany_group_file_name links += add_link(current_dir, folder, file_name, - pprldmany_per_group_dim_header, dimension=20) + pprldmany_per_group_dim_header, dimension=testbedsettings.current_testbed.goto_dimension) file_name = '%s.html' % genericsettings.pprldmany_file_name links += add_link(current_dir, '', file_name, - pprldmany_per_group_dim_header, dimension=20) + pprldmany_per_group_dim_header, dimension=testbedsettings.current_testbed.goto_dimension) return links diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 5257be3d1..940bfcafa 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -210,6 +210,7 @@ class GECCOBBOBTestbed(Testbed): name=testbed_name_single, short_names=get_short_names(shortinfo_filename), dimensions_to_display=(2, 3, 5, 10, 20, 40), + goto_dimension=20, # auto-focus on this dimension in html rldDimsOfInterest=dimsOfInterest, tabDimsOfInterest=dimsOfInterest, hardesttargetlatex='10^{-8}', # used for ppfigs, pptable and pptables @@ -387,6 +388,7 @@ class GECCOBiObjBBOBTestbed(Testbed): name=testbed_name_bi, short_names=get_short_names(shortinfo_filename), dimensions_to_display=(2, 3, 5, 10, 20, 40), + goto_dimension=20, # auto-focus on this dimension in html rldDimsOfInterest=dimsOfInterest, tabDimsOfInterest=dimsOfInterest, hardesttargetlatex='10^{-5}', # used for ppfigs, pptable and pptables @@ -491,6 +493,7 @@ class BBOBLargeScaleTestbed(GECCOBBOBTestbed): name=testbed_name_ls, short_names=get_short_names(shortinfo_filename), dimensions_to_display=(20, 40, 80, 160, 320, 640), + goto_dimension=160, # auto-focus on this dimension in html tabDimsOfInterest=dimsOfInterest, rldDimsOfInterest=dimsOfInterest, hardesttargetlatex='10^{-8}', # used for ppfigs, pptable and pptables @@ -550,6 +553,7 @@ class GECCOBBOBMixintTestbed(GECCOBBOBTestbed): name=testbed_name_mixint, first_dimension=5, dimensions_to_display=[5, 10, 20, 40, 80, 160], + goto_dimension=40, # auto-focus on this dimension in html tabDimsOfInterest=dimsOfInterest, rldDimsOfInterest=dimsOfInterest, reference_algorithm_filename=None, # TODO produce correct reference algo and update this line @@ -578,6 +582,7 @@ class GECCOBBOBBiObjMixintTestbed(GECCOBiObjExtBBOBTestbed): name=testbed_name_bi_mixint, first_dimension=5, dimensions_to_display=[5, 10, 20, 40, 80, 160], + goto_dimension=40, # auto-focus on this dimension in html tabDimsOfInterest=dimsOfInterest, rldDimsOfInterest=dimsOfInterest, reference_algorithm_filename=None, # TODO produce correct reference algo and update this line From 024b0ec962c98792eac6b5541acabec7d9ec409d Mon Sep 17 00:00:00 2001 From: brockhof Date: Fri, 19 Apr 2019 12:10:25 +0200 Subject: [PATCH 19/28] removed unwanted prints --- code-postprocessing/cocopp/testbedsettings.py | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 28de8040f..f317de533 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -486,36 +486,9 @@ def filter(self, dsl): else: print(str((dsl[algname])[i])) if ((dsl[algname])[i]).funcId > 55: - print(str((dsl[algname])[i]) + ' removed') - - print('--------------------------------------') - print(dsl) - print('now popping...........................') - dsl[algname].pop(i) - - print(dsl) - print('--------------------------------------') - - return dsl - #new_dsl = {} - #for algname in dsl: - # new_ds = DataSetList() - # for d in dsl[algname]: - # if not d.get_suite() in ['bbob-biobj', 'bbob-biobj-ext']: - # raise ValueError("Data from %s suite is not " - # "compatible with other data from " - # "the bbob-biobj and/or bbob-biobj-ext " - # "suites" % str(ds.suite)) - # else: - # if d.funcId <= 55: - # new_ds.append(d) - # new_dsl[algname] = new_ds - # - #return new_dsl - class GECCOBiObjExtBBOBTestbed(GECCOBiObjBBOBTestbed): """Biobjective testbed to display data sets run on the `bbob-biobj-ext` From 576f37ebf83751469f64706ffb177c4c22bb8a42 Mon Sep 17 00:00:00 2001 From: nikohansen Date: Tue, 23 Apr 2019 22:06:06 +0200 Subject: [PATCH 20/28] Testbed.instances_are_uniform=False prevents simulated restarts in pprldmany for biobjective testbeds --- .../cocopp/compall/pprldmany.py | 34 ++++++++++++++----- code-postprocessing/cocopp/testbedsettings.py | 5 +-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/code-postprocessing/cocopp/compall/pprldmany.py b/code-postprocessing/cocopp/compall/pprldmany.py index 079dbfcfd..95322a895 100644 --- a/code-postprocessing/cocopp/compall/pprldmany.py +++ b/code-postprocessing/cocopp/compall/pprldmany.py @@ -420,10 +420,19 @@ def plot(dsList, targets=None, craftingeffort=0., **kwargs): evals = entry.detEvals([t])[0] runlengthsucc = evals[np.isnan(evals) == False] / divisor runlengthunsucc = entry.maxevals[np.isnan(evals)] / divisor - if len(runlengthsucc) > 0: - x = toolsstats.drawSP(runlengthsucc, runlengthunsucc, - percentiles=[50], - samplesize=perfprofsamplesize)[1] + if len(runlengthsucc) > 0: # else x == [inf, inf,...] + if testbedsettings.current_testbed.instances_are_uniform: + x = toolsstats.drawSP(runlengthsucc, runlengthunsucc, + percentiles=[50], + samplesize=perfprofsamplesize)[1] + else: + nruns = len(runlengthsucc) + len(runlengthunsucc) + if perfprofsamplesize % nruns: + warnings.warn("without simulated restarts nbsamples=%d" + " should be a multiple of nbruns=%d" + % (perfprofsamplesize, nruns)) + idx = toolsstats.randint_derandomized(nruns, size=perfprofsamplesize) + x = np.hstack((runlengthsucc, len(runlengthunsucc) * [np.inf]))[idx] data.extend(x) maxevals.extend(runlengthunsucc) @@ -636,10 +645,19 @@ def main(dictAlg, order=None, outputdir='.', info='default', assert entry.dim == dim runlengthsucc = evals[np.isnan(evals) == False] / divisor runlengthunsucc = entry.maxevals[np.isnan(evals)] / divisor - if len(runlengthsucc) > 0: - x = toolsstats.drawSP(runlengthsucc, runlengthunsucc, - percentiles=[50], - samplesize=perfprofsamplesize)[1] + if len(runlengthsucc) > 0: # else x == [inf, inf,...] + if testbedsettings.current_testbed.instances_are_uniform: + x = toolsstats.drawSP(runlengthsucc, runlengthunsucc, + percentiles=[50], + samplesize=perfprofsamplesize)[1] + else: + nruns = len(runlengthsucc) + len(runlengthunsucc) + if perfprofsamplesize % nruns: + warnings.warn("without simulated restarts nbsamples=%d" + " should be a multiple of nbruns=%d" + % (perfprofsamplesize, nruns)) + idx = toolsstats.randint_derandomized(nruns, size=perfprofsamplesize) + x = np.hstack((runlengthsucc, len(runlengthunsucc) * [np.inf]))[idx] except (KeyError, IndexError): # set_trace() warntxt = ('Data for algorithm %s on function %d in %d-D ' diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 5257be3d1..d0e8747f8 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -165,6 +165,8 @@ class Testbed(object): """ reference_algorithm_displayname = None + instances_are_uniform = True + "False for biobjective suites, used (so far only) for simulated restarts in pprldmany" def info(self, fun_number=None): """info on the testbed if ``fun_number is None`` or one-line info @@ -369,8 +371,6 @@ def __init__(self, target_values): self.instantiate_attributes(target_values, [key]) - - class GECCOBiObjBBOBTestbed(Testbed): """Testbed used in the BBOB workshops to display data sets run on the `bbob-biobj` test suite. @@ -396,6 +396,7 @@ class GECCOBiObjBBOBTestbed(Testbed): pprldistr_target_values=(1e-1, 1e-2, 1e-3, 1e-5), pprldmany_target_values= np.append(np.append(10 ** np.arange(0, -5.1, -0.1), [0]), -10 ** np.arange(-5, -3.9, 0.2)), + instances_are_uniform = False, pprldmany_target_range_latex='$\{-10^{-4}, -10^{-4.2}, $ $-10^{-4.4}, -10^{-4.6}, -10^{-4.8}, -10^{-5}, 0, 10^{-5}, 10^{-4.9}, 10^{-4.8}, \dots, 10^{-0.1}, 10^0\}$', ppscatter_target_values=np.logspace(-5, 1, 21), # 21 was 51 rldValsOfInterest=(1e-1, 1e-2, 1e-3, 1e-4, 1e-5), From 5cb2697b2cc32db1bf508ac40a7ca962d1a2e9cc Mon Sep 17 00:00:00 2001 From: brockhof Date: Wed, 24 Apr 2019 08:44:37 +0200 Subject: [PATCH 21/28] correction --- code-postprocessing/cocopp/testbedsettings.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index f317de533..6c0f65d8b 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -497,19 +497,19 @@ class GECCOBiObjExtBBOBTestbed(GECCOBiObjBBOBTestbed): shortinfo_filename = 'bbob-biobj-benchmarkshortinfos.txt' - settings = {} # dict( -# info_filename='bbob-biobj-benchmarkinfos.txt', -# shortinfo_filename=shortinfo_filename, -# name=testbed_name_bi_ext, -# short_names=get_short_names(shortinfo_filename), -# functions_with_legend=(1, 30, 31, 60, 61, 92), -# first_function_number=1, -# last_function_number=92, -# scenario=scenario_biobjextfixed, -# reference_algorithm_filename='', # TODO produce correct best2017 algo and delete this line -# reference_algorithm_displayname='', # TODO: should be read in from data set in reference_algorithm_filename -# instancesOfInterest={1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1}, # None:consider all instances -# ) + settings = dict( + info_filename='bbob-biobj-benchmarkinfos.txt', + shortinfo_filename=shortinfo_filename, + name=testbed_name_bi_ext, + short_names=get_short_names(shortinfo_filename), + functions_with_legend=(1, 30, 31, 60, 61, 92), + first_function_number=1, + last_function_number=92, + scenario=scenario_biobjextfixed, + reference_algorithm_filename='', # TODO produce correct best2017 algo and delete this line + reference_algorithm_displayname='', # TODO: should be read in from data set in reference_algorithm_filename + instancesOfInterest={1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1}, # None:consider all instances + ) def __init__(self, targetValues): super(GECCOBiObjExtBBOBTestbed, self).__init__(targetValues) From 71c37fc1062fe49ef3678a536148787816c098db Mon Sep 17 00:00:00 2001 From: brockhof Date: Sat, 27 Apr 2019 07:31:59 +0200 Subject: [PATCH 22/28] shortened some of the bbob-biobj(-ext) function names to reduce the effect of too narrow plots in the pdf output (in the single function ECDFs) --- .../cocopp/bbob-biobj-benchmarkshortinfos.txt | 50 +++++++++---------- code-postprocessing/cocopp/testbedsettings.py | 1 + 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/code-postprocessing/cocopp/bbob-biobj-benchmarkshortinfos.txt b/code-postprocessing/cocopp/bbob-biobj-benchmarkshortinfos.txt index 730b182d1..63bdfd426 100644 --- a/code-postprocessing/cocopp/bbob-biobj-benchmarkshortinfos.txt +++ b/code-postprocessing/cocopp/bbob-biobj-benchmarkshortinfos.txt @@ -1,6 +1,6 @@ 1 Sphere/Sphere 2 Sphere/sep. Ellipsoid -3 Sphere/Attractive sector +3 Sphere/Attr. sector 4 Sphere/Rosenbrock 5 Sphere/Sharp ridge 6 Sphere/Different Powers @@ -8,51 +8,51 @@ 8 Sphere/Schaffer F7 9 Sphere/Schwefel 10 Sphere/Gallagher 101 -11 sep. Ellipsoid/sep. Ellipsoid -12 sep. Ellipsoid/Attractive sector +11 sep. Ellipsoid/sep. Elli. +12 sep. Ellipsoid/Attr. sector 13 sep. Ellipsoid/Rosenbrock 14 sep. Ellipsoid/Sharp ridge -15 sep. Ellipsoid/Different Powers +15 sep. Ellipsoid/Diff. Powers 16 sep. Ellipsoid/Rastrigin 17 sep. Ellipsoid/Schaffer F7 18 sep. Ellipsoid/Schwefel -19 sep. Ellipsoid/Gallagher 101 -20 Attractive sector/Attractive sector -21 Attractive sector/Rosenbrock -22 Attractive sector/Sharp ridge -23 Attractive sector/Different Powers -24 Attractive sector/Rastrigin -25 Attractive sector/Schaffer F7 -26 Attractive sector/Schwefel -27 Attractive sector/Gallagher 101 +19 sep. Elli./Gallagher 101 +20 Attr. sector/Attr. sector +21 Attr. sector/Rosenbrock +22 Attr. sector/Sharp ridge +23 Attr. sector/Diff. Powers +24 Attr. sector/Rastrigin +25 Attr. sector/Schaffer F7 +26 Attr. sector/Schwefel +27 Attr. sector/Gallagher 101 28 Rosenbrock/Rosenbrock 29 Rosenbrock/Sharp ridge -30 Rosenbrock/Different Powers +30 Rosenbrock/Diff. Powers 31 Rosenbrock/Rastrigin 32 Rosenbrock/Schaffer F7 33 Rosenbrock/Schwefel 34 Rosenbrock/Gallagher 101 35 Sharp ridge/Sharp ridge -36 Sharp ridge/Different Powers +36 Sharp ridge/Diff. Powers 37 Sharp ridge/Rastrigin 38 Sharp ridge/Schaffer F7 39 Sharp ridge/Schwefel 40 Sharp ridge/Gallagher 101 -41 Different Powers/Different Powers -42 Different Powers/Rastrigin -43 Different Powers/Schaffer F7 -44 Different Powers/Schwefel -45 Different Powers/Gallagher 101 +41 Diff. Powers/Diff. Powers +42 Diff. Powers/Rastrigin +43 Diff. Powers/Schaffer F7 +44 Diff. Powers/Schwefel +45 Diff. Powers/Gallagher 101 46 Rastrigin/Rastrigin 47 Rastrigin/Schaffer F7 48 Rastrigin/Schwefel 49 Rastrigin/Gallagher 101 50 Schaffer F7/Schaffer F7 51 Schaffer F7/Schwefel -52 Schaffer F7/Gallagher 101 +52 Schaffer F7/Gallagh. 101 53 Schwefel/Schwefel 54 Schwefel/Gallagher 101 -55 Gallagher 101/Gallagher 101 +55 Gallagher 101/Gallagh. 101 56 Sphere/sep. Rastrigin 57 Sphere/Skew Rastrigin-Bueche 58 Sphere/Linear slope @@ -70,12 +70,12 @@ 70 Ellipsoid/Discus 71 Ellipsoid/Bent cigar 72 Ellipsoid/Sharp ridge -73 Ellipsoid/Different Powers +73 Ellipsoid/Diff. Powers 74 Discus/Bent cigar 75 Discus/Sharp ridge -76 Discus/Different Powers +76 Discus/Diff. Powers 77 Bent cigar/Sharp ridge -78 Bent cigar/Different Powers +78 Bent cigar/Diff. Powers 79 Rastrigin/Schaffer F7 cond 1000 80 Rastrigin/Griewank-Rosenbrock 81 Schaffer F7/Schaffer F7 cond 1000 diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 3dfbfe268..bbe86edcd 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -630,6 +630,7 @@ class GECCOBBOBBiObjMixintTestbed(GECCOBiObjExtBBOBTestbed): name=testbed_name_bi_mixint, first_dimension=5, dimensions_to_display=[5, 10, 20, 40, 80, 160], + instances_are_uniform=False, tabDimsOfInterest=dimsOfInterest, rldDimsOfInterest=dimsOfInterest, reference_algorithm_filename=None, # TODO produce correct reference algo and update this line From 1b73b10544f3c2e54b776c4211a8f66c6cc6df34 Mon Sep 17 00:00:00 2001 From: brockhof Date: Sat, 27 Apr 2019 07:56:29 +0200 Subject: [PATCH 23/28] removed unnecessary print --- code-postprocessing/cocopp/testbedsettings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index bbe86edcd..95ac44c04 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -485,7 +485,6 @@ def filter(self, dsl): "the bbob-biobj and/or bbob-biobj-ext " "suites" % str((dsl[algname])[i].suite)) else: - print(str((dsl[algname])[i])) if ((dsl[algname])[i]).funcId > 55: dsl[algname].pop(i) return dsl From 2395f9d2072dc2a44d0a39949f6dec7c87894b62 Mon Sep 17 00:00:00 2001 From: brockhof Date: Tue, 30 Apr 2019 10:43:45 +0200 Subject: [PATCH 24/28] change to Java 11 on CircleCI to (hopefully) pass the tests again --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef4313010..d6243ad7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ jobs: - run: name: Install jdk for java tests command: | - apt-get install -y openjdk-8-jdk + apt-get install -y openjdk-11-jdk updatedb - run: name: Run coco octave tests @@ -163,7 +163,7 @@ jobs: - run: name: Install jdk for java tests command: | - apt-get install -y openjdk-8-jdk + apt-get install -y openjdk-11-jdk updatedb - run: name: Run coco java tests From 8b9c7f811efa3beef18be8a544d5ab5a84c46322 Mon Sep 17 00:00:00 2001 From: brockhof Date: Tue, 30 Apr 2019 11:33:49 +0200 Subject: [PATCH 25/28] corrected merge of pull request that had still some cmocka parts in it --- do.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/do.py b/do.py index 1d0c7f775..58ed53fae 100755 --- a/do.py +++ b/do.py @@ -124,31 +124,6 @@ def test_c_example(): def build_c_unit_tests(): """ Builds unit tests in C """ - library_path = 'code-experiments/test/unit-test/lib' - library_dir = '' - file_name = '' - if 'win32' in sys.platform: - file_name = 'cmocka.dll' - if '64' in platform.machine(): - library_dir = 'win64' - elif ('32' in platform.machine()) or ('x86' in platform.machine()): - if 'cygwin' in os.environ['PATH']: - library_dir = 'win32_cygwin' - else: - library_dir = 'win32_mingw' - elif 'linux' in sys.platform: - file_name = 'libcmocka.so' - if 'Ubuntu' in platform.linux_distribution(): - library_dir = 'linux_ubuntu' - elif 'Fedora' in platform.linux_distribution(): - library_dir = 'linux_fedora' - elif 'darwin' in sys.platform: # Mac - library_dir = 'macosx' - file_name = 'libcmocka.dylib' - - if len(library_dir) > 0: - copy_file(os.path.join(library_path, library_dir, file_name), - os.path.join('code-experiments/test/unit-test', file_name)) copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) From f72e3b0dc06418ba2c205328d9fd976e6ac37a25 Mon Sep 17 00:00:00 2001 From: brockhof Date: Tue, 30 Apr 2019 14:02:19 +0200 Subject: [PATCH 26/28] remove the check for JAVA_HOME --- do.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/do.py b/do.py index 58ed53fae..e731d04bf 100755 --- a/do.py +++ b/do.py @@ -673,15 +673,12 @@ def build_java(): # env=os.environ, universal_newlines=True) #jdkpath1 = jdkpath.split("jni.h")[0] # better - jdkhome = os.environ.get('JAVA_HOME') or os.environ.get('JDK_HOME') - if not jdkhome: - javapath = executable_path('java') - if not javapath: - raise RuntimeError('Can not find Java executable') - jdkhome = abspath(join(javapath, os.pardir, os.pardir)) - if os.path.basename(jdkhome) == 'jre': - jdkhome = join(jdkhome, os.pardir) - + javapath = executable_path('java') + if not javapath: + raise RuntimeError('Can not find Java executable') + jdkhome = abspath(join(javapath, os.pardir, os.pardir)) + if os.path.basename(jdkhome) == 'jre': + jdkhome = join(jdkhome, os.pardir) jdkpath1 = join(jdkhome, 'include') jdkpath2 = jdkpath1 + '/linux' run('code-experiments/build/java', From 6da4e061cd064d6a14d203696668eb8dc3364ea4 Mon Sep 17 00:00:00 2001 From: brockhof Date: Tue, 30 Apr 2019 14:37:00 +0200 Subject: [PATCH 27/28] no interactive installation under linux for Octave tests --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d6243ad7c..c70ac9ead 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,7 +63,7 @@ jobs: - run: name: Install octave for octave tests command: | - apt-get install -y liboctave-dev + DEBIAN_FRONTEND=noninteractive apt-get install -y liboctave-dev updatedb - run: name: Run coco octave tests From 4f164184ff7708d45cf63fe7a79b1212ef5503b5 Mon Sep 17 00:00:00 2001 From: brockhof Date: Tue, 30 Apr 2019 15:18:07 +0200 Subject: [PATCH 28/28] correction in filter method when suite is not biobjective --- code-postprocessing/cocopp/testbedsettings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code-postprocessing/cocopp/testbedsettings.py b/code-postprocessing/cocopp/testbedsettings.py index 95ac44c04..0e33c1da3 100644 --- a/code-postprocessing/cocopp/testbedsettings.py +++ b/code-postprocessing/cocopp/testbedsettings.py @@ -207,8 +207,7 @@ def filter(self, dsl): Right now only used for making bbob-biobj and bbob-biobj-ext suites consistent. Here implemented as a stub. """ - if type(dsl) is list: - return dsl + return dsl