Incorporate QP dual residual into daqp_refine_active#139
Draft
Incorporate QP dual residual into daqp_refine_active#139
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
daqp_refine_activeonly 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 inr_dcan degrade solution quality after refinement.Changes
src/auxiliary.c—daqp_refine_activeWhen
RinvorRinvDis available (non-identity Hessian), runs a full KKT-informed correction instead of the primal-only fix:r_p = M·u − d(primal residual, as before)r_d = u + M^Tλ*(dual residual, new)eps = Rinv·r_d(solveR·eps = r_dvia packed upper-triangularRinv)rhs_lam = r_p + M·eps(enriched RHS)delta_lam = (LDL^T)⁻¹ · rhs_lamλ* += delta_lam,u -= r_d + M^T·delta_lamStep 6 simultaneously zeroes both residuals. No new allocations —
work->xold(unused duringdaqp_ldp) holdsr_d, and the firstnelements of the existingn+1-elementwork->zldltemporarily holdepsbefore 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.cppNew test for the QP-informed path: sets
pivot_tol = DAQP_INFto forcedaqp_refine_activeon 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.