SciML / DiffEqCallbacks.jl

A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
https://docs.sciml.ai/DiffEqCallbacks/stable/
Other
94 stars 47 forks source link

`get_tstops_max` not implemented for integrators of type `ODEIntegrator` #231

Closed baggepinnen closed 1 week ago

baggepinnen commented 1 week ago

On the latest release, I get the following error when solving a problem with a PeriodicCallback.

@isaacsas is there perhaps a compat bound that should have been bumped?

julia> noise_sol = solve(noise_prob, Tsit5())
tnew = t0[] + (index[] + 1) * Δt = 0.005
ERROR: get_tstops_max not implemented for integrators of type ODEIntegrator
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] get_tstops_max(integ::OrdinaryDiffEq.ODEIntegrator{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/sCsah/src/integrator_accessors.jl:8
  [3] add_next_tstop!(integrator::OrdinaryDiffEq.ODEIntegrator{…}, S::DiffEqCallbacks.PeriodicCallbackAffect{…})
    @ DiffEqCallbacks ~/.julia/packages/DiffEqCallbacks/fZvMG/src/iterative_and_periodic.jl:104
  [4] (::DiffEqCallbacks.PeriodicCallbackAffect{…})(integrator::OrdinaryDiffEq.ODEIntegrator{…})
    @ DiffEqCallbacks ~/.julia/packages/DiffEqCallbacks/fZvMG/src/iterative_and_periodic.jl:86
  [5] (::DiffEqCallbacks.var"#94#98"{…})(c::DiscreteCallback{…}, u::Vector{…}, t::Float64, integrator::OrdinaryDiffEq.ODEIntegrator{…})
    @ DiffEqCallbacks ~/.julia/packages/DiffEqCallbacks/fZvMG/src/iterative_and_periodic.jl:167
  [6] initialize!(u::Vector{…}, t::Float64, integrator::OrdinaryDiffEq.ODEIntegrator{…}, any_modified::Bool, c::DiscreteCallback{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/sCsah/src/callbacks.jl:18
  [7] initialize!(cb::CallbackSet{…}, u::Vector{…}, t::Float64, integrator::OrdinaryDiffEq.ODEIntegrator{…})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/sCsah/src/callbacks.jl:7
  [8] initialize_callbacks!(integrator::OrdinaryDiffEq.ODEIntegrator{…}, initialize_save::Bool)
    @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/HQ92J/src/solve.jl:667
ChrisRackauckas commented 1 week ago

We might've needed a weakdep on OrdinaryDiffEqCore

isaacsas commented 1 week ago

Wouldn’t tests have errored if that was required? @baggepinnen are you only loading OrdinaryDiffEqCore?

ChrisRackauckas commented 1 week ago

No because the latest OrdinaryDiffEq would grab the latest OrdinaryDiffEqCore, but if for some reason someone upper bounded OrdinaryDiffEqCore they could get a version that CI didn't use

isaacsas commented 1 week ago

I bumped it in https://github.com/SciML/DiffEqCallbacks.jl/pull/232, but I don't know if something more is needed or I used the wrong version.