@@ -76,9 +76,9 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
7676 error (" Bridge function must be given for adaptivity. Either declare this function in noise process or set adaptive=false" )
7777 end
7878
79- if ! StochasticDiffEq. alg_compatible (prob, getalg (alg))
80- error (" The algorithm is not compatible with the chosen noise type. Please see the documentation on the solver methods" )
81- end
79+ # if !StochasticDiffEq.alg_compatible(prob, getalg(alg))
80+ # error("The algorithm is not compatible with the chosen noise type. Please see the documentation on the solver methods")
81+ # end
8282
8383 if haskey (kwargs, :initial_order )
8484 @warn " initial_order has been deprecated. Please specify order_discontinuity_t0 in the DDEProblem instead."
@@ -171,6 +171,41 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
171171 end
172172 end
173173
174+ #= TODO : Jump handling
175+ if typeof(_prob) <: JumpProblem && _prob.regular_jump !== nothing
176+
177+ if !isnothing(_prob.regular_jump.mark_dist) == nothing # https://github.com/JuliaDiffEq/DifferentialEquations.jl/issues/250
178+ error("Mark distributions are currently not supported in SimpleTauLeaping")
179+ end
180+
181+ jump_prototype = zeros(_prob.regular_jump.numjumps)
182+ c = _prob.regular_jump.c
183+
184+ if isinplace(_prob.regular_jump)
185+ rate_constants = zeros(_prob.regular_jump.numjumps)
186+ _prob.regular_jump.rate(rate_constants,u./u,prob.p,tspan[1])
187+ P = CompoundPoissonProcess!(_prob.regular_jump.rate,t,jump_prototype,
188+ computerates = !alg_control_rate(alg) || !adaptive,
189+ save_everystep=save_noise,
190+ rng = Xorshifts.Xoroshiro128Plus(_seed))
191+ alg_control_rate(alg) && adaptive && P.cache.rate(P.cache.currate,u,p,tspan[1])
192+ else
193+ rate_constants = _prob.regular_jump.rate(u./u,prob.p,tspan[1])
194+ P = CompoundPoissonProcess(_prob.regular_jump.rate,t,jump_prototype,
195+ save_everystep=save_noise,
196+ computerates = !alg_control_rate(alg) || !adaptive,
197+ rng = Xorshifts.Xoroshiro128Plus(_seed))
198+ alg_control_rate(alg) && adaptive && (P.cache.currate = P.cache.rate(u,p,tspan[1]))
199+ end
200+
201+ else
202+ =#
203+ jump_prototype = nothing
204+ c = nothing
205+ P = nothing
206+ rate_constants = nothing
207+ # end
208+
174209 # tstops_internal, saveat_internal, d_discontinuities_internal =
175210 # tstop_saveat_disc_handling(tstops, saveat, d_discontinuities, tspan) # TODO add delays to discontinuities
176211 # retrieve time stops, time points at which solutions is saved, and discontinuities
@@ -284,14 +319,14 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
284319
285320 # create a history function
286321 history = build_history_function (prob, alg, reltol_internal,
287- rate_prototype, noise_rate_prototype, W, _seed, dense;
322+ rate_prototype, noise_rate_prototype, jump_prototype, W, _seed, dense;
288323 dt = dt, adaptive = adaptive,
289324 internalnorm = internalnorm)
290325 f_with_history, g_with_history = wrap_functions_and_history (f, g, history)
291326
292327 sde_integrator = history. integrator;
293328
294- cache = StochasticDiffEq. alg_cache (getalg (alg), prob, u, W. dW, W. dZ, p, rate_prototype, noise_rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, uprev, f_with_history, t, dt, Val{isinplace (prob)})
329+ cache = StochasticDiffEq. alg_cache (getalg (alg), prob, u, W. dW, W. dZ, p, rate_prototype, noise_rate_prototype, jump_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, uprev, f_with_history, t, dt, Val{isinplace (prob)})
295330
296331 # id = StochasticDiffEq.LinearInterpolationData(timeseries,ts)
297332 id = StochasticDiffEq. LinearInterpolationData (sde_integrator. sol. u, sde_integrator. sol. t)
@@ -364,12 +399,19 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
364399 success_iter = 0
365400 q = tTypeNoUnits (1 )
366401
367- integrator = SDDEIntegrator {typeof(getalg(alg)),isinplace(prob),uType,uBottomEltype,tType,typeof(p),typeof(eigen_est),QT,uEltypeNoUnits,typeof(W),rateType,typeof(sol),typeof(cache),FType,GType,typeof(opts),typeof(noise),typeof(last_event_error),typeof(callback_cache),typeof(history),typeof(sde_integrator)} (f_with_history, g_with_history, noise, uprev, tprev,
402+ integrator = SDDEIntegrator{typeof (getalg (alg)),isinplace (prob),uType,
403+ uBottomEltype,tType,typeof (p),typeof (eigen_est),
404+ QT,uEltypeNoUnits,typeof (W),typeof (P),
405+ rateType,typeof (sol),typeof (cache),FType,GType,typeof (c),
406+ typeof (opts),typeof (noise),typeof (last_event_error),
407+ typeof (callback_cache),typeof (history),
408+ typeof (sde_integrator)}(f_with_history,
409+ g_with_history, c, noise, uprev, tprev,
368410 order_discontinuity_t0, tracked_discontinuities,
369411 t, u, p, tType (dt), tType (dt), tType (dt), dtcache, tspan[2 ], tdir,
370412 just_hit_tstop, isout, event_last_time, vector_event_last_time, last_event_error, accept_step,
371413 last_stepfail, force_stepfail, dtchangeable, u_modified, saveiter, getalg (alg), sol,
372- cache, callback_cache, tType (dt), W,
414+ cache, callback_cache, tType (dt), W, P,
373415 opts, iter, success_iter, eigen_est, EEst, q, QT (qoldinit), q11, history, sde_integrator)
374416
375417 if initialize_integrator
@@ -387,7 +429,7 @@ function DiffEqBase.__init(prob::AbstractSDDEProblem,# TODO DiffEqBasee.Abstract
387429 integrator. sqdt = integrator. tdir * sqrt (abs (integrator. dt))
388430
389431 integrator. W. dt = integrator. dt
390- DiffEqNoiseProcess. setup_next_step! (integrator. W )
432+ DiffEqNoiseProcess. setup_next_step! (integrator)
391433
392434 integrator
393435end
0 commit comments