39 const size_t horizon,
const double ts,
const Eigen::MatrixXd& ego,
40 size_t obstacles_num,
const Eigen::MatrixXi& obstacles_edges_num,
41 const Eigen::MatrixXd& obstacles_A,
const Eigen::MatrixXd& obstacles_b,
42 const Eigen::MatrixXd& xWS, Eigen::MatrixXd* l_warm_up,
43 Eigen::MatrixXd* n_warm_up, Eigen::MatrixXd* s_warm_up) {
45 bool solver_flag =
false;
51 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
52 obstacles_b, xWS, planner_open_space_config_);
55 ADEBUG <<
"dual warm up done.";
61 AWARN <<
"dual warm up fail.";
69 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
70 obstacles_b, xWS, planner_open_space_config_);
73 ADEBUG <<
"dual warm up done.";
79 AWARN <<
"dual warm up fail.";
87 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
88 obstacles_b, xWS, planner_open_space_config_);
90 Ipopt::SmartPtr<Ipopt::TNLP> problem = ptop;
92 Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
94 app->Options()->SetIntegerValue(
99 app->Options()->SetIntegerValue(
104 app->Options()->SetNumericValue(
109 app->Options()->SetIntegerValue(
113 app->Options()->SetNumericValue(
117 app->Options()->SetNumericValue(
118 "acceptable_constr_viol_tol",
122 app->Options()->SetNumericValue(
123 "min_hessian_perturbation",
127 app->Options()->SetNumericValue(
128 "jacobian_regularization_value",
132 app->Options()->SetStringValue(
133 "print_timing_statistics",
137 app->Options()->SetStringValue(
142 app->Options()->SetStringValue(
147 app->Options()->SetStringValue(
"mehrotra_algorithm",
"yes");
149 Ipopt::ApplicationReturnStatus status = app->Initialize();
150 if (status != Ipopt::Solve_Succeeded) {
151 AERROR <<
"*** Dual variable wart start problem error during "
156 status = app->OptimizeTNLP(problem);
158 if (status == Ipopt::Solve_Succeeded ||
159 status == Ipopt::Solved_To_Acceptable_Level) {
161 Ipopt::Index iter_count = app->Statistics()->IterationCount();
162 ADEBUG <<
"*** The problem solved in " << iter_count <<
" iterations!";
164 Ipopt::Number final_obj = app->Statistics()->FinalObjective();
165 ADEBUG <<
"*** The final value of the objective function is " << final_obj
169 ADEBUG <<
"Solve not succeeding, return status: " << int(status);
174 solver_flag = (status == Ipopt::Solve_Succeeded ||
175 status == Ipopt::Solved_To_Acceptable_Level);
180 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
181 obstacles_b, xWS, planner_open_space_config_);
183 Ipopt::SmartPtr<Ipopt::TNLP> problem = ptop;
185 Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
187 app->Options()->SetIntegerValue(
192 app->Options()->SetIntegerValue(
197 app->Options()->SetNumericValue(
202 app->Options()->SetIntegerValue(
206 app->Options()->SetNumericValue(
210 app->Options()->SetNumericValue(
211 "acceptable_constr_viol_tol",
215 app->Options()->SetNumericValue(
216 "min_hessian_perturbation",
220 app->Options()->SetNumericValue(
221 "jacobian_regularization_value",
225 app->Options()->SetStringValue(
226 "print_timing_statistics",
230 app->Options()->SetStringValue(
235 app->Options()->SetStringValue(
240 Ipopt::ApplicationReturnStatus status = app->Initialize();
241 if (status != Ipopt::Solve_Succeeded) {
242 AERROR <<
"*** Dual variable wart start problem error during "
247 status = app->OptimizeTNLP(problem);
248 if (status == Ipopt::Solve_Succeeded ||
249 status == Ipopt::Solved_To_Acceptable_Level) {
251 Ipopt::Index iter_count = app->Statistics()->IterationCount();
252 ADEBUG <<
"*** The problem solved in " << iter_count <<
" iterations!";
254 Ipopt::Number final_obj = app->Statistics()->FinalObjective();
255 ADEBUG <<
"*** The final value of the objective function is " << final_obj
259 ADEBUG <<
"Solve not succeeding, return status: " << int(status);
264 solver_flag = (status == Ipopt::Solve_Succeeded ||
265 status == Ipopt::Solved_To_Acceptable_Level);
269 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
270 obstacles_b, xWS, planner_open_space_config_);
274 AERROR <<
"dual warm up fail.";
278 ADEBUG <<
"dual warm up done.";
284 Eigen::MatrixXd l_warm_up_ipoptqp(l_warm_up->rows(), l_warm_up->cols());
285 Eigen::MatrixXd n_warm_up_ipoptqp(n_warm_up->rows(), n_warm_up->cols());
289 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
290 obstacles_b, xWS, planner_open_space_config_);
292 Ipopt::SmartPtr<Ipopt::TNLP> problem = ptop_ipoptqp;
294 Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
296 app->Options()->SetIntegerValue(
301 app->Options()->SetIntegerValue(
306 app->Options()->SetNumericValue(
311 app->Options()->SetIntegerValue(
315 app->Options()->SetNumericValue(
319 app->Options()->SetNumericValue(
320 "acceptable_constr_viol_tol",
324 app->Options()->SetNumericValue(
325 "min_hessian_perturbation",
329 app->Options()->SetNumericValue(
330 "jacobian_regularization_value",
334 app->Options()->SetStringValue(
335 "print_timing_statistics",
339 app->Options()->SetStringValue(
344 app->Options()->SetStringValue(
349 app->Options()->SetStringValue(
"mehrotra_algorithm",
"yes");
351 Ipopt::ApplicationReturnStatus status = app->Initialize();
352 if (status != Ipopt::Solve_Succeeded) {
353 AERROR <<
"*** Dual variable wart start problem error during "
358 status = app->OptimizeTNLP(problem);
360 if (status == Ipopt::Solve_Succeeded ||
361 status == Ipopt::Solved_To_Acceptable_Level) {
363 Ipopt::Index iter_count = app->Statistics()->IterationCount();
364 ADEBUG <<
"*** IPOPTQP: The problem solved in " << iter_count
366 Ipopt::Number final_obj = app->Statistics()->FinalObjective();
367 ADEBUG <<
"*** IPOPTQP: The final value of the objective function is "
370 ADEBUG <<
"Solve not succeeding, return status: " << int(status);
377 Eigen::MatrixXd l_warm_up_ipopt(l_warm_up->rows(), l_warm_up->cols());
378 Eigen::MatrixXd n_warm_up_ipopt(n_warm_up->rows(), n_warm_up->cols());
382 horizon, ts, ego, obstacles_edges_num, obstacles_num, obstacles_A,
383 obstacles_b, xWS, planner_open_space_config_);
385 problem = ptop_ipopt;
388 status = app->Initialize();
389 if (status != Ipopt::Solve_Succeeded) {
390 AERROR <<
"*** Dual variable wart start problem error during "
395 status = app->OptimizeTNLP(problem);
396 if (status == Ipopt::Solve_Succeeded ||
397 status == Ipopt::Solved_To_Acceptable_Level) {
399 Ipopt::Index iter_count = app->Statistics()->IterationCount();
400 ADEBUG <<
"*** IPOPT: The problem solved in " << iter_count
402 Ipopt::Number final_obj = app->Statistics()->FinalObjective();
403 ADEBUG <<
"*** IPOPT: The final value of the objective function is "
406 ADEBUG <<
"Solve not succeeding, return status: " << int(status);
412 double l_max_diff1 = 0.0;
413 double l_max_diff2 = 0.0;
414 double l_max_diff3 = 0.0;
415 for (
int c = 0; c < l_warm_up->cols(); ++c) {
416 for (
int r = 0; r < l_warm_up->rows(); ++r) {
417 l_max_diff1 = std::max(l_max_diff1, std::abs(l_warm_up->coeff(r, c) -
418 l_warm_up_ipopt(r, c)));
419 l_max_diff2 = std::max(l_max_diff2, std::abs(l_warm_up->coeff(r, c) -
420 l_warm_up_ipoptqp(r, c)));
421 l_max_diff3 = std::max(l_max_diff3, std::abs(l_warm_up_ipoptqp(r, c) -
422 l_warm_up_ipopt(r, c)));
425 ADEBUG <<
"max l warm up diff between osqp & ipopt: " << l_max_diff1;
426 ADEBUG <<
"max l warm up diff between osqp & ipoptqp: " << l_max_diff2;
427 ADEBUG <<
"max l warm up diff between ipopt & ipoptqp: " << l_max_diff3;
429 double n_max_diff1 = 0.0;
430 double n_max_diff2 = 0.0;
431 double n_max_diff3 = 0.0;
432 for (
int c = 0; c < n_warm_up->cols(); ++c) {
433 for (
int r = 0; r < n_warm_up->rows(); ++r) {
434 n_max_diff1 = std::max(n_max_diff1, std::abs(n_warm_up->coeff(r, c) -
435 n_warm_up_ipopt(r, c)));
436 n_max_diff2 = std::max(n_max_diff2, std::abs(n_warm_up->coeff(r, c) -
437 n_warm_up_ipoptqp(r, c)));
438 n_max_diff3 = std::max(n_max_diff3, std::abs(n_warm_up_ipoptqp(r, c) -
439 n_warm_up_ipopt(r, c)));
442 ADEBUG <<
"max n warm up diff between osqp & ipopt: " << n_max_diff1;
443 ADEBUG <<
"max n warm up diff between osqp & ipoptqp: " << n_max_diff2;
444 ADEBUG <<
"max n warm up diff between ipopt & ipoptqp: " << n_max_diff3;
449 if (solver_flag ==
false) {
451 for (
int r = 0; r < l_warm_up->rows(); ++r) {
452 for (
int c = 0; c < l_warm_up->cols(); ++c) {
453 (*l_warm_up)(r, c) = 0.0;
457 for (
int r = 0; r < n_warm_up->rows(); ++r) {
458 for (
int c = 0; c < n_warm_up->cols(); ++c) {
459 (*n_warm_up)(r, c) = 0.0;