Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adds bindings for PagMo2 NSGA-III #160

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WIP: Add initial NSGA3 interface
  • Loading branch information
pmslavin committed Mar 20, 2024
commit c794460490656ec3d5cad49fd9667d0040668cf5
3 changes: 2 additions & 1 deletion pygmo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ Python3_add_library(core MODULE WITH_SOABI
)

target_link_libraries(core PRIVATE Pagmo::pagmo Boost::boost Boost::serialization)
target_link_directories(core PRIVATE "/home/paul/work/UoM/wrg/code/moea/pagmo2/build")
# NOTE: quench warnings from Boost when building the library.
target_compile_definitions(core PRIVATE BOOST_ALLOW_DEPRECATED_HEADERS)
target_include_directories(core SYSTEM PRIVATE "${pybind11_INCLUDE_DIR}")
target_include_directories(core SYSTEM PRIVATE "${pybind11_INCLUDE_DIR}" "/home/paul/work/UoM/wrg/code/moea/pagmo2/include")
target_compile_definitions(core PRIVATE "${pybind11_DEFINITIONS}")
target_compile_options(core PRIVATE
"$<$<CONFIG:Debug>:${PYGMO_CXX_FLAGS_DEBUG}>"
Expand Down
3 changes: 3 additions & 0 deletions pygmo/docstrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,9 @@ See also the docs of the relevant C++ method :cpp:func:`pagmo::nsga2::get_log`.
)";
}

std::string nsga3_docstring(){ return R"(nsga3_docstring)"; }
std::string nsga3_get_log_docstring(){ return R"(nsga3_get_log_docstring)"; }

std::string gaco_set_bfe_docstring()
{
return R"(set_bfe(b)
Expand Down
2 changes: 2 additions & 0 deletions pygmo/docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ std::string moead_gen_get_log_docstring();
std::string nsga2_set_bfe_docstring();
std::string nsga2_docstring();
std::string nsga2_get_log_docstring();
std::string nsga3_docstring();
std::string nsga3_get_log_docstring();
std::string nspso_set_bfe_docstring();
std::string nspso_docstring();
std::string nspso_get_log_docstring();
Expand Down
4 changes: 4 additions & 0 deletions pygmo/expose_algorithms_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <pagmo/algorithms/maco.hpp>
#include <pagmo/algorithms/moead_gen.hpp>
#include <pagmo/algorithms/nsga2.hpp>
#include <pagmo/algorithms/nsga3.hpp>
#include <pagmo/algorithms/nspso.hpp>
#include <pagmo/algorithms/null_algorithm.hpp>
#include <pagmo/algorithms/pso.hpp>
Expand Down Expand Up @@ -71,6 +72,9 @@ void expose_algorithms_1(py::module &m, py::class_<pagmo::algorithm> &algo, py::
nsga2_.def("get_seed", &pagmo::nsga2::get_seed, generic_uda_get_seed_docstring().c_str());
nsga2_.def("set_bfe", &pagmo::nsga2::set_bfe, nsga2_set_bfe_docstring().c_str(), py::arg("b"));

// NSGA3
auto nsga3_ = expose_algorithm<pagmo::nsga3>(m, algo, a_module, "nsga3", nsga3_docstring().c_str());

// GACO
auto gaco_ = expose_algorithm<pagmo::gaco>(m, algo, a_module, "gaco", gaco_docstring().c_str());
gaco_.def(
Expand Down