Skip to content

Improve DAQP Prox#128

Merged
darnstrom merged 17 commits intomasterfrom
copilot/optimize-proximal-methods
Mar 21, 2026
Merged

Improve DAQP Prox#128
darnstrom merged 17 commits intomasterfrom
copilot/optimize-proximal-methods

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

LP iteration counts differed between the current branch and v0.8.1 when run through the CMake benchmark (-DBENCHMARK=ON). The root cause was a combination of a broken benchmark comparison path and an off-by-one in the proximal stagnation loop.

Changes

src/api.c — restore n_prox = n for LPs

The previous session removed this, which routed LPs to daqp_ldp directly and broke LP solving. Restored: setup_daqp_ldp must set work->n_prox = work->n for LPs so daqp_solve routes them to daqp_prox.

src/daqp_prox.c — fix cycle-counter increment (LP stagnation)

Pre-increment (++cycle_counter) caused stagnation to fire one outer step earlier than v0.8.1 (11 vs 12 consecutive non-improving steps). Changed to post-increment to match v0.8.1 exactly.

// before (fires after 11 stagnation steps)
if(++cycle_counter > work->settings->cycle_tol)

// after (matches v0.8.1: fires after 12 stagnation steps)
if(cycle_counter++ > work->settings->cycle_tol)

interfaces/daqp-julia/src/api.jl — restore eps_prox=1 for LP setup

Required for pre-v0.9 C libraries that dispatch via eps_prox != 0 rather than n_prox. Without this, old libs route LPs to daqp_ldp.

interfaces/daqp-julia/test/benchmark.jl — fair old-lib comparison

The workspace struct grew by 16 bytes (prox_mask + n_prox) between v0.8.1 and current, shifting the settings pointer from offset 208 → 224. When the benchmark swaps in the v0.8.1 .so, Julia's settings() reads from the wrong offset (gets NULL) and silently fails to set eps_prox=1 — so the old lib takes the daqp_ldp path (few iterations) while the current lib takes daqp_prox (many iterations), making the comparison unfair.

Fix: benchmark_lp now uses the old-style quadprog(QPj; settings=...) API with an explicit DAQPSettings struct where eps_prox=1. This passes settings directly to daqp_quadprog by pointer, bypassing the workspace struct entirely and working correctly with both old and new library ABIs.


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

Copilot AI changed the title [WIP] Update proximal method to conditionally add scaled identity matrix Semi-proximal method for daqp_prox: regularise only singular Hessian directions Mar 21, 2026
Copilot AI requested a review from darnstrom March 21, 2026 01:48
Copilot AI and others added 2 commits March 21, 2026 08:21
Copilot AI changed the title Semi-proximal method for daqp_prox: regularise only singular Hessian directions Semi-proximal dispatch via n_prox; default eps_prox > 0; benchmark Mar 21, 2026
Copilot AI changed the title Semi-proximal dispatch via n_prox; default eps_prox > 0; benchmark Fix LP regression: restore 1e-10 stagnation threshold for LP cycle detection Mar 21, 2026
Copilot AI changed the title Fix LP regression: restore 1e-10 stagnation threshold for LP cycle detection Fix LP benchmark regression: restore eps_prox=1 in Julia LP setup Mar 21, 2026
…tale Julia eps_prox workaround

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/2dc5486d-98e9-43f5-837d-c2bdab2ea2cf
Copilot AI changed the title Fix LP benchmark regression: restore eps_prox=1 in Julia LP setup Fix LP iteration regression introduced by n_prox-based dispatch Mar 21, 2026
…er, fix benchmark fairness

Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/8f333298-da40-41eb-99dc-428a077df3d3
Copilot AI changed the title Fix LP iteration regression introduced by n_prox-based dispatch Fix LP benchmark regression vs v0.8.1 Mar 21, 2026
@darnstrom darnstrom changed the title Fix LP benchmark regression vs v0.8.1 Improve DAQP Prox Mar 21, 2026
@darnstrom darnstrom marked this pull request as ready for review March 21, 2026 15:59
@darnstrom darnstrom merged commit 5b9bdf6 into master Mar 21, 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