Bridges fail test_model_LowerBoundAlreadySet test
julia> using GLPK
julia> GLPK.MOI.Test.test_model_LowerBoundAlreadySet(
GLPK.Optimizer(), MOI.Test.Config()
)
julia> GLPK.MOI.Test.test_model_LowerBoundAlreadySet(
MOI.Bridges.full_bridge_optimizer(GLPK.Optimizer(), Float64),
MOI.Test.Config(),
)
Test Failed at /Users/oscar/.julia/dev/MathOptInterface/src/Test/test_model.jl:815
Expression: MOI.add_constraint(model, f, set2)
Expected: MathOptInterface.LowerBoundAlreadySet{MathOptInterface.Semicontinuous{Float64}, MathOptInterface.GreaterThan{Float64}}(MathOptInterface.VariableIndex(1))
No exception thrown
ERROR: There was an error during testing
Same happens with test_model_UpperBoundAlreadySet, but I assume it's the same problem.
I can reproduce it without GLPK like so:
model = MOI.Utilities.Model{Float64}()
bridged = MOI.Bridges.Constraint.SemiToBinary{Float64}(model)
MOI.Test.test_model_LowerBoundAlreadySet(bridged, MOI.Test.Config())
The issue is that the bridge creates affine constraints: https://github.com/jump-dev/MathOptInterface.jl/blob/e51754fb12651eb230cb5fae8ea9812f3235b746/src/Bridges/Constraint/semi_to_binary.jl#L48-L56 Therefore, the inner model does not see it as variable bound and do not see any double lower bound. One way to fix it would be https://github.com/jump-dev/MathOptInterface.jl/pull/1097 So the bridge would say that it is watching this variable so that when a new bound is set, it gets notified and can throw an error.
It's still failing for some solvers, see, e.g., https://github.com/blegat/ICCOPT_SummerSchool_2022/blob/main/SimpleConicADMM/test/MOI_wrapper.jl.
We could fix it now with final_touch but we might want to first discuss variable bounds.
We start by reopening this issue though.
I still think the fix for this issue is https://github.com/jump-dev/MathOptInterface.jl/pull/1879.
Not sure since there is no ZeroOne in test_model_LowerBoundAlreadySet. We might need it for ScalarFunctionizeBridge as well.