Skip to content

Commit 3703a1e

Browse files
fix: fix parsing of costs in time-independent systems
1 parent 36295d0 commit 3703a1e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/systems/system.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,11 @@ function System(eqs::Vector{Equation}; kwargs...)
543543
for ssys in get(kwargs, :systems, System[])
544544
collect_scoped_vars!(allunknowns, ps, ssys, nothing)
545545
end
546-
costs = get(kwargs, :costs, nothing)
547-
if costs !== nothing
548-
costunknowns, costps = process_costs(costs, allunknowns, ps, nothing)
549-
union!(allunknowns, costunknowns)
550-
union!(ps, costps)
546+
costs = get(kwargs, :costs, [])
547+
for val in costs
548+
collect_vars!(allunknowns, ps, val, nothing)
551549
end
550+
552551
cstrs = Vector{Union{Equation, Inequality}}(get(kwargs, :constraints, []))
553552
for eq in cstrs
554553
collect_vars!(allunknowns, ps, eq, nothing)

0 commit comments

Comments
 (0)