From be57c4246cac4a457521d6b6e24615d910955608 Mon Sep 17 00:00:00 2001 From: Natacha Javerzat Date: Thu, 15 Jun 2023 09:49:52 +0200 Subject: [PATCH] remove LOWER_UPPER from enum ActiveBound --- src/Algorithm/benders/default.jl | 2 +- src/MathProg/MOIinterface.jl | 3 --- src/MathProg/solutions.jl | 2 +- test/unit/Benders/benders_cuts.jl | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Algorithm/benders/default.jl b/src/Algorithm/benders/default.jl index f37141fb6..524ada8ef 100644 --- a/src/Algorithm/benders/default.jl +++ b/src/Algorithm/benders/default.jl @@ -287,7 +287,7 @@ function _compute_cut_rhs_contrib(ctx, sp, dual_sol) spid = getuid(sp) bounds_contrib_to_rhs = 0.0 ##init bounding constraints contribution to the right-hand side of the cut for (varid, (val, active_bound)) in get_var_redcosts(dual_sol) ##compute bounding constraints contribution ; val is the dual value of the bounding constraint, active_bound indicates whoever the bound is a LOWER or a UPPER bound - if active_bound == MathProg.LOWER || active_bound == MathProg.LOWER_AND_UPPER + if active_bound == MathProg.LOWER bounds_contrib_to_rhs += val * getperenlb(sp, varid) elseif active_bound == MathProg.UPPER bounds_contrib_to_rhs += val * getperenub(sp, varid) diff --git a/src/MathProg/MOIinterface.jl b/src/MathProg/MOIinterface.jl index be45c94b5..7bb2e8792 100644 --- a/src/MathProg/MOIinterface.jl +++ b/src/MathProg/MOIinterface.jl @@ -323,9 +323,6 @@ function get_dual_solutions(form::F, optimizer::MoiOptimizer) where {F <: Formul for var_id in getfixedvars(form) cost = getcurcost(form, var_id) if abs(cost) > Coluna.TOL - push!(varids, var_id) - push!(varvals, sense * cost) - push!(activebounds, LOWER_AND_UPPER) fixed_obj += cost * getcurlb(form, var_id) end end diff --git a/src/MathProg/solutions.jl b/src/MathProg/solutions.jl index f3d17accf..6a12b97a7 100644 --- a/src/MathProg/solutions.jl +++ b/src/MathProg/solutions.jl @@ -126,7 +126,7 @@ end ############################################################################################ # Indicate whether the active bound of a variable is the lower or the upper one. -@enum ActiveBound LOWER UPPER LOWER_AND_UPPER +@enum ActiveBound LOWER UPPER struct DualSolution{M} <: AbstractSolution solution::Solution{M,ConstrId,Float64} diff --git a/test/unit/Benders/benders_cuts.jl b/test/unit/Benders/benders_cuts.jl index 5cc94bf0b..caca67be9 100644 --- a/test/unit/Benders/benders_cuts.jl +++ b/test/unit/Benders/benders_cuts.jl @@ -166,7 +166,7 @@ function test_benders_cut_rhs() master, [cids["sp_c1"], cids["sp_c2"], cids["sp_c3"]], [2.0, 4.0, 1.0], ##dumb dual sol - Coluna.MathProg.VarId[vids["y1"], vids["x1"], vids["y2"], vids["x2"]], Float64[10.0, 5.0, 2.0, 3.0], Coluna.MathProg.ActiveBound[MathProg.LOWER, MathProg.UPPER, MathProg.UPPER, MathProg.LOWER_AND_UPPER], ## x2 fixed to 1.0 + Coluna.MathProg.VarId[vids["y1"], vids["x1"], vids["y2"], vids["x2"]], Float64[10.0, 5.0, 2.0, 3.0], Coluna.MathProg.ActiveBound[MathProg.LOWER, MathProg.UPPER, MathProg.UPPER, MathProg.LOWER], ## x2 fixed to 1.0 0.0, Coluna.MathProg.FEASIBLE_SOL )