Skip to content

Fix MOI nonlinear derivative sparsity - #292

Open
harshangrjn wants to merge 1 commit into
exanauts:mainfrom
harshangrjn:fix-moi-derivative-sparsity
Open

Fix MOI nonlinear derivative sparsity#292
harshangrjn wants to merge 1 commit into
exanauts: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

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

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

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.

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