Skip to content

Use native Cholesky for Dense QPs and make equality projection optional - #2921

Merged
dellaert merged 2 commits into
developfrom
codex/dense-qp-projection
Nov 8, 2026
Merged

dellaert merged 2 commits into
developfrom
codex/dense-qp-projection

Conversation

@dellaert

@dellaert dellaert commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

I wanted to get GTSAM's Dense QP solver closer to DAQP, whose performance on small MPC problems was particularly impressive. After adding dual active-set solving in #2918, I investigated why Dense still lagged and found avoidable work in curvature setup. This PR adds cached native-Hessian Cholesky and makes permanent equality projection configurable for both Primal and Dual solves.

On the small MPC problems in this benchmark, GTSAM Dense/Dual is now the dominant solver after DAQP. Across the 60 WALK/BAL problems with 16 or 50 variables, it is the fastest passing non-DAQP method in 187/240 problem/accuracy combinations, including 42/60 at Default and 51/60 at the highest accuracy. Sparse/Dual accounts for most of the remaining wins.

Stacked on #2918; base branch: codex/qp-dual-formulation.

Behavior and numerical safeguards

  • Add projectDenseQpEqualities, defaulting to true, through the shared C++/Python/MATLAB interface. Setting it to false keeps original coordinates and enforces permanent equalities with exact hard pivots and cached rank/multiplier recovery.
  • Use Cholesky for well-conditioned, positive-definite, Hessian-only objectives without permanent equalities. Validate the original Hessian before adding the requested proximal term; retain the existing square-root path for other cases.
  • Reuse curvature across proximal centers and working-set changes. Preserve original-QP feasibility, multiplier, stationarity and gap checks, value shapes, ordering and multiplier conventions. No regularization floor is added.

Sparse behavior and the Sparse/Automatic defaults are unchanged.

Benchmark evidence

MPC performance profiles at four accuracy settings

Higher curves toward the left are better; curves ending below 100% include failures. These profiles cover all 64 MPC cases: 60 small WALK/BAL problems and four larger QUAD problems. Dense/Dual's small-problem result is summarized above; Sparse/Dual remains the stronger GTSAM choice on larger structured problems.

The paired 12,800-call campaign covers both backends, both formulations, all 64 MPC problems and four accuracy settings, plus 512 Automatic checks. Complete native-factor timing includes solver construction, Dense packing, equality preparation, factorization, optimization and multiplier recovery. Matrix-to-factor input assembly is excluded.

Default-setting family medians in milliseconds, with paired speedups computed from per-case medians of five additional fresh calls:

Family Dense formulation Before After Paired speedup
LIPMWALK Primal 0.609 0.584 1.04×
LIPMWALK Dual 0.126 0.100 1.25×
WHLIPBAL Primal 0.364 0.248 1.44×
WHLIPBAL Dual 0.321 0.192 1.66×

Both versions retain 256/256 passing Dual cases and 253/256 passing Primal cases per backend; the same three low-accuracy Primal initialization failures remain. All 512 Automatic checks pass. QUAD is ineligible for native-Hessian Cholesky, and Sparse is a control; timing differences there are not attributed to this optimization. Equality projection remains enabled by default because disabling it can increase the dimension and setup cost of Dense solves.

The benchmark report includes timing boundaries, failures, numerical settings and before/after provenance. G1 and external-solver measurements retain their earlier provenance. Benchmark scripts, raw measurements and private inputs remain untracked.

Validation

  • Nine affected native suites pass, covering Dense/dual algebra, QP/LP behavior, initialization, backend options and feasible-step behavior.
  • Python: 582 passed, 6 skipped, 89 subtests passed, including calls with the equality-projection option.
  • Coverage includes duplicate/inconsistent equalities, fixed variables, warm starts, curvature fallback, native-Hessian factor reuse and original KKT checks.
  • MyST HTML build, interactive report rendering/legend/zoom checks and git diff --check pass.
  • MATLAB smoke tests are updated; MATLAB runtime validation remains unavailable on this host.

Retain well-conditioned positive-definite native Hessians for both formulations, with square-root fallbacks and unchanged original-QP checks. Refresh the MPC report and profiles with paired before/after measurements.
@dellaert
dellaert requested a review from ProfFan November 8, 2026 03:20
Base automatically changed from codex/qp-dual-formulation to develop November 8, 2026 04:09
@dellaert
dellaert merged commit 444863c into develop Nov 8, 2026
7 checks passed
@dellaert
dellaert deleted the codex/dense-qp-projection branch November 8, 2026 16:08
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.

1 participant