Skip to content

Fix false infeasibility for badly scaled QPs in daqp_ldp#137

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-daqp-infeasibility-issues
Closed

Fix false infeasibility for badly scaled QPs in daqp_ldp#137
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-daqp-infeasibility-issues

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

For poorly conditioned Hessians combined with a large f, the LDP transformation produces v = R⁻ᵀf with very large norm. The internal objective ||u||² equals roughly ||v||² at the optimum, which was incorrectly exceeding the hard internal limit 2 * settings->fval_bound (default 2e30) and causing DAQP_EXIT_INFEASIBLE on feasible problems. This affects both the direct daqp_ldp path and the inner solve inside daqp_prox.

Example that previously returned INFEASIBLE:

// min 0.5 * 1e-10 * x^2 + 1e13 * x  s.t.  0 <= x <= 1
// x* = 0 (feasible), but ||v||^2 = (f/sqrt(H))^2 = 1e36 >> 2e30 = old limit
H = 1e-10, f = 1e13, bl = 0, bu = 1

Changes

  • src/daqp.c — At the start of daqp_ldp, compute v_norm2 = ||work->v||² and use:

    c_float fval_bound = 2 * work->settings->fval_bound + v_norm2;

    This makes the check equivalent to 0.5*(||u||² − ||v||²) > settings->fval_bound — i.e. the actual QP objective exceeds the user-specified bound — which is the correct condition regardless of problem scaling.

  • interfaces/daqp-eigen/tests/08_badly_scaled.cpp — Regression test covering:

    • Non-prox path (H = 1e-10, ||v||² ≈ 1e36)
    • Prox path (H = 1e-20, inner daqp_ldp with ||v||² ≈ 1e32)
    • 2-D mixed-scale sanity check (H = diag(1e8, 1e-8))

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…2 in fval_bound

For poorly conditioned Hessians with large f, v = R^{-T}*f can be very large.
The internal LDP objective ||u||^2 ≈ ||v||^2 at the optimum can then exceed
the old hard limit 2*fval_bound (= 2e30 by default), causing daqp_ldp to
return INFEASIBLE for feasible problems.

Fix: compute v_norm2 = ||work->v||^2 at the start of daqp_ldp and use
  fval_bound = 2*settings->fval_bound + v_norm2
so the check is equivalent to testing whether the QP objective
  0.5*(||u||^2 - ||v||^2) > settings->fval_bound,
which is the semantically correct condition.

Also adds a regression test (test_08_badly_scaled) covering the non-prox path
(H just above zero_tol) and the prox path (H below zero_tol).

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/51944423-3526-446b-b4a2-85d457f1ecb8
Copilot AI changed the title [WIP] Fix numerical handling for DAQP infeasible problems Fix false infeasibility for badly scaled QPs in daqp_ldp Mar 23, 2026
Copilot AI requested a review from darnstrom March 23, 2026 09:56
@darnstrom darnstrom closed this Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants