Best algorithm dataset module
This module implements BestAlgSet
class which is used as
data structure for the data set of the virtual best algorithm.
Therefore this module will be imported by other modules which need
to access best algorithm data set.
The best algorithm data set can be accessed by the
bestAlgorithmEntries
variable. This variable needs to be
initialized by executing functions load_reference_algorithm(...)
This module can also be used generate the best algorithm data set with its generate method.
Class |
|
Unit element of best algorithm data set. |
Function | create |
Undocumented |
Function | custom |
Generates best algorithm data set from a given set of algorithms. |
Function | deprecated |
Generates best algorithm data set. |
Function | extract |
Returns (and prints) per dimension a list of algorithms within algorithm list args that contains an algorithm if for any |
Function | generate |
Generates dictionary of best algorithm data set. |
Function | get |
Undocumented |
Function | get |
Computes first the artificial best algorithm from given algorithm list algnamelist, constructed by extracting for each target/function pair thalgorithm with best ERT among the given ones. Returns then the list of algorithms that are contributing to the definition of the best algorithm, separated by dimension, and sorted by importance (i... |
Function | load |
Assigns bestAlgorithmEntries . |
Function | reset |
Undocumented |
Function | usage |
Undocumented |
Function | write |
Undocumented |
Variable | algs2009 |
Undocumented |
Variable | algs2010 |
Undocumented |
Variable | algs2012 |
Undocumented |
Variable | best |
Undocumented |
Generates best algorithm data set from a given set of algorithms.
It will create a folder named as algId in the current working directory
corresponding to the bestalg dataSet of the algorithms listed in
variable args. This folder is furthermore added to a .tar.gz
file
of the same name.
This method is called from the python command line from a directory containing all necessary data folders:
>>> import cocopp >>> def print_(*args, **kwargs): pass >>> cocopp.archives.bbob._print = print_ # prevent download message >>> filename = cocopp.archives.bbob.get('2009/ALPS_hornby_noiseless') >>> with cocopp.toolsdivers.InfolderGoneWithTheWind(cocopp.archives.bbob.local_data_path):
... print('ESC'); cocopp.bestalg.custom_generate((filename, ), ... '_doctest_refAlgFromALPS') # doctest: +ELLIPSIS ESC...
Generates best algorithm data set.
This functionality is deprecated because it writes unsupported pickle files.
It will create a folder bestAlg in the current working directory with a pickle file corresponding to the bestalg dataSet of the algorithms listed in variable args.
This method is called from the python command line from a directory containing all necessary data folders.
Returns (and prints) per dimension a list of algorithms within algorithm list args that contains an algorithm if for any
dimension/target/function pair this algorithm: - is the best algorithm wrt ERT - its own ERT lies within a factor f_factor of the best ERT - there is no algorithm within a factor of f_factor of the best ERT
and the current algorithm is the second best.
Computes first the artificial best algorithm from given algorithm list algnamelist, constructed by extracting for each target/function pair thalgorithm with best ERT among the given ones. Returns then the list of algorithms that are contributing to the definition of the best algorithm, separated by dimension, and sorted by importance (i.e. with respect to the number of target/function pairs where each algorithm is best). Only target/function pairs are taken into account where the target is in between target_lb and target_ub. This method should be called from the python command line from a directory containing all necessary data folders:
>>> import os, cocopp >>> import cocopp.toolsdivers >>> def print_(*args, **kwargs): pass >>> cocopp.archives.bbob._print = print_ # prevent downloading... message >>> filenames = (cocopp.archives.bbob.get('2009/BIPOP-CMA-ES'), # first match will stay the same forever ... cocopp.archives.bbob.get('2009/MCS_huyer_noiseless')) >>> with cocopp.toolsdivers.InfolderGoneWithTheWind(cocopp.archives.bbob.local_data_path): ... cocopp.bestalg.getAllContributingAlgorithmsToBest(filenames) ... assert os.path.exists('bestCustomAlg.tar.gz') # doctest:+ELLIPSIS Generating best algorithm data...
Assigns bestAlgorithmEntries
.
This function is needed to set the global variable
bestAlgorithmEntries
. It reads in the data, specified by
the string best_algo_filename which can
either be a pickled file (deprecated), generated by
deprecated_customgenerate or any standard data set (i.e. a zipped or
unzipped folder with .info, .dat, and .tdat files such as the ones
generated by custom_generate). This function will also set
the testbedsettings.current_testbed.reference_algorithm_displayname
according to the read data if not already present.
bestAlgorithmEntries
is a dictionary accessed by providing
a tuple (dimension, function)
. This returns an instance
of BestAlgSet
.
The data is that of specific algorithms (depending on the Testbed used).