@@ -54,8 +54,8 @@ mutable struct RegionIterator{Problem, RegionPlan} <: AbstractNetworkIterator
5454 end
5555end
5656
57- function RegionIterator (problem; sweep, sweep_kwargs... )
58- plan = region_plan (problem; sweep_kwargs... )
57+ function RegionIterator (problem, prevplan ; sweep, sweep_kwargs... )
58+ plan = region_plan (problem, prevplan ; sweep_kwargs... )
5959 return RegionIterator (problem, plan, sweep)
6060end
6161
@@ -109,6 +109,8 @@ function compute!(iter::RegionIterator)
109109 return iter
110110end
111111
112+ # Default behaviour:
113+ region_plan (problem, :: Any ; sweep_kwargs... ) = region_plan (problem; sweep_kwargs... )
112114region_plan (problem; sweep_kwargs... ) = euler_sweep (state (problem); sweep_kwargs... )
113115
114116#
@@ -129,7 +131,7 @@ mutable struct SweepIterator{Problem, Iter} <: AbstractNetworkIterator
129131 end
130132
131133 first_kwargs, _ = first_state
132- region_iter = RegionIterator (problem; sweep = 1 , first_kwargs... )
134+ region_iter = RegionIterator (problem, nothing ; sweep = 1 , first_kwargs... )
133135
134136 return new {Prob, Iter} (region_iter, stateful_sweep_kwargs, 1 )
135137 end
151153
152154function update_region_iterator! (iterator:: SweepIterator ; kwargs... )
153155 sweep = state (iterator)
154- iterator. region_iter = RegionIterator (problem (iterator); sweep, kwargs... )
156+
157+ previous_plan = iterator. region_iter. region_plan
158+
159+ iterator. region_iter = RegionIterator (problem (iterator), previous_plan; sweep, kwargs... )
155160 return iterator
156161end
157162
0 commit comments