JuMP: get (warm)start value of an expression

Context

I’m trying to write some utility functions to solve non linear control problems using JuMP. Following the Rocket control tutorial I set my state variables as JuMP variables and the dynamics as constraints.
However I’ve noticed that often the optimizer will fail if I don’t provide a starting value for the states, that are close to the solution imposed by the dynamics.
Because my dynamics include a control term, itself a JuMP variable, I’d like to be able to compute the starting values for my states based on the starting values of my control (without having to specify by hand the starting value of my control).

(simplified) MWE

Basically what I need is to be able to initialize a variable based on a function of previously defined variables:

using JuMP
using Ipopt

test = Model(Ipopt.Optimizer)

@variables(test,begin
    a[i=1:2], (start=[5.0,5.0][i])
    b, (start=sum(a)) # initialize b as a function (sum) of a
end)

Doing this I get the following error:

ERROR: MethodError: Cannot `convert` an object of type AffExpr to an object of type Float64
Closest candidates are:
  convert(::Type{T}, ::T) where T<:Number at number.jl:6
  convert(::Type{T}, ::Number) where T<:Number at number.jl:7
  convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:273
  ...

So I gathered that I must provide a Number to the start keyword. Hence I’ve tried to access explicitly the start value:

using JuMP
using Ipopt

test = Model(Ipopt.Optimizer)

@variables(test,begin
    a[i=1:2], (start=[5.0,5.0][i])
    b, (start=start_value(sum(a))) # initialize b as a function (sum) of a and explicitly request the start_value
end)

and get the following error

ERROR: MethodError: no method matching start_value(::AffExpr)
Closest candidates are:
  start_value(::ConstraintRef{<:AbstractModel, <:MathOptInterface.ConstraintIndex}) at ~/.julia/packages/JuMP/Z1pVn/src/constraints.jl:190
  start_value(::VariableRef) at ~/.julia/packages/JuMP/Z1pVn/src/variables.jl:999

I understand start_value is only defined for ConstraintRef and VariableRef objects, is there an equivalent to get the starting value implied by a AffExpr (the object returned by sum(a))? I feel this must be implemented somewhere (at least using value. during the optimization process) in JuMP? How can I access this but using start_value? My problem being a non linear control problem, I assume the resulting object is not an AffExpr but rather a JuMP.NonlinearExpression type, so any pointers specific to this would also be appreciated!

Thanks a bunch!

You don’t need to do everything in the macros. Do instead:

test = Model()
@variables(test, begin
    a[1:2]
    b
end)
set_start_value.(a, [5.0, 5.0])
set_start_value(b, sum(start_value(a[i]) for i in 1:2))