SDDP: type Array has no field out

You need [x.out for x in stage[:level]].

level = SDDP.State{Float64}[SDDP.State{Float64}(273.0, 273.6889607972534), SDDP.State{Float64}(225.0, 225.08061916277788), SDDP.State{Float64}(267.0, 267.3945072693355), SDDP.State{Float64}(267.0, 267.5107715473515)]

Let’s break this down:

  • The Julia syntax. T[ ... stuff ... ] means an Array of stuff with element type T.
  • So SDDP.State{Float64}[ ... ] means you have an array, with element type SDDP.State{Float64}
  • So you have an array of state variables, not a state variable that is an array (if that makes sense)
  • [x.out for x in stage[:level]] says "create a new array, which is built by looping over each x in stage[:level], and returning x.out.