GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/core/solvers/ipopt.cpp
Date: 2025-01-16 08:47:40
Exec Total Coverage
Lines: 17 17 100.0%
Branches: 13 26 50.0%

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