@@ -9,6 +9,8 @@ function test_proposition_add_fail()
9
9
m = GDPModel ()
10
10
@variable (m, y[1 : 3 ], Logical)
11
11
@test_throws ErrorException @constraint (m, y[1 ] := true )
12
+ @test_throws ErrorException @constraint (m, ¬ y[1 ] := true )
13
+ @test_throws ErrorException @constraint (m, logical_not (y[1 ]) := true )
12
14
@test_throws ErrorException @constraint (Model (), logical_or (y... ) := true )
13
15
@test_throws ErrorException @constraint (m, logical_or (y... ) == 2 )
14
16
@test_throws ErrorException @constraint (m, logical_or (y... ) <= 1 )
@@ -22,33 +24,6 @@ function test_proposition_add_fail()
22
24
@test_throws AssertionError add_constraint (m, ScalarConstraint (logical_or (y... ), MOI. LessThan (42 )))
23
25
end
24
26
25
- function test_negation_add_success ()
26
- model = GDPModel ()
27
- @variable (model, y, Logical)
28
- c1 = @constraint (model, logical_not (y) := true )
29
- @constraint (model, c2, ¬ y := true )
30
- @test is_valid (model, c1)
31
- @test is_valid (model, c2)
32
- @test owner_model (c1) == model
33
- @test owner_model (c2) == model
34
- @test name (c1) == " "
35
- @test name (c2) == " c2"
36
- @test index (c1) == LogicalConstraintIndex (1 )
37
- @test index (c2) == LogicalConstraintIndex (2 )
38
- @test haskey (DP. _logical_constraints (model), index (c1))
39
- @test haskey (DP. _logical_constraints (model), index (c2))
40
- @test DP. _logical_constraints (model)[index (c1)] == DP. _constraint_data (c1)
41
- @test constraint_object (c1). func isa DP. _LogicalExpr
42
- @test constraint_object (c2). func isa DP. _LogicalExpr
43
- @test constraint_object (c1). func. head ==
44
- constraint_object (c2). func. head == :!
45
- @test constraint_object (c1). func. args ==
46
- constraint_object (c2). func. args == Any[y]
47
- @test constraint_object (c1). set ==
48
- constraint_object (c2). set == MOI. EqualTo {Bool} (true )
49
- @test c1 == copy (c1)
50
- end
51
-
52
27
function test_implication_add_success ()
53
28
model = GDPModel ()
54
29
@variable (model, y[1 : 2 ], Logical)
@@ -168,18 +143,6 @@ function test_proposition_delete()
168
143
@test ! DP. _ready_to_optimize (model)
169
144
end
170
145
171
- function test_negation_reformulation ()
172
- model = GDPModel ()
173
- @variable (model, y, Logical)
174
- @constraint (model, ¬ y := true )
175
- reformulate_model (model, DummyReformulation ())
176
- ref_con = DP. _reformulation_constraints (model)[1 ]
177
- @test is_valid (model, ref_con)
178
- ref_con_obj = constraint_object (ref_con)
179
- @test ref_con_obj. set == MOI. GreaterThan (0.0 )
180
- @test ref_con_obj. func == - DP. _indicator_to_binary (model)[y]
181
- end
182
-
183
146
function test_implication_reformulation ()
184
147
model = GDPModel ()
185
148
@variable (model, y[1 : 2 ], Logical)
530
493
end
531
494
@testset " Add Proposition" begin
532
495
test_proposition_add_fail ()
533
- test_negation_add_success ()
534
496
test_implication_add_success ()
535
497
test_equivalence_add_success ()
536
498
test_intersection_and_flatten_add_success ()
540
502
test_proposition_add_sparse_axis ()
541
503
end
542
504
@testset " Reformulate Proposition" begin
543
- test_negation_reformulation ()
544
505
test_implication_reformulation ()
545
506
test_implication_reformulation_fail ()
546
507
test_equivalence_reformulation ()
0 commit comments