Skip to content

Support SciMLBase v3#290

Merged
ChrisRackauckas merged 2 commits intoSciML:masterfrom
ChrisRackauckas-Claude:sciml-base-v3-compat
Apr 13, 2026
Merged

Support SciMLBase v3#290
ChrisRackauckas merged 2 commits intoSciML:masterfrom
ChrisRackauckas-Claude:sciml-base-v3-compat

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

  • Replace DiffEqBase.DEProblem with SciMLBase.AbstractDEProblem in multiple_shooting_objective and two_stage_objective. The bare DEProblem alias was removed in SciMLBase v3.
  • Port the ensemble tutorial to the new v3 prob_func(prob, ctx) signature, using ctx.sim_id instead of the i argument.
  • Extend SciMLBase compat to "1.69, 2, 3.1" and bump DiffEqParamEstim to 2.4.0.

Supersedes the Project.toml-only bump in #289.

Known limitation — please read before merging

Local Pkg.resolve() fails on any environment that contains SciMLBase 3.1, because SciMLBase 3.1 pins RecursiveArrayTools = 4 while OrdinaryDiffEq in the registry still pins RecursiveArrayTools ≤ 3.54. CI on this PR will reproduce the same unsatisfiable resolution until upstream OrdinaryDiffEq releases a RAT-v4-compatible version.

That means:

  • I have not been able to run tests locally. Per our usual rule of not claiming something works without running it, this PR should be treated as unverified until CI passes.
  • CI is expected to fail at the Pkg.add / instantiate step with an Unsatisfiable requirements detected for package RecursiveArrayTools error, not at Julia runtime. Once OrdinaryDiffEq bumps, re-running CI here should succeed without further edits.

What is NOT in this PR (and why)

The sol[i] / length(sol) / for x in sol call sites in src/cost_functions.jl and src/multiple_shooting_objective.jl are deliberately untouched. I could not conclusively verify in the SciMLBase v3.1 source whether scalar integer indexing on AbstractTimeseriesSolution changed behavior — no explicit Base.getindex(::AbstractTimeseriesSolution, ::Int) override is present there. Rewriting the cost-function machinery on an unverified claim would be reckless.

Once CI on this PR actually exercises those code paths (either passing silently or producing concrete failures), the real scope of any follow-up work will be visible, and we can land a second PR for cost-function indexing if needed.

Test plan

  • CI passes once OrdinaryDiffEq releases a RAT-v4-compatible version.
  • Specifically, verify the ensemble tutorial build succeeds with the new (prob, ctx) signature.
  • Triage any runtime failures from cost-function indexing before merging; file follow-up PR if needed.

🤖 Generated with Claude Code

ChrisRackauckas and others added 2 commits April 12, 2026 23:31
Three changes for v3 compatibility:

1. Replace `DiffEqBase.DEProblem` with `SciMLBase.AbstractDEProblem` in
   `multiple_shooting_objective` and `two_stage_objective`. The bare
   `DEProblem` alias is removed in SciMLBase v3; `AbstractDEProblem` is the
   supported abstract supertype.

2. Port the ensemble tutorial's `prob_func` to the new v3 signature
   `(prob, ctx)`, using `ctx.sim_id` (previously the `i` argument).

3. Extend SciMLBase compat to `"1.69, 2, 3.1"` and bump version to 2.4.0.

Limitations: local tests cannot be run — Pkg resolution fails on any env
containing SciMLBase 3.1 because OrdinaryDiffEq still pins
RecursiveArrayTools ≤ 3.54 while SciMLBase 3.1 requires RAT v4. This PR is
intended to land once upstream OrdinaryDiffEq releases RAT-v4-compatible
versions; CI here is the only venue where the full matrix can be tested.

Deliberately out of scope for this PR: the `sol[i]` / `length(sol)` /
iteration call sites in `cost_functions.jl` and
`multiple_shooting_objective.jl`. The behavior of scalar-int indexing on
`AbstractTimeseriesSolution` in v3 could not be verified against the
SciMLBase v3.1 source (no explicit `Base.getindex(::AbstractTimeseriesSolution, ::Int)`
override exists there), and making destructive changes to the cost
machinery on an unverified claim would be reckless. Track as a follow-up
once CI actually exercises those code paths and either passes or produces
concrete failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
SciMLBase v3 changes the behavior of single-integer indexing on
`AbstractTimeseriesSolution` for non-scalar ODEs: `sol[i]` used to return
the i-th state vector (`sol.u[i]`) but now returns the i-th scalar in the
flat representation (equivalent to `sol.u[end][end]` for `sol[end]`).

Replace `sol[i]` → `sol.u[i]` at the single-int call sites:

- `cost_functions.jl` — `length(sol[i])` in the L2Loss timeseries method
  (both weighted and unweighted branches) and in the diff_weight branch;
  `logpdf(distributions[i], sol[i])` in LogLikeLoss MultivariateDistribution
  branch.
- `multiple_shooting_objective.jl` — `sol[k][1] - sol[k-1][end]` in the
  discontinuity penalty, where `sol[k]` is a Julia `Vector`-indexed
  sub-solution and the subsequent `[1]`/`[end]` are single-int indexing
  into each ODE solution.

Left unchanged: 2-arg `sol[j, i]` indexing (handled by RecursiveArrayTools
and unaffected), iteration `for s in sol` on ensemble solutions (ensemble
iteration semantics unchanged), `length(sol)` (iteration protocol still
per-timestep per SciMLBase v3 `solution_interface.jl:188`), and the
NoTime-method `sol[i]` (explicitly defined as `A.u[i]` in v3).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas merged commit b2547b6 into SciML:master Apr 13, 2026
2 of 7 checks passed
@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor Author

cc @ChrisRackauckas

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