You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 14, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: src/constraints/singlevariable.jl
+23-6Lines changed: 23 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -42,16 +42,25 @@ end
42
42
43
43
SVCI(v::SinVar, ::S) where S =SVCI{S}(v.variable.value)
44
44
45
+
functionhasvalue(d::Dict{T,S}, val::S)
46
+
for v invalues(d)
47
+
if v == val
48
+
returntrue
49
+
end
50
+
end
51
+
returnfalse
52
+
end
53
+
45
54
functioncheckexisting(m::LinQuadOptimizer, v::SinVar, set::S) where S
46
55
ref =SVCI(v, set)
47
-
ifhaskey(constrdict(m, ref), ref)
56
+
ifhasvalue(constrdict(m, ref), v.variable)
48
57
error("Adding the same constraint type: $(S) is not allowed for SingleVariable function")
49
58
end
50
59
end
51
60
52
61
functioncheckconflicting(m::LinQuadOptimizer, v::SinVar, set_to_add::S0, set_to_test::S) where S where S0
53
62
ref =SVCI(v, set_to_test)
54
-
ifhaskey(constrdict(m, ref), ref)
63
+
ifhasvalue(constrdict(m, ref), v.variable)
55
64
error("Adding the same constraint type: $(S0) is not allowed for SingleVariable function because there is constraint of type $(S) tied to the respective variable")
56
65
end
57
66
end
@@ -63,7 +72,9 @@ function MOI.addconstraint!(m::LinQuadOptimizer, v::SinVar, set::S) where S <: L
0 commit comments