Template Class ExternPythonProblem

Inheritance Relationships

Base Type

Class Documentation

template<class InputType>
class ioh::problem::python::ExternPythonProblem : public ioh::problem::base<InputType>

Public Functions

ExternPythonProblem(std::string module_name, std::string instance_name, std::string objective_function_api = "call", std::string instance_api_get = "get_instance", std::string dimension_api_get = "get_number_of_variables", std::string problem_id_api_get = "get_problem_id", std::string lowerbound_api = "get_lowerbound", std::string upperbound_api = "get_upperbound", std::string minimization_api = "get_minimization", std::string name_api = "get_name", std::string type_api = "get_type", std::string number_of_objectives_api = "get_number_of_objectives")

The only mandatory arguments are the module and the instance.

All other arguments defines the API which will be used to reach the Python code.

This constructor initialize the Python API and check if all the necessary member functions can actually be called.

double internal_evaluate(const std::vector<InputType> &x) override

Actually call the objective function.

~ExternPythonProblem()

Deallocate Python variables.

Protected Attributes

std::string _api_objfunc
PyObject *_py_objfunc
std::string _api_instance_get
PyObject *_py_instance_get
std::string _api_dimension_get
PyObject *_py_dimension_get
std::string _api_problem_id_get
PyObject *_py_problem_id_get
std::string _api_lowerbound_get
PyObject *_py_lowerbound_get
std::string _api_upperbound_get
PyObject *_py_upperbound_get
std::string _api_minimization_get
PyObject *_py_minimization_get
std::string _api_name_get
PyObject *_py_name_get
std::string _api_type_get
PyObject *_py_type_get
std::string _api_number_of_objectives_get
PyObject *_py_number_of_objectives_get
const InputType _return_on_error
ExternPythonHelper<InputType> py