@@ -327,6 +327,7 @@ function remake(prob::SDEProblem;
327327 use_defaults = false ,
328328 seed = missing ,
329329 kwargs = missing ,
330+ lazy_initialization = nothing ,
330331 build_initializeprob = true ,
331332 _kwargs... )
332333 if tspan === missing
@@ -358,7 +359,7 @@ function remake(prob::SDEProblem;
358359 f = remake (prob. f; f, g, initialization_data)
359360 iip = isinplace (prob)
360361
361- if kwargs === missing
362+ prob = if kwargs === missing
362363 SDEProblem {iip} (f,
363364 newu0,
364365 tspan,
@@ -371,6 +372,20 @@ function remake(prob::SDEProblem;
371372 else
372373 SDEProblem {iip} (f, newu0, tspan, newp; noise, noise_rate_prototype, seed, kwargs... )
373374 end
375+ if lazy_initialization === nothing
376+ lazy_initialization = ! is_trivial_initialization (initialization_data)
377+ end
378+ if ! lazy_initialization
379+ u0, p, _ = get_initial_values (
380+ prob, prob, prob. f, OverrideInit (), Val (isinplace (prob)))
381+ if u0 != = nothing && eltype (u0) == Any && isempty (u0)
382+ u0 = nothing
383+ end
384+ @reset prob. u0 = u0
385+ @reset prob. p = p
386+ end
387+
388+ return prob
374389end
375390
376391"""
@@ -413,7 +428,8 @@ function remake(prob::DDEProblem; f = missing, h = missing, u0 = missing,
413428 tspan = missing , p = missing , constant_lags = missing ,
414429 dependent_lags = missing , order_discontinuity_t0 = missing ,
415430 neutral = missing , kwargs = missing , interpret_symbolicmap = true ,
416- use_defaults = false , build_initializeprob = true , _kwargs... )
431+ use_defaults = false , lazy_initialization = nothing , build_initializeprob = true ,
432+ _kwargs... )
417433 if tspan === missing
418434 tspan = prob. tspan
419435 end
@@ -438,7 +454,7 @@ function remake(prob::DDEProblem; f = missing, h = missing, u0 = missing,
438454
439455 iip = isinplace (prob)
440456
441- if kwargs === missing
457+ prob = if kwargs === missing
442458 DDEProblem {iip} (f,
443459 newu0,
444460 h,
@@ -454,6 +470,20 @@ function remake(prob::DDEProblem; f = missing, h = missing, u0 = missing,
454470 DDEProblem {iip} (f, newu0, h, tspan, newp; constant_lags, dependent_lags,
455471 order_discontinuity_t0, neutral, kwargs... )
456472 end
473+ if lazy_initialization === nothing
474+ lazy_initialization = ! is_trivial_initialization (initialization_data)
475+ end
476+ if ! lazy_initialization
477+ u0, p, _ = get_initial_values (
478+ prob, prob, prob. f, OverrideInit (), Val (isinplace (prob)))
479+ if u0 != = nothing && eltype (u0) == Any && isempty (u0)
480+ u0 = nothing
481+ end
482+ @reset prob. u0 = u0
483+ @reset prob. p = p
484+ end
485+
486+ return prob
457487end
458488
459489function remake (func:: DDEFunction ;
@@ -495,6 +525,7 @@ function remake(prob::SDDEProblem;
495525 use_defaults = false ,
496526 seed = missing ,
497527 kwargs = missing ,
528+ lazy_initialization = nothing ,
498529 build_initializeprob = true ,
499530 _kwargs... )
500531 if tspan === missing
@@ -533,7 +564,7 @@ function remake(prob::SDDEProblem;
533564 order_discontinuity_t0 = coalesce (order_discontinuity_t0, prob. order_discontinuity_t0)
534565 neutral = coalesce (neutral, prob. neutral)
535566
536- if kwargs === missing
567+ prob = if kwargs === missing
537568 SDDEProblem {iip} (f,
538569 g,
539570 newu0,
@@ -554,6 +585,21 @@ function remake(prob::SDDEProblem;
554585 f, g, newu0, tspan, newp; noise, noise_rate_prototype, seed, constant_lags,
555586 dependent_lags, order_discontinuity_t0, neutral, kwargs... )
556587 end
588+
589+ if lazy_initialization === nothing
590+ lazy_initialization = ! is_trivial_initialization (initialization_data)
591+ end
592+ if ! lazy_initialization
593+ u0, p, _ = get_initial_values (
594+ prob, prob, prob. f, OverrideInit (), Val (isinplace (prob)))
595+ if u0 != = nothing && eltype (u0) == Any && isempty (u0)
596+ u0 = nothing
597+ end
598+ @reset prob. u0 = u0
599+ @reset prob. p = p
600+ end
601+
602+ return prob
557603end
558604
559605"""
0 commit comments