logger_bbob.c File Reference

Implementation of the bbob logger. More...

#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <float.h>
#include <math.h>
#include <errno.h>
#include "coco.h"
#include "coco_utilities.c"
#include "coco_problem.c"
#include "coco_string.c"
#include "observer_bbob.c"

Data Structures

struct  logger_bbob_data_t
 The bbob logger data type. More...
 

Functions

static int single_digit_constraint_value (const double c)
 Discretized constraint value, ~8 + log10(c), in a single digit. More...
 
static void logger_bbob_write_data (FILE *target_file, size_t number_of_f_evaluations, size_t number_of_cons_evaluations, double fvalue, double best_fvalue, double best_value, const double *x, size_t number_of_variables, size_t number_of_integer_variables, const double *constraints, size_t number_of_constraints, const int log_discrete_as_int)
 
static void logger_bbob_error_io (FILE *path, int errnum)
 
static void logger_bbob_open_dataFile (FILE **target_file, const char *path, const char *dataFile_path, const char *file_extension)
 
static void logger_bbob_openIndexFile (logger_bbob_data_t *logger, const char *folder_path, const char *indexFile_prefix, const char *function_id, const char *dataFile_path, const char *suite_name)
 
static void logger_bbob_initialize (logger_bbob_data_t *logger, coco_problem_t *inner_problem)
 
static void logger_bbob_evaluate (coco_problem_t *problem, const double *x, double *y)
 
static void logger_bbob_free (void *stuff)
 
static coco_problem_tlogger_bbob (coco_observer_t *observer, coco_problem_t *inner_problem)
 

Variables

static const double fvalue_logged_for_infinite = 3e21
 
static const double fvalue_logged_for_nan = 2e21
 
static const double weight_constraints = 1e0
 
static size_t bbob_current_dim = 0
 
static size_t bbob_current_funId = 0
 
static size_t bbob_infoFile_firstInstance = 0
 
char * bbob_infoFile_firstInstance_char
 
static const int bbob_number_of_dimensions = 6
 
static size_t bbob_dimensions_in_current_infoFile [6] = { 0, 0, 0, 0, 0, 0 }
 
static int bbob_logger_is_open = 0
 
static const char * bbob_file_header_str
 
static const char * logger_name = "bbob"
 
static const char * data_format = "bbob-new2"
 

Detailed Description

Implementation of the bbob logger.

Logs the performance of a single-objective optimizer on noisy or noiseless problems. It produces four kinds of files:

  • The "info" files ...
  • The "dat" files ...
  • The "tdat" files ...
  • The "rdat" files ...

Function Documentation

static coco_problem_t* logger_bbob ( coco_observer_t observer,
coco_problem_t inner_problem 
)
static
static void logger_bbob_error_io ( FILE *  path,
int  errnum 
)
static

Error when trying to create the file "path"

static void logger_bbob_evaluate ( coco_problem_t problem,
const double *  x,
double *  y 
)
static

Layer added to the transformed-problem evaluate_function by the logger

static void logger_bbob_free ( void *  stuff)
static

Also serves as a finalize run method so. Must be called at the end of Each run to correctly fill the index file

TODO: make sure it is called at the end of each run or move the writing into files to another function

static void logger_bbob_initialize ( logger_bbob_data_t logger,
coco_problem_t inner_problem 
)
static

Generates the different files and folder needed by the logger to store the data if these don't already exist

static void logger_bbob_open_dataFile ( FILE **  target_file,
const char *  path,
const char *  dataFile_path,
const char *  file_extension 
)
static

Creates the data files or simply opens it

static void logger_bbob_openIndexFile ( logger_bbob_data_t logger,
const char *  folder_path,
const char *  indexFile_prefix,
const char *  function_id,
const char *  dataFile_path,
const char *  suite_name 
)
static

Creates the index file fileName_prefix+problem_id+file_extension in folder_path

static void logger_bbob_write_data ( FILE *  target_file,
size_t  number_of_f_evaluations,
size_t  number_of_cons_evaluations,
double  fvalue,
double  best_fvalue,
double  best_value,
const double *  x,
size_t  number_of_variables,
size_t  number_of_integer_variables,
const double *  constraints,
size_t  number_of_constraints,
const int  log_discrete_as_int 
)
static

adds a formated line to a data file

static int single_digit_constraint_value ( const double  c)
static

Discretized constraint value, ~8 + log10(c), in a single digit.

-..0 -> 0 0..1e-7 -> 1 1e-7..1e-6 -> 2 ... 1e-1..1 -> 8 >1 -> 9

Variable Documentation

size_t bbob_current_dim = 0
static
size_t bbob_current_funId = 0
static
size_t bbob_dimensions_in_current_infoFile[6] = { 0, 0, 0, 0, 0, 0 }
static
const char* bbob_file_header_str
static
Initial value:
= "%% "
"f evaluations | "
"g evaluations | "
"best noise-free fitness - Fopt (%13.12e) + sum g_i+ | "
"measured fitness | "
"best measured fitness or single-digit g-values | "
"x1 | "
"x2...\n"
size_t bbob_infoFile_firstInstance = 0
static
char* bbob_infoFile_firstInstance_char
int bbob_logger_is_open = 0
static
const int bbob_number_of_dimensions = 6
static
const char* data_format = "bbob-new2"
static
const double fvalue_logged_for_infinite = 3e21
static
const double fvalue_logged_for_nan = 2e21
static
const char* logger_name = "bbob"
static
const double weight_constraints = 1e0
static