SciML / StochasticDelayDiffEq.jl

Stochastic delay differential equations (SDDE) solvers for the SciML scientific machine learning ecosystem
MIT License
25 stars 10 forks source link

`ERROR: MethodError: no method matching StochasticDiffEq.SDEOptions` for simple example #72

Closed TorkelE closed 11 months ago

TorkelE commented 11 months ago

Hi, this used to work for me, but dug up some old code and it doesn't work (this is on Julia 1.10). I couldn't;t actually find an example of how to use it, but dug up this from the tests, and it gave the same error:

using StochasticDelayDiffEq
begin
    function hayes_modelf(du, u, h, p, t)
        τ, a, b, c, α, β, γ = p
        du .= a .* u .+ b .* h(p, t - τ) .+ c
    end
    function hayes_modelg(du, u, h, p, t)
        τ, a, b, c, α, β, γ = p
        du .= α .* u .+ β .* h(p, t - τ) .+ γ
    end
    h(p, t) = (ones(1) .+ t)
    tspan = (0.0, 1.0)
end

p = [1.0, -4.0, -2.0, 10.0, -1.3, -1.2, 1.1]

prob = SDDEProblem(hayes_modelf, hayes_modelg, [1.0], h, tspan, p)

sol = solve(prob, EM(), dt = 0.01)

gives

ERROR: MethodError: no method matching StochasticDiffEq.SDEOptions(::Int64, ::Bool, ::Bool, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::OrdinaryDiffEq.PIController{…}, ::typeof(DiffEqBase.ODE_DEFAULT_NORM), ::Nothing, ::DataStructures.BinaryMinHeap{…}, ::DataStructures.BinaryMinHeap{…}, ::DataStructures.BinaryMinHeap{…}, ::Vector{…}, ::Vector{…}, ::Vector{…}, ::Nothing, ::Bool, ::Int64, ::String, ::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), ::Symbol, ::Bool, ::Bool, ::Float64, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::CallbackSet{…}, ::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), ::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), ::Bool, ::Bool, ::Bool, ::Bool, ::Bool)

Closest candidates are:
  StochasticDiffEq.SDEOptions(::MI, ::Bool, ::Bool, ::A, ::R, ::tTypeNoUnits, ::tTypeNoUnits, ::tTypeNoUnits, ::tTypeNoUnits, ::tTypeNoUnits, ::tTypeNoUnits, ::tTypeNoUnits, ::tType, ::tType, ::Controller, ::F2, ::SType, ::tstopsType, ::tstopsType, ::discType, ::tcache, ::savecache, ::disccache, ::ECType, ::Bool, ::Int64, ::String, ::F6, ::Bool, ::Bool, ::D, ::Bool, ::Bool, ::Bool, ::Bool, ::F3, ::Bool, ::F4, ::F5, ::F7, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool) where {tTypeNoUnits, tType, Controller, F2, F3, F4, F5, F6, F7, tstopsType, discType, ECType, SType, MI, A, R, D, tcache, savecache, disccache}
   @ StochasticDiffEq ~/.julia/packages/StochasticDiffEq/4xxaL/src/options_type.jl:3

Stacktrace:
 [1] __init(prob::SDDEProblem{…}, alg::EM{…}, timeseries_init::Vector{…}, ts_init::Vector{…}, ks_init::Nothing, recompile::Type{…}; saveat::Vector{…}, tstops::Vector{…}, d_discontinuities::Vector{…}, save_idxs::Nothing, save_everystep::Bool, save_noise::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, adaptive::Bool, gamma::Rational{…}, abstol::Nothing, reltol::Nothing, qmax::Int64, qmin::Int64, qsteady_min::Int64, qsteady_max::Int64, qoldinit::Rational{…}, fullnormalize::Bool, controller::Nothing, failfactor::Int64, beta2::Nothing, beta1::Nothing, delta::Rational{…}, maxiters::Int64, dtmax::Float64, dtmin::Float64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, force_dtmin::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_id::Symbol, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, initialize_integrator::Bool, seed::UInt64, alias_u0::Bool, discontinuity_interp_points::Int64, discontinuity_abstol::Float64, discontinuity_reltol::Int64, kwargs::@Kwargs{})
   @ StochasticDelayDiffEq ~/.julia/packages/StochasticDelayDiffEq/rnchu/src/solve.jl:387
 [2] __solve(::SDDEProblem{…}, ::EM{…}; kwargs::@Kwargs{…})
   @ StochasticDelayDiffEq ~/.julia/packages/StochasticDelayDiffEq/rnchu/src/solve.jl:4
 [3] solve_call(_prob::SDDEProblem{…}, args::EM{…}; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/xSmHR/src/solve.jl:571
 [4] solve_up(prob::SDDEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::Vector{…}, args::EM{…}; kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/xSmHR/src/solve.jl:1033
 [5] solve(prob::SDDEProblem{…}, args::EM{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{…})
   @ DiffEqBase ~/.julia/packages/DiffEqBase/xSmHR/src/solve.jl:943
 [6] top-level scope
   @ ~/Desktop/Writing/General Model Article/Scripts/make_supplementary_figures.jl:485
Some type information was truncated. Use `show(err)` to see complete types.

This is my environment:

⌃ [0f109fa4] BifurcationKit v0.3.1
  [336ed68f] CSV v0.10.11
⌃ [479239e8] Catalyst v13.5.0
  [717857b8] DSP v0.7.9
  [0c46a032] DifferentialEquations v7.11.0
  [7a1cc6ca] FFTW v1.7.1
  [fc60dff9] LombScargle v1.0.3
  [2fda8390] LsqFit v0.15.0
  [23992714] MAT v0.10.6
  [91a5bcdd] Plots v1.39.0
⌃ [f27b6e38] Polynomials v4.0.4
⌃ [08abe8d2] PrettyTables v2.2.8
  [274fc56d] PythonPlot v1.0.3
  [2913bbd2] StatsBase v0.34.2
  [f3b207a7] StatsPlots v0.15.6
  [29a0d76e] StochasticDelayDiffEq v1.5.0
devmotion commented 11 months ago

Which version of StochasticDiffEq do you use? My first guess would be that you use incompatible versions of StochasticDelayDiffEq and StochasticDiffEq (probably due to https://github.com/SciML/StochasticDiffEq.jl/pull/552 and https://github.com/SciML/StochasticDelayDiffEq.jl/pull/71 not both being present).

TorkelE commented 11 months ago

This is my manifest entry:

[[deps.StochasticDiffEq]]
deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FillArrays", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
git-tree-sha1 = "2a1818923476d496190791b4cf7183e9ccf64a99"
uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
version = "6.63.0"

It is not in my Project.toml file as I am not using it directly, and figured I'd let Pkg sort the versioning out.

devmotion commented 11 months ago

You should upgrade to 6.63.2 if possible. Or downgrade StochasticDelayDiffEq.

TorkelE commented 11 months ago

yes that worked, thanks a lot :)