File tree 1 file changed +18
-0
lines changed 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()
544
544
return
545
545
end
546
546
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
+
547
565
end # module
548
566
549
567
TestModel. runtests ()
You can’t perform that action at this time.
0 commit comments