Skip to content

Commit

Permalink
Fix computation of benders master problem temporal structure
Browse files Browse the repository at this point in the history
We were excluding all time slices that went beyond the end of the
rolling window, but that's too much. Instead, now we cut the time slices
to fit within the window so it's more consistent.
  • Loading branch information
manuelma committed Jun 28, 2023
1 parent e3d13dc commit 0ae2969
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/data_structure/temporal_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,15 @@ function generate_master_temporal_structure!(m::Model, m_mp::Model)
k = 1
dur_unit = _model_duration_unit(m.ext[:spineopt].instance)
while true
blocks_by_interval = Dict()
for t in time_slice(m)
t_start, t_end = start(t), min(end_(t), end_(current_window(m)))
t_start < t_end || continue
union!(get!(blocks_by_interval, (t_start, t_end), Set()), blocks(t))
end
append!(
mp_time_slices,
(
TimeSlice(start(t), end_(t), blocks(t)...; duration_unit=dur_unit)
for t in time_slice(m)
if end_(t) <= end_(current_window(m))
)
(TimeSlice(interval..., blocks...; duration_unit=dur_unit) for (interval, blocks) in blocks_by_interval)
)
roll_temporal_structure!(m, k) || break
k += 1
Expand Down

0 comments on commit 0ae2969

Please sign in to comment.