@@ -1508,7 +1508,13 @@ qp_solve( //
15081508 break ;
15091509 }
15101510 } else {
1511- qpresults.info .status = QPSolverOutput::PROXQP_SOLVED;
1511+ if (qpsettings.primal_infeasibility_solving &&
1512+ qpresults.info .status == QPSolverOutput::PROXQP_PRIMAL_INFEASIBLE) {
1513+ qpresults.info .status =
1514+ QPSolverOutput::PROXQP_SOLVED_CLOSEST_PRIMAL_FEASIBLE;
1515+ } else {
1516+ qpresults.info .status = QPSolverOutput::PROXQP_SOLVED;
1517+ }
15121518 break ;
15131519 }
15141520 }
@@ -1593,8 +1599,8 @@ qp_solve( //
15931599 scaled_eps =
15941600 infty_norm (qpwork.rhs .head (qpmodel.dim )) * qpsettings.eps_abs ;
15951601 }
1596- T primal_feasibility_lhs_new (primal_feasibility_lhs);
15971602
1603+ T primal_feasibility_lhs_new (primal_feasibility_lhs);
15981604 global_primal_residual (qpmodel,
15991605 qpresults,
16001606 qpsettings,
@@ -1607,37 +1613,38 @@ qp_solve( //
16071613 primal_feasibility_eq_lhs,
16081614 primal_feasibility_in_lhs);
16091615
1616+ T dual_feasibility_lhs_new (dual_feasibility_lhs);
1617+ global_dual_residual (qpresults,
1618+ qpwork,
1619+ qpmodel,
1620+ box_constraints,
1621+ ruiz,
1622+ dual_feasibility_lhs_new,
1623+ dual_feasibility_rhs_0,
1624+ dual_feasibility_rhs_1,
1625+ dual_feasibility_rhs_3,
1626+ rhs_duality_gap,
1627+ duality_gap,
1628+ hessian_type);
1629+
1630+ qpresults.info .pri_res = primal_feasibility_lhs_new;
1631+ qpresults.info .dua_res = dual_feasibility_lhs_new;
1632+ qpresults.info .duality_gap = duality_gap;
1633+
16101634 is_primal_feasible =
16111635 primal_feasibility_lhs_new <=
16121636 (scaled_eps + qpsettings.eps_rel * std::max (primal_feasibility_eq_rhs_0,
16131637 primal_feasibility_in_rhs_0));
1614- qpresults.info .pri_res = primal_feasibility_lhs_new;
1615- if (is_primal_feasible) {
1616- T dual_feasibility_lhs_new (dual_feasibility_lhs);
16171638
1618- global_dual_residual (qpresults,
1619- qpwork,
1620- qpmodel,
1621- box_constraints,
1622- ruiz,
1623- dual_feasibility_lhs_new,
1624- dual_feasibility_rhs_0,
1625- dual_feasibility_rhs_1,
1626- dual_feasibility_rhs_3,
1627- rhs_duality_gap,
1628- duality_gap,
1629- hessian_type);
1630- qpresults.info .dua_res = dual_feasibility_lhs_new;
1631- qpresults.info .duality_gap = duality_gap;
1632-
1633- is_dual_feasible =
1634- dual_feasibility_lhs_new <=
1635- (qpsettings.eps_abs +
1636- qpsettings.eps_rel *
1637- std::max (
1638- std::max (dual_feasibility_rhs_3, dual_feasibility_rhs_0),
1639- std::max (dual_feasibility_rhs_1, qpwork.dual_feasibility_rhs_2 )));
1639+ is_dual_feasible =
1640+ dual_feasibility_lhs_new <=
1641+ (qpsettings.eps_abs +
1642+ qpsettings.eps_rel *
1643+ std::max (
1644+ std::max (dual_feasibility_rhs_3, dual_feasibility_rhs_0),
1645+ std::max (dual_feasibility_rhs_1, qpwork.dual_feasibility_rhs_2 )));
16401646
1647+ if (is_primal_feasible) {
16411648 if (is_dual_feasible) {
16421649 if (qpsettings.check_duality_gap ) {
16431650 if (std::fabs (qpresults.info .duality_gap ) <=
@@ -1651,6 +1658,7 @@ qp_solve( //
16511658 } else {
16521659 qpresults.info .status = QPSolverOutput::PROXQP_SOLVED;
16531660 }
1661+ break ;
16541662 }
16551663 } else {
16561664 if (qpsettings.primal_infeasibility_solving &&
@@ -1661,9 +1669,11 @@ qp_solve( //
16611669 } else {
16621670 qpresults.info .status = QPSolverOutput::PROXQP_SOLVED;
16631671 }
1672+ break ;
16641673 }
16651674 }
16661675 }
1676+
16671677 if (qpsettings.bcl_update ) {
16681678 bcl_update (qpsettings,
16691679 qpresults,
@@ -1690,24 +1700,8 @@ qp_solve( //
16901700 new_bcl_mu_in_inv,
16911701 new_bcl_mu_eq_inv);
16921702 }
1693- // COLD RESTART
1694-
1695- T dual_feasibility_lhs_new (dual_feasibility_lhs);
16961703
1697- global_dual_residual (qpresults,
1698- qpwork,
1699- qpmodel,
1700- box_constraints,
1701- ruiz,
1702- dual_feasibility_lhs_new,
1703- dual_feasibility_rhs_0,
1704- dual_feasibility_rhs_1,
1705- dual_feasibility_rhs_3,
1706- rhs_duality_gap,
1707- duality_gap,
1708- hessian_type);
1709- qpresults.info .dua_res = dual_feasibility_lhs_new;
1710- qpresults.info .duality_gap = duality_gap;
1704+ // COLD RESTART
17111705
17121706 if (primal_feasibility_lhs_new >= primal_feasibility_lhs &&
17131707 dual_feasibility_lhs_new >= dual_feasibility_lhs &&
0 commit comments