Skip to content

Commit ec2f130

Browse files
committed
Update
1 parent 806958a commit ec2f130

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ext/KNITROMathOptInterfaceExt.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,14 +676,18 @@ end
676676

677677
function MOI.add_constraint(model::Optimizer, x::MOI.VariableIndex, ::MOI.ZeroOne)
678678
MOI.throw_if_not_valid(model, x)
679-
lb, ub = nothing, nothing
679+
fx, lb, ub = nothing, nothing, nothing
680680
p = Ref{Cdouble}(NaN)
681681
info = model.variable_info[x.value]
682-
if info.has_lower_bound || info.is_fixed
682+
if info.is_fixed
683+
KNITRO.@_checked KNITRO.KN_get_var_fxbnd(model.inner, _c_column(x), p)
684+
fx = p[]
685+
end
686+
if info.has_lower_bound
683687
KNITRO.@_checked KNITRO.KN_get_var_lobnd(model.inner, _c_column(x), p)
684688
lb = max(0.0, p[])
685689
end
686-
if info.has_upper_bound || info.is_fixed
690+
if info.has_upper_bound
687691
KNITRO.@_checked KNITRO.KN_get_var_upbnd(model.inner, _c_column(x), p)
688692
ub = min(1.0, p[])
689693
end
@@ -694,6 +698,9 @@ function MOI.add_constraint(model::Optimizer, x::MOI.VariableIndex, ::MOI.ZeroOn
694698
)
695699
# Calling `set_var_type` resets variable bounds in KNITRO. To fix, we need
696700
# to restore them after calling `set_var_type`.
701+
if fx !== nothing
702+
KNITRO.@_checked KNITRO.KN_set_var_fxbnd(model.inner, _c_column(x), fx)
703+
end
697704
if lb !== nothing
698705
KNITRO.@_checked KNITRO.KN_set_var_lobnd(model.inner, _c_column(x), lb)
699706
end

test/MOI_wrapper.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ function test_MOI_Test_cached()
6565
model,
6666
config;
6767
exclude=Union{String,Regex}[
68-
# TODO(odow): this fails in Linux and Windows
69-
r"^test_linear_Semiinteger_integration$",
7068
# This is an upstream issue in MOI with bridges and support
7169
# comparing VectorNonlinear and VectorQuadratic
7270
r"^test_basic_VectorNonlinearFunction_GeometricMeanCone$",

0 commit comments

Comments
 (0)