Skip to content

Use MOI.Nonlinear.QPBlockData - #274

Draft
blegat wants to merge 4 commits into
masterfrom
bl/qp_block_data
Draft

Use MOI.Nonlinear.QPBlockData#274
blegat wants to merge 4 commits into
masterfrom
bl/qp_block_data

Conversation

@blegat

@blegat blegat commented Aug 13, 2026

Copy link
Copy Markdown
Member

A net line deletion of 134 lines. Needs

@blegat
blegat marked this pull request as draft August 13, 2026 10:24
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.80220% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.16%. Comparing base (f84a501) to head (288b939).

Files with missing lines Patch % Lines
ext/NLoptMathOptInterfaceExt.jl 97.80% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
- Coverage   99.75%   99.16%   -0.60%     
==========================================
  Files           2        2              
  Lines         805      715      -90     
==========================================
- Hits          803      709      -94     
- Misses          2        6       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blegat blegat mentioned this pull request Aug 13, 2026
blegat added 2 commits August 20, 2026 08:40
Replace the objective union field, the four vectors of affine and
quadratic constraints, and their bespoke evaluation helpers
(_fill_gradient, _fill_jacobian, _fill_result) with a single
MOI.Nonlinear.QPBlockData, which also answers the per-constraint-type
MOI attribute queries. The equality and inequality callbacks evaluate
the block once and scatter the rows into NLopt's separate equality and
inequality blocks.
blegat added 2 commits August 21, 2026 07:20
* Use MOI.Nonlinear.ModelWithQuad instead of QPBlockData

Store the affine and quadratic objective and constraints in a
MOI.Nonlinear.ModelWithQuad whose inner model is the nonlinear model, and
build a single MOI.Nonlinear.EvaluatorWithQuad in optimize! that stacks the
quadratic rows before the NLPBlock rows. The equality/inequality
classification and the Jacobian assembly are now uniform over all rows,
which removes the separate QP scatter machinery (qp_eq_pos/qp_le_pos) and
the direct use of the private product functions of QPBlockData.

* MOI

* Set the quadratic objective with Nonlinear.set_objective

MOI.Nonlinear.ModelWithQuad no longer implements MOI.set for the objective;
Nonlinear.set_objective is the single way to set it.

* Merge the variables and the nonlinear model into one field

MOI.Nonlinear.ModelWithQuad now owns the variables (with indices guaranteed
to be 1:n), so the variables, quad_data and nlp_model fields collapse into a
single model field. A uses_nlp_block flag replaces the nlp_model !== nothing
test to tell the legacy MOI.NLPBlock API apart, because optimize! overwrites
nlp_data; the NLPBlock is rebuilt on every solve unless that flag is set, so
that a stale objective cannot survive an objective switch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant