@@ -305,10 +305,12 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
305
305
lcons = lcons_
306
306
ucons = ucons_
307
307
else # use the user supplied constraints bounds
308
+ xor (isnothing (lcons), isnothing (lcons)) &&
309
+ throw (ArgumentError (" Expected both `lcons` and `lcons` to be supplied" ))
308
310
! isnothing (lcons) && length (lcons) != length (cstr) &&
309
- throw (ArgumentError (" Expected both `lcons` to be of the same length as the vector of constraints" ))
311
+ throw (ArgumentError (" Expected `lcons` to be of the same length as the vector of constraints" ))
310
312
! isnothing (ucons) && length (ucons) != length (cstr) &&
311
- throw (ArgumentError (" Expected both `ucons` to be of the same length as the vector of constraints" ))
313
+ throw (ArgumentError (" Expected `ucons` to be of the same length as the vector of constraints" ))
312
314
end
313
315
314
316
if sparse
@@ -399,9 +401,9 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0,
399
401
xor (isnothing (lb), isnothing (ub)) &&
400
402
throw (ArgumentError (" Expected both `lb` and `ub` to be supplied" ))
401
403
! isnothing (lb) && length (lb) != length (dvs) &&
402
- throw (ArgumentError (" Expected both `lb` to be of the same length as the vector of optimization variables" ))
404
+ throw (ArgumentError (" Expected `lb` to be of the same length as the vector of optimization variables" ))
403
405
! isnothing (ub) && length (ub) != length (dvs) &&
404
- throw (ArgumentError (" Expected both `ub` to be of the same length as the vector of optimization variables" ))
406
+ throw (ArgumentError (" Expected `ub` to be of the same length as the vector of optimization variables" ))
405
407
end
406
408
407
409
int = isintegervar .(dvs) .| isbinaryvar .(dvs)
@@ -469,11 +471,13 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0,
469
471
if isnothing (lcons) && isnothing (ucons) # use the symbolically specified bounds
470
472
lcons = lcons_
471
473
ucons = ucons_
472
- else # use the user supplied variable bounds
474
+ else # use the user supplied constraints bounds
475
+ xor (isnothing (lcons), isnothing (lcons)) &&
476
+ throw (ArgumentError (" Expected both `lcons` and `lcons` to be supplied" ))
473
477
! isnothing (lcons) && length (lcons) != length (cstr) &&
474
- throw (ArgumentError (" Expected both `lcons` to be of the same length as the vector of constraints" ))
478
+ throw (ArgumentError (" Expected `lcons` to be of the same length as the vector of constraints" ))
475
479
! isnothing (ucons) && length (ucons) != length (cstr) &&
476
- throw (ArgumentError (" Expected both `ucons` to be of the same length as the vector of constraints" ))
480
+ throw (ArgumentError (" Expected `ucons` to be of the same length as the vector of constraints" ))
477
481
end
478
482
479
483
if sparse
0 commit comments