From 8540c7b194e80e97a3751d3fcc4fc7fb7dcbb2bf Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 2 Oct 2024 19:48:41 +1300 Subject: [PATCH] [docs] fix a bug in the Benders tutorial --- docs/src/tutorials/algorithms/benders_decomposition.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/src/tutorials/algorithms/benders_decomposition.jl b/docs/src/tutorials/algorithms/benders_decomposition.jl index 50c1b1d9528..de9bfe1a126 100644 --- a/docs/src/tutorials/algorithms/benders_decomposition.jl +++ b/docs/src/tutorials/algorithms/benders_decomposition.jl @@ -168,9 +168,8 @@ objective_value(model) # and the optimal flows are: -function optimal_flows(x_sol) - flows = [(i, j) => value(x[i, j]) for i in 1:n for j in 1:n] - return filter!(flow -> last(flow) > 0, flows) +function optimal_flows(x) + return [(i, j) => x[i, j] for i in 1:n for j in 1:n if x[i, j] > 0] end monolithic_solution = optimal_flows(value.(y))