42 #include "MoochoPack_FeasibilityStepReducedStd_Strategy.hpp" 43 #include "MoochoPack_NLPAlgo.hpp" 44 #include "MoochoPack_NLPAlgoState.hpp" 45 #include "MoochoPack_Exceptions.hpp" 46 #include "Teuchos_dyn_cast.hpp" 51 const quasi_range_space_step_ptr_t &quasi_range_space_step
52 ,
const qp_solver_ptr_t &qp_solver
53 ,
const qp_tester_ptr_t &qp_tester
57 :quasi_range_space_step_(quasi_range_space_step)
58 ,qp_solver_(qp_solver)
59 ,qp_tester_(qp_tester)
60 ,qp_objective_(qp_objective)
61 ,qp_testing_(qp_testing)
69 ,
const Vector& xo,
const Vector& c_xo, VectorMutable* w
72 using Teuchos::dyn_cast;
502 TEUCHOS_TEST_FOR_EXCEPT(
true);
509 out << L <<
"*** Computes feasibility steps by solving a constrained QP using the range and null\n" 510 << L <<
"*** space decomposition\n" 511 << L <<
"begin quais-range space step: \"" << typeName(quasi_range_space_step()) <<
"\"\n";
513 quasi_range_space_step().print_step( out, L +
" " );
515 out << L <<
"end quasi-range space step\n" 516 << L <<
"if quasi-range space step failed then\n" 517 << L <<
" this feasibility step fails also!\n" 520 << L <<
"*** Set the bounds for bl <= Z*wz <= bu\n" 521 << L <<
"bl = d_bounds_k.l - (xo - x_k) - Ywy\n" 522 << L <<
"bu = d_bounds_k.u - (xo - x_k) - Ywy\n" 523 << L <<
"Set bl(i) = bu(i) for those nu_k(i) != 0.0\n" 524 << L <<
"if (qp_objective == OBJ_MIN_FULL_STEP) and (current_k != k) then\n" 525 << L <<
" grad = Z_k'*Ywy\n" 526 << L <<
" Hess = Z_k'*Z_k\n" 527 << L <<
"elseif (qp_objective == OBJ_MIN_NULL_SPACE_STEP) and (current_k != k) then\n" 528 << L <<
" grad = 0\n" 529 << L <<
" Hess = I\n" 530 << L <<
"elseif (qp_objective == OBJ_RSQP) and (current_k != k) then\n" 531 << L <<
" grad = qp_grad_k\n" 532 << L <<
" Hess = rHL_k\n" 534 << L <<
"if check_results == true then\n" 535 << L <<
" assert that bl and bu are valid and sorted\n" 537 << L <<
"etaL = 0.0\n" 538 << L <<
"*** Determine if we can use simple bounds on pz or not\n" 539 << L <<
"if Z_k is a variable reduction null space matrix and norm(Ypy_k(indep),0) == 0 then\n" 540 << L <<
" use_simple_wz_bounds = true\n" 542 << L <<
" use_simple_wz_bounds = false\n" 544 << L <<
"*** Setup QP arguments\n" 545 << L <<
"qp_g = qp_grad_k\n" 546 << L <<
"qp_G = rHL_k\n" 547 << L <<
"if use_simple_wz_bounds == true then\n" 548 << L <<
" qp_dL = bl(indep), qp_dU = bu(indep)\n" 549 << L <<
" qp_E = Z_k.D, qp_b = Ywy(dep)\n" 550 << L <<
" qp_eL = bl(dep), qp_eU = bu(dep)\n" 552 << L <<
" qp_dL = -inf, qp_dU = +inf\n" 553 << L <<
" qp_E = Z_k, qp_b = Ywy\n" 554 << L <<
" qp_eL = bl, qp_eU = bu\n" 556 << L <<
"if m > r then\n" 557 << L <<
" qp_F = V_k, qp_f = c_k(undecomp) + Gc_k(undecomp)'*Ywy\n" 559 << L <<
" qp_F = empty, qp_f = empty\n" 561 << L <<
"Use a warm start given the active-set in nu_k\n" 562 << L <<
"Solve the following QP to compute qp_d, qp_eta, qp_Ed = qp_E * qp_d\n" 563 << L <<
",qp_nu, qp_mu and qp_lambda (" << typeName(qp_solver()) <<
"):\n" 564 << L <<
" min qp_g' * qp_d + 1/2 * qp_d' * qp_G * qp_d + M(eta)\n" 565 << L <<
" qp_d <: R^(n-r)\n" 567 << L <<
" etaL <= qp_eta\n" 568 << L <<
" qp_dL <= qp_d <= qp_dU [qp_nu]\n" 569 << L <<
" qp_eL <= qp_E * qp_d + (1-eta)*qp_b <= qp_eU [qp_mu]\n" 570 << L <<
" qp_F * d_qp + (1-eta) * qp_f = 0 [qp_lambda]\n" 571 << L <<
"if (qp_teing==QP_TEST) or (fd_deriv_testing==QP_TEST_DEFAULT\n" 572 << L <<
"and check_results==true) then\n" 573 << L <<
" Check the optimality conditions of the above QP\n" 574 << L <<
" if the optimality conditions do not check out then\n" 575 << L <<
" set throw_qp_failure = true\n" 578 << L <<
"*** Set the solution to the QP subproblem\n" 579 << L <<
"wz = qp_d\n" 580 << L <<
"eta = qp_eta\n" 581 << L <<
"if use_simple_wz_bounds == true then\n" 582 << L <<
" Zwz(dep) = qp_Ed, Zwz(indep) = wz\n" 584 << L <<
" Zwz = qp_Ed\n" 586 << L <<
"if eta > 0 then set Ywy = (1-eta) * Ywy\n" 587 << L <<
"if QP solution is suboptimal then\n" 588 << L <<
" throw_qp_failure = true\n" 589 << L <<
"elseif QP solution is primal feasible (not optimal) then\n" 590 << L <<
" throw_qp_failure = primal_feasible_point_error\n" 591 << L <<
"elseif QP solution is dual feasible (not optimal) then\n" 592 << L <<
" find max u s.t.\n" 593 << L <<
" d_bounds_k.l <= (xo - x) + u*(Ywy+Zwz) <= d_bounds_k.u\n" 594 << L <<
" alpha_k = u\n" 595 << L <<
" throw_qp_failure = true\n" 597 << L <<
"if eta == 1.0 then\n" 598 << L <<
" The constraints are infeasible!\n" 599 << L <<
" throw_qp_failure = true\n" 601 << L <<
"current_k = k\n" 602 << L <<
"w = Zwz + Ywy\n" 603 << L <<
"if (throw_qp_failure == true) then\n" 604 << L <<
" The feasibility step computation has failed!\n"
void print_step(std::ostream &out, const std::string &leading_str) const
rSQP Algorithm control class.
Reduced space SQP state encapsulation interface.
bool compute_feasibility_step(std::ostream &out, EJournalOutputLevel olevel, NLPAlgo *algo, NLPAlgoState *s, const Vector &xo, const Vector &c_xo, VectorMutable *w)
Computes a feasibility step by computing simple quasi-range and null space components.
FeasibilityStepReducedStd_Strategy(const quasi_range_space_step_ptr_t &quasi_range_space_step, const qp_solver_ptr_t &qp_solver, const qp_tester_ptr_t &qp_tester, EQPObjective qp_objective=OBJ_MIN_NULL_SPACE_STEP, EQPTesting qp_testing=QP_TEST_DEFAULT)
Construct and initialize.