While trying to run a code which is paraphrasing the DE tutorial on SDE's, I'm getting the following stacktrace (only the first few lines):
Bridging distribution is unknown. Cannot use adapativity
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] (::DiffEqNoiseProcess.var"#106#108")(rand_vec::Vector{Float64}, W::NoiseProcess{Float64, 2, Float64, Vector{Float64}, Nothing, Nothing, DiffEqNoiseProcess.var"#105#107"{Vector{Float64}, Matrix{Float64}}, DiffEqNoiseProcess.var"#106#108", true, ResettableStacks.ResettableStack{Tuple{Float64, Vector{Float64}, Nothing}, true}, ResettableStacks.ResettableStack{Tuple{Float64, Vector{Float64}, Nothing}, true}, RSWM{Float64}, Nothing, RandomNumbers.Xorshifts.Xoroshiro128Plus}, W0::Int64, Wh::Vector{Float64}, q::Float64, h::Float64, u::Vector{Float64}, p::SciMLBase.NullParameters, t::Float64, rng::RandomNumbers.Xorshifts.Xoroshiro128Plus)
@ DiffEqNoiseProcess ~/.julia/packages/DiffEqNoiseProcess/9NzQP/src/correlated_noisefunc.jl:28
[3] reject_step!
@ ~/.julia/packages/DiffEqNoiseProcess/9NzQP/src/noise_interfaces/noise_process_interface.jl:278 [inlined]
[4] reject_step! (repeats 2 times)
@ ~/.julia/packages/StochasticDiffEq/Ysmjy/src/integrators/integrator_utils.jl:7 [inlined]
I suspect this has to do with the way I am defining the correlated wiener processes. Here is the block of code I'm trying to run:
# Correlated Brownian motions
# e.g. Heston model
heston_tspan = (0.0,1.0)
μ = 1.0
κ = 1.0
Θ = 1.0
σ = 1.0
ρ = 0.333
function heston_drift!(du,u,p,t)
du[1] = μ*u[1]
du[2] = κ*(Θ-u[2])
end
function heston_sigma!(du,u,p,t)
du[1] = √u[2]*u[1]
du[2] = σ*√u[2]
end
correl = [1 ρ;ρ 1]
heston_noise = CorrelatedWienerProcess!(correl, heston_tspan[1], zeros(2), zeros(2))
heston_problem = SDEProblem(heston_drift!, heston_sigma!, ones(2), heston_tspan, noise=heston_noise)
heston_sol = solve(heston_problem)
plot(heston_sol)
EDIT: The solver works if I tell it to not use adaptive methods explicitly. For example,
heston_sol = solve(heston_problem, adaptive=false, dt=0.01)
However, I don't understand why
- There's no bridging distribution property defined for this CorrelatedWienerProcess! "object" (mathematically, it's similar to the default WienerProcess)
- The solve function's auto selector does not try a non-adaptive method when it fails to find a bridging distribution.