@@ -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
@@ -357,7 +358,7 @@ function remake(prob::SDEProblem;
357358 f = remake (prob. f; f, g, initialization_data)
358359 iip = isinplace (prob)
359360
360- if kwargs === missing
361+ prob = if kwargs === missing
361362 SDEProblem {iip} (f,
362363 newu0,
363364 tspan,
@@ -370,6 +371,20 @@ function remake(prob::SDEProblem;
370371 else
371372 SDEProblem {iip} (f, newu0, tspan, newp; noise, noise_rate_prototype, seed, kwargs... )
372373 end
374+ if lazy_initialization === nothing
375+ lazy_initialization = ! is_trivial_initialization (initialization_data)
376+ end
377+ if ! lazy_initialization
378+ u0, p, _ = get_initial_values (
379+ prob, prob, prob. f, OverrideInit (), Val (isinplace (prob)))
380+ if u0 != = nothing && eltype (u0) == Any && isempty (u0)
381+ u0 = nothing
382+ end
383+ @reset prob. u0 = u0
384+ @reset prob. p = p
385+ end
386+
387+ return prob
373388end
374389
375390"""
@@ -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 ;
@@ -498,6 +528,7 @@ function remake(prob::SDDEProblem;
498528 use_defaults = false ,
499529 seed = missing ,
500530 kwargs = missing ,
531+ lazy_initialization = nothing ,
501532 build_initializeprob = true ,
502533 _kwargs... )
503534 if tspan === missing
@@ -535,7 +566,7 @@ function remake(prob::SDDEProblem;
535566 order_discontinuity_t0 = coalesce (order_discontinuity_t0, prob. order_discontinuity_t0)
536567 neutral = coalesce (neutral, prob. neutral)
537568
538- if kwargs === missing
569+ prob = if kwargs === missing
539570 SDDEProblem {iip} (f,
540571 g,
541572 newu0,
@@ -556,6 +587,21 @@ function remake(prob::SDDEProblem;
556587 f, newu0, tspan, newp; noise, noise_rate_prototype, seed, constant_lags,
557588 dependent_lags, order_discontinuity_t0, neutral, kwargs... )
558589 end
590+
591+ if lazy_initialization === nothing
592+ lazy_initialization = ! is_trivial_initialization (initialization_data)
593+ end
594+ if ! lazy_initialization
595+ u0, p, _ = get_initial_values (
596+ prob, prob, prob. f, OverrideInit (), Val (isinplace (prob)))
597+ if u0 != = nothing && eltype (u0) == Any && isempty (u0)
598+ u0 = nothing
599+ end
600+ @reset prob. u0 = u0
601+ @reset prob. p = p
602+ end
603+
604+ return prob
559605end
560606
561607"""
0 commit comments