Git Product home page Git Product logo

coco's Introduction

numbbo/coco: Comparing Continuous Optimizers

Important

This repository contains the source files for the coco framework. If you don't want to extend the framework, you probably don't need this! See instead the new documentation and use the language bindings of your choice from the package repository for your language (e.g. PyPI for Python, crates.io for Rust, ...).

Caution

We are currently refactoring the coco code base to make it more accessible. Much of the documentation is therefore outdated or in a state of flux. We try our best to update it as soon as possible, if you find something that you think is outdated or needs a better description, don't hestitate to open an issue or a pull request!

DOI [BibTeX] 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. COmparing Continuous Optimizers: numbbo/COCO on Github. Zenodo, DOI:10.5281/zenodo.2594848, March 2019.


This code provides a platform to benchmark and compare continuous optimizers, AKA non-linear solvers for numerical optimization. It is fully written in ANSI C and Python (reimplementing the original Comparing Continous Optimizer platform) with other languages calling the C code. Languages currently available to connect a solver to the benchmarks are

  • C/C++
  • Java
  • MATLAB
  • Octave
  • Python
  • Rust

Contributions to link further languages (including a better example in C++) are more than welcome.

The general project structure is shown in the following figure where the black color indicates code or data provided by the platform and the red color indicates either user code or data and graphical output from using the platform:

General COCO Structure

For more general information:

Getting Started

Running Experiments

  1. For running experiments in Python, follow the (new) instructions here.
    Otherwise, download the COCO framework code from github,

    • either by clicking the Download ZIP button and unzip the zip file,
    • or by typing git clone https://github.com/numbbo/coco.git. This way allows to remain up-to-date easily (but needs git to be installed). After cloning, git pull keeps the code up-to-date with the latest release.

    The record of official releases can be found here. The latest release corresponds to the master branch as linked above.

  2. In a system shell, cd into the coco or coco-<version> folder (framework root), where the file do.py can be found. Type, i.e. execute, one of the following commands once

      python do.py run-c
      python do.py run-java
      python do.py run-matlab
      python do.py run-octave
      python do.py run-python

    depending on which language shall be used to run the experiments. run-* will build the respective code and run the example experiment once. The build result and the example experiment code can be found under code-experiments/build/<language> (<language>=matlab for Octave). python do.py lists all available commands.

  3. 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 or 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:

    If the example experiment runs, connect your favorite algorithm to Coco: replace the call to the random search optimizer in the example experiment file by a call to your algorithm (see above). Update the output result_folder, the algorithm_name and algorithm_info of the observer options in the example experiment file.

    Another entry point for your own experiments can be the code-experiments/examples folder.

  4. Now you can run your favorite algorithm on the bbob and bbob-largescale suites (for single-objective algorithms), on the bbob-biobj suite (for multi-objective algorithms), or on the mixed-integer suites (bbob-mixint and bbob-biobj-mixint respectively). Output is automatically generated in the specified data result_folder. By now, more suites might be available, see below.

Post-processing Data

  1. Install the post-processing for displaying data (using Python):

        pip install cocopp
    
  2. Postprocess the data from the results folder of a locally run experiment by typing

        python -m cocopp [-o OUTPUT_FOLDERNAME] YOURDATAFOLDER [MORE_DATAFOLDERS]

    Any subfolder in the folder arguments will be searched for logged data. That is, experiments from different batches can be in different folders collected under a single "root" YOURDATAFOLDER folder. We can also compare more than one algorithm by specifying several data result folders generated by different algorithms.

  3. We also provide many archived algorithm data sets. For example

      python -m cocopp 'bbob/2009/BFGS_ros' 'bbob/2010/IPOP-ACTCMA'

    processes the referenced archived BFGS data set and an IPOP-CMA data set. The given substring must have a unique match in the archive or must end with ! or * or must be a regular expression containing a * and not ending with ! or *. Otherwise, all matches are listed but none is processed with this call. For more information in how to obtain and display specific archived data, see help(cocopp) or help(cocopp.archives) or the class COCODataArchive.

    Data descriptions can be found for the bbob test suite at coco-algorithms and for the bbob-biobj test suite at coco-algorithms-biobj. For other test suites, please see the COCO data archive.

    Local and archived data can be freely mixed like

      python -m cocopp YOURDATAFOLDER 'bbob/2010/IPOP-ACT'

    which processes the data from YOURDATAFOLDER and the archived IPOP-ACT data set in comparison.

    The output folder, ppdata by default, contains all output from the post-processing. The index.html file is the main entry point to explore the result with a browser. Data from the same foldername as previously processed may be overwritten. If this is not desired, a different output folder name can be chosen with the -o OUTPUT_FOLDERNAME option.

    A summary pdf can be produced via LaTeX. The corresponding templates can be found in the code-postprocessing/latex-templates folder. Basic html output is also available in the result folder of the postprocessing (file templateBBOBarticle.html).

  4. In order to exploit more features of the post-processing module, it is advisable to use the module within a Python or IPython shell or a Jupyter notebook or JupyterLab, where

    import cocopp
    help(cocopp)

    provides the documentation entry pointer.

If you detect bugs or other issues, please let us know by opening an issue in our issue tracker at https://github.com/numbbo/coco/issues.

Known Issues / Trouble-Shooting

Post-Processing

Too long paths for postprocessing

It can happen that the postprocessing fails due to too long paths to the algorithm data. Unfortunately, the error you get in this case does not indicate directly to the problem but only tells that a certain file could not be read. Please try to shorten the folder names in such a case.

Font issues in PDFs

We have occasionally observed some font issues in the pdfs, produced by the postprocessing of COCO (see also issue #1335). Changing to another matplotlib version solved the issue at least temporarily.

BibTeX under Mac

Under the Mac operating system, bibtex seems to be messed up a bit with respect to absolute and relative paths which causes problems with the test of the postprocessing via python do.py test-postprocessing. Note that there is typically nothing to fix if you compile the LaTeX templates "by hand" or via your LaTeX IDE. But to make the
python do.py test-postprocessing work, you will have to add a line with openout_any = a to your texmf.cnf file in the local TeX path. Type kpsewhich texmf.cnf to find out where this file actually is.

Algorithm appears twice in the figures

Earlier versions of cocopp have written extracted data to a folder named _extracted_.... If the post-processing is invoked with a * argument, these folders become an argument and are displayed (most likely additionally to the original algorithm data folder). Solution: remove the _extracted_... folders and use the latest version of the post-processing module cocopp (since release 2.1.1).

Implementation Details

  • The C code features an object oriented implementation, where the coco_problem_t is the most central data structure / object. coco.h, example_experiment.c and coco_internal.h are probably the best pointers to start to investigate the code (but see also here). coco_problem_t defines a benchmark function instance (in a given dimension), and is called via coco_evaluate_function.

  • Building, running, and testing of the code is done by merging/amalgamation of all C-code into a single C file, coco.c, and coco.h. (by calling do.py, see above). Like this it becomes very simple to include/use the code in different projects.

  • Cython is used to compile the C to Python interface in build/python/interface.pyx. The Python module installation file setup.py uses the compiled interface.c, if interface.pyx has not changed. For this reason, Cython is not a requirement for the end-user.

Citation

You may cite this work in a scientific context as

N. Hansen, A. Auger, R. Ros, O. Mersmann, T. Tušar, D. Brockhoff. COCO: A Platform for Comparing Continuous Optimizers in a Black-Box Setting, Optimization Methods and Software, 36(1), pp. 114-144, 2021. [pdf, arXiv]

@ARTICLE{hansen2021coco,
author = {Hansen, N. and Auger, A. and Ros, R. and Mersmann, O.
          and Tu{\v s}ar, T. and Brockhoff, D.},
title = {{COCO}: A Platform for Comparing Continuous Optimizers 
          in a Black-Box Setting},
journal = {Optimization Methods and Software},
doi = {https://doi.org/10.1080/10556788.2020.1808977},
pages = {114--144},
issue = {1},
volume = {36},
year = 2021
}

Links About the Workshops and Data

Comprehensive List of Documentations

coco's People

Contributors

anneauger avatar berndbischl avatar brockho avatar dotran avatar dtusar avatar floopcz avatar fmgs666 avatar girotomas avatar giuse avatar islandblue avatar kkafar avatar kostasvar avatar luleyleo avatar mlopez-ibanez avatar ndmanh avatar nikohansen avatar oaitelhara avatar olafmersmann avatar paulduf avatar petrposik avatar phrsampaio avatar tobiaswagner avatar trautm avatar ttusar avatar ulfgard avatar youheiakimoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coco's Issues

Handle Non-anytime Algorithms

non-anytime algorithms

- restart signal must point to a unique run
- write scripts in Matlab, Java, C/C++, Python, that benchmark a non-anytime 
algorithm by doing restarts with increasing budgets.
- transform non-anytime algorithm data into budget-less data (we need restart 
annotations for that). 


Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:50

CVS file conversion

A function/class that imports from cvs files, like those Bernd Bischl provided, 
into the post-processing 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 9:59

Merge code bases

Merge code bases (if time needed <2h), not only config: is there a problem with 
DataSet becoming a new style class?

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:42

Remove pickle files from repository

Remove (almost) all pickle files from the repository? Only if this does not 
make things worse regarding space. For this, the load_data_files mechanism must 
proceed as follows: data files are by default zipped or tar.gz text archives. 
When they are opened the first time, at the same location a folder with 
.pickle.gz files is generated. The pickle folder also stores a check-sum of the 
original archive. Any subsequent loads of this "data file" loads the pickle 
folder and checks the check-sum and if this has changed the pickle files are 
removed and regenerated like for the first time opening... 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 9:16

Single-Run Plot Function

implement a single-run plot function: input is, for the time being, an .tdat 
file, the first run found

- read in data (just as an array)
- plot data
- design a single-run class? 


Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:45

Invisible ftarget

ftarget should become invisible to the solver: instead of returning ftarget, a 
call-back function should return a flag whether a final termination condition 
is reached. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 5:07

Comparative Scaling Graphs

Do we have comparative scaling graphs (like Fig.1)? Would they have some 
advantage over the scatter plots? 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:43

RANDOMSEARCH as reference algorithm for easy targets

Try RANDOMSEARCH as alternative reference algorithm for easy target values. 
Using a portfolio of the best of [-4,4], [-4.5, 4.5], [-5, 5] might be the 
right thing to do. However, this is not too realistic for dimension>10. 
Alternatively, we can sample cubes around the optimum and like that estimate 
the volume for each target level. The reference would be rel_vol with 
rel_vol^dimension<target. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:43

Display testbed ID in ECDF graphs

display testbed ID in the ECDF graphs (now functions and dimensions are shown). 
We also need to define how an ID should look like, where this information is 
stored and how it is passed around. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 5:46

Allow for .zip files to contain data for postprocessing

(after new data format is introduced) processInputArgs/findfiles should also 
accept zipped archives (now it accepts 'tar', '.tar.gz'). Maybe: write a small 
class, that opens a file or folder regardless wether it is zipped, tarred, 
tar.gz... 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 5:55

Improve R documentation

The R doc looks really crappy and comes from doc/sphinxdoc/source/READSPHINX 
somehow written by the makefile 

Original issue reported on code.google.com by [email protected] on 14 Jun 2014 at 11:42

xticks in Figure 2 (runlength-based setting)

Figure 2:

- for large evaluation setting runlength-based the xticks are not fine, but why?
- (Done) show previous algorithms in the background also with runlength based 
targets.

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:36

Single function ECDFs

Check that the single function ECDFs are created correctly in all cases (e.g. 
also in the single algorithm case)

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 5:05

Best Algorithm Class inherited from DataSet class

implement a (new) best algorithm class that derives from the DataSet class

- the DataSet class should become a new-style class (inheriting from object) 
first!
- implementing a (new) best algorithm class that derives from the DataSet class 
looks simple: only for each target the evals-line with the best ERT or best 
median f-value (or best f-value?) needs to be inserted. 

related to #45


Original issue reported on code.google.com by [email protected] on 16 Jun 2014 at 12:22

Deal with (too) rich data sets

Test the (already implemented?) feature that writes more data than needed 
(implemented in fgeneric) in the post-processing; especially skip additional 
data entries

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 9:01

Plot of the average log runtime vs the fraction of problems.

Plot the average log runtime vs the fraction of problems.

Remarks:
- This is the area to the left of the ECDF graph up to the respective fraction.
- The maximal runtime would be the ECDF graph with flipped axes
- The median runtime would be the ECDF graph with flipped axes, plotted up to 
0.5 but annotated up to 1.0
- The average runtime is probably not so interesting, because it is too much 
dominated by the maximum runtime 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 8:56

Dealing with maxfuneval in successful/unsuccessful data

Check how maxevals is used (e.g. line 400 in pprldmany): differentiate between 
successful and unsuccessful data! We need to decide what is most reasonable to 
display. It might be reasonable to display the larger value of either 
unsuccessful or successful (all?) runs. 

Original issue reported on code.google.com by [email protected] on 16 Jun 2014 at 12:12

target dependend figures

rungeneric should accept a target level for the scaling figures when comparing 
many algorithms. This should work with an f-value and RL based target. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 8:57

Separating Unit Tests for Users and Developers

implement a unit test separate for users and developers: maybe based on some 
"automatic detection" of finding the data. Related: data might be downloaded 
automatically (but we don't want to annoy the user, so we should be smart about 
the interface). 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:51

Consistency in New Figure 3

How are maxFE/D in the table and the vertical line in the Figure 3 computed? If 
they do not match, why? One is computed based on ERT, the other on evaluations, 
see also Issue #13. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 12:45

Max Budget in New Figure 3

Figure 3 (new): why is max-budget different for table and pictures? (The range 
of fevals is not the same (one with floor, the other with a ceil like). Fixed). 
Reverted (Niko). The figures show now i such that only for the largest i we 
have 10^i >= maxERT, the table show all i such that 10^i<=maxmaxevals. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 10:06

Implement Algorithm Filter to Extract the Best X%

A procedure to filter the better algorithms out of a dataset list (see mail by 
Arnold Neumaier). First idea: any algorithm which is within 10% of the best 
algorithm for at least one function-target pair. This might not be workable, as 
it might select too many algorithms. It could be done function group-wise. Or: 
all algorithms where the ECDF is at some point no less than a factor of two 
(horizontally) away from the best single (non-artificial) algorithm. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 8:54

Loading pickle files

benchmark the time for cPickle.load(gzip.open('testfile.pickle.gz','rb')) 
versus cPickle.load('testfile.pickle','rb') and report back (gzip might be even 
faster, because it needs to read less from disk). We like to be able to load 
.pickle and .pickle.gz files alike (e.g. in class DataSetList). 

Original issue reported on code.google.com by [email protected] on 16 Jun 2014 at 12:34

Function labels in dataset class

The dataset class should probably contain a description of the function, not 
only a number. This is non-trivial, because it would need to be passed through 
the entire data chain (e.g. in the .info files) 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 9:00

Parameter Sweeps

Complete the usecase where we sweep over a parameter rather than over an 
instance 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:44

Documentation Sphinx: Java

coco/BBOB/doc/sphinxdoc/source/runningexp.rst should be complemented with a few 
words how Java can be used to run experiments. 

Original issue reported on code.google.com by [email protected] on 13 Jun 2014 at 4:46

postprocessing: Code restructuring regarding DataSet class

The DataSet class should become a new-style class (inheriting from object)

- copy-paste into a new class DataSet2(object)?
- start using the new class (cave: pickle objects are most likely not 
compatible even if the name were kept)
- as becoming class DataSet a new-style class will make all .pickle data files 
invalid they need to be regenerated. Proposed procedure: see above under 
"remove (almost) all pickle files". 

Original issue reported on code.google.com by [email protected] on 16 Jun 2014 at 12:13

  • Blocking: #20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.