Skip to content

Commit

Permalink
Merge branch 'developing' into fix-ext-binding
Browse files Browse the repository at this point in the history
  • Loading branch information
nojhan committed Mar 10, 2020
2 parents 0fca4e0 + e46996f commit cdf3e4c
Show file tree
Hide file tree
Showing 69 changed files with 322 additions and 684 deletions.
86 changes: 86 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
cmake_minimum_required(VERSION 3.6)

# set the project name and version
project(IOHexperimenter VERSION 1.0)
SET(EXECUTABLE_OUTPUT_PATH "build/Cpp/")

# add the executable
add_executable(IOHprofiler_run_experiment build/Cpp/IOHprofiler_run_experiment.cpp)
add_executable(IOHprofiler_run_problem build/Cpp/IOHprofiler_run_problem.cpp)
add_executable(IOHprofiler_run_suite build/Cpp/IOHprofiler_run_suite.cpp)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# specify the CXX FLAGS
set(CMAKE_CXX_FLAGS "-g -std=c++11 -Wall -Wno-unused-variable -Wno-sign-compare -Wno-unused-function -O2")

# set source file directorys and prepare for adding libraries.
SET(PROBLEMS_BBOB_DIR "src/Problems/BBOB")
FILE (GLOB PROBLEMS_BBOB_SRC "${PROBLEMS_BBOB_DIR}/*.cpp" "${PROBLEMS_BBOB_DIR}/*.hpp" "${PROBLEMS_BBOB_DIR}/*.h")

SET(PROBLEMS_BBOB_COMMON_DIR "src/Problems/BBOB/bbob_common_used_functions")
FILE (GLOB PROBLEMS_BBOB_COMMON_SRC "${PROBLEMS_BBOB_COMMON_DIR}/*.cpp" "${PROBLEMS_BBOB_COMMON_DIR}/*.hpp" "${PROBLEMS_BBOB_COMMON_DIR}/*.h")

SET(PROBLEMS_COMMON_DIR "src/Problems/common_used_functions")
FILE (GLOB PROBLEMS_COMMON_SRC "${PROBLEMS_COMMON_DIR}/*.cpp" "${PROBLEMS_COMMON_DIR}/*.hpp" "${PROBLEMS_COMMON_DIR}/*.h")

SET(PROBLEMS_PBO_DIR "src/Problems/PBO")
FILE (GLOB PROBLEMS_PBO_SRC "${PROBLEMS_PBO_DIR}/*.cpp" "${PROBLEMS_PBO_DIR}/*.hpp" "${PROBLEMS_PBO_DIR}/*.h")

SET(PROBLEMS_WMODEL_DIR "src/Problems/WModel")
FILE (GLOB PROBLEMS_WMODEL_SRC "${PROBLEMS_WMODEL_DIR}/*.cpp" "${PROBLEMS_WMODEL_DIR}/*.hpp" "${PROBLEMS_WMODEL_DIR}/*.h")

SET(SUITES_DIR "src/Suites")
FILE (GLOB SUITES_SRC "${SUITES_DIR}/*.cpp" "${SUITES_DIR}/*.hpp" "${SUITES_DIR}/*.h")

SET(TEMPLATE_DIR "src/Template")
FILE (GLOB TEMPLATE_SRC "${TEMPLATE_DIR}/*.cpp" "${TEMPLATE_DIR}/*.hpp" "${TEMPLATE_DIR}/*.h")

SET(TEMPLATE_EXPERIMENTS_DIR "src/Template/Experiments")
FILE (GLOB TEMPLATE_EXPERIMENTS_SRC "${TEMPLATE_EXPERIMENTS_DIR}/*.cpp" "${TEMPLATE_EXPERIMENTS_DIR}/*.hpp" "${TEMPLATE_EXPERIMENTS_DIR}/*.h")

SET(TEMPLATE_LOGGERS_DIR "src/Template/Loggers")
FILE (GLOB TEMPLATE_LOGGERS_SRC "${TEMPLATE_LOGGERS_DIR}/*.cpp" "${TEMPLATE_LOGGERS_DIR}/*.hpp" "${TEMPLATE_LOGGERS_DIR}/*.h")

SET(IOHEXPERIMENTER_SRC
"${PROBLEMS_COMMON_SRC}"
"${PROBLEMS_BBOB_SRC}"
"${PROBLEMS_BBOB_COMMON_SRC}"
"${PROBLEMS_PBO_SRC}"
"${PROBLEMS_WMODEL_SRC}"
"${SUITES_SRC}"
"${TEMPLATE_SRC}"
"${TEMPLATE_EXPERIMENTS_SRC}"
"${TEMPLATE_LOGGERS_SRC}"
)

SET(IOHEXPERIMENTER_DIR
"${PROBLEMS_COMMON_DIR}"
"${PROBLEMS_BBOB_DIR}"
"${PROBLEMS_BBOB_COMMON_DIR}"
"${PROBLEMS_PBO_DIR}"
"${PROBLEMS_WMODEL_DIR}"
"${SUITES_DIR}"
"${TEMPLATE_DIR}"
"${TEMPLATE_EXPERIMENTS_DIR}"
"${TEMPLATE_LOGGERS_DIR}"
)

# add the binary tree to the search path for include files
# so that we will find header files of IOHexperimenter.
include_directories(${IOHEXPERIMENTER_DIR})

# add the IOH library
add_library(IOH ${IOHEXPERIMENTER_SRC})

# link the IOH library to executable files.
target_link_libraries(IOHprofiler_run_experiment IOH)
target_link_libraries(IOHprofiler_run_problem IOH)
target_link_libraries(IOHprofiler_run_suite IOH)

# install. set name of the installed library as 'IOH'.
install (TARGETS IOH DESTINATION lib)
install (FILES ${IOHEXPERIMENTER_SRC} DESTINATION include)
29 changes: 0 additions & 29 deletions Makefile

This file was deleted.

21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,34 @@ This is the __benchmarking platform__ for <b>I</b>terative <b>O</b>ptimization <

<b>IOHexperimenter</b> is <i>built on</i>:

* `C++` (tested on `gcc 5.4.0`)
* `boost.filesystem` library for logging files.
* `C++`

<b>IOHexperimenter</b> is available for:

* `C++`
* `R` package [https://github.com/IOHprofiler/IOHexperimenter/tree/R](https://github.com/IOHprofiler/IOHexperimenter/tree/R)
* `Python` interface (soon to come)
* `Python` interface
* `Java` interface (soon to come)

## Using IOHexperimenter

### Running Experiments

The __IOHexperimenter__ has been built on `C++` and tested on complier `gcc 5.4.0`. To use the logging of `csv` output files, `boost.filesystem` library is required (To install boost library, please visit [https://www.boost.org](https://www.boost.org)).
The __IOHexperimenter__ has been built on `C++`.

#### Using IOHexperimenter in C++

If you are using the tool for the first time, please download or clone this branch and run `make` at the root directory of the project. After running `make` to compile,
* object files will be generated in `build/c/obj`
* three exectuable files will be generated in `build/c/bin`
[Cmake](https://cmake.org) is used to build this project, please make sure you have it installed.

If you are using the tool for the first time, please download or clone this branch, and run `cmake .` and `make install` at the directory where the project locates.
* If you want to set up the install directory, please run `cmake -DCMAKE_INSTALL_PREFIX=your/path .` before installation.
* three exectuable files will be generated in `build/Cpp` for test.

After installation, you can compile your project as follow (with linking IOH library):
```
g++ $CMPL_FLAGS -o IOHprofiler_run_experiment IOHprofiler_run_experiment.cpp -lIOH
```

Afterwards, you can use the folder `build/c` and use the `Makefile` therein for your experiments.
For more details of how to use the `C++` version, please visit [this page](/build/Cpp).

#### Using IOHexperimenter in R
Expand Down
4 changes: 2 additions & 2 deletions build/Cpp/IOHprofiler_run_experiment.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "src/IOHprofiler_experimenter.hpp"
#include <IOHprofiler_experimenter.hpp>

IOHprofiler_random random_generator(1);
static int budget_scale = 100;
Expand Down Expand Up @@ -37,7 +37,7 @@ void evolutionary_algorithm(std::shared_ptr<IOHprofiler_problem<int> > problem,
*mutation_rate = 1.0/problem->IOHprofiler_get_number_of_variables();
int budget = budget_scale * problem->IOHprofiler_get_number_of_variables() * problem->IOHprofiler_get_number_of_variables();

std::vector<std::shared_ptr<double>> parameters;
std::vector<std::shared_ptr<double> > parameters;
parameters.push_back(std::shared_ptr<double>(mutation_rate));
std::vector<std::string> parameters_name;
parameters_name.push_back("mutation_rate");
Expand Down
10 changes: 5 additions & 5 deletions build/Cpp/IOHprofiler_run_problem.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include "src/f_one_max.hpp"
#include "src/f_w_model_one_max.hpp"
#include "src/IOHprofiler_csv_logger.h"
#include <f_one_max.hpp>
#include <f_w_model_one_max.hpp>
#include <IOHprofiler_csv_logger.h>


std::vector<int> Initialization(int dimension) {
Expand Down Expand Up @@ -62,7 +62,7 @@ void _run_w_model() {
/// Set problem_id as 1
w_model_om.IOHprofiler_set_problem_id(1);
/// Set dimension.
w_model_om.Initilize_problem(dimension);
w_model_om.IOHprofiler_set_number_of_variables(dimension);
int restart_flag = 0;
while (restart_flag < 10) {
/// reset_problem must be called before testing the same problem class repeatedly.
Expand Down Expand Up @@ -118,7 +118,7 @@ void _run_problem() {
/// Allocate the problem to be tested.
OneMax om;
int dimension = 1000;
om.Initilize_problem(dimension);
om.IOHprofiler_set_number_of_variables(dimension);

/// If no logger is added, there will be not any output files, but users
/// can still get fitness values.
Expand Down
4 changes: 2 additions & 2 deletions build/Cpp/IOHprofiler_run_suite.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "src/IOHprofiler_PBO_suite.hpp"
#include "src/IOHprofiler_csv_logger.h"
#include <IOHprofiler_PBO_suite.hpp>
#include <IOHprofiler_csv_logger.h>

std::vector<int> Initialization(int dimension) {
std::vector<int> x;
Expand Down
30 changes: 0 additions & 30 deletions build/Cpp/Makefile

This file was deleted.

Loading

0 comments on commit cdf3e4c

Please sign in to comment.