v1#

Classes#

Analyzer#

class Analyzer : public ioh::logger::FlatFile#

A logger that stores information in a format supported by the IOHAnalyzer platform.

logger::Analyzer(
    {trigger::always},
    {watch::evaluations, watch::transformed_y},
    "~/data",
    "experiment_folder",
    "MyOptimizer",
    "Version 1.0"
);

Subclassed by ioh::logger::analyzer::v2::Analyzer

Public Functions

inline Analyzer(const Triggers &triggers = {trigger::on_improvement}, const Properties &additional_properties = {}, const fs::path &root = fs::current_path(), const std::string &folder_name = "ioh_data", const std::string &algorithm_name = "algorithm_name", const std::string &algorithm_info = "algorithm_info", const bool store_positions = false, const bool use_old_data_format = true, const structures::Attributes &attributes = {})#

Logger formatting data in a format supported by iohprofiler.

Parameters:
  • triggers – When to fire a log event.

  • additional_properties – What to log.

  • root – Path in which to store the data.

  • folder_name – Name of folder in which to store data. Will be created as a subdirectory of root.

  • algorithm_name – The string separating fields.

  • algorithm_info – The string indicating a comment.

  • store_positions – Whether to store x positions in the logged data

  • use_old_data_format – Wheter to use the old data format

  • attributes – See: analyzer::Attributes.

inline virtual void close() override#

close data file

inline virtual ~Analyzer()#
inline virtual void attach_problem(const problem::MetaData &problem) override#

Part of public interface. Updates info file.

inline virtual void log(const logger::Info &log_info) override#

Set log_info_ in order to check if the last line has been logged.

inline virtual void call(const Info &log_info) override#

See: logger::FlatFile::call. Updates best_point_

inline virtual void reset() override#

Optional actions when the logger is detached from a suite/problem or the problem is reset.

Useful if you want to flush data, for instance, and/or start a new run of the linked algorithm.

Warning

You most probably don’t want to call this directly, but should call the Problem::reset() instead, which will call this anyway.

Warning

If you override this function, do not forget to call the base class’ one.

inline virtual void watch(logger::Property &property) override#

Watcher::watch is protected, so it can only be called before track_problem is called for the first time.

inline void add_experiment_attribute(const std::string &name, const std::string &value)#

Adds an experiment attribute. Can only be called before track_problem is called for the first time.

inline void set_experiment_attributes(const structures::StringMap &map)#

Sets experiment attributes. Can only be called before track_problem is called for the first time.

inline void add_run_attribute(const std::string &name, double *value = nullptr)#

Adds a new run attribute. Can only be called before track_problem is called for the first time.

inline void set_run_attributes(const structures::dPtrMap &map)#

Sets run attributes. Can only be called before track_problem is called for the first time.

inline void set_run_attribute(const std::string &name, double *value)#

Sets the value for a single run attribute.

inline virtual fs::path output_directory() const override#

Accessor for output directory.

Protected Functions

inline virtual void handle_new_problem(const problem::MetaData &problem)#

Gets called when a new problem is attached.

inline virtual void handle_last_eval()#

Gets called after the last evaluation of a run.

inline virtual void handle_new_dimension(const problem::MetaData &problem, const std::string &dat_path)#

Gets called when the current problem changes dimension.

inline virtual void flush_info_file()#

Protected Attributes

const common::file::UniqueFolder path_#

output path

const structures::AlgorithmInfo algorithm_#

Algorithm meta data.

std::ofstream info_stream_#

info file stream

structures::BestPoint best_point_#

Best point.

structures::Attributes attributes_#

Run/Experiment attribues.

bool has_started_#

Has started logging?

logger::Info log_info_ = {}#

Current log info.

size_t evals_ = 0#

Evals.

Private Functions

inline void update_info_file(const problem::MetaData &problem, const std::string &dat_path)#
inline void guard_attributes(const std::function<void()> &f)#

Private Static Attributes

static watch::Evaluations evaluations_   = {R"#("function evaluation")#"}
static watch::RawY current_y_   = {R"#("current f(x)")#"}
static watch::RawYBest y_best_   = {R"#("best-so-far f(x)")#"}
static watch::TransformedY transformed_y_   = {R"#("current af(x)+b")#"}
static watch::TransformedYBest transformed_y_best_   = {R"#("best af(x)+b")#"}
static Properties default_properties_old_{evaluations_, current_y_, y_best_, transformed_y_, transformed_y_best_}#
static Properties default_properties_ = {watch::evaluations, watch::raw_y}#

The only properties used by the analyzer (actually only raw_y is used)