Skip to content

Forward ProblemTypeCtx metadata to OptimizationProblem - #5115

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:optprob-problem-type
Sep 12, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:optprob-problem-type

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Note: please ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed and why

ODEProblem, DAEProblem and NonlinearProblem pass the system's ProblemTypeCtx metadata as the problem's problem_type, which is how PDE discretizations (MethodOfLines) get their solutions wrapped by wrap_sol. OptimizationProblem dropped it. This forwards getmetadata(sys, ProblemTypeCtx, nothing) into the new problem_type slot of SciMLBase.OptimizationProblem, so the NeuralPDE parser rewrite (SciML/NeuralPDE.jl#1161), which lowers a PDESystem to an optimization System, gets a PDENoTimeSolution from solve.

One line in lib/ModelingToolkitBase/src/problems/optimizationproblem.jl plus a compat bump to SciMLBase = "3.54"; depends on SciML/SciMLBase.jl#1600 and pairs with SciML/Optimization.jl#1354.

Verification

New testset at the end of lib/ModelingToolkitBase/test/optimization/optimizationsystem.jl, run with SciMLBase#1600 dev'd on Julia 1.11.9:

Test Summary:                                          | Pass  Total   Time
`ProblemTypeCtx` is forwarded to `OptimizationProblem` |    2      2  10.0s

Without the change SciMLBase.problem_type(prob) is nothing for the system carrying ProblemTypeCtx => "A", so the first @test fails.

Not verified

The full ModelingToolkitBase test groups were not run locally; CI cannot resolve until SciMLBase 3.54 is released.

🤖 Generated with Claude Code (model: claude-fable-5-1)

https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax

`ODEProblem`, `DAEProblem` and `NonlinearProblem` pass the system's `ProblemTypeCtx`
metadata as the problem's `problem_type`, which is how PDE discretizations get their
solutions wrapped by `wrap_sol`. `OptimizationProblem` dropped it. Forward it (default
`nothing`) now that SciMLBase's `OptimizationProblem` has a `problem_type` slot. Needed by
the NeuralPDE parser rewrite (SciML/NeuralPDE.jl#1161).

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Agent-Harness: 2.1.269 (Claude Code)
Agent-Model: claude-fable-5-1
Agent-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax
Claude-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 12, 2026 21:59
@ChrisRackauckas
ChrisRackauckas merged commit c691dab into SciML:master Sep 12, 2026
50 of 55 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 12, 2026
- Forward ProblemTypeCtx metadata to OptimizationProblem (#5115)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 13, 2026
- Add constraints_to_penalties: lower constraints to quadratic penalty costs (#5111)
- Fix QA: approve the `limited`/`constraints_to_penalties` API additions (#5116)
- Concretize initialization problems once at construction (#5062)
- Make tovar public (#5120)
- Fix SciCompDSL model macro hygiene (#5058)
- Release ModelingToolkitBase 1.71.0 (#5126)
- Forward ProblemTypeCtx metadata to OptimizationProblem (#5115)
- Release ModelingToolkitBase 1.71.1 (#5127)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 13, 2026
The `ProblemTypeCtx` testset added in #5115 calls `SciMLBase.problem_type`,
but the file never imported `SciMLBase`, so under `@safetestset` the two
assertions error with `UndefVarError: SciMLBase not defined in Main`.



Agent-Harness: Claude Code 2.1.269
Agent-Model: claude-fable-5-1
Agent-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax
Claude-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
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