Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
s

d

Config.

s

s

s

s

d

'

'
  • Loading branch information
Dimitri Rusin committed Feb 1, 2024
1 parent 570f2ef commit 28f6763
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 96 deletions.
3 changes: 1 addition & 2 deletions BUILD → .INSTALL_WITH_MAKE
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env fish

true

and rm -rf build/
and mkdir build/
and cd build/
and cmake -DCMAKE_INSTALL_PREFIX=IOHexperimenter ..
and cmake ..
and make install
10 changes: 10 additions & 0 deletions .INSTALL_WITH_PIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env fish

true
and conda activate base
and rm -rf ./.conda_environment/
and rm -rf build/
and conda env create --prefix ./.conda_environment/ --file .conda.yaml
and conda activate ./.conda_environment/
and pip install --requirement .pip.txt
and CC=gcc-9 CXX=g++-9 pip install -e . -vvv
File renamed without changes.
3 changes: 3 additions & 0 deletions .conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
- python==3.9.18
- pip==23.3.1
93 changes: 93 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Ubuntu

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug


jobs:
build-test-cpp:
runs-on: ubuntu-20.04
strategy:
matrix:
rust: [stable, nightly]
compiler: [g++-10, g++-9, g++-8, g++-7]

steps:
- uses: actions/checkout@v2
with:
rust-version: ${{ matrix.rust }}
submodules: true

- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install doxygen python3-setuptools python3-dev python3-wheel -y
pip3 install wheel
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
env:
CXX: ${{ matrix.compiler }}
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.compiler }} -y
git submodule status
cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
env:
CXX: ${{ matrix.compiler }}
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
env:
CXX: ${{ matrix.compiler }}
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE

- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
run: tests/test_ioh

build-test-python:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6.x", "3.7.x", "3.8.x", "3.9.x", "3.10.x", "3.11.x"]
compiler: [g++-10]
architecture: [x64]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
env:
CXX: ${{ matrix.compiler }}
with:
python-version: ${{matrix.python-version}}
architecture: ${{matrix.architecture}}
- name: Install library
run: |
sudo apt-get update -y
sudo apt-get install ninja-build -y
python -m pip install --upgrade pip
pip install mypy xmltodict wheel scikit-build
pip install -e . -v
- name: Run unit tests
run: python -m unittest -v
9 changes: 1 addition & 8 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@ jobs:
strategy:
matrix:
python-version: ["3.9.x"]
architecture: [x86]

architecture: [x64]
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true

- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down
9 changes: 9 additions & 0 deletions .pip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake==3.27.7
colored==2.2.3
jupyter==1.0.0
m2r2==0.3.3.post2
mypy==1.6.1
nbconvert==6.5.4
numpy==1.26.3
pybind11==2.11.1
xmltodict==0.13.0
9 changes: 9 additions & 0 deletions workflows.md → .workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,12 @@ cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/home/dimitri/code/IOHexperimenter/mingw-w64-toolchain.cmake -DCMAKE_INSTALL_PREFIX=./IOHexperimenter_headers ..
sudo make install
```
February 1, 2024
===========================================================================
There is a problem with the Python package. Specifically, it shows that essentially, we write null characters inside the string that's supposed to be the optimization problem names. Apparently, the CEC functions are not loaded properly from C++ into Python. Now, there is also the problem that the CEC functions are not loaded at all, yet these weird signs appear and a function called Levy appears although it's loading code has been removed from problems.cpp. There is also a newer version of the package called ioh-1.14.0. There could be a way to load CEC functions, a way inside the package, that I'm unaware of. Also I get errors when running unit tests on Ubuntu, but there are no errors on 32-bit Windows. Additionally, Windows cannot find the ioh_data.zip file but Ubuntu on GitHub Actions seems to be able to find it.
My judgment is that the package is broken. The package should be fixed properly. The package should run on local Ubuntu first, then verify that one CEC function is properly loaded on GitHub's Ubuntu. Then ensure that all one CEC function is properly loaded on GitHub's Windows. Then add more CEC functions, and test these on local Ubuntu first. Use the most-up-to-date IOH version. Verify that one CEC function is actually loaded as expected.
7 changes: 0 additions & 7 deletions INSTALL

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ graft external/json/include
graft external/json/cmake
include external/json/CMakeLists.txt

include external/clutchlog/clutchlog/clutchlog.h external/clutchlog/CMakeLists.txt
include include/ioh/common/clutchlog.h
include doc/generate_docs.py doc/__init__.py
include VERSION
include pyproject.toml
Expand Down
21 changes: 0 additions & 21 deletions conda.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions ioh/src/problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ class PyProblem : public P
auto constraints = this->constraints();
auto optimum = this->optimum();

std::cerr << "PyProblem meta_data.name: " << meta_data.name << std::endl;

auto &factory = ioh::common::Factory<P, int, int>::instance();
factory.include(meta_data.name, meta_data.problem_id, [=](const int instance, const int n_variables) {
return std::make_shared<PyProblem<P, T>>(MetaData(meta_data.problem_id, instance, meta_data.name,
Expand Down Expand Up @@ -922,39 +920,6 @@ void define_cec_problems(py::module &m)

py::class_<cec::CEC_Zakharov, CEC, std::shared_ptr<cec::CEC_Zakharov>>(m, "CEC_Zakharov", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_Rosenbrock, CEC, std::shared_ptr<cec::CEC_Rosenbrock>>(m, "CEC_Rosenbrock", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_ExpandedSchafferF7, CEC, std::shared_ptr<cec::CEC_ExpandedSchafferF7>>(m, "CEC_ExpandedSchafferF7", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_Rastrigin, CEC, std::shared_ptr<cec::CEC_Rastrigin>>(m, "CEC_Rastrigin", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_Levy, CEC, std::shared_ptr<cec::CEC_Levy>>(m, "CEC_Levy", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_HybridFunction1, CEC, std::shared_ptr<cec::CEC_HybridFunction1>>(m, "CEC_HybridFunction1", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_HybridFunction2, CEC, std::shared_ptr<cec::CEC_HybridFunction2>>(m, "CEC_HybridFunction2", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_HybridFunction3, CEC, std::shared_ptr<cec::CEC_HybridFunction3>>(m, "CEC_HybridFunction3", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_CompositionFunction1, CEC, std::shared_ptr<cec::CEC_CompositionFunction1>>(m, "CompositionFunction1", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_CompositionFunction2, CEC, std::shared_ptr<cec::CEC_CompositionFunction2>>(m, "CompositionFunction2", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_CompositionFunction3, CEC, std::shared_ptr<cec::CEC_CompositionFunction3>>(m, "CompositionFunction3", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));

py::class_<cec::CEC_CompositionFunction4, CEC, std::shared_ptr<cec::CEC_CompositionFunction4>>(m, "CompositionFunction4", py::is_final())
.def(py::init<int, int>(), py::arg("instance"), py::arg("n_variables"));
}

std::string to_lower(const std::string &s)
Expand Down
12 changes: 0 additions & 12 deletions tests/cpp/problem/test_cec_problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ TEST_F(BaseTest, CECProblem)
std::exit(EXIT_FAILURE);
}

const auto &problem_factory = ioh::problem::ProblemRegistry<ioh::problem::CEC>::instance();

std::cerr << "Registered Names in Problem Factory:" << std::endl;
for (const auto& name : problem_factory.names()) {
std::cerr << name << std::endl;
}
std::cout << "Registered IDs in Problem Factory:" << std::endl;
for (const auto& id : problem_factory.ids()) {
std::cerr << id << std::endl;
}

std::string s;
while (getline(infile, s))
{
Expand All @@ -70,7 +59,6 @@ TEST_F(BaseTest, xopt_equals_yopt_cec)
1006, 1007, 1008, 1009, 1010,
1011, 1012
};
const auto& problem_factory = ioh::problem::ProblemRegistry<ioh::problem::CEC>::instance();
for (const auto& enumerated_meta_problem_id : cec_problem_ids)
{
// Any function's, but the composition function's, optimum is defined.
Expand Down
10 changes: 0 additions & 10 deletions tests/python/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ def a_problem(x):
exp.add_custom_problem(a_problem, "Name")
pid = ioh.get_problem_id("Name", ioh.ProblemClass.REAL)

print("ioh.problem.RealSingleObjective.problems")
print(ioh.problem.RealSingleObjective.problems)
print("ioh.problem.IntegerSingleObjective.problems")
print(ioh.problem.IntegerSingleObjective.problems)
print("ioh.problem.CEC.problems")
print(ioh.problem.CEC.problems)
print("exp.fids", exp.fids)
print("exp.iids", exp.iids)
print("exp.dims", exp.dims)

exp()

info_files = {f'IOHprofiler_f{pid}_Name.info', 'IOHprofiler_f1_Sphere.info'}
Expand Down

0 comments on commit 28f6763

Please sign in to comment.