diff --git a/include/ioh/logger/analyzer.hpp b/include/ioh/logger/analyzer.hpp index e90ea90b6..06843d905 100644 --- a/include/ioh/logger/analyzer.hpp +++ b/include/ioh/logger/analyzer.hpp @@ -315,7 +315,7 @@ namespace ioh::logger if (info_stream_.tellp() != 0) info_stream_ << "\n"; - info_stream_ << "suite = \"" << current_suite_ << "\", funcId = " << problem.problem_id + info_stream_ << "suite = \"" << suite_ << "\", funcId = " << problem.problem_id << ", funcName = \"" << problem.name << "\", DIM = " << problem.n_variables << ", maximization = \"" << (problem.optimization_type == common::OptimizationType::MAX ? 'T' : 'F') @@ -539,7 +539,7 @@ namespace ioh::logger if (experiments_.find(current_filename_) == experiments_.end()) experiments_.insert({current_filename_, - {current_suite_, problem, algorithm_, + {suite_, problem, algorithm_, common::as_vector(attributes_.experiment), common::keys(attributes_.run), attribute_names()}}); } diff --git a/include/ioh/logger/flatfile.hpp b/include/ioh/logger/flatfile.hpp index ffc79bcbe..18571b3fe 100644 --- a/include/ioh/logger/flatfile.hpp +++ b/include/ioh/logger/flatfile.hpp @@ -60,8 +60,7 @@ namespace ioh::logger //! Output stream std::ofstream out_; - //! Current suite - std::string current_suite_; + //! Current run size_t current_run_; @@ -126,12 +125,12 @@ namespace ioh::logger (common_header_titles.empty() ? "" : sep_)), repeat_header_(repeat_header), store_positions_(store_positions), requires_header_(true), log_meta_data_(!common_header_titles.empty()), output_directory_(output_directory), filename_(filename), - current_suite_("unknown_suite"), current_run_(0), current_meta_data_{} + current_run_(0), current_meta_data_{} { assert(common_header_titles.empty() || common_header_titles.size() == 7); } - void attach_suite(const std::string &suite_name) override { current_suite_ = suite_name; } + void attach_problem(const problem::MetaData &problem) override { @@ -214,7 +213,7 @@ namespace ioh::logger if (log_meta_data_) { std::stringstream ss; - ss /* no sep */ << current_suite_; + ss /* no sep */ << suite_; ss << sep_ << problem_.value().name; ss << sep_ << problem_.value().problem_id; ss << sep_ << problem_.value().instance; diff --git a/include/ioh/logger/loggers.hpp b/include/ioh/logger/loggers.hpp index 0684f10f0..5d4d1336e 100644 --- a/include/ioh/logger/loggers.hpp +++ b/include/ioh/logger/loggers.hpp @@ -37,6 +37,9 @@ namespace ioh { //! Access to the problem. std::optional problem_; + //! Current suite + std::string suite_ = "unknown_suite"; + /** Map property names to property references. * * If your logger is handling any property, you can just iterate over them, @@ -189,11 +192,11 @@ namespace ioh { IOH_DBG(xdebug,"attach problem " << problem.problem_id) problem_ = problem; } - - public: + //! Starts a new session for the given Suite name. - virtual void attach_suite(const std::string& suite_name) = 0; + virtual void attach_suite(const std::string &suite_name) { suite_ = suite_name; } + public: //! Main entry point, called everytime a Trigger is true. virtual void call(const logger::Info& log_info) = 0;