@@ -54,7 +54,7 @@ struct ODESystem <: AbstractODESystem
54
54
""" A set of expressions defining the costs of the system for optimal control."""
55
55
costs:: Vector
56
56
""" Takes the cost vector and returns a scalar for optimization."""
57
- coalesce :: Union{Nothing, Function}
57
+ consolidate :: Union{Nothing, Function}
58
58
"""
59
59
Time-derivative matrix. Note: this field will not be defined until
60
60
[`calculate_tgrad`](@ref) is called on the system.
@@ -210,7 +210,7 @@ struct ODESystem <: AbstractODESystem
210
210
211
211
function ODESystem (
212
212
tag, deqs, iv, dvs, ps, tspan, var_to_name, ctrls,
213
- observed, constraints, costs, coalesce , tgrad,
213
+ observed, constraints, costs, consolidate , tgrad,
214
214
jac, ctrl_jac, Wfact, Wfact_t, name, description, systems, defaults, guesses,
215
215
torn_matching, initializesystem, initialization_eqs, schedule,
216
216
connector_type, preface, cevents,
@@ -234,7 +234,7 @@ struct ODESystem <: AbstractODESystem
234
234
check_units (u, deqs)
235
235
end
236
236
new (tag, deqs, iv, dvs, ps, tspan, var_to_name,
237
- ctrls, observed, constraints, costs, coalesce , tgrad, jac,
237
+ ctrls, observed, constraints, costs, consolidate , tgrad, jac,
238
238
ctrl_jac, Wfact, Wfact_t, name, description, systems, defaults, guesses, torn_matching,
239
239
initializesystem, initialization_eqs, schedule, connector_type, preface,
240
240
cevents, devents, parameter_dependencies, assertions, metadata,
@@ -249,7 +249,7 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
249
249
observed = Equation[],
250
250
constraintsystem = nothing ,
251
251
costs = Num[],
252
- coalesce = nothing ,
252
+ consolidate = nothing ,
253
253
systems = ODESystem[],
254
254
tspan = nothing ,
255
255
name = nothing ,
@@ -334,15 +334,15 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
334
334
end
335
335
costs = wrap .(costs)
336
336
337
- if length (costs) > 1 && isnothing (coalesce )
338
- error (" Must specify a coalesce function for the costs vector." )
337
+ if length (costs) > 1 && isnothing (consolidate )
338
+ error (" Must specify a consolidation function for the costs vector." )
339
339
end
340
340
341
341
assertions = Dict {BasicSymbolic, Any} (unwrap (k) => v for (k, v) in assertions)
342
342
343
343
ODESystem (Threads. atomic_add! (SYSTEM_COUNT, UInt (1 )),
344
344
deqs, iv′, dvs′, ps′, tspan, var_to_name, ctrl′, observed,
345
- constraintsystem, costs, coalesce , tgrad, jac,
345
+ constraintsystem, costs, consolidate , tgrad, jac,
346
346
ctrl_jac, Wfact, Wfact_t, name, description, systems,
347
347
defaults, guesses, nothing , initializesystem,
348
348
initialization_eqs, schedule, connector_type, preface, cont_callbacks,
@@ -421,7 +421,7 @@ function Base.:(==)(sys1::ODESystem, sys2::ODESystem)
421
421
_eq_unordered (continuous_events (sys1), continuous_events (sys2)) &&
422
422
_eq_unordered (discrete_events (sys1), discrete_events (sys2)) &&
423
423
all (s1 == s2 for (s1, s2) in zip (get_systems (sys1), get_systems (sys2))) &&
424
- isequal (get_constraintsystem (sys1), get_constraintssystem (sys2)) &&
424
+ isequal (get_constraintsystem (sys1), get_constraintsystem (sys2)) &&
425
425
_eq_unordered (get_costs (sys1), get_costs (sys2))
426
426
end
427
427
@@ -770,7 +770,7 @@ function process_constraint_system(
770
770
end
771
771
772
772
# Validate the states.
773
- validate_vars_and_find_ps! (coststs, costps , sts, iv)
773
+ validate_vars_and_find_ps! (constraintsts, constraintps , sts, iv)
774
774
775
775
ConstraintsSystem (
776
776
constraints, collect (constraintsts), collect (constraintps); name = consname)
@@ -830,7 +830,7 @@ Generate a function that takes a solution object and computes the cost function
830
830
"""
831
831
function generate_cost_function (sys:: ODESystem , kwargs... )
832
832
costs = get_costs (sys)
833
- coalesce = get_coalesce (sys)
833
+ consolidate = get_consolidate (sys)
834
834
iv = get_iv (sys)
835
835
836
836
ps = parameters (sys; initial_parameters = false )
@@ -853,6 +853,6 @@ function generate_cost_function(sys::ODESystem, kwargs...)
853
853
fs = build_function_wrapper (sys, costs, sol, _p... , t; output_type = Array, kwargs... )
854
854
vc_oop, vc_iip = eval_or_rgf .(fs)
855
855
856
- cost (sol, p, t) = coalesce (vc_oop (sol, p, t))
856
+ cost (sol, p, t) = consolidate (vc_oop (sol, p, t))
857
857
return cost
858
858
end
0 commit comments