Skip to content

Incorporate QP dual residual into daqp_refine_active#139

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/update-daqp-refine-active
Draft

Incorporate QP dual residual into daqp_refine_active#139
Copilot wants to merge 2 commits intomasterfrom
copilot/update-daqp-refine-active

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

daqp_refine_active only corrected the LDP primal residual (r_p = M·u − d), ignoring the dual residual (r_d = u + M^T·λ). For QPs with a non-trivial Hessian, errors in r_d can degrade solution quality after refinement.

Changes

src/auxiliary.cdaqp_refine_active

When Rinv or RinvD is available (non-identity Hessian), runs a full KKT-informed correction instead of the primal-only fix:

Step Operation
1 r_p = M·u − d (primal residual, as before)
2 r_d = u + M^Tλ* (dual residual, new)
3 eps = Rinv·r_d (solve R·eps = r_d via packed upper-triangular Rinv)
4 rhs_lam = r_p + M·eps (enriched RHS)
5 delta_lam = (LDL^T)⁻¹ · rhs_lam
6 λ* += delta_lam, u -= r_d + M^T·delta_lam

Step 6 simultaneously zeroes both residuals. No new allocations — work->xold (unused during daqp_ldp) holds r_d, and the first n elements of the existing n+1-element work->zldl temporarily hold eps before the LDL D⁻¹ step overwrites them.

Pure LDP case (Rinv == NULL && RinvD == NULL) is unchanged — falls through to the original primal-only correction.

interfaces/daqp-eigen/tests/08_qp_refinement.cpp

New test for the QP-informed path: sets pivot_tol = DAQP_INF to force daqp_refine_active on every solve and checks the result against a reference solve at default settings.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/1df8cbe1-03b4-4aae-9052-2a572f7b95a8
Copilot AI changed the title [WIP] Update refinement step to include dual and primal residuals Incorporate QP dual residual into daqp_refine_active Mar 23, 2026
Copilot AI requested a review from darnstrom March 23, 2026 20:49
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