34 ipopt_app_ = std::make_shared<Ipopt::IpoptApplication>();
35 status_ = Ipopt::Solve_Succeeded;
50 SetOption(
"jacobian_approximation",
"exact");
51 SetOption(
"hessian_approximation",
"limited-memory");
54 SetOption(
"print_timing_statistics",
"no");
63 ipopt_app_->RethrowNonIpoptException(rethrow_non_ipopt_exceptions);
68 using namespace Ipopt;
71 if (
status_ != Solve_Succeeded) {
72 std::cout << std::endl
74 <<
"*** Error during initialization!" << std::endl;
75 throw std::length_error(
"Ipopt could not initialize correctly");
79 std::string jac_type =
"";
80 ipopt_app_->Options()->GetStringValue(
"jacobian_approximation", jac_type,
"");
81 bool finite_diff = jac_type ==
"finite-difference-values";
84 SmartPtr<TNLP> nlp_ptr =
new IpoptAdapter(nlp, finite_diff);
87 if (
status_ != Solve_Succeeded) {
88 std::string msg =
"ERROR: Ipopt failed to find a solution. Return Code: " +
96 ipopt_app_->Options()->SetStringValue(name, value);
101 ipopt_app_->Options()->SetIntegerValue(name, value);
106 ipopt_app_->Options()->SetNumericValue(name, value);
111 return ipopt_app_->Statistics()->TotalWallclockTime();