logger_biobj.c File Reference

Implementation of the bbob-biobj logger. More...

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "coco.h"
#include "coco_internal.h"
#include "coco_utilities.c"
#include "coco_problem.c"
#include "coco_string.c"
#include "mo_avl_tree.c"
#include "observer_biobj.c"
#include "mo_utilities.c"

Data Structures

struct  logger_biobj_indicator_t
 The indicator type. More...
 
struct  logger_biobj_data_t
 The bi-objective logger data type. More...
 
struct  logger_biobj_avl_item_t
 The type for the node's item in the AVL tree as used by the bi-objective logger. More...
 

Macros

#define LOGGER_BIOBJ_NUMBER_OF_INDICATORS   1
 Number of implemented indicators. More...
 

Functions

static logger_biobj_avl_item_tlogger_biobj_node_create (const coco_problem_t *problem, const double *x, const double *y, const size_t evaluation_number, const size_t dim, const size_t num_obj)
 Creates and returns the information on the solution in the form of a node's item in the AVL tree. More...
 
static void logger_biobj_node_free (logger_biobj_avl_item_t *item, void *userdata)
 Frees the data of the given logger_biobj_avl_item_t. More...
 
static int avl_tree_compare_by_last_objective (const logger_biobj_avl_item_t *item1, const logger_biobj_avl_item_t *item2, void *userdata)
 Defines the ordering of AVL tree nodes based on the value of the last objective. More...
 
static int avl_tree_compare_by_eval_number (const logger_biobj_avl_item_t *item1, const logger_biobj_avl_item_t *item2, void *userdata)
 Defines the ordering of AVL tree nodes based on the evaluation number (the time when the nodes were created). More...
 
static size_t logger_biobj_tree_output (FILE *file, const avl_tree_t *tree, const size_t dim, const size_t num_int_vars, const size_t num_obj, const int log_vars, const int precision_x, const int precision_f, const int log_discrete_as_int)
 Outputs the AVL tree to the given file. Returns the number of nodes in the tree. More...
 
static int logger_biobj_tree_update (logger_biobj_data_t *logger, logger_biobj_avl_item_t *node_item)
 Updates the archive and buffer trees with the given node. More...
 
static logger_biobj_indicator_tlogger_biobj_indicator (const logger_biobj_data_t *logger, const coco_observer_t *observer, const coco_problem_t *problem, const char *indicator_name)
 Initializes the indicator with name indicator_name. More...
 
static void logger_biobj_indicator_finalize (logger_biobj_indicator_t *indicator, const logger_biobj_data_t *logger)
 Outputs the final information about this indicator. More...
 
static void logger_biobj_indicator_free (void *stuff)
 Frees the memory of the given indicator. More...
 
static void logger_biobj_output (logger_biobj_data_t *logger, const int update_performed, const logger_biobj_avl_item_t *node_item)
 
static void logger_biobj_evaluate (coco_problem_t *problem, const double *x, double *y)
 Evaluates the function, increases the number of evaluations and outputs information according to observer options. More...
 
int coco_logger_biobj_feed_solution (coco_problem_t *problem, const size_t evaluation, const double *y)
 Feeds the solution to the bi-objective logger for logger output reconstruction purposes. More...
 
static void logger_biobj_finalize (logger_biobj_data_t *logger)
 Outputs the final nondominated solutions to the archive file. More...
 
static void logger_biobj_free (void *stuff)
 Frees the memory of the given biobjective logger. More...
 
static coco_problem_tlogger_biobj (coco_observer_t *observer, coco_problem_t *inner_problem)
 Initializes the biobjective logger. More...
 

Variables

const char * logger_biobj_indicators [LOGGER_BIOBJ_NUMBER_OF_INDICATORS] = { "hyp" }
 Names of implemented indicators. More...
 

Detailed Description

Implementation of the bbob-biobj logger.

Logs the values of the implemented indicators and archives nondominated solutions. Produces four kinds of files:

  • The "info" files contain high-level information on the performed experiment. One .info file is created for each problem group (and indicator type) and contains information on all the problems in that problem group (and indicator type).
  • The "dat" files contain function evaluations, indicator values and target hits for every target hit as well as for the last evaluation. One .dat file is created for each problem function and dimension (and indicator type) and contains information for all instances of that problem (and indicator type).
  • The "tdat" files contain function evaluation and indicator values for every predefined evaluation number as well as for the last evaluation. One .tdat file is created for each problem function and dimension (and indicator type) and contains information for all instances of that problem (and indicator type).
  • The "adat" files are archive files that contain function evaluations, 2 objectives and dim variables for every nondominated solution. Whether these files are created, at what point in time the logger writes nondominated solutions to the archive and whether the decision variables are output or not depends on the values of log_nondom_mode and log_nondom_mode. See the bi-objective observer constructor observer_biobj() for more information. One .adat file is created for each problem function, dimension and instance.
Note
Whenever in this file a ROI is mentioned, it means the (normalized) region of interest in the objective space. The non-normalized ROI is a rectangle with the ideal and nadir points as its two opposite vertices, while the normalized ROI is the square [0, 1]^2. If not specifically mentioned, the normalized ROI is assumed.
This logger can handle both the original bbob-biobj test suite with 55 and the extended bbob-biobj-ext test suite with 96 functions.

Macro Definition Documentation

#define LOGGER_BIOBJ_NUMBER_OF_INDICATORS   1

Number of implemented indicators.

Function Documentation

static int avl_tree_compare_by_eval_number ( const logger_biobj_avl_item_t item1,
const logger_biobj_avl_item_t item2,
void *  userdata 
)
static

Defines the ordering of AVL tree nodes based on the evaluation number (the time when the nodes were created).

Note
This ordering is used by the buffer_tree.
static int avl_tree_compare_by_last_objective ( const logger_biobj_avl_item_t item1,
const logger_biobj_avl_item_t item2,
void *  userdata 
)
static

Defines the ordering of AVL tree nodes based on the value of the last objective.

Note
This ordering is used by the archive_tree.
int coco_logger_biobj_feed_solution ( coco_problem_t problem,
const size_t  evaluation,
const double *  y 
)

Feeds the solution to the bi-objective logger for logger output reconstruction purposes.

Sets the number of evaluations, adds the objective vector to the archive and outputs information according to observer options (but does not output the archive).

Note
Vector y must point to a correctly sized allocated memory region and the given evaluation number must be larger than the existing one.
Parameters
problemThe given COCO problem.
evaluationThe number of evaluations.
yThe objective vector.
Returns
1 if archive was updated was done and 0 otherwise.
static coco_problem_t* logger_biobj ( coco_observer_t observer,
coco_problem_t inner_problem 
)
static

Initializes the biobjective logger.

Copies all observer field values that are needed after initialization into logger field values for two reasons:

  • If the observer is deleted before the suite, the observer is not available anymore when the logger is finalized.
  • This reduces function calls.
static void logger_biobj_evaluate ( coco_problem_t problem,
const double *  x,
double *  y 
)
static

Evaluates the function, increases the number of evaluations and outputs information according to observer options.

static void logger_biobj_finalize ( logger_biobj_data_t logger)
static

Outputs the final nondominated solutions to the archive file.

static void logger_biobj_free ( void *  stuff)
static

Frees the memory of the given biobjective logger.

static logger_biobj_indicator_t* logger_biobj_indicator ( const logger_biobj_data_t logger,
const coco_observer_t observer,
const coco_problem_t problem,
const char *  indicator_name 
)
static

Initializes the indicator with name indicator_name.

Opens files for writing and resets counters.

static void logger_biobj_indicator_finalize ( logger_biobj_indicator_t indicator,
const logger_biobj_data_t logger 
)
static

Outputs the final information about this indicator.

static void logger_biobj_indicator_free ( void *  stuff)
static

Frees the memory of the given indicator.

static logger_biobj_avl_item_t* logger_biobj_node_create ( const coco_problem_t problem,
const double *  x,
const double *  y,
const size_t  evaluation_number,
const size_t  dim,
const size_t  num_obj 
)
static

Creates and returns the information on the solution in the form of a node's item in the AVL tree.

static void logger_biobj_node_free ( logger_biobj_avl_item_t item,
void *  userdata 
)
static

Frees the data of the given logger_biobj_avl_item_t.

static void logger_biobj_output ( logger_biobj_data_t logger,
const int  update_performed,
const logger_biobj_avl_item_t node_item 
)
static
static size_t logger_biobj_tree_output ( FILE *  file,
const avl_tree_t tree,
const size_t  dim,
const size_t  num_int_vars,
const size_t  num_obj,
const int  log_vars,
const int  precision_x,
const int  precision_f,
const int  log_discrete_as_int 
)
static

Outputs the AVL tree to the given file. Returns the number of nodes in the tree.

static int logger_biobj_tree_update ( logger_biobj_data_t logger,
logger_biobj_avl_item_t node_item 
)
static

Updates the archive and buffer trees with the given node.

Checks for domination and updates the archive tree and the values of the indicators if the given node is not weakly dominated by existing nodes in the archive tree. This is where the main computation of indicator values takes place.

Returns
1 if the update was performed and 0 otherwise.

Variable Documentation

const char* logger_biobj_indicators[LOGGER_BIOBJ_NUMBER_OF_INDICATORS] = { "hyp" }

Names of implemented indicators.

"hyp" stands for the hypervolume indicator.