Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed Dec 14, 2023
1 parent c10d206 commit 60f3acd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/systems/optimization/modelingtoolkitize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function modelingtoolkitize(prob::DiffEqBase.OptimizationProblem; kwargs...)
if !isnothing(prob.lcons)
for i in 1:num_cons
if !isinf(prob.lcons[i])
if prob.lcons[i] != prob.ucons[i] &&
if prob.lcons[i] != prob.ucons[i]
push!(cons, prob.lcons[i] lhs[i])
else
push!(cons, lhs[i] ~ prob.ucons[i])
Expand Down
4 changes: 2 additions & 2 deletions src/systems/optimization/optimizationsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
lcons = lcons_
ucons = ucons_
else # use the user supplied constraints bounds
haskey(kwargs, :lcons) && haskey(kwargs, :ucons) &&
(haskey(kwargs, :lcons) haskey(kwargs, :ucons)) &&
throw(ArgumentError("Expected both `ucons` and `lcons` to be supplied"))
haskey(kwargs, :lcons) && length(kwargs[:lcons]) != length(cstr) &&
throw(ArgumentError("Expected `lcons` to be of the same length as the vector of constraints"))
Expand Down Expand Up @@ -527,7 +527,7 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0map,
lcons = lcons_
ucons = ucons_
else # use the user supplied constraints bounds
!haskey(kwargs, :lcons) && !haskey(kwargs, :ucons) &&
(haskey(kwargs, :lcons) haskey(kwargs, :ucons)) &&
throw(ArgumentError("Expected both `ucons` and `lcons` to be supplied"))
haskey(kwargs, :lcons) && length(kwargs[:lcons]) != length(cstr) &&
throw(ArgumentError("Expected `lcons` to be of the same length as the vector of constraints"))
Expand Down

0 comments on commit 60f3acd

Please sign in to comment.