File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,24 @@ function test_copy_to_unsupported_scalar_function()
544544 return
545545end
546546
547+ function test_indicator_constraints ()
548+ model = MOI. Utilities. Model {Float64} ()
549+ x = MOI. add_variable (model)
550+ z, _ = MOI. add_constrained_variable (model, MOI. ZeroOne ())
551+ f = MOI. Utilities. operate (vcat, Float64, 1.0 * x, z)
552+ for si in (MOI. LessThan (1.0 ), MOI. GreaterThan (1.0 ), MOI. EqualTo (1.0 ))
553+ for a in (MOI. ACTIVATE_ON_ONE, MOI. ACTIVATE_ON_ZERO)
554+ s = MOI. Indicator {a} (si)
555+ MOI. supports_constraint (model, typeof (f), typeof (s))
556+ ci = MOI. add_constraint (model, f, s)
557+ @test MOI. is_valid (model, ci)
558+ @test MOI. get (model, MOI. ConstraintFunction (), ci) ≈ f
559+ @test MOI. get (model, MOI. ConstraintSet (), ci) == s
560+ end
561+ end
562+ return
563+ end
564+
547565end # module
548566
549567TestModel. runtests ()
You can’t perform that action at this time.
0 commit comments