class BatchScheduler:
Constructor: BatchScheduler(number_of_batches, batch_to_execute)
Facilitate to run a benchmarking experiment in independent batches.
All instances of the same (function, dimension) belong to the same batch, in order to allow for uniform instance repetitions.
The batch scheduler crucially assumes that in each batch the same
problems are given in the same order when calling is_in_batch.
Pseudo code example:
batch_to_execute = 0 # set current batch to execute
suite = cocoex.Suite('bbob', '', '')
batcher = cocoex.BatchScheduler(4, batch_to_execute)
for problem in suite:
if not batcher.is_in_batch(problem):
continue
# ... run optimizer on problem ...
needs to be run, in accordance with the first argument to
BatchScheduler, four times overall (e.g., in parallel) with
batch_to_execute in (0,1,2,3) to generate the full experimental
data.
Details: while making the number of functions not divisible by the number of
batches may sometimes achieve a more even time distribution over all
batches, in practice, it is advisable to keep each function in a single or a
few batches as it is enforced by the BatchScheduler. Hence, for the 24
functions of the 'bbob' testbed, having 48 or 24 or 12 or 8 or 6 or 4
batches is advisable. Additionally, it can be useful to run the largest
dimension in a separate launch (with at most 24 batches in this case).
| Method | __init__ |
distribute over number_of_batches batches and execute |
| Method | is |
return True iff the batch number for problem equals batch_to_execute |
| Instance Variable | current |
Undocumented |
| Instance Variable | current |
Undocumented |
| Instance Variable | first |
Undocumented |
| Instance Variable | params |
Undocumented |
distribute over number_of_batches batches and execute
the batch with number batch_to_execute which must obey
0 <= batch_to_execute < number_of_batches.
return True iff the batch number for problem equals batch_to_execute
as given as constructor argument. Assumes that id_function and
dimension are attributes of problem.
The batch number for problem is attributed using
(problem.id_function, problem.dimension) by order of
appearance, in that the number is incremented whenever either
id_function or dimension changes. Instances that follow
suit with the same function ID and dimension belong to the same
batch.