Skip to content

Use live parameters in sparse constraint Jacobians#1270

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-sparse-cons-j-live-parameters
Draft

Use live parameters in sparse constraint Jacobians#1270
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-sparse-cons-j-live-parameters

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Important

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Summary

  • accept the live parameter argument in generated and analytic sparse constraint-Jacobian callbacks
  • rebuild DifferentiationInterface preparation when the live state or parameter type changes
  • cover in-place/out-of-place and generated/analytic callbacks directly in OptimizationBase
  • exercise generated and analytic sparse callbacks through OptimizationIpopt

Root cause

OptimizationIpopt switched to the generic OptimizationCache in #1257. That cache invokes constraint Jacobians with the current parameter value. The sparse instantiation path still produced two-argument callbacks that captured the initial parameter, causing a MethodError when called as cons_j(J, x, p). The out-of-place path had the equivalent missing live-parameter behavior.

This patch preserves the old two-argument convenience through default arguments while making the current parameter part of differentiation and analytic callback evaluation.

Investigation

  • reproduced the failure from current master at be6fbd279
  • traced the behavior change to Use the default OptimizationCache in OptimizationIpopt #1257; the same BoundaryValueDiffEq case passed with OptimizationIpopt 1.2.3
  • reduced it to sparse generated and analytic constraint Jacobians
  • added direct four-way coverage in OptimizationBase and an in-place solver integration test in OptimizationIpopt

Local validation

  • OptimizationBase AD: 729 passed
  • OptimizationIpopt Core: 129 passed, 1 pre-existing broken
  • Runic check passed for all three changed Julia files
  • git diff --check passed

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-sparse-cons-j-live-parameters branch from 16265b0 to d1e327f Compare July 16, 2026 19:02
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