stochastic programming for hydropower operations
play

Stochastic Programming for Hydropower Operations Modeling and - PowerPoint PPT Presentation

Stochastic Programming for Hydropower Operations Modeling and Algorithms Martin Biel KTH - Royal Institute of Technology JUNE 28, 2018 Price forecasts Irregular power production: solar and wind Nuclear power phase-out Common:


  1. • No clearcut way to calculate stochastic measures: EVPI, VSS • The model creation is somewhat infmexible • Parallel L-shaped using the Distributed module in Julia… • …but StructJuMP relies on MPI • Creating a new hydromodel involves reimplementing a new type Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition

  2. • The model creation is somewhat infmexible • Parallel L-shaped using the Distributed module in Julia… • …but StructJuMP relies on MPI • Creating a new hydromodel involves reimplementing a new type Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition • No clearcut way to calculate stochastic measures: EVPI, VSS

  3. • Parallel L-shaped using the Distributed module in Julia… • …but StructJuMP relies on MPI • Creating a new hydromodel involves reimplementing a new type Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition • No clearcut way to calculate stochastic measures: EVPI, VSS • The model creation is somewhat infmexible

  4. • …but StructJuMP relies on MPI • Creating a new hydromodel involves reimplementing a new type Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition • No clearcut way to calculate stochastic measures: EVPI, VSS • The model creation is somewhat infmexible • Parallel L-shaped using the Distributed module in Julia…

  5. • Creating a new hydromodel involves reimplementing a new type Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition • No clearcut way to calculate stochastic measures: EVPI, VSS • The model creation is somewhat infmexible • Parallel L-shaped using the Distributed module in Julia… • …but StructJuMP relies on MPI

  6. Initial Approach - Issues Martin Biel (KTH) Stochastic Programming for Hydropower 7 / 25 • A lot of code repetition • No clearcut way to calculate stochastic measures: EVPI, VSS • The model creation is somewhat infmexible • Parallel L-shaped using the Distributed module in Julia… • …but StructJuMP relies on MPI • Creating a new hydromodel involves reimplementing a new type

  7. ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl • HydroModels.jl

  8. ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation • HydroModels.jl

  9. ∘ Stochastic programming constructs ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module • HydroModels.jl

  10. ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs • HydroModels.jl

  11. ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs • HydroModels.jl ∘ Model creation focused on data and optimization formulation

  12. ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs • HydroModels.jl ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization

  13. New Approach Martin Biel (KTH) Stochastic Programming for Hydropower 8 / 25 • StochasticPrograms.jl ∘ Flexible model creation ∘ Parallel capabilities based on the Distributed module ∘ Stochastic programming constructs • HydroModels.jl ∘ Model creation focused on data and optimization formulation ∘ Effjcient model reinitialization ∘ Predefjned models • Short-term production planning • Optimal orders on the day-ahead market

  14. StochasticPrograms.jl - Simple Example where Stochastic Programming for Hydropower Martin Biel (KTH) s.t. minimize Q ( x 1 , x 2 , 𝜊) = min y 1 , y 2 ∈ℝ x 1 , x 2 ∈ℝ s.t. 9 / 25 100 x 1 + 150 x 2 + 𝔽 𝜕 [ Q ( x 1 , x 2 , 𝜊)] x 1 + x 2 ≤ 120 x 1 ≥ 40 x 2 ≥ 20 q 1 (𝜊) y 1 + q 2 (𝜊) y 2 6 y 1 + 10 y 2 ≤ 60 x 1 8 y 1 + 5 y 2 ≤ 80 x 2 0 ≤ y 1 ≤ d 1 (𝜊) 0 ≤ y 2 ≤ d 2 (𝜊)

  15. StochasticPrograms.jl - Simple Example Martin Biel (KTH) Stochastic Programming for Hydropower 10 / 25 sp = StochasticProgram(solver=ClpSolver()) @first_stage sp = begin @variable(model, x₁ >= 40) @variable(model, x₂ >= 20) @objective(model, Min, 100*x₁ + 150*x₂) @constraint(model, x₁+x₂ <= 120) end @second_stage sp = begin @decision x₁ x₂ s = scenario @variable(model, 0 <= y₁ <= s.d[1]) @variable(model, 0 <= y₂ <= s.d[2]) @objective(model, Min, s.q[1]*y₁ + s.q[2]*y₂) @constraint(model, 6*y₁ + 10*y₂ <= 60*x₁) @constraint(model, 8*y₁ + 5*y₂ <= 80*x₂) end

  16. StochasticPrograms.jl - Simple Example Creates a generator function for the fjrst stage model Stochastic Programming for Hydropower Martin Biel (KTH) 10 / 25 sp = StochasticProgram(solver=ClpSolver()) @first_stage sp = begin @variable(model, x₁ >= 40) @variable(model, x₂ >= 20) @objective(model, Min, 100*x₁ + 150*x₂) @constraint(model, x₁+x₂ <= 120) end @second_stage sp = begin @decision x₁ x₂ s = scenario @variable(model, 0 <= y₁ <= s.d[1]) @variable(model, 0 <= y₂ <= s.d[2]) @objective(model, Min, s.q[1]*y₁ + s.q[2]*y₂) @constraint(model, 6*y₁ + 10*y₂ <= 60*x₁) @constraint(model, 8*y₁ + 5*y₂ <= 80*x₂) end

  17. StochasticPrograms.jl - Simple Example Creates a generator function for the second stage model Stochastic Programming for Hydropower Martin Biel (KTH) 10 / 25 sp = StochasticProgram(solver=ClpSolver()) @first_stage sp = begin @variable(model, x₁ >= 40) @variable(model, x₂ >= 20) @objective(model, Min, 100*x₁ + 150*x₂) @constraint(model, x₁+x₂ <= 120) end @second_stage sp = begin @decision x₁ x₂ s = scenario @variable(model, 0 <= y₁ <= s.d[1]) @variable(model, 0 <= y₂ <= s.d[2]) @objective(model, Min, s.q[1]*y₁ + s.q[2]*y₂) @constraint(model, 6*y₁ + 10*y₂ <= 60*x₁) @constraint(model, 8*y₁ + 5*y₂ <= 80*x₂) end

  18. StochasticPrograms.jl - Simple Example Explicitly denote that some variables originate from the fjrst stage Stochastic Programming for Hydropower Martin Biel (KTH) 10 / 25 sp = StochasticProgram(solver=ClpSolver()) @first_stage sp = begin @variable(model, x₁ >= 40) @variable(model, x₂ >= 20) @objective(model, Min, 100*x₁ + 150*x₂) @constraint(model, x₁+x₂ <= 120) end @second_stage sp = begin @decision x₁ x₂ s = scenario @variable(model, 0 <= y₁ <= s.d[1]) @variable(model, 0 <= y₂ <= s.d[2]) @objective(model, Min, s.q[1]*y₁ + s.q[2]*y₂) @constraint(model, 6*y₁ + 10*y₂ <= 60*x₁) @constraint(model, 8*y₁ + 5*y₂ <= 80*x₂) end

  19. StochasticPrograms.jl - Simple Example Injection point for scenario data Stochastic Programming for Hydropower Martin Biel (KTH) 10 / 25 sp = StochasticProgram(solver=ClpSolver()) @first_stage sp = begin @variable(model, x₁ >= 40) @variable(model, x₂ >= 20) @objective(model, Min, 100*x₁ + 150*x₂) @constraint(model, x₁+x₂ <= 120) end @second_stage sp = begin @decision x₁ x₂ s = scenario @variable(model, 0 <= y₁ <= s.d[1]) @variable(model, 0 <= y₂ <= s.d[2]) @objective(model, Min, s.q[1]*y₁ + s.q[2]*y₂) @constraint(model, 6*y₁ + 10*y₂ <= 60*x₁) @constraint(model, 8*y₁ + 5*y₂ <= 80*x₂) end

  20. StochasticPrograms.jl - Simple Example Martin Biel (KTH) Stochastic Programming for Hydropower 11 / 25 struct SimpleScenario <: AbstractScenarioData p:: Float64 d:: Vector { Float64 } q:: Vector { Float64 } end StochasticPrograms.probability(s::SimpleScenario) = s.p

  21. StochasticPrograms.jl - Simple Example Add two scenarios to the stochastic program Martin Biel (KTH) Stochastic Programming for Hydropower 11 / 25 struct SimpleScenario <: AbstractScenarioData p:: Float64 d:: Vector { Float64 } q:: Vector { Float64 } end StochasticPrograms.probability(s::SimpleScenario) = s.p s1 = SimpleScenario(0.4,[500.0,100],[-24.0,-28]) s2 = SimpleScenario(0.6,[300.0,300],[-28.0,-32]) append!(sp,[s1,s2])

  22. StochasticPrograms.jl - Simple Example Martin Biel (KTH) Stochastic Programming for Hydropower 11 / 25 print(sp)

  23. StochasticPrograms.jl - Simple Example Martin Biel (KTH) Stochastic Programming for Hydropower 11 / 25 print(sp) First-stage ============== Min 100 x₁ + 150 x₂ Subject to x₁ + x₂ ≤ 120 x₁ ≥ 40 x₂ ≥ 20 Second-stage ============== Subproblem 1: Min -24 y₁ - 28 y₂ Subject to 6 y₁ + 10 y₂ - 60 x₁ ≤ 0 8 y₁ + 5 y₂ - 80 x₂ ≤ 0 0 ≤ y₁ ≤ 500 0 ≤ y₂ ≤ 100 Subproblem 2: Min -28 y₁ - 32 y₂ Subject to 6 y₁ + 10 y₂ - 60 x₁ ≤ 0 8 y₁ + 5 y₂ - 80 x₂ ≤ 0 0 ≤ y₁ ≤ 300 0 ≤ y₂ ≤ 300

  24. • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25

  25. • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly

  26. • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions

  27. • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks

  28. • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks

  29. • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords

  30. • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds

  31. • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds

  32. • Effjcient parallel implementation • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation

  33. • Versatility Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation

  34. Implementation Details Deferred model creation Data injection Implications Martin Biel (KTH) Stochastic Programming for Hydropower 12 / 25 • JuMP models are not created instantly • Model defjnitions are stored in generating lambda functions • These model recipes are then used as building blocks • The generating functions contain certain placeholders keywords • Upon model creation, the keywords contain the required data fjelds • Flexible model creation and reformulation • Effjcient parallel implementation • Versatility

  35. dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg • First stage generator • Second stage generator on all available scenarios • Connections possible due to the @decision annotation • DEP model is cached internally until new scenarios are added Stochastic Programming for Hydropower Martin Biel (KTH) StochasticPrograms.jl - Deterministically Equivalent Model minimize Ax = b s.t. c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n 13 / 25

  36. • First stage generator • Second stage generator on all available scenarios • Connections possible due to the @decision annotation • DEP model is cached internally until new scenarios are added StochasticPrograms.jl - Deterministically Equivalent Model minimize Stochastic Programming for Hydropower Martin Biel (KTH) 13 / 25 Ax = b s.t. c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg

  37. • Second stage generator on all available scenarios • Connections possible due to the @decision annotation • DEP model is cached internally until new scenarios are added StochasticPrograms.jl - Deterministically Equivalent Model minimize Stochastic Programming for Hydropower Martin Biel (KTH) 13 / 25 s.t. Ax = b c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg • First stage generator

  38. • Connections possible due to the @decision annotation • DEP model is cached internally until new scenarios are added StochasticPrograms.jl - Deterministically Equivalent Model minimize Stochastic Programming for Hydropower Martin Biel (KTH) 13 / 25 Ax = b s.t. c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg • First stage generator • Second stage generator on all available scenarios

  39. • DEP model is cached internally until new scenarios are added StochasticPrograms.jl - Deterministically Equivalent Model minimize Stochastic Programming for Hydropower Martin Biel (KTH) 13 / 25 s.t. Ax = b c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg • First stage generator • Second stage generator on all available scenarios • Connections possible due to the @decision annotation

  40. StochasticPrograms.jl - Deterministically Equivalent Model minimize Stochastic Programming for Hydropower Martin Biel (KTH) 13 / 25 Ax = b s.t. c T x + 𝔽 𝜕 [ Q ( x , 𝜊(𝜕))] x ∈ℝ n dep = DEP(sp) Minimization problem with: * 5 linear constraints * 6 variables Solver is ClpMathProg • First stage generator • Second stage generator on all available scenarios • Connections possible due to the @decision annotation • DEP model is cached internally until new scenarios are added

  41. StochasticPrograms.jl - Deterministically Equivalent Model Martin Biel (KTH) Stochastic Programming for Hydropower 13 / 25 print(dep)

  42. StochasticPrograms.jl - Deterministically Equivalent Model Martin Biel (KTH) Stochastic Programming for Hydropower 13 / 25 print(dep) Min 100 x₁ + 150 x₂ - 9.6 y₁_1 - 11.2 y₂_1 - 16.8 y₁_2 - 19.2 y₂_2 Subject to x₁ + x₂ ≤ 120 6 y₁_1 + 10 y₂_1 - 60 x₁ ≤ 0 8 y₁_1 + 5 y₂_1 - 80 x₂ ≤ 0 6 y₁_2 + 10 y₂_2 - 60 x₁ ≤ 0 8 y₁_2 + 5 y₂_2 - 80 x₂ ≤ 0 x₁ ≥ 40 x₂ ≥ 20 0 ≤ y₁_1 ≤ 500 0 ≤ y₂_1 ≤ 100 0 ≤ y₁_2 ≤ 300 0 ≤ y₂_2 ≤ 300

  43. • Extended form solve(sp,solver=ClpSolver()) :Optimal getobjectivevalue(sp) -855.83 • L-shaped solve(sp,solver=LShapedSolver(:ls,ClpSolver())) L-Shaped Gap Time: 0:00:01 (4 iterations) Objective: -855.8333333333358 Gap: 2.1229209144670507e-15 Number of cuts: 5 :Optimal • Convenience function (Value of the recourse problem) VRP(sp,solver=ClpSolver()) -855.83 Stochastic Programming for Hydropower StochasticPrograms.jl - Solving Models Martin Biel (KTH) 14 / 25

  44. • L-shaped solve(sp,solver=LShapedSolver(:ls,ClpSolver())) L-Shaped Gap Time: 0:00:01 (4 iterations) Objective: -855.8333333333358 Gap: 2.1229209144670507e-15 Number of cuts: 5 :Optimal • Convenience function (Value of the recourse problem) VRP(sp,solver=ClpSolver()) -855.83 Stochastic Programming for Hydropower Martin Biel (KTH) StochasticPrograms.jl - Solving Models 14 / 25 • Extended form solve(sp,solver=ClpSolver()) :Optimal getobjectivevalue(sp) -855.83

  45. • Convenience function (Value of the recourse problem) VRP(sp,solver=ClpSolver()) -855.83 StochasticPrograms.jl - Solving Models Stochastic Programming for Hydropower Martin Biel (KTH) 14 / 25 • Extended form solve(sp,solver=ClpSolver()) :Optimal getobjectivevalue(sp) -855.83 • L-shaped solve(sp,solver=LShapedSolver(:ls,ClpSolver())) L-Shaped Gap Time: 0:00:01 (4 iterations) Objective: -855.8333333333358 Gap: 2.1229209144670507e-15 Number of cuts: 5 :Optimal

  46. StochasticPrograms.jl - Solving Models Martin Biel (KTH) Stochastic Programming for Hydropower 14 / 25 • Extended form solve(sp,solver=ClpSolver()) :Optimal getobjectivevalue(sp) -855.83 • L-shaped solve(sp,solver=LShapedSolver(:ls,ClpSolver())) L-Shaped Gap Time: 0:00:01 (4 iterations) Objective: -855.8333333333358 Gap: 2.1229209144670507e-15 Number of cuts: 5 :Optimal • Convenience function (Value of the recourse problem) VRP(sp,solver=ClpSolver()) -855.83

  47. ws = WS(sp,s1) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg • First stage generator • Second stage generator on the given scenario StochasticPrograms.jl - Wait-And-See Models Stochastic Programming for Hydropower Martin Biel (KTH) 𝜊 minimize ̃ for given x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 15 / 25 c T x + Q ( x , ̃

  48. • First stage generator • Second stage generator on the given scenario StochasticPrograms.jl - Wait-And-See Models ̃ Stochastic Programming for Hydropower Martin Biel (KTH) minimize 𝜊 for given x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 15 / 25 c T x + Q ( x , ̃ ws = WS(sp,s1) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg

  49. • Second stage generator on the given scenario StochasticPrograms.jl - Wait-And-See Models for given Stochastic Programming for Hydropower Martin Biel (KTH) minimize ̃ 𝜊 x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 15 / 25 c T x + Q ( x , ̃ ws = WS(sp,s1) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg • First stage generator

  50. StochasticPrograms.jl - Wait-And-See Models for given Stochastic Programming for Hydropower Martin Biel (KTH) minimize ̃ 𝜊 x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 15 / 25 c T x + Q ( x , ̃ ws = WS(sp,s1) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg • First stage generator • Second stage generator on the given scenario

  51. StochasticPrograms.jl - Wait-And-See Models Martin Biel (KTH) Stochastic Programming for Hydropower 15 / 25 print(ws)

  52. StochasticPrograms.jl - Wait-And-See Models Martin Biel (KTH) Stochastic Programming for Hydropower 15 / 25 print(ws) Min 100 x₁ + 150 x₂ - 24 y₁ - 28 y₂ Subject to x₁ + x₂ ≤ 120 6 y₁ + 10 y₂ - 60 x₁ ≤ 0 8 y₁ + 5 y₂ - 80 x₂ ≤ 0 x₁ ≥ 40 x₂ ≥ 20 0 ≤ y₁ ≤ 500 0 ≤ y₂ ≤ 100

  53. function expected(scenarios:: Vector {SimpleScenario}) return SimpleScenario(sum([s.p for s in scenarios]), sum([s.p*s.d for s in scenarios]), sum([s.p*s.q for s in scenarios])) end StochasticPrograms.jl - Expected Value Problems Must be possible to take expectation over scenarios Stochastic Programming for Hydropower Martin Biel (KTH) 𝜊 = 𝔽 𝜕 [𝜊(𝜕)] minimize ̄ where x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 16 / 25 c T x + Q ( x , ̄

  54. StochasticPrograms.jl - Expected Value Problems where Stochastic Programming for Hydropower Martin Biel (KTH) Must be possible to take expectation over scenarios minimize ̄ 𝜊 = 𝔽 𝜕 [𝜊(𝜕)] x ≥ 0 Ax = b s.t. 𝜊) x ∈ℝ n 16 / 25 c T x + Q ( x , ̄ function expected(scenarios:: Vector {SimpleScenario}) return SimpleScenario(sum([s.p for s in scenarios]), sum([s.p*s.d for s in scenarios]), sum([s.p*s.q for s in scenarios])) end

  55. StochasticPrograms.jl - Expected Value Problems Martin Biel (KTH) Stochastic Programming for Hydropower 16 / 25 evp = EVP(sp) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg print(evp)

  56. StochasticPrograms.jl - Expected Value Problems Martin Biel (KTH) Stochastic Programming for Hydropower 16 / 25 evp = EVP(sp) Minimization problem with: * 3 linear constraints * 4 variables Solver is ClpMathProg print(evp) Min 100 x₁ + 150 x₂ - 26.4 y₁ - 30.4 y₂ Subject to x₁ + x₂ ≤ 120 6 y₁ + 10 y₂ - 60 x₁ ≤ 0 8 y₁ + 5 y₂ - 80 x₂ ≤ 0 x₁ ≥ 40 x₂ ≥ 20 0 ≤ y₁ ≤ 380 0 ≤ y₂ ≤ 220

  57. x ̂ = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator • Fixate them to the given values • Generate the second stage problems • Again, linking handled through @decision • Solve resulting JuMP model Stochastic Programming for Hydropower Martin Biel (KTH) StochasticPrograms.jl - Decision Evaulation x + 𝔽 𝜕 [ Q ( ̂ x , 𝜊(𝜕))] 17 / 25 c T ̂

  58. • Fixate them to the given values • Generate the second stage problems • Again, linking handled through @decision • Solve resulting JuMP model StochasticPrograms.jl - Decision Evaulation Stochastic Programming for Hydropower Martin Biel (KTH) 17 / 25 x + 𝔽 𝜕 [ Q ( ̂ x , 𝜊(𝜕))] c T ̂ ̂ x = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator

  59. • Generate the second stage problems • Again, linking handled through @decision • Solve resulting JuMP model StochasticPrograms.jl - Decision Evaulation Stochastic Programming for Hydropower Martin Biel (KTH) 17 / 25 x , 𝜊(𝜕))] x + 𝔽 𝜕 [ Q ( ̂ c T ̂ ̂ x = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator • Fixate them to the given values

  60. • Again, linking handled through @decision • Solve resulting JuMP model StochasticPrograms.jl - Decision Evaulation Stochastic Programming for Hydropower Martin Biel (KTH) 17 / 25 x + 𝔽 𝜕 [ Q ( ̂ x , 𝜊(𝜕))] c T ̂ ̂ x = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator • Fixate them to the given values • Generate the second stage problems

  61. • Solve resulting JuMP model StochasticPrograms.jl - Decision Evaulation Stochastic Programming for Hydropower Martin Biel (KTH) 17 / 25 x , 𝜊(𝜕))] x + 𝔽 𝜕 [ Q ( ̂ c T ̂ ̂ x = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator • Fixate them to the given values • Generate the second stage problems • Again, linking handled through @decision

  62. StochasticPrograms.jl - Decision Evaulation Martin Biel (KTH) Stochastic Programming for Hydropower 17 / 25 x + 𝔽 𝜕 [ Q ( ̂ x , 𝜊(𝜕))] c T ̂ x ̂ = [50,50]; eval_decision(sp,x ̂ ,solver=ClpSolver()) 356.0 • Create fjrst stage variables using generator • Fixate them to the given values • Generate the second stage problems • Again, linking handled through @decision • Solve resulting JuMP model

  63. • Expected wait-and-see solution (EWS) EWS(sp,solver=ClpSolver()) -1518.75 • Expected value of perfect information (EVPI = VRP - EWS) EVPI(sp,solver=ClpSolver()) 662.92 • Value of the stochastic solution (VSS = EEV - VRP) VSS(sp,solver=ClpSolver()) 286.92 Stochastic Programming for Hydropower Martin Biel (KTH) Many of the required calculations are embarassingly parallel StochasticPrograms.jl - Stochastic Measures 18 / 25 • Expected value of using the expected solution (EEV) EEV(sp,solver=ClpSolver()) -568.92

  64. • Expected value of perfect information (EVPI = VRP - EWS) EVPI(sp,solver=ClpSolver()) 662.92 • Value of the stochastic solution (VSS = EEV - VRP) VSS(sp,solver=ClpSolver()) 286.92 Stochastic Programming for Hydropower Martin Biel (KTH) Many of the required calculations are embarassingly parallel StochasticPrograms.jl - Stochastic Measures 18 / 25 • Expected value of using the expected solution (EEV) EEV(sp,solver=ClpSolver()) -568.92 • Expected wait-and-see solution (EWS) EWS(sp,solver=ClpSolver()) -1518.75

  65. • Value of the stochastic solution (VSS = EEV - VRP) VSS(sp,solver=ClpSolver()) 286.92 StochasticPrograms.jl - Stochastic Measures Stochastic Programming for Hydropower Martin Biel (KTH) Many of the required calculations are embarassingly parallel 18 / 25 • Expected value of using the expected solution (EEV) EEV(sp,solver=ClpSolver()) -568.92 • Expected wait-and-see solution (EWS) EWS(sp,solver=ClpSolver()) -1518.75 • Expected value of perfect information (EVPI = VRP - EWS) EVPI(sp,solver=ClpSolver()) 662.92

  66. StochasticPrograms.jl - Stochastic Measures Many of the required calculations are embarassingly parallel Stochastic Programming for Hydropower Martin Biel (KTH) 18 / 25 • Expected value of using the expected solution (EEV) EEV(sp,solver=ClpSolver()) -568.92 • Expected wait-and-see solution (EWS) EWS(sp,solver=ClpSolver()) -1518.75 • Expected value of perfect information (EVPI = VRP - EWS) EVPI(sp,solver=ClpSolver()) 662.92 • Value of the stochastic solution (VSS = EEV - VRP) VSS(sp,solver=ClpSolver()) 286.92

  67. StochasticPrograms.jl - Stochastic Measures Many of the required calculations are embarassingly parallel Stochastic Programming for Hydropower Martin Biel (KTH) 18 / 25 • Expected value of using the expected solution (EEV) EEV(sp,solver=ClpSolver()) -568.92 • Expected wait-and-see solution (EWS) EWS(sp,solver=ClpSolver()) -1518.75 • Expected value of perfect information (EVPI = VRP - EWS) EVPI(sp,solver=ClpSolver()) 662.92 • Value of the stochastic solution (VSS = EEV - VRP) VSS(sp,solver=ClpSolver()) 286.92

  68. LShapedSolvers.jl L-shaped algorithm variants Martin Biel (KTH) Stochastic Programming for Hydropower 19 / 25 • L-shaped [Van Slyke,Wets] • Multicut L-shaped [Birge,Louveaux] • Regularized decomposition [Ruszczyński] • Trust-region L-shaped [Linderoth,Wright] • Level-set [Fábián,Szőke]

  69. • Distributed L-shaped variants 1. Distributed L-shaped with multiple cuts: LShapedSolver(:dls) 2. Distributed regularized L-shaped: LShapedSolver(:drd) 3. Distributed L-shaped with trust region: LShapedSolver(:dtr) 4. Distributed L-shaped with level sets: LShapedSolver(:dlv) • Trait based implementation. Every solver is a combination of a: ∘ Regularization trait ∘ Parallelization trait • Subproblems are solved using MathProgBase solvers Stochastic Programming for Hydropower Martin Biel (KTH) LShapedSolvers.jl 20 / 25 • L-shaped variants 1. L-shaped with multiple cuts (default): LShapedSolver(:ls) 2. L-shaped with regularized decomposition: LShapedSolver(:rd) 3. L-shaped with trust region: LShapedSolver(:tr) 4. L-shaped with level sets: LShapedSolver(:lv)

  70. • Trait based implementation. Every solver is a combination of a: ∘ Regularization trait ∘ Parallelization trait • Subproblems are solved using MathProgBase solvers LShapedSolvers.jl Stochastic Programming for Hydropower Martin Biel (KTH) 20 / 25 • L-shaped variants 1. L-shaped with multiple cuts (default): LShapedSolver(:ls) 2. L-shaped with regularized decomposition: LShapedSolver(:rd) 3. L-shaped with trust region: LShapedSolver(:tr) 4. L-shaped with level sets: LShapedSolver(:lv) • Distributed L-shaped variants 1. Distributed L-shaped with multiple cuts: LShapedSolver(:dls) 2. Distributed regularized L-shaped: LShapedSolver(:drd) 3. Distributed L-shaped with trust region: LShapedSolver(:dtr) 4. Distributed L-shaped with level sets: LShapedSolver(:dlv)

  71. • Subproblems are solved using MathProgBase solvers LShapedSolvers.jl Stochastic Programming for Hydropower Martin Biel (KTH) 20 / 25 • L-shaped variants 1. L-shaped with multiple cuts (default): LShapedSolver(:ls) 2. L-shaped with regularized decomposition: LShapedSolver(:rd) 3. L-shaped with trust region: LShapedSolver(:tr) 4. L-shaped with level sets: LShapedSolver(:lv) • Distributed L-shaped variants 1. Distributed L-shaped with multiple cuts: LShapedSolver(:dls) 2. Distributed regularized L-shaped: LShapedSolver(:drd) 3. Distributed L-shaped with trust region: LShapedSolver(:dtr) 4. Distributed L-shaped with level sets: LShapedSolver(:dlv) • Trait based implementation. Every solver is a combination of a: ∘ Regularization trait ∘ Parallelization trait

  72. LShapedSolvers.jl Martin Biel (KTH) Stochastic Programming for Hydropower 20 / 25 • L-shaped variants 1. L-shaped with multiple cuts (default): LShapedSolver(:ls) 2. L-shaped with regularized decomposition: LShapedSolver(:rd) 3. L-shaped with trust region: LShapedSolver(:tr) 4. L-shaped with level sets: LShapedSolver(:lv) • Distributed L-shaped variants 1. Distributed L-shaped with multiple cuts: LShapedSolver(:dls) 2. Distributed regularized L-shaped: LShapedSolver(:drd) 3. Distributed L-shaped with trust region: LShapedSolver(:dtr) 4. Distributed L-shaped with level sets: LShapedSolver(:dlv) • Trait based implementation. Every solver is a combination of a: ∘ Regularization trait ∘ Parallelization trait • Subproblems are solved using MathProgBase solvers

  73. • The user creates a model recipe using the @hydromodel macro • Defjne model indices • Defjne model data • Defjne modelindices(::AbstractHydroModelData, ::Horizon, args...) • Defjne optimization problem • horizon : the time horizon if the model • indices : structure with model indices • data : structure with model data HydroModels.jl Creating a Planning Problem Data injection keywords Martin Biel (KTH) Stochastic Programming for Hydropower 21 / 25 • Also based on deferred model creation and data injection

  74. • Defjne model indices • Defjne model data • Defjne modelindices(::AbstractHydroModelData, ::Horizon, args...) • Defjne optimization problem • horizon : the time horizon if the model • indices : structure with model indices • data : structure with model data HydroModels.jl Creating a Planning Problem Data injection keywords Martin Biel (KTH) Stochastic Programming for Hydropower 21 / 25 • Also based on deferred model creation and data injection • The user creates a model recipe using the @hydromodel macro

  75. • horizon : the time horizon if the model • indices : structure with model indices • data : structure with model data HydroModels.jl Creating a Planning Problem Data injection keywords Martin Biel (KTH) Stochastic Programming for Hydropower 21 / 25 • Also based on deferred model creation and data injection • The user creates a model recipe using the @hydromodel macro • Defjne model indices • Defjne model data • Defjne modelindices(::AbstractHydroModelData, ::Horizon, args...) • Defjne optimization problem

  76. HydroModels.jl Creating a Planning Problem Data injection keywords Martin Biel (KTH) Stochastic Programming for Hydropower 21 / 25 • Also based on deferred model creation and data injection • The user creates a model recipe using the @hydromodel macro • Defjne model indices • Defjne model data • Defjne modelindices(::AbstractHydroModelData, ::Horizon, args...) • Defjne optimization problem • horizon : the time horizon if the model • indices : structure with model indices • data : structure with model data

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend