Skip to content

Commit

Permalink
Merge pull request #256 from scipopt/binbounds-fixed
Browse files Browse the repository at this point in the history
binbounds fixed
  • Loading branch information
matbesancon authored Feb 9, 2023
2 parents 4703243 + 6ae0005 commit 9970afb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/MOI_wrapper/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,20 @@ function MOI.set(o::Optimizer, ::MOI.ConstraintSet, ci::CI{VI,S}, set::S) where
allow_modification(o)
v = var(o, VI(ci.value)) # cons index is actually var index
lb, ub = bounds(set)
old_interval = get(o.binbounds, VI(ci.value), MOI.Interval(0.0, 1.0))
if lb !== nothing
if SCIPvarGetType(v) == SCIP_VARTYPE_BINARY
lb = max(lb, 0.0)
end
@SCIP_CALL SCIPchgVarLb(o, v, lb)
o.binbounds[VI(ci.value)] = MOI.Interval(lb, old_interval.upper)
end
if ub !== nothing
if SCIPvarGetType(v) == SCIP_VARTYPE_BINARY
ub = min(ub, 1.0)
end
@SCIP_CALL SCIPchgVarUb(o, v, ub)
o.binbounds[VI(ci.value)] = MOI.Interval(old_interval.lower, ub)
end
return nothing
end
Expand Down

0 comments on commit 9970afb

Please sign in to comment.