From 44b3e2928b83f6cefa939cb3a36d450e8d229ed4 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 9 Mar 2020 16:13:56 +0100 Subject: [PATCH 1/3] add IOHprofiler_suite::IOHprofiler_suite_get_problems This accessor is useful when one want to build an interface toward a problem suite, but not with the experimenter. That way, the registered list of problems is available to the third party. --- src/Template/IOHprofiler_suite.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Template/IOHprofiler_suite.hpp b/src/Template/IOHprofiler_suite.hpp index d3fd17b1e..0d96e8234 100644 --- a/src/Template/IOHprofiler_suite.hpp +++ b/src/Template/IOHprofiler_suite.hpp @@ -148,6 +148,11 @@ template class IOHprofiler_suite : public IOHprofiler_problem< return this->problem_id_name_map; } + //! Return a map of problem name to problem ID, for all the registered problem. + std::map IOHprofiler_suite_get_problems() const { + return this->problem_name_id_map; + } + std::vector IOHprofiler_suite_get_instance_id() const { return this->instance_id; } From 73230f91d6d181d6bdbda6f2df28228f1332b55e Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 9 Mar 2020 16:18:00 +0100 Subject: [PATCH 2/3] feat add problem::target_problem(problem) Add setter for the target problem which takes a problem itself. Avoid having to enumerate the list of the corresponding accessors, that would directly used the problem anyway. This may effectively simplify the examples. --- src/Template/Loggers/IOHprofiler_csv_logger.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Template/Loggers/IOHprofiler_csv_logger.h b/src/Template/Loggers/IOHprofiler_csv_logger.h index f0daf4d38..5f155228e 100644 --- a/src/Template/Loggers/IOHprofiler_csv_logger.h +++ b/src/Template/Loggers/IOHprofiler_csv_logger.h @@ -10,6 +10,7 @@ #include "IOHprofiler_observer.hpp" #include "IOHprofiler_common.h" +#include "IOHprofiler_problem.hpp" // #define BOOST_NO_CXX11_SCOPED_ENUMS // #include @@ -47,6 +48,19 @@ class IOHprofiler_csv_logger : public IOHprofiler_observer { void clear_logger(); void target_problem(const int problem_id, const int dimension, const int instance, const std::string problem_name, const int maximization_minimization_flag); + + template + void target_problem(const IOHprofiler_problem & om) + { + this->target_problem( + om.IOHprofiler_get_problem_id(), + om.IOHprofiler_get_number_of_variables(), + om.IOHprofiler_get_instance_id(), + om.IOHprofiler_get_problem_name(), + om.IOHprofiler_get_optimization_type() + ); + } + void target_suite(std::string suite_name); void openInfo(int problem_id, int dimension, std::string problem_name); From 0fca4e0301b380343442037b3d8f01a0ec1b0963 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 9 Mar 2020 16:18:13 +0100 Subject: [PATCH 3/3] fix additional folder names separator When indicating an empty folder name in the CSV logger, the file increment would start with "-", e.g. "-1". Instead of "-", use "_", which behave better with several shell commands under Linux, where "-" is a common argument prefix (cf. `ls -1`). --- src/Template/Loggers/IOHprofiler_csv_logger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Template/Loggers/IOHprofiler_csv_logger.cpp b/src/Template/Loggers/IOHprofiler_csv_logger.cpp index 556a6add0..686716cff 100644 --- a/src/Template/Loggers/IOHprofiler_csv_logger.cpp +++ b/src/Template/Loggers/IOHprofiler_csv_logger.cpp @@ -47,7 +47,7 @@ int IOHprofiler_csv_logger::IOHprofiler_create_folder(std::string folder_name) { /// directory will be renamed by adding a suffix. /// For example, /// If a folder or file 'test' has already been in currect path, the -/// expected directory will be renamed as 'test-1', 'test-2', ... +/// expected directory will be renamed as 'test_1', 'test_2', ... /// until there is no such a folder or file. std::string IOHprofiler_csv_logger::IOHprofiler_experiment_folder_name() { std::string renamed_directory = this->output_directory + IOHprofiler_path_separator + this->folder_name; @@ -56,7 +56,7 @@ std::string IOHprofiler_csv_logger::IOHprofiler_experiment_folder_name() { //while (fs::exists(renamed_directory.c_str())) { while (folder_exist(renamed_directory) ) { ++index; - temp_folder_name = this->folder_name + '-' + std::to_string(index); + temp_folder_name = this->folder_name + '_' + std::to_string(index); renamed_directory = this->output_directory + IOHprofiler_path_separator + temp_folder_name; } this->folder_name = temp_folder_name;