FAST: the hydro-thermal problem

This tutorial was generated using Literate.jl. Download the source as a .jl file. Download the source as a .ipynb file.

An implementation of the Hydro-thermal example from FAST

using SDDP, HiGHS, Testfunction fast_hydro_thermal()    model = SDDP.LinearPolicyGraph(;        stages = 2,        upper_bound = 0.0,        sense = :Max,        optimizer = HiGHS.Optimizer,    ) do sp, t        @variable(sp, 0 <= x <= 8, SDDP.State, initial_value = 0.0)        @variables(sp, begin            y >= 0            p >= 0            ξ        end)        @constraints(sp, begin            p + y >= 6            x.out <= x.in - y + ξ        end)        RAINFALL = (t == 1 ? [6] : [2, 10])        SDDP.parameterize(sp, RAINFALL) do ω            fix(ξ, ω)            return        end        @stageobjective(sp, -5 * p)    end    det = SDDP.deterministic_equivalent(model, HiGHS.Optimizer)    set_silent(det)    optimize!(det)    @test objective_sense(det) == MAX_SENSE    @test objective_value(det) == -10    SDDP.train(model)    @test SDDP.calculate_bound(model) == -10    returnendfast_hydro_thermal()
-------------------------------------------------------------------
         SDDP.jl (c) Oscar Dowson and contributors, 2017-26
-------------------------------------------------------------------
problem
  nodes           : 2
  state variables : 1
  scenarios       : 2.00000e+00
  existing cuts   : false
options
  solver          : serial mode
  risk measure    : SDDP.Expectation()
  sampling scheme : SDDP.InSampleMonteCarlo
subproblem structure
  VariableRef                             : [6, 6]
  AffExpr in MOI.GreaterThan{Float64}     : [1, 1]
  AffExpr in MOI.LessThan{Float64}        : [1, 1]
  VariableRef in MOI.EqualTo{Float64}     : [1, 1]
  VariableRef in MOI.GreaterThan{Float64} : [3, 4]
  VariableRef in MOI.LessThan{Float64}    : [2, 2]
numerical stability report
  matrix range     [1e+00, 1e+00]
  objective range  [1e+00, 5e+00]
  bounds range     [8e+00, 8e+00]
  rhs range        [6e+00, 6e+00]
-------------------------------------------------------------------
 iteration    simulation      bound        time (s)     solves  pid
-------------------------------------------------------------------
         1   0.000000e+00 -1.000000e+01  5.320811e-02         5   1
        20   0.000000e+00 -1.000000e+01  1.548190e-01       104   1
-------------------------------------------------------------------
status         : simulation_stopping
total time (s) : 1.548190e-01
total solves   : 104
best bound     : -1.000000e+01
numeric issues : 0
-------------------------------------------------------------------