31 const std::vector<std::pair<double, double>>& raw_point2d,
32 const std::vector<double>& bounds, std::vector<double>* opt_x,
33 std::vector<double>* opt_y) {
39 const size_t acceptable_num_of_iterations =
41 const double tol = config_.
tol();
43 const bool use_automatic_differentiation =
54 Ipopt::SmartPtr<Ipopt::TNLP> problem = smoother;
57 Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
59 app->Options()->SetIntegerValue(
"print_level",
static_cast<int>(print_level));
60 app->Options()->SetIntegerValue(
"max_iter",
61 static_cast<int>(max_num_of_iterations));
62 app->Options()->SetIntegerValue(
63 "acceptable_iter",
static_cast<int>(acceptable_num_of_iterations));
64 app->Options()->SetNumericValue(
"tol", tol);
65 app->Options()->SetNumericValue(
"acceptable_tol", acceptable_tol);
67 Ipopt::ApplicationReturnStatus status = app->Initialize();
68 if (status != Ipopt::Solve_Succeeded) {
69 AERROR <<
"*** Error during initialization!";
73 status = app->OptimizeTNLP(problem);
75 if (status == Ipopt::Solve_Succeeded ||
76 status == Ipopt::Solved_To_Acceptable_Level) {
78 Ipopt::Index iter_count = app->Statistics()->IterationCount();
79 ADEBUG <<
"*** The problem solved in " << iter_count <<
" iterations!";
81 AERROR <<
"Solver fails with return code: " <<
static_cast<int>(status);