Skip to content

Commit

Permalink
Merge pull request nojhan#31 from nojhan/fix-ext-binding
Browse files Browse the repository at this point in the history
Features: easier external binding
  • Loading branch information
FurongYe committed Mar 11, 2020
2 parents e46996f + cdf3e4c commit 443fc91
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Template/IOHprofiler_suite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ template <class InputType> 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<std::string, int> IOHprofiler_suite_get_problems() const {
return this->problem_name_id_map;
}

std::vector<int> IOHprofiler_suite_get_instance_id() const {
return this->instance_id;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Template/Loggers/IOHprofiler_csv_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/Template/Loggers/IOHprofiler_csv_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "IOHprofiler_observer.hpp"
#include "IOHprofiler_common.h"
#include "IOHprofiler_problem.hpp"

// #define BOOST_NO_CXX11_SCOPED_ENUMS
// #include <boost/filesystem.hpp>
Expand Down Expand Up @@ -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<class T>
void target_problem(const IOHprofiler_problem<T> & 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);
Expand Down

0 comments on commit 443fc91

Please sign in to comment.