1 #include "AllClassWrappers.h"
3 #include <pybind11/pybind11.h>
4 #include <pybind11/stl.h>
5 #include <pybind11/eigen.h>
6 #include <pybind11/iostream.h>
28 py::class_<Optimizer, std::shared_ptr<Optimizer>>(m,
"Optimizer")
29 .def_static(
"Construct", [](std::shared_ptr<ModPiece>
const& cost, py::dict d){
return Optimizer::Construct(cost,
ConvertDictToPtree(d));})
30 .def(
"ListMethods", &Optimizer::ListMethods, py::call_guard<py::scoped_ostream_redirect,py::scoped_estream_redirect>())
31 .def(
"AddInequalityConstraint", (
void (
Optimizer::*)(std::vector<std::shared_ptr<muq::Modeling::ModPiece>>
const&)) &Optimizer::AddInequalityConstraint)
32 .def(
"AddInequalityConstraint", (
void (
Optimizer::*)(std::shared_ptr<muq::Modeling::ModPiece>
const&)) &Optimizer::AddInequalityConstraint)
33 .def(
"ClearInequalityConstraint", &Optimizer::ClearInequalityConstraint)
34 .def(
"AddEqualityConstraint", (
void (
Optimizer::*)(std::vector<std::shared_ptr<muq::Modeling::ModPiece>>
const&)) &Optimizer::AddEqualityConstraint)
35 .def(
"AddEqualityConstraint", (
void (
Optimizer::*)(std::shared_ptr<muq::Modeling::ModPiece>
const&)) &Optimizer::AddEqualityConstraint)
36 .def(
"ClearEqualityConstraint", &Optimizer::ClearEqualityConstraint)
37 .def(
"Solve", &Optimizer::Solve, py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>());
39 py::class_<NLoptOptimizer, Optimizer, std::shared_ptr<NLoptOptimizer>>(m,
"NLoptOptimizer")
Solve an optimization problem.
void OptimizationWrapper(pybind11::module &m)
boost::property_tree::ptree ConvertDictToPtree(pybind11::dict dict)