Skip to content

Commit 1024404

Browse files
adds missing collect_constants!
1 parent ae0c60e commit 1024404

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/systems/optimization/optimizationsystem.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
225225
lb[isbinaryvar.(dvs)] .= 0
226226
ub[isbinaryvar.(dvs)] .= 1
227227
else # use the user supplied variable bounds
228-
xor(isnothing(lb), isnothing(ub)) && throw(ArgumentError("Expected both `lb` and `ub` to be supplied"))
228+
xor(isnothing(lb), isnothing(ub)) &&
229+
throw(ArgumentError("Expected both `lb` and `ub` to be supplied"))
229230
end
230231

231232
int = isintegervar.(dvs) .| isbinaryvar.(dvs)
@@ -378,7 +379,8 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0,
378379
lb[isbinaryvar.(dvs)] .= 0
379380
ub[isbinaryvar.(dvs)] .= 1
380381
else # use the user supplied variable bounds
381-
xor(isnothing(lb), isnothing(ub)) && throw(ArgumentError("Expected both `lb` and `ub` to be supplied"))
382+
xor(isnothing(lb), isnothing(ub)) &&
383+
throw(ArgumentError("Expected both `lb` and `ub` to be supplied"))
382384
end
383385

384386
int = isintegervar.(dvs) .| isbinaryvar.(dvs)

src/utils.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@ function collect_constants!(constants, eq::Equation)
522522
collect_constants!(constants, eq.rhs)
523523
end
524524

525+
function collect_constants!(constants, eq::Inequality)
526+
collect_constants!(constants, eq.lhs)
527+
collect_constants!(constants, eq.rhs)
528+
end
529+
525530
collect_constants!(constants, x::Num) = collect_constants!(constants, unwrap(x))
526531
collect_constants!(constants, x::Real) = nothing
527532
collect_constants(n::Nothing) = Symbolics.Sym[]

0 commit comments

Comments
 (0)