Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed Oct 20, 2023
1 parent 285cbac commit 6dd8d79
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]

Check warning on line 29 in src/systems/optimization/modelingtoolkitize.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/optimization/modelingtoolkitize.jl#L29

Added line #L29 was not covered by tests
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)) &&

Check warning on line 352 in src/systems/optimization/optimizationsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/optimization/optimizationsystem.jl#L352

Added line #L352 was not covered by tests
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)) &&

Check warning on line 530 in src/systems/optimization/optimizationsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/optimization/optimizationsystem.jl#L530

Added line #L530 was not covered by tests
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 6dd8d79

Please sign in to comment.