From 1f0292cb55bc502e5f6439d8029b5525954537f7 Mon Sep 17 00:00:00 2001 From: Manuel Marin Date: Wed, 9 Aug 2023 17:06:42 +0200 Subject: [PATCH] Fix unit_flow computation from subproblem to account for weight --- src/data_structure/benders_data.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data_structure/benders_data.jl b/src/data_structure/benders_data.jl index ea8be501de..ab7b06db2e 100644 --- a/src/data_structure/benders_data.jl +++ b/src/data_structure/benders_data.jl @@ -112,7 +112,11 @@ function _save_sp_objective_value!(m, win_weight, tail=false) end function _save_sp_unit_flow!(m, win_weight, tail=false) - pval_by_ent = _pval_by_entity(m.ext[:spineopt].values[:unit_flow]) + win_start, win_end = start(current_window(m)), end_(current_window(m)) + window_values = Dict( + k => v for (k, v) in m.ext[:spineopt].values[:unit_flow] if start(k.t) >= win_start && end_(k.t) <= win_end + ) + pval_by_ent = _pval_by_entity(window_values, win_weight) pvals_to_node = Dict( ent => Dict(:sp_unit_flow => pval) for (ent, pval) in pval_by_ent if ent.direction == direction(:to_node) )