Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove LOWER_UPPER from enum ActiveBound #937

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Algorithm/benders/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/MathProg/MOIinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/MathProg/solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/Benders/benders_cuts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down