File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -246,8 +246,12 @@ function _basic_constraint_test_helper(
246246 # ## Test MOI.is_valid
247247 # ##
248248 @test MOI. is_valid (model, c)
249- # TODO (odow): we could improve this test by checking `c.value+1` and
250- # `c.value-1` but there is a bug in `LazyBridgeOptimizer`.
249+ # We could improve this test by checking these are `== true` instead of
250+ # `isa Bool`, but there is a bug in `LazyBridgeOptimizer`. See
251+ # MathOptInterface.jl#2696 for details. At the very least, this test checks
252+ # that they do not error, and hopefully helps hit some code paths.
253+ @test ! MOI. is_valid (model, typeof (c)(c. value + 1 )) isa Bool
254+ @test ! MOI. is_valid (model, typeof (c)(c. value - 1 )) isa Bool
251255 @test ! MOI. is_valid (model, typeof (c)(c. value + 12345 ))
252256 # ##
253257 # ## Test MOI.ConstraintName
Original file line number Diff line number Diff line change @@ -2238,6 +2238,21 @@ function test_bridge_complex_greatertoless()
22382238 return
22392239end
22402240
2241+ function test_issue_2696 ()
2242+ b = MOI. instantiate (StandardSDPAModel{Float64}; with_bridge_type = Float64)
2243+ x = MOI. add_variables (b, 2 )
2244+ c = MOI. add_constraint (b, MOI. VectorOfVariables (x), MOI. Nonpositives (2 ))
2245+ @test MOI. is_valid (b, c)
2246+ F, S = MOI. VectorOfVariables, MOI. Nonpositives
2247+ # See MathOptInterface.jl#2696
2248+ d = MOI. ConstraintIndex {F,S} (c. value + 1 )
2249+ @test_broken ! MOI. is_valid (b, d)
2250+ @test MOI. get (b, MOI. ListOfConstraintTypesPresent ()) == [(F, S)]
2251+ @test only (MOI. get (b, MOI. ListOfConstraintIndices {F,S} ())) == c
2252+ @test MOI. get (b, MOI. NumberOfConstraints {F,S} ()) == 1
2253+ return
2254+ end
2255+
22412256end # module
22422257
22432258TestBridgesLazyBridgeOptimizer. runtests ()
You can’t perform that action at this time.
0 commit comments