Repository navigation
Add a problem_type slot to OptimizationProblem - #1600
Merged
ChrisRackauckas merged 1 commit intoSep 12, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
PDE discretizations that lower to an optimization problem (the NeuralPDE parser rewrite, SciML/NeuralPDE.jl#1161) need `wrap_sol` to turn the `OptimizationSolution` into a `PDENoTimeSolution`, which `wrap_sol` decides through `problem_type(prob)`. `OptimizationProblem` had no `problem_type` field, so `problem_type` always returned `nothing`. Add the field (default `nothing`, so nothing changes for existing problems) and carry it through `remake`. 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
This was referenced Sep 12, 2026
Merged
ChrisRackauckas
marked this pull request as ready for review
September 12, 2026 21:02
4 of 5 tasks
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 14, 2026
* Add a lowered_problem slot to SteadyStateProblem Symbolic frontends can construct a SteadyStateProblem whose intended non-transient form is a lowered problem (e.g. an SCC-decomposed SCCNonlinearProblem) rather than the ODE residual wrapped as a NonlinearProblem. SteadyStateProblem had nowhere to record that lowering, so ModelingToolkit stored it in system metadata — which survives remake structurally but captures the construction-time operating point, so remake(prob; u0, p) returned a lowering built from stale values. Add a `lowered_problem` field (default `nothing`) following the `problem_type` slot added to OptimizationProblem in #1600: it holds either an AbstractNonlinearProblem (used verbatim) or a callable `prob -> problem` that is evaluated on the current problem, letting frontends defer the lowering while still seeing remade u0/p. `remake` carries and can override the field, and `NonlinearProblem(::SteadyStateProblem)` prefers the stored lowering over wrapping `f`, so non-dynamic steady-state solves (NonlinearSolveBase's solve_call, SteadyStateDiffEq's SSRootfind) pick it up automatically. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: Devin CLI 3000.10.21 Agent-Model: SWE-2 Max Agent-Session: daily-primrose (local Devin CLI session ID; workspace /home/crackauc/sandbox/tmp_20260913_211211_19443) * Treat any stored problem as materialized in NonlinearProblem(prob) The callable-vs-stored check now keys on Base.Callable rather than AbstractNonlinearProblem: a system whose steady-state residual lowers to a single linear SCC stores a LinearProblem, which is an AbstractLinearProblem and would otherwise have been invoked as a callable. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin CLI 3000.10.21 Agent-Model: SWE-2 Max Agent-Session: /home/crackauc/.local/share/devin/cli/summaries/history_f9264d4995564dac.md (local transcript; no shareable URL) --------- Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Devin <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
PDE discretizations that lower to an optimization problem (the NeuralPDE parser rewrite, SciML/NeuralPDE.jl#1161) need
wrap_solto turn theOptimizationSolutioninto aPDENoTimeSolution.wrap_soldecides that throughproblem_type(prob), andOptimizationProblemhad noproblem_typefield, so it always returnednothing. This adds the field (keywordproblem_type = nothing, so nothing changes for existing problems), documents it, and carries it throughremake.Companion PRs: OptimizationBase passes
problem_type(prob)towrap_sol(anOptimizationSolutionhas noprobfield, so the one-argumentwrap_sol(sol)cannot find it) at SciML/Optimization.jl#1354, and ModelingToolkitBase forwardsProblemTypeCtxmetadata into the new slot at SciML/ModelingToolkit.jl#5115.Minor version bump (3.53.3 → 3.54.0): new keyword and a new type parameter on
OptimizationProblem.Verification
New testset in
test/pde_solutions.jl. Without the change the constructor rejects the keyword:With the change (
GROUP=Core julia --project -e 'using Pkg; Pkg.test()'on Julia 1.11.9):(The full Core group passed; the tail of the log only shows the last summaries.)
Not verified
Downstream groups and Julia 1.10/pre were not run locally.
🤖 Generated with Claude Code (model: claude-fable-5-1)
https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax