Skip to content

Add SCCSteadyStateProblem, the SCC-split form of a steady-state problem - #1642

Draft
ChrisRackauckas wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas:scc-steadystate
Draft

ChrisRackauckas wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas:scc-steadystate

Conversation

@ChrisRackauckas

@ChrisRackauckas ChrisRackauckas commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — awaiting review by @ChrisRackauckas. Filed by an AI agent running as @ChrisRackauckas; Chris has not seen this.
Harness: Devin CLI 3000.11.3 (diagnosis and fix), Claude Code 2.1.285 (PR) · Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

This fixes a failure on the default branch's CI. The diagnosis and the evidence below come from the investigating agent's report; "confirmed by running" and "read in logs" are kept apart there.

Part of a three-PR stack implementing Chris's direction (2026-10-14) to replace the post-solve SCC reversal with an SCC form of SteadyStateProblem stored in the compressed layout: SciMLBase (new type) → ModelingToolkit (constructs it) → SteadyStateDiffEq (solves it). Supersedes SciML/SteadyStateDiffEq.jl#175 and #177; fixes SciML/SteadyStateDiffEq.jl#171. CI on the downstream PRs cannot pass until the upstream ones are released.

SciMLBase.jl

Branch scc-steadystate (on master 365283c6)

  • ef607783 Add SCCSteadyStateProblem, the SCC-split form of a steady-state problem
  • Files: Project.toml (3.58.0 → 3.59.0), src/SciMLBase.jl (export),
    src/problems/nonlinear_problems.jl (type, docstring, conversions to and from
    SCCNonlinearProblem, SII methods shared over Union{SCCNonlinearProblem, SCCSteadyStateProblem}),
    src/remake.jl (shared SCC remake), docs/src/interfaces/Algebraic_Problem_Types.md,
    test/scc_steady_state_problem.jl (new), test/runtests.jl, test/public_interface.jl.
  • Tests:
    SCCSteadyStateProblem |   57     57  4.8s
    SteadyStateProblem lowered_problem |   17     17  0.5s      (problem_building_test.jl, all testsets green)
    SCCNonlinearProblem remake preserves Vector container eltype |    6      6  1.3s
    
    remake_tests.jl and public_interface.jl were green as well. Runic --check and typos: clean.
  • Before/after: not applicable. It adds a new type, and the before-state of its tests is
    UndefVarError (see the SSDE before-run).

Branch scc-steadystate-remove-lowered (stacked on ef607783; checked out in worktree scratch/SciMLBase-remove)

  • bfc48343 Remove SteadyStateProblem.lowered_problem (breaking, 4.0.0). This is the
    revert of Add a lowered_problem slot to SteadyStateProblem #1603, resolved by hand: the field,
    the type parameter, the constructor/remake keyword, constructorof,
    NonlinearProblem(::SteadyStateProblem) and its testset. Version is 4.0.0.
  • Files: Project.toml, src/problems/{nonlinear_problems,steady_state_problems}.jl,
    src/remake.jl, test/problem_building_test.jl.
  • Tests: rm_scc_steady_state.log SCCSteadyStateProblem | 57 57;
    rm_remake.log remake | 4605 4605; rm_problem_building.log and rm_public_interface.log all green.
  • Not verified: anything downstream of 4.0.0. OrdinaryDiffEqCore and Sundials cap
    SciMLBase below 4, so this branch could not be tested with MTK or SSDE. The MTK/SSDE
    branches declare SciMLBase = "3.59", so they would also need a "3.59, 4" compat to
    pick up 4.0.

Open design questions for Chris

  1. Plain SteadyStateProblem + nonlinear alg. With NewtonRaphson() the solution's
    sol.prob is the converted NonlinearProblem, as before the lowering existed (only
    SSRootfind/DynamicSS/SICNM give sol.prob isa SteadyStateProblem). The tests
    encode this. Should SSDE rewrap it? I left it alone because it changes the dispatch
    surface that SciMLSensitivity uses.
  2. Release order for removing the field. Should lowered_problem go now as SciMLBase
    4.0 (scc-steadystate-remove-lowered), or stay deprecated-but-unused in 3.x? The 4.0
    path needs SciMLBase = "3.59, 4" compat in MTK/SSDE and in every package that caps
    SciMLBase below 4.
  3. SemVer of the MTKBase accessor removal. The SCCNonlinearProblem(::SteadyStateProblem)
    method was a public-ish extension in MTKBase 1.77. I released its removal as a minor
    (1.78.0), on the grounds that it was only meaningful with the lowering. A strict reading
    makes it a major.
  4. Construction cost. SCCSteadyStateProblem(sys, op) builds a full
    SteadyStateProblem (including its initialization problem) only to process op, then
    compiles the residual system. build_initializeprob = false breaks hierarchical
    initialization_eqs. Is a lighter op-processing path worth adding?
  5. Monolithic DynamicSS with Tsit5. On the plain mix system, DynamicSS(Tsit5()) with
    the default tspan = Inf runs out of maxiters before the termination callback fires,
    even though the ODE is globally stable. A hand-written SteadyStateProblem behaves the
    same, so this is not caused by this change. The tests use tspan = 100. Worth an SSDE
    issue?
  6. No dedicated SCC solution type. SteadyStateSolution (= NonlinearSolution) on an
    SCCSteadyStateProblem carries the compressed layout through sol.prob.f.sys, and no
    dedicated SCC solution type was added. Is that the intended end state?

🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (fix), Claude Code 2.1.285 (PR) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium / claude-opus-5-5
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

🤖 Generated with Claude Code

Independent review (Codex CLI 0.162.1 gpt-6.1-sol, head 867dba9)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

VERDICT: CHANGES
The new SCC steady-state type is documented and tested, and the guess-less linear-block remake fix has reproducible failing-before/passing-after evidence. However, the shared constructor validation rejects an existing SCCNonlinearProblem input that solves successfully on the base. This is a breaking change in a proposed 3.59.0 release. Four failing CI checks also remain unclassified against master.

Validation: Julia 1.12.7, JULIA_NUM_THREADS=4, JULIA_NUM_PRECOMPILE_TASKS=4, timeout 3600. Base source was extracted from 365283c; tracked head files were untouched. The complete new test file passes 117/117 at head. Existing problem_building_test.jl and remake_tests.jl pass (4,777 assertions across 81 reported testsets). Extracting the new linear-block regression testsets for SCCNonlinearProblem gives 18/18 and 12/12 at head; the first testset on base reports 4 passed, 5 failed, 1 errored, including stale parameters, a wrong linear solution, and length(::Nothing). Logs and scripts are under tmp/.

G1: no numerical algorithm or tolerance changes; the linear-block regression checks the independent solution of 2x = 4. G2: no GPU kernels, AD rules, Reactant tracing, or MPI implementation changes. G3: the parameter-propagation tests catch stale subproblem state and check that the original matrix remains unchanged. These gates do not excuse the compatibility regression or the outstanding CI comparison.

  1. src/problems/nonlinear_problems.jl:595 — confirmed by running: preserve working SCCNonlinearProblem inputs with mixed initial-guess availability. The new all(has_state) check is reached by the existing public constructor. This reproducer succeeds on base 365283c with sol.u = [2.0, 3.0] and ReturnCode.Success, but throws ArgumentError at construction on head 867dba9:

    using SciMLBase, SCCNonlinearSolve, LinearSolve, Test
    lin1 = LinearProblem([2.0;;], [4.0])
    lin2 = LinearProblem([3.0;;], [9.0]; u0 = [0.0])
    prob = SCCNonlinearProblem((lin1, lin2), (Returns(nothing), Returns(nothing)))
    sol = solve(prob, SCCNonlinearSolve.SCCAlg())
    @test sol.u ≈ [2.0, 3.0]
    @test SciMLBase.successful_retcode(sol)

    I ran julia --startup-file=no --project=tmp/baseenv tmp/mixed-linear.jl successfully and the same script with tmp/mixed-headenv fails at the new check. Both environments use SCCNonlinearSolve 1.16.0 and LinearSolve 5.18.2. See tmp/mixed-base-final.log and tmp/mixed-head.log. Initial guesses are optional for these direct linear solves, so rejecting the container removes a working use case. Preserve existing SCCNonlinearProblem acceptance, or separate this restriction into an explicitly approved major release; the new mixed-block rejection tests do not establish backward compatibility. This matches H1, regardless of the additive steady-state API (ML7) and the separately verified remake fix (ML1).

  2. checks.txt:1 — suspected from reading; verification blocker, not a confirmed code defect: the supplied snapshot reports failures for Catalyst/All/1, LinearSolve.jl/All, and SymbolicIndexingInterface on Julia 1 and lts. No failing-job logs or matching master evidence are supplied. Attempts to retrieve them with gh failed because no GitHub credentials are available. Establish the cause of each failure and compare it with master before asserting no test regressions. I did not classify any of these failures as pre-existing.

Not verified: the four failing CI jobs versus master, CI reruns, the full Core/QA/downstream suites locally, or the complete three-package solve workflow. The supplied issue-171.json describes an unrelated 2022 SciMLBase PR, not the SteadyStateDiffEq issue linked in the PR body; retrieving the correct issue with gh was blocked by missing authentication. Successful CI statuses are taken from the supplied snapshot, not independently inspected logs.

🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: Codex exec session 01a14b16-ae24-7a63-b73b-b1709517e4ec (no public URL)

Codex CLI gpt-6.1-sol rated it high (H1) at head 867dba9

ChrisRackauckas and others added 2 commits October 14, 2026 03:56
A steady state whose residual is block-lower-triangular is represented by
the same blocks as SCCNonlinearProblem, but as an AbstractSteadyStateProblem,
so pseudo-transient solvers can integrate each block and the solution is
stored in the compressed SCC layout with symbolic indexing through
prob.f.sys. The SII methods and remake are shared between the two SCC
types; conversions in both directions reuse the block containers.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin CLI 3000.11.3
Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Agent-Session: local headless run, log /Users/chrisrackauckas/sandbox/master/green/scc-ssprob/log.txt
`remake(prob; p)` on an SCC problem with `parameters_alias` skipped (tuple
blocks) or threw on (vector blocks) `LinearProblem` blocks with `u0 = nothing`,
so those blocks kept their old parameters and `A`/`b`. Both helpers now share
one per-block update that pushes `p` into guess-less blocks and splits a
supplied `u0` by `size(A, 2)`.

The SCC constructors inferred the state type from the first block only, so
mixing guess-less linear blocks with blocks that have a state either hid the
other blocks' states or concatenated `nothing` into the state vector. Such
mixed inputs now throw an `ArgumentError`; all-stateful and all-guess-less
inputs behave as before.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin CLI 3000.11.3
Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Agent-Session: local headless run, log /Users/chrisrackauckas/sandbox/master/green/fu/SciML_SciMLBase.jl-1642-1951/log.txt
@ChrisRackauckas

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #1642

Reviewed head: 867dba9
Raw SHA-256: ef9a291330f50174d91132830352333147727881a1c0081e1613691052e59f47
Source SHA-256: b611003f246b813d6ce2a4acc9cfe61ee8a77add731fa3d4c84202b6adca6341
Source: operator-attested-codex-v1 (runner attested by pankgeorg)
Reviewer session: 01a2238d-c99c-7e22-879a-c812050059db
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=14)

Risk assessment

  • Risk: high (H1)
  • Verdict: CHANGES
  • Reviewed head: 867dba9

Review report

VERDICT: CHANGES
PR: #1642
Head: 867dba9
Base: 365283c
Reviewer: codex-cli 0.172.0 / gpt-6.2-sol
Session: 01a2238d-c99c-7e22-879a-c812050059db

Risk

high (H1: the existing public SCCNonlinearProblem constructor rejects a mixed linear/nonlinear block layout that I solved successfully on the base).

This affects users constructing SCC problems directly, symbolic modeling front ends that construct them for initialization, and solver packages that call remake to prepare SCC blocks. The change reaches construction, symbolic indexing, and solve preparation on the opt-in SCC path. General solver selection, solver caches, and modeling compilation are outside the patch.

Blocking findings

  • P1 · Existing mixed SCC problems stop solving. The base solved a guessless LinearProblem followed by a NonlinearProblem with a guess, returning [2.0, 6.0] with zero residual. The head rejects the same input in _scc_state_type. Preserve the previously accepted linear-first layout for SCCNonlinearProblem and replace the test that requires it to throw with a regression that solves it and checks the analytic root. A uniform policy for mixed layouts can be designed separately. src/problems/nonlinear_problems.jl:595 · test/scc_steady_state_problem.jl:189
  • P1 · The new steady-state type fails at the solver entry point. With SteadyStateDiffEq 2.19.0, solve(prob, SSRootfind()) and solve(prob, DynamicSS(Tsit5())) both failed because SCCSteadyStateProblem has no kwargs field. NonlinearProblem(prob) also failed because it reads prob.u0. I recommend adding solver dispatch that delegates through SCCNonlinearProblem(prob) and preserves the original problem in the returned solution. If this release is intended to ship the representation alone, document the required explicit conversion and test that example. For direct support, assert the analytic root, residual, and sol.prob === prob for both algorithms. src/problems/nonlinear_problems.jl:688 · src/problems/nonlinear_problems.jl:240
  • P1 · Symbolic parameter writes can change the wrong block. With :a and :b each at local index 1 in separate blocks, prob.ps[:a] = 8 changed both blocks. A subsequent prob.ps[:b] = 9 changed only the top-level value, leaving the :b block at 8. This behavior reproduces on the old nonlinear wrapper and is now exposed on the steady-state wrapper. In set_parameter!, resolve the parent parameter symbol to each block’s local index. Replace the new test that expects both blocks to change with assertions that each symbolic write changes only its owning block. src/problems/nonlinear_problems.jl:782 · test/scc_steady_state_problem.jl:91
  • P2 · remake silently discards excess initial guesses. For guessless linear blocks with one and two columns, respectively, u0 = [4, 3, 4, 999] returned [4, 3, 4] for both SCC types and both container forms. Have remake validate the full length against the block widths. Assert that three values split as [4] and [3, 4] and that shorter and longer inputs throw DimensionMismatch. src/remake.jl:1563
  • P2 · A parameter remake can fail when replacement blocks supply guesses. Starting from a guessless SCC with aliased parameters, remake(prob; p = [2.0], probs = replacement_blocks) threw getindex(::Nothing, ::UnitRange) when the replacement block had u0 = [8.0]. The failure also exists on the base nonlinear wrapper. Have _scc_update_subproblem take the parameter-only path when no replacement state was requested and the resolved top-level state is nothing. Assert that this call retains [8.0] and gives the replacement block the new shared parameter object. src/remake.jl:1554 · src/remake.jl:1641

Nonblocking findings

  • The existing SCC nonlinear docstring says the explicit callback receives the block problem. Its example, the new steady-state docstring, and the cached downstream solver pass the block parameters. Correct the old signature so callback authors can use either wrapper. src/problems/nonlinear_problems.jl:458

What I ran

  • git -C before apply --check ../changes.diff, git -C head apply --reverse --check ../changes.diff, and diff -qr before head. Both patch checks passed, the snapshots differ in eight files, and no separate target/ was supplied.
  • On ARM64 with Julia 1.13.4, the initial --project=head test command could not load ConstructionBase. I resolved dependencies from the local depot in isolated projects and used julia --startup-file=no --project=.review/head to include scc_steady_state_problem.jl, problem_building_test.jl, public_interface.jl, and remake_tests.jl. All passed, including 117 assertions in the new test file. The patch removes no existing assertions. The build_solution test checks supplied values and indexing, so its supplied residual does not establish convergence.
  • Ran julia --startup-file=no --project=.review/before .review/probe.jl and the same command with .review/head. For the independent reference (p x = 4), successive parameters 1, 2, and 4 gave roots 4, 2, and 1 on the head. The base tuple stayed at 4, and the base vector errored. The probe checked that each remake shared its own new parameter object and preserved the original matrix and parameters. probe.jl
  • Ran the base root_probe.jl with .review/solver-before and the head solve_probe.jl with .review/solver. The analytic reference was (2x=4,\ y=3x). The base mixed solve and the head’s explicitly converted rootfinding solve returned [2.0, 6.0] exactly. The converted DynamicSS solve had a maximum independently recomputed residual of 2.05e-10. A separate converted DynamicSS probe for the homotopy endpoint (2-u^2=0) agreed with (\sqrt{2}) within 1.47e-11. root_probe.jl · solve_probe.jl

What I did not verify

  • ci.json provides conclusions and links. The exact-head LinearSolve job failed and its base counterpart passed. The SymbolicIndexingInterface release and LTS jobs and Catalyst have matching failure labels on the base and head, but the underlying failures are unknown. Establish their relevance with the failing test output and resolved dependencies, or rerun the failing groups against both snapshots with matching dependencies. I did not run the full downstream or ModelingToolkit initialization suites locally. LinearSolve head · LinearSolve head job · LinearSolve base job · SymbolicIndexingInterface release · SymbolicIndexingInterface LTS · Catalyst
  • I did not exercise GPU-only execution on ARM64, Reactant, MPI, or downstream AD rules. The patch changes no GPU kernel, Reactant or MPI path, or AD rule. I found no performance claim or before/after SCC benchmark in the supplied material.

Head link: 867dba9


🤖 Posted by an AI agent — harness: codex-cli 0.172.0 · model: gpt-6.2-sol
Conversation: local session 01a2238d-c99c-7e22-879a-c812050059db (no session URL)

This branch has not been deployed

No deployments
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.

solve(::SteadyStateProblem) returns the lowered problem's solution: sol.u reordered/empty, sol.prob.f.sys time-independent

1 participant