@@ -54,7 +54,7 @@ struct ODESystem <: AbstractODESystem
5454 """ A set of expressions defining the costs of the system for optimal control."""
5555 costs:: Vector
5656 """ Takes the cost vector and returns a scalar for optimization."""
57- coalesce :: Union{Nothing, Function}
57+ consolidate :: Union{Nothing, Function}
5858 """
5959 Time-derivative matrix. Note: this field will not be defined until
6060 [`calculate_tgrad`](@ref) is called on the system.
@@ -210,7 +210,7 @@ struct ODESystem <: AbstractODESystem
210210
211211 function ODESystem (
212212 tag, deqs, iv, dvs, ps, tspan, var_to_name, ctrls,
213- observed, constraints, costs, coalesce , tgrad,
213+ observed, constraints, costs, consolidate , tgrad,
214214 jac, ctrl_jac, Wfact, Wfact_t, name, description, systems, defaults, guesses,
215215 torn_matching, initializesystem, initialization_eqs, schedule,
216216 connector_type, preface, cevents,
@@ -234,7 +234,7 @@ struct ODESystem <: AbstractODESystem
234234 check_units (u, deqs)
235235 end
236236 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,
238238 ctrl_jac, Wfact, Wfact_t, name, description, systems, defaults, guesses, torn_matching,
239239 initializesystem, initialization_eqs, schedule, connector_type, preface,
240240 cevents, devents, parameter_dependencies, assertions, metadata,
@@ -249,7 +249,7 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
249249 observed = Equation[],
250250 constraintsystem = nothing ,
251251 costs = Num[],
252- coalesce = nothing ,
252+ consolidate = nothing ,
253253 systems = ODESystem[],
254254 tspan = nothing ,
255255 name = nothing ,
@@ -334,15 +334,15 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
334334 end
335335 costs = wrap .(costs)
336336
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." )
339339 end
340340
341341 assertions = Dict {BasicSymbolic, Any} (unwrap (k) => v for (k, v) in assertions)
342342
343343 ODESystem (Threads. atomic_add! (SYSTEM_COUNT, UInt (1 )),
344344 deqs, iv′, dvs′, ps′, tspan, var_to_name, ctrl′, observed,
345- constraintsystem, costs, coalesce , tgrad, jac,
345+ constraintsystem, costs, consolidate , tgrad, jac,
346346 ctrl_jac, Wfact, Wfact_t, name, description, systems,
347347 defaults, guesses, nothing , initializesystem,
348348 initialization_eqs, schedule, connector_type, preface, cont_callbacks,
@@ -421,7 +421,7 @@ function Base.:(==)(sys1::ODESystem, sys2::ODESystem)
421421 _eq_unordered (continuous_events (sys1), continuous_events (sys2)) &&
422422 _eq_unordered (discrete_events (sys1), discrete_events (sys2)) &&
423423 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)) &&
425425 _eq_unordered (get_costs (sys1), get_costs (sys2))
426426end
427427
@@ -770,7 +770,7 @@ function process_constraint_system(
770770 end
771771
772772 # Validate the states.
773- validate_vars_and_find_ps! (coststs, costps , sts, iv)
773+ validate_vars_and_find_ps! (constraintsts, constraintps , sts, iv)
774774
775775 ConstraintsSystem (
776776 constraints, collect (constraintsts), collect (constraintps); name = consname)
@@ -830,7 +830,7 @@ Generate a function that takes a solution object and computes the cost function
830830"""
831831function generate_cost_function (sys:: ODESystem , kwargs... )
832832 costs = get_costs (sys)
833- coalesce = get_coalesce (sys)
833+ consolidate = get_consolidate (sys)
834834 iv = get_iv (sys)
835835
836836 ps = parameters (sys; initial_parameters = false )
@@ -853,6 +853,6 @@ function generate_cost_function(sys::ODESystem, kwargs...)
853853 fs = build_function_wrapper (sys, costs, sol, _p... , t; output_type = Array, kwargs... )
854854 vc_oop, vc_iip = eval_or_rgf .(fs)
855855
856- cost (sol, p, t) = coalesce (vc_oop (sol, p, t))
856+ cost (sol, p, t) = consolidate (vc_oop (sol, p, t))
857857 return cost
858858end
0 commit comments