| 130 | "mResultFile", &dart::optimizer::Solver::Properties::mResultFile); |
| 131 | |
| 132 | class PySolver : public dart::optimizer::Solver |
| 133 | { |
| 134 | public: |
| 135 | // Inherit the constructors |
| 136 | using Solver::Solver; |
| 137 | |
| 138 | // Trampoline for virtual function |
| 139 | bool solve() override |
| 140 | { |
| 141 | PYBIND11_OVERLOAD_PURE( |
| 142 | bool, // Return type |
| 143 | Solver, // Parent class |
| 144 | solve, // Name of function in C++ (must match Python name) |
| 145 | ); |
| 146 | } |
| 147 | |
| 148 | // Trampoline for virtual function |
| 149 | std::string getType() const override |
| 150 | { |
| 151 | PYBIND11_OVERLOAD_PURE( |
| 152 | std::string, // Return type |
| 153 | Solver, // Parent class |
| 154 | getType, // Name of function in C++ (must match Python name) |
| 155 | ); |
| 156 | } |
| 157 | |
| 158 | // Trampoline for virtual function |
| 159 | std::shared_ptr<Solver> clone() const override |
| 160 | { |
| 161 | PYBIND11_OVERLOAD_PURE( |
| 162 | std::shared_ptr<Solver>, // Return type |
| 163 | Solver, // Parent class |
| 164 | clone, // Name of function in C++ (must match Python name) |
| 165 | ); |
| 166 | } |
| 167 | }; |
| 168 | |
| 169 | ::py::class_< |
| 170 | dart::optimizer::Solver, |
| 171 | PySolver, |
| 172 | std::shared_ptr<dart::optimizer::Solver>>(m, "Solver") |
| 173 | .def(py::init<>()) |
| 174 | .def( |
| 175 | py::init<dart::optimizer::Solver::Properties>(), |
| 176 | ::py::arg("properties")) |
| 177 | .def( |
| 178 | py::init<std::shared_ptr<dart::optimizer::Problem>>(), |
| 179 | ::py::arg("problem")) |
| 180 | .def( |
| 181 | "solve", |
| 182 | +[](dart::optimizer::Solver* self) -> bool { return self->solve(); }) |
| 183 | .def( |
| 184 | "getType", |
| 185 | +[](const dart::optimizer::Solver* self) -> std::string { |
| 186 | return self->getType(); |
| 187 | }) |
| 188 | .def( |
| 189 | "clone", |
nothing calls this directly
no test coverage detected