module documentation

A short yet complete example experiment script with restarts and batching.

Arguments

This script must be called with 1-3 arguments:

budget_multiplier [number_of_batches batch_to_execute]

budget_multiplier times dimension is the budget within which problem instances are run repeatedly as long as too few successes are observed.

batch_to_execute can only be omitted when number_of_batches == 1. When number_of_batches > 1, the script must be executed repeatedly (e.g., in parallel) with the different values for batch_to_execute = 0..number_of_batches-1 to get data for the full experiment.

Usage

To apply the code to a different solver/algorithm, fmin must be re-assigned or re-defined accordingly, and the below code must be edited at the two places marked with "### input" around lines 40 and 80.

See also: https://coco-platform.org/getting-started#experiment

Variable __author__ Undocumented
Variable __copyright__ Undocumented
Variable batcher Undocumented
Variable cma Undocumented
Variable dsl Undocumented
Variable final_condition Undocumented
Variable final_conditions Undocumented
Variable minimal_print Undocumented
Variable observer Undocumented
Variable output_folder Undocumented
Variable repeater Undocumented
Variable res Undocumented
Variable scipy Undocumented
Variable suite Undocumented
Variable suite_filter Undocumented
Variable suite_name Undocumented
Variable time0 Undocumented
Variable time1 Undocumented
Variable timings Undocumented
Variable ts Undocumented
Variable xopt Undocumented
Variable _ninst Undocumented
__author__: str =

Undocumented

Value
'Nikolaus Hansen'
__copyright__: str =

Undocumented

Value
'public domain'
batcher =

Undocumented

Value
cocoex.BatchScheduler(number_of_batches, batch_to_execute)
cma =

Undocumented

Value
cocoex.utilities.forgiving_import('cma')
dsl =

Undocumented

Value
cocopp.main(observer.result_folder)
final_condition =

Undocumented

Value
res[1]
final_conditions =

Undocumented

Value
collections.defaultdict(list)
minimal_print =

Undocumented

Value
cocoex.utilities.MiniPrint()
observer =

Undocumented

Value
cocoex.Observer(suite_name,
                """result_folder: {0}  algorithm_name: {1}""".format(output_folder↵
,
                                                                     (fmin.__module__↵
+'.'+fmin.__name__)))
output_folder =

Undocumented

Value
"""{}_of_{}_{}D_on_{}{}""".format(fmin.__name__,
                                  (fmin.__module__ or ''),
                                  int((budget_multiplier+0.499)),
                                  suite_name,
                                  (('_batch{:0' + str(len(str(number_of_batches ↵
- 1))) + '}of{}').format(
    batch_to_execute, number_of_batches) if number_of_batches > 1 else ''))
repeater =

Undocumented

Value
cocoex.ExperimentRepeater(budget_multiplier,
                          min_successes=min(((4+_ninst/5), 11)), max_sweeps=100)
res =

Undocumented

Value
fmin(problem, repeater.initial_solution_proposal(problem))
scipy =

Undocumented

Value
cocoex.utilities.forgiving_import('scipy')
suite =

Undocumented

Value
cocoex.Suite(suite_name, '', suite_filter)
suite_filter: str =

Undocumented

Value
''
suite_name: str =

Undocumented

Value
'bbob'
time0 =

Undocumented

Value
time.time()
time1 =

Undocumented

Value
time.time()
timings =

Undocumented

Value
collections.defaultdict(list)
ts =

Undocumented

Value
sorted(timings[dimension])
xopt =

Undocumented

Value
res[0]
_ninst =

Undocumented

Value
len(suite)/len(suite.dimensions)/len({p.id_function for p in suite})