Definitions of functions regarding COCO suites. More...
#include <time.h>
#include "coco.h"
#include "coco_internal.h"
#include "coco_utilities.c"
#include "suite_bbob.c"
#include "suite_bbob_mixint.c"
#include "suite_biobj.c"
#include "suite_biobj_mixint.c"
#include "suite_toy.c"
#include "suite_largescale.c"
#include "suite_cons_bbob.c"
Macros | |
#define | COCO_MAX_INSTANCES 1000 |
The maximum number of different instances in a suite. More... | |
Functions | |
static coco_suite_t * | coco_suite_intialize (const char *suite_name) |
Calls the initializer of the given suite. More... | |
static const char * | coco_suite_get_instances_by_year (const coco_suite_t *suite, const int year) |
Calls the function that sets the instanced by year for the given suite. More... | |
static coco_problem_t * | coco_suite_get_problem_from_indices (coco_suite_t *suite, const size_t function_idx, const size_t dimension_idx, const size_t instance_idx) |
Calls the function that returns the problem corresponding to the given suite, function index, dimension index and instance index. If the indices don't correspond to a problem because of suite filtering, it returns NULL. More... | |
static double | coco_suite_get_best_indicator_value (const coco_suite_t *suite, const coco_problem_t *problem, const char *indicator_name) |
Returns the best indicator value for the given problem. More... | |
coco_problem_t * | coco_suite_get_problem_by_function_dimension_instance (coco_suite_t *suite, const size_t function, const size_t dimension, const size_t instance) |
Returns the first problem of the suite defined by function, dimension and instance numbers. More... | |
static coco_suite_t * | coco_suite_allocate (const char *suite_name, const size_t number_of_functions, const size_t number_of_dimensions, const size_t *dimensions, const char *default_instances) |
Allocates the space for a coco_suite_t instance. More... | |
static void | coco_suite_set_instance (coco_suite_t *suite, const size_t *instance_numbers) |
Sets the suite instance to the given instance_numbers. More... | |
static void | coco_suite_filter_indices (size_t *items, const size_t number_of_items, const size_t *indices, const char *name) |
Filters the given items w.r.t. the given indices (starting from 1). More... | |
static void | coco_suite_filter_dimensions (coco_suite_t *suite, const size_t *dimension_numbers) |
Filters dimensions w.r.t. the given dimension_numbers. More... | |
size_t | coco_suite_get_function_from_function_index (const coco_suite_t *suite, const size_t function_idx) |
Returns the function number in the suite in position function_idx (counting from 0). More... | |
size_t | coco_suite_get_dimension_from_dimension_index (const coco_suite_t *suite, const size_t dimension_idx) |
Returns the dimension number in the suite in position dimension_idx (counting from 0). More... | |
size_t | coco_suite_get_instance_from_instance_index (const coco_suite_t *suite, const size_t instance_idx) |
Returns the instance number in the suite in position instance_idx (counting from 0). More... | |
void | coco_suite_free (coco_suite_t *suite) |
Frees the given suite. More... | |
coco_problem_t * | coco_suite_get_problem (coco_suite_t *suite, const size_t problem_index) |
Returns the problem of the suite defined by problem_index. More... | |
size_t | coco_suite_get_number_of_problems (const coco_suite_t *suite) |
Returns the number of problems in the given suite. More... | |
static size_t * | coco_suite_get_instance_indices (const coco_suite_t *suite, const char *suite_instance) |
Returns the instances read from either a "year: YEAR" or "instances: NUMBERS" string. More... | |
static int | coco_suite_is_next_item_found (const size_t *items, const size_t number_of_items, long *current_item_id) |
Iterates through the items from the current_item_id position on in search for the next positive item. More... | |
static int | coco_suite_is_next_instance_found (coco_suite_t *suite) |
Iterates through the instances of the given suite from the current_instance_idx position on in search for the next positive instance. More... | |
static int | coco_suite_is_next_function_found (coco_suite_t *suite) |
Iterates through the functions of the given suite from the current_function_idx position on in search for the next positive function. More... | |
static int | coco_suite_is_next_dimension_found (coco_suite_t *suite) |
Iterates through the dimensions of the given suite from the current_dimension_idx position on in search for the next positive dimension. More... | |
coco_suite_t * | coco_suite (const char *suite_name, const char *suite_instance, const char *suite_options) |
Constructs a COCO suite. More... | |
coco_problem_t * | coco_suite_get_next_problem (coco_suite_t *suite, coco_observer_t *observer) |
Returns the next (observed) problem of the suite or NULL if there is no next problem left. More... | |
size_t | coco_suite_encode_problem_index (const coco_suite_t *suite, const size_t function_idx, const size_t dimension_idx, const size_t instance_idx) |
Computes the index of the problem in the suite that corresponds to the given function, dimension and instance indices. More... | |
void | coco_suite_decode_problem_index (const coco_suite_t *suite, const size_t problem_index, size_t *function_idx, size_t *dimension_idx, size_t *instance_idx) |
Computes the function, dimension and instance indexes of the problem with problem_index in the given suite. More... | |
Detailed Description
Definitions of functions regarding COCO suites.
When a new suite is added, the functions coco_suite_intialize, coco_suite_get_instances_by_year and coco_suite_get_problem_from_indices need to be updated.
- See also
- Instructions on how to write new test functions and combine them into test suites.
Macro Definition Documentation
#define COCO_MAX_INSTANCES 1000 |
The maximum number of different instances in a suite.
Function Documentation
coco_suite_t* coco_suite | ( | const char * | suite_name, |
const char * | suite_instance, | ||
const char * | suite_options | ||
) |
Constructs a COCO suite.
Currently, seven suites are supported:
- "bbob" contains 24 single-objective functions in 6 dimensions (2, 3, 5, 10, 20, 40)
- "bbob-biobj" contains 55 bi-objective functions in 6 dimensions (2, 3, 5, 10, 20, 40)
- "bbob-biobj-ext" as an extension of "bbob-biobj" contains 92 bi-objective functions in 6 dimensions (2, 3, 5, 10, 20, 40)
- "bbob-largescale" contains 24 single-objective functions in 6 large dimensions (40, 80, 160, 320, 640, 1280)
- "bbob-constrained" contains 48 linearly-constrained problems, which are combinations of 8 single objective functions with 6 different numbers of linear constraints (1, 2, 10, dimension/2, dimension-1, dimension+1), in 6 dimensions (2, 3, 5, 10, 20, 40).
- "bbob-mixint" contains mixed-integer single-objective functions in 6 dimensions (2, 3, 5, 10, 20, 40)
- "bbob-biobj-mixint" contains 92 mixed-integer bi-objective functions in 6 dimensions (2, 3, 5, 10, 20, 40)
- "toy" contains 6 single-objective functions in 5 dimensions (2, 3, 5, 10, 20)
Only the suite_name parameter needs to be non-empty. The suite_instance and suite_options can be "" or NULL. In this case, default values are taken (default instances of a suite are those used in the last year and the suite is not filtered by default).
- Parameters
-
suite_name A string containing the name of the suite. Currently supported suite names are "bbob", "bbob-biobj", "bbob-biobj-ext", "bbob-largescale", "bbob-constrained", and "toy". suite_instance A string used for defining the suite instances. Two ways are supported: - "year: YEAR", where YEAR is the year of the BBOB workshop, includes the instances (to be) used in that year's workshop;
- "instances: VALUES", where VALUES are instance numbers from 1 on written as a comma-separated list or a range m-n.
suite_options A string of pairs "key: value" used to filter the suite (especially useful for parallelizing the experiments). Supported options: - "dimensions: LIST", where LIST is the list of dimensions to keep in the suite (range-style syntax is not allowed here),
- "dimension_indices: VALUES", where VALUES is a list or a range of dimension indices (starting from 1) to keep in the suite, and
- "function_indices: VALUES", where VALUES is a list or a range of function indices (starting from 1) to keep in the suite, and
- "instance_indices: VALUES", where VALUES is a list or a range of instance indices (starting from 1) to keep in the suite.
- Returns
- The constructed suite object.
|
static |
Allocates the space for a coco_suite_t instance.
This function sets the functions and dimensions contained in the suite, while the instances are set by the function coco_suite_set_instance.
void coco_suite_decode_problem_index | ( | const coco_suite_t * | suite, |
const size_t | problem_index, | ||
size_t * | function_idx, | ||
size_t * | dimension_idx, | ||
size_t * | instance_idx | ||
) |
Computes the function, dimension and instance indexes of the problem with problem_index in the given suite.
- Parameters
-
suite The suite. problem_index Index of the problem in the suite (starting with 0). function_idx Pointer to the index of the function, which is set by this function. dimension_idx Pointer to the index of the dimension, which is set by this function. instance_idx Pointer to the index of the instance, which is set by this function.
size_t coco_suite_encode_problem_index | ( | const coco_suite_t * | suite, |
const size_t | function_idx, | ||
const size_t | dimension_idx, | ||
const size_t | instance_idx | ||
) |
Computes the index of the problem in the suite that corresponds to the given function, dimension and instance indices.
- Parameters
-
suite The suite. function_idx Index of the function (starting with 0). dimension_idx Index of the dimension (starting with 0). instance_idx Index of the instance (starting with 0).
- Returns
- The problem index in the suite computed from function_idx, dimension_idx and instance_idx.
|
static |
Filters dimensions w.r.t. the given dimension_numbers.
Sets suite->dimensions[i] to 0 for every dimension value that cannot be found in dimension_numbers.
|
static |
Filters the given items w.r.t. the given indices (starting from 1).
Sets items[i - 1] to 0 for every i that cannot be found in indices (this function performs the conversion from user-friendly indices starting from 1 to C-friendly indices starting from 0).
void coco_suite_free | ( | coco_suite_t * | suite | ) |
Frees the given suite.
|
static |
Returns the best indicator value for the given problem.
size_t coco_suite_get_dimension_from_dimension_index | ( | const coco_suite_t * | suite, |
const size_t | dimension_idx | ||
) |
Returns the dimension number in the suite in position dimension_idx (counting from 0).
- Parameters
-
suite The given suite. dimension_idx The index of the dimension in question (starting from 0).
- Returns
- The dimension number in position dimension_idx in the suite. If the dimension has been filtered out through suite_options in the coco_suite function, the result is 0.
size_t coco_suite_get_function_from_function_index | ( | const coco_suite_t * | suite, |
const size_t | function_idx | ||
) |
Returns the function number in the suite in position function_idx (counting from 0).
- Parameters
-
suite The given suite. function_idx The index of the function in question (starting from 0).
- Returns
- The function number in position function_idx in the suite. If the function has been filtered out through suite_options in the coco_suite function, the result is 0.
size_t coco_suite_get_instance_from_instance_index | ( | const coco_suite_t * | suite, |
const size_t | instance_idx | ||
) |
Returns the instance number in the suite in position instance_idx (counting from 0).
- Parameters
-
suite The given suite. instance_idx The index of the instance in question (starting from 0).
- Returns
- The instance number in position instance_idx in the suite. If the instance has been filtered out through suite_options in the coco_suite function, the result is 0.
|
static |
Returns the instances read from either a "year: YEAR" or "instances: NUMBERS" string.
If both "year" and "instances" are given, the second is ignored (and a warning is raised). See the coco_suite function for more information about the required format.
|
static |
Calls the function that sets the instanced by year for the given suite.
- Note
- This function needs to be updated when a new suite is added to COCO.
coco_problem_t* coco_suite_get_next_problem | ( | coco_suite_t * | suite, |
coco_observer_t * | observer | ||
) |
Returns the next (observed) problem of the suite or NULL if there is no next problem left.
Iterates through the suite first by instances, then by functions and finally by dimensions. The instances/functions/dimensions that have been filtered out using the suite_options of the coco_suite function are skipped. Outputs some information regarding the current place in the iteration. The returned problem is wrapped with the observer. If the observer is NULL, the returned problem is unobserved.
- Parameters
-
suite The given suite. observer The observer used to wrap the problem. If NULL, the problem is returned unobserved.
- Returns
- The next problem of the suite or NULL if there is no next problem left.
size_t coco_suite_get_number_of_problems | ( | const coco_suite_t * | suite | ) |
Returns the number of problems in the given suite.
The number of problems in the suite is computed as a product of the number of instances, number of functions and number of dimensions and therefore doesn't account for any filtering done through the suite_options parameter of the coco_suite function.
- Parameters
-
suite The given suite.
- Returns
- The number of problems in the suite.
coco_problem_t* coco_suite_get_problem | ( | coco_suite_t * | suite, |
const size_t | problem_index | ||
) |
Returns the problem of the suite defined by problem_index.
Note that the problem_index depends on the number of instances a suite is defined with.
- Parameters
-
suite The given suite. problem_index The index of the problem to be returned.
- Returns
- The problem of the suite defined by problem_index (NULL if this problem has been filtered out from the suite).
coco_problem_t* coco_suite_get_problem_by_function_dimension_instance | ( | coco_suite_t * | suite, |
const size_t | function, | ||
const size_t | dimension, | ||
const size_t | instance | ||
) |
Returns the first problem of the suite defined by function, dimension and instance numbers.
- Note
- : While a suite can contain multiple problems with equal function, dimension and instance, this function always returns the first problem in the suite with the given function, dimension and instance values. If the given values don't correspond to a problem, the function returns NULL.
|
static |
Calls the function that returns the problem corresponding to the given suite, function index, dimension index and instance index. If the indices don't correspond to a problem because of suite filtering, it returns NULL.
- Note
- This function needs to be updated when a new suite is added to COCO.
|
static |
Calls the initializer of the given suite.
- Note
- This function needs to be updated when a new suite is added to COCO.
|
static |
Iterates through the dimensions of the given suite from the current_dimension_idx position on in search for the next positive dimension.
If such a dimension is found, current_dimension_idx points to this dimension and the method returns 1. If such a dimension cannot be found, current_dimension_idx points to the first positive dimension and the method returns 0.
|
static |
Iterates through the functions of the given suite from the current_function_idx position on in search for the next positive function.
If such a function is found, current_function_idx points to this function and the method returns 1. If such a function cannot be found, current_function_idx points to the first positive function, current_instance_idx points to the first positive instance and the method returns 0.
|
static |
Iterates through the instances of the given suite from the current_instance_idx position on in search for the next positive instance.
If such an instance is found, current_instance_idx points to this instance and the method returns 1. If such an instance cannot be found, current_instance_idx points to the first positive instance and the method returns 0.
|
static |
Iterates through the items from the current_item_id position on in search for the next positive item.
If such an item is found, current_item_id points to this item and the method returns 1. If such an item cannot be found, current_item_id points to the first positive item and the method returns 0.
|
static |
Sets the suite instance to the given instance_numbers.