Skip to content

Fix MOI nonlinear derivative sparsity - #292

Closed
harshangrjn wants to merge 3 commits into
madsuite-org:mainfrom
harshangrjn:fix-moi-derivative-sparsity
Closed

Fix MOI nonlinear derivative sparsity#292
harshangrjn wants to merge 3 commits into
madsuite-org:mainfrom
harshangrjn:fix-moi-derivative-sparsity

Conversation

@harshangrjn

Copy link
Copy Markdown

Based on discussions with @odow , this PR implements the following:

  • Fixes inflated Jacobian and Hessian sparsity caused by repeated variables receiving different data slots during MOI translation.
  • Reuses variable slots within nonlinear expressions while preserving SIMD batching.
  • Adds bounded grouping for nonlinear objectives to avoid large, slow-compiling kernels.
  • For PGLib case with 30k nodes, equality Jacobian entries drop from 1,565,483 to 857,623 and Hessian entries from 3,116,094 to 1,558,802, matching the JuMP model’s derivative structure.
  • Adds correctness, sparsity, batching, parameter, and Float32 regression tests.

@odow

odow commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I've done pretty much this in #290. We can chat tomorrow.

Comment thread ext/ExaModelsMOI.jl
return true
end

const _MAX_OBJECTIVE_GROUP_SIZE = 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should discuss this

Comment thread test/JuMPTest/JuMPTest.jl

function runtests()
@testset "JuMP Interface test" begin
derivative_sparsity_tests()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice nice. More tests are good.

I'm also planning on enabling the MOI tests. But that was going to wait until we agreed on the changes to the wrapper.

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results


@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.09375% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.86%. Comparing base (6f15038) to head (5abf806).
⚠️ Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
ext/ExaModelsMOI.jl 96.09% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #292       +/-   ##
===========================================
- Coverage   80.80%   55.86%   -24.94%     
===========================================
  Files          20       25        +5     
  Lines        2021     4094     +2073     
===========================================
+ Hits         1633     2287      +654     
- Misses        388     1807     +1419     

☔ 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.

@odow

odow commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

I think this can be closed in favor of #290.

@sshin23

sshin23 commented Aug 15, 2026

Copy link
Copy Markdown
Member

Closed in favor of #290

@sshin23 sshin23 closed this Aug 15, 2026
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.

3 participants