Skip to content

Fix unconstrained-feasibility shortcut for LP objectives and equality constraints#142

Merged
darnstrom merged 4 commits intomasterfrom
copilot/check-unconstrained-solution-validity
Mar 25, 2026
Merged

Fix unconstrained-feasibility shortcut for LP objectives and equality constraints#142
darnstrom merged 4 commits intomasterfrom
copilot/check-unconstrained-solution-validity

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

  • Understand the issue: check_unconstrained in daqp_update_ldp (src/utils.c) was incorrectly enabled for LP problems and problems with equality constraints
  • Fix check_unconstrained to exclude LP case and equality constraints
  • Refactor: move daqp_check_bounds call before the unconstrained feasibility check so that equal-bound constraints are already marked IMMUTABLE before the equality scan. The has_equalities loop now only checks the IMMUTABLE flag — no duplicate bupper[i]-blower[i] computation.
  • Add test 08 covering LP and equality constraint edge cases
  • All 9 tests pass

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

…uality constraints

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/66cd7d3a-d1d8-4d2a-9c03-cbbb36907fc5
Copilot AI changed the title [WIP] Fix validation for unconstrained solutions with equalities and LP objectives Fix unconstrained-feasibility shortcut for LP objectives and equality constraints Mar 25, 2026
Copilot AI requested a review from darnstrom March 25, 2026 02:39
Comment on lines +62 to +70
if(check_unconstrained_base && has_hessian){
for(i = 0; i < work->m; i++){
if(DAQP_IS_IMMUTABLE(i) ||
qp->bupper[i] - qp->blower[i] < work->settings->zero_tol){
has_equalities = 1;
break;
}
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like this is doing double the work of what is already done in daqp_check_bounds.
Could the logic somehow be combined with the daqp_check_bounds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3b8d1d3. daqp_check_bounds is now moved to before the unconstrained check (within the same mask guard). Since it already marks equal-bound constraints as IMMUTABLE, the has_equalities scan now only needs to check DAQP_IS_IMMUTABLE(i) — no duplicate bupper[i]-blower[i] arithmetic.

…duplicate equality detection

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/7e052cfd-6b65-42a2-80f7-60814191c494
Copy link
Contributor Author

Copilot AI commented Mar 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI requested a review from darnstrom March 25, 2026 10:43
@darnstrom darnstrom marked this pull request as ready for review March 25, 2026 11:57
@darnstrom darnstrom merged commit 459dae3 into master Mar 25, 2026
14 checks passed
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