-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathtest_SplitComplexIndicatorEqualToBridge.jl
More file actions
86 lines (79 loc) · 2.56 KB
/
test_SplitComplexIndicatorEqualToBridge.jl
File metadata and controls
86 lines (79 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright (c) 2017: Miles Lubin and contributors
# Copyright (c) 2017: Google Inc.
#
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
module TestConstraintSplitComplexIndicatorEqualTo
using Test
import MathOptInterface as MOI
function runtests()
for name in names(@__MODULE__; all = true)
if startswith("$(name)", "test_")
@testset "$(name)" begin
getfield(@__MODULE__, name)()
end
end
end
return
end
function test_runtests()
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitComplexIndicatorEqualToBridge,
"""
variables: x, z
::Complex{Float64}: [z, (1.0 + 2.0im) * x] in Indicator{ACTIVATE_ON_ONE}(EqualTo(3.0 + 4.0im))
z in ZeroOne()
""",
"""
variables: x, z
::Float64: [z, 1.0 * x] in Indicator{ACTIVATE_ON_ONE}(EqualTo(3.0))
::Float64: [z, 2.0 * x] in Indicator{ACTIVATE_ON_ONE}(EqualTo(4.0))
z in ZeroOne()
""",
)
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitComplexIndicatorEqualToBridge,
"""
variables: x, z
::Complex{Float64}: [z, (1.0 + 2.0im) * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(3.0 + 4.0im))
z in ZeroOne()
""",
"""
variables: x, z
::Float64: [z, 1.0 * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(3.0))
::Float64: [z, 2.0 * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(4.0))
z in ZeroOne()
""",
)
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitComplexIndicatorEqualToBridge,
"""
variables: x, z
::Complex{Float64}: [z, (0.0 + 2.0im) * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(0.0 + 4.0im))
z in ZeroOne()
""",
"""
variables: x, z
::Float64: [z, 2.0 * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(4.0))
z in ZeroOne()
""";
constraint_start = [1.0, 0.0 + 1.2im],
)
MOI.Bridges.runtests(
MOI.Bridges.Constraint.SplitComplexIndicatorEqualToBridge,
"""
variables: x, z
::Complex{Float64}: [z, (1.0 + 0.0im) * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(3.0 + 0.0im))
z in ZeroOne()
""",
"""
variables: x, z
::Float64: [z, 1.0 * x] in Indicator{ACTIVATE_ON_ZERO}(EqualTo(3.0))
z in ZeroOne()
""";
constraint_start = [1.0, 1.2 + 0.0im],
)
return
end
end # module
TestConstraintSplitComplexIndicatorEqualTo.runtests()