@@ -9,22 +9,14 @@ JuMP.name(con_ref::NonlinearConstraintRef) = ""
9
9
10
10
Check constraints in a disjunction Tuple.
11
11
12
- check_constraint!(m::Model, constr_j::Union{Tuple,Array} , constr_list::Vector)
12
+ check_constraint!(m::Model, constr_j, constr_list::Vector)
13
13
14
- Check constraints in a nested Tuple or Array of constraints and update `constr_list`.
14
+ Check nested constraint and update `constr_list`.
15
15
16
- check_constraint!(m::Model, constr_j::ConstraintRef, constr_list::Vector)
17
-
18
- Check constraint `constr_j` in position `j` of a disjunct and update `constr_list`.
19
-
20
- check_constraint!(m::Model, constr::ConstraintRef)
16
+ check_constraint!(m::Model, constr)
21
17
22
18
Check constraint in a Model.
23
19
24
- check_constraint!(m::Model, constr::AbstractArray)
25
-
26
- Check constraint block in a model.
27
-
28
20
check_constraint!(m::Model, constr::Nothing)
29
21
30
22
Return nothing for an empty disjunct.
@@ -34,9 +26,12 @@ function check_constraint!(m::Model, constr::Tuple)
34
26
map (constr_j -> check_constraint! (m, constr_j, constr_list), constr)
35
27
return Tuple (constr_list)
36
28
end
37
- function check_constraint! (m:: Model , constr_j:: Union{ Tuple,Array} , constr_list:: Vector )
29
+ function check_constraint! (m:: Model , constr_j:: Tuple , constr_list:: Vector )
38
30
map (constr_jk -> check_constraint! (m, constr_jk, constr_list), constr_j)
39
31
end
32
+ function check_constraint! (m:: Model , constr_j:: AbstractArray{<:ConstraintRef} , constr_list:: Vector )
33
+ push! (constr_list, check_constraint! (m, constr_j))
34
+ end
40
35
function check_constraint! (m:: Model , constr_j:: ConstraintRef , constr_list:: Vector )
41
36
push! (constr_list, check_constraint! (m, constr_j))
42
37
end
@@ -54,7 +49,7 @@ function check_constraint!(m::Model, constr::ConstraintRef)
54
49
end
55
50
return new_constr
56
51
end
57
- function check_constraint! (m:: Model , constr:: AbstractArray )
52
+ function check_constraint! (m:: Model , constr:: AbstractArray{<:ConstraintRef} )
58
53
@assert all (is_valid .(m, constr)) " $constr is not a valid constraint."
59
54
if ! any (is_interval_constraint .(constr)) && ! any (is_equality_constraint .(constr))
60
55
new_constr = constr
@@ -87,19 +82,15 @@ Split a nonlinear constraint that is an Interval or EqualTo constraint.
87
82
88
83
split_constraint(m::Model, constr::ConstraintRef, constr_name::String = name(constr))
89
84
90
- Split a linear or quadratic constraint that is MOI.Interval or MOI.EqualTo .
85
+ Split a linear or quadratic constraint.
91
86
92
- split_constraint(m::Model, func::Union{AffExpr,QuadExpr}, lb::Float64, ub::Float64, lb_name::String, ub_name::String)
93
-
94
- Create split constraint for linear or quadratic constraint.
87
+ split_constraint(m::Model, constr_obj::ScalarConstraint, lb_name::String, ub_name::String)
95
88
96
- split_constraint(m::Model, constr_obj::ScalarConstraint{T,<: MOI.EqualTo}, lb_name::String, ub_name::String)
89
+ Split a constraint that is a MOI.EqualTo or MOI.Interval.
97
90
98
- Split a constraint that is a MOI.EqualTo.
99
-
100
- split_constraint(m::Model, constr_obj::ScalarConstraint{T,<:MOI.Interval}, lb_name::String, ub_name::String)
91
+ split_constraint(m::Model, func::Union{AffExpr,QuadExpr}, lb::Float64, ub::Float64, lb_name::String, ub_name::String)
101
92
102
- Split a constraint that is a MOI.Interval
93
+ Create split constraint for linear or quadratic constraint.
103
94
104
95
split_constraint(m::Model, constr::ConstraintRef, constr_func_expr::Expr, lb::Float64, ub::Float64)
105
96
@@ -168,7 +159,7 @@ split_constraint(args...) = nothing
168
159
169
160
delete_original_constraint! (m:: Model , constr:: ConstraintRef ) = delete (m,constr)
170
161
delete_original_constraint! (m:: Model , constr:: NonlinearConstraintRef ) = nothing
171
- delete_original_constraint! (m:: Model , constr:: AbstractArray ) = map (c -> delete_original_constraint! (m,c), constr)
162
+ delete_original_constraint! (m:: Model , constr:: AbstractArray{<:ConstraintRef} ) = map (c -> delete_original_constraint! (m,c), constr)
172
163
173
164
"""
174
165
parse_constraint(constr::ConstraintRef)
0 commit comments