| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifdef CROCODDYL_WITH_IPOPT | ||
| 2 | |||
| 3 | #define SCALAR_float64 | ||
| 4 | |||
| 5 | #include "crocoddyl/core/solvers/ipopt.hpp" | ||
| 6 | |||
| 7 | #include "python/crocoddyl/core/core.hpp" | ||
| 8 | #include "python/crocoddyl/utils/copyable.hpp" | ||
| 9 | |||
| 10 | namespace crocoddyl { | ||
| 11 | namespace python { | ||
| 12 | |||
| 13 | ✗ | BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SolverIpopt_solves, SolverIpopt::solve, | |
| 14 | 0, 5) | ||
| 15 | |||
| 16 | ✗ | void exposeSolverIpopt() { | |
| 17 | #ifdef SCALAR_float64 | ||
| 18 | ✗ | bp::register_ptr_to_python<std::shared_ptr<SolverIpopt>>(); | |
| 19 | ✗ | bp::class_<SolverIpopt, bp::bases<SolverAbstract>>( | |
| 20 | "SolverIpopt", | ||
| 21 | ✗ | bp::init<const std::shared_ptr<crocoddyl::ShootingProblem>&>( | |
| 22 | ✗ | bp::args("self", "problem"), "Initialize solver")) | |
| 23 | ✗ | .def("solve", &SolverIpopt::solve, | |
| 24 | ✗ | SolverIpopt_solves( | |
| 25 | ✗ | bp::args("self", "init_xs", "init_us", "maxiter", "is_feasible", | |
| 26 | "init_reg"), | ||
| 27 | "Compute the optimal trajectory xopt, uopt as lists of T+1 and " | ||
| 28 | "T terms.\n\n" | ||
| 29 | "From an initial guess init_xs,init_us (feasible or not), " | ||
| 30 | "iterate\n" | ||
| 31 | "over computeDirection and tryStep until stoppingCriteria is " | ||
| 32 | "below\n" | ||
| 33 | "threshold. It also describes the globalization strategy used\n" | ||
| 34 | "during the numerical optimization.\n" | ||
| 35 | ":param init_xs: initial guess for state trajectory with T+1 " | ||
| 36 | "elements (default []).\n" | ||
| 37 | ":param init_us: initial guess for control trajectory with T " | ||
| 38 | "elements (default []) (default []).\n" | ||
| 39 | ":param maxiter: maximum allowed number of iterations (default " | ||
| 40 | "100).\n" | ||
| 41 | ":param is_feasible: true if the init_xs are obtained from " | ||
| 42 | "integrating the init_us (rollout) (default " | ||
| 43 | "False).\n" | ||
| 44 | ":param init_reg: initial guess for the regularization value. " | ||
| 45 | "Very low values are typical\n" | ||
| 46 | " used with very good guess points (init_xs, " | ||
| 47 | "init_us) (default None).\n" | ||
| 48 | ":returns the optimal trajectory xopt, uopt and a boolean that " | ||
| 49 | "describes if convergence was reached.")) | ||
| 50 | ✗ | .def("setStringIpoptOption", &SolverIpopt::setStringIpoptOption, | |
| 51 | ✗ | bp::args("self", "param_name", "param_value"), | |
| 52 | "Sets a string option for IPOPT\n\n") | ||
| 53 | ✗ | .def("setNumericIpoptOption", &SolverIpopt::setNumericIpoptOption, | |
| 54 | ✗ | bp::args("self", "param_name", "param_value"), | |
| 55 | "Sets a numeric option for IPOPT\n\n") | ||
| 56 | ✗ | .add_property("th_stop", bp::make_function(&SolverIpopt::get_th_stop), | |
| 57 | ✗ | bp::make_function(&SolverIpopt::set_th_stop), | |
| 58 | "threshold for stopping criteria") | ||
| 59 | ✗ | .def(CopyableVisitor<SolverIpopt>()); | |
| 60 | #endif | ||
| 61 | ✗ | } | |
| 62 | |||
| 63 | } // namespace python | ||
| 64 | } // namespace crocoddyl | ||
| 65 | |||
| 66 | #endif | ||
| 67 |