@@ -25,26 +25,25 @@ function modelingtoolkitize(prob::DiffEqBase.OptimizationProblem; kwargs...)
25
25
26
26
if ! isnothing (prob. lcons)
27
27
for i in 1 : num_cons
28
- ! isinf (prob. lcons[i]) && prob. lcons[i] != = prob. ucons[i] &&
29
- push! (cons, prob. lcons[i] ≲ lhs[i])
30
- if ! isinf (prob. ucons[i])
31
- prob. lcons[i] == prob. ucons[i] ? push! (cons, lhs[i] ~ prob. ucons[i]) :
32
- push! (cons, lhs[i] ≲ prob. ucons[i])
28
+ if ! isinf (prob. lcons[i])
29
+ if prob. lcons[i] != prob. ucons[i] &&
30
+ push! (cons, prob. lcons[i] ≲ lhs[i])
31
+ else
32
+ push! (cons, lhs[i] ~ prob. ucons[i])
33
+ end
33
34
end
34
35
end
35
36
end
36
37
37
38
if ! isnothing (prob. ucons)
38
39
for i in 1 : num_cons
39
- if ! isinf (prob. ucons[i])
40
- prob. lcons[i] == prob. ucons[i] ? push! (cons, lhs[i] ~ prob. ucons[i]) :
40
+ if ! isinf (prob. ucons[i]) && prob. lcons[i] != prob. ucons[i]
41
41
push! (cons, lhs[i] ≲ prob. ucons[i])
42
42
end
43
43
end
44
44
end
45
-
46
- if (isnothing (prob. lcons) || all (isinf .(prob. lcons))) &&
47
- (isnothing (prob. ucons) || all (isinf .(prob. ucons)))
45
+ if (isnothing (prob. lcons) || all (isinf, prob. lcons)) &&
46
+ (isnothing (prob. ucons) || all (isinf, prob. ucons))
48
47
throw (ArgumentError (" Constraints passed have no proper bounds defined.
49
48
Ensure you pass equal bounds (the scalar that the constraint should evaluate to) for equality constraints
50
49
or pass the lower and upper bounds for inequality constraints." ))
0 commit comments