Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy:...

50
Stochastic Programming in Energy: Theory vs. Practical Application Andreas Eichhorn VERBUND – Austrian Power Trading AG 6th Annual ÖGOR-IHS-Workshop "Mathematische Ökonomie und Optimierung in der Energiewirtschaft“ Institute for Advanced Studies (IHS), Vienna, Austria September 23, 2010

Transcript of Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy:...

Page 1: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

Stochastic Programming in Energy:Theory vs. Practical Application

Andreas EichhornVERBUND – Austrian Power Trading AG

6th Annual ÖGOR-IHS-Workshop "Mathematische Ökonomie und Optimierung in der Energiewirtschaft“

Institute for Advanced Studies (IHS), Vienna, AustriaSeptember 23, 2010

Page 2: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 2VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Overview

Introduction: medium-term optimization of power generation @ Verbund

Stochastic Programming> (Mixed-integer) Linear Programming in power generation> 2-stage Stochastic Programming> Multi-stage Stochastic Programming> Scenario Trees

Application: A scenario-tree based mean-risk model for optimal hedging

Dynamic Programming Approaches> Dynamic Programming> Stochastic Dynamic Programming> Stochastic Dual Dynamic Programming (SDDP)

Application: SDDP @ Verbund

Conclusion

Page 3: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 3VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Introduction

Mathematical Optimization in the Power Industry

Long-term planning (e.g. 30 years)> Investment decisions> Market models for price forecasting ( marginal cost)

Medium-term planning (few months up to few years)> Rationing / managing of storable energy / limited recourses> Hedging of power generation (i.e., future market sales) > Hedging of power sales contracts (i.e., future market purchases) > Financial planning

Short-term planning > Actual power plant scheduling> Day-ahead bidding @ EPEX, intra-day redispatch

Page 4: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 4VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Introduction

Power generation @ Verbund:

Hydro power ( ≈ 90% in 2009)> Run-of-river plants> Hydro storage plants

Other renewables

Thermal

Page 5: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 5VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Gas Contract and Storage Management @ Verbund

Gasnetwork

Gas-MarktCEGH

Gas Storage

GasStorage

CCGTCHPplant

GasSupply

Contract Heat Demand

Gas

Coal-firedCHP-plant

Flow constraints+ transportation fees

Coal

Flow constraints+ transportation fees

Flow constraints+ transportation fees

yearly minimum / maximum volume

Page 6: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 6VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Thermal Generation Planning Process @ Verbund

Medium-term optimizationSiemens RO

Short-term optimizationSiemens HTC/TOS daily

spot thresholds / benchmarks

Fuel scenariosPFC / Spot price scenarios

hedging

Couplingw.r.t. gas storagemanagement(e.g. viaShadow Prices)

Inflow forecastSpot price forecast actual schedules

Must be consistent with each other

Must be consistent with each other

Page 7: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 7VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Hedging

Spot prices are uncertain, but general price level can be “locked in”

Hedgable vs. Non-Hedgable

0

50

100

150

200

250

300

350

400

450

1. Ja

n.1.

Jan.

1. Ja

n.1.

Jan.

2. Ja

n.2.

Jan.

2. Ja

n.2.

Jan.

3. Ja

n.3.

Jan.

3. Ja

n.3.

Jan.

4. Ja

n.4.

Jan.

4. Ja

n.4.

Jan.

5. Ja

n.5.

Jan.

5. Ja

n.5.

Jan.

6. Ja

n.6.

Jan.

6. Ja

n.6.

Jan.

7. Ja

n.7.

Jan.

7. Ja

n.7.

Jan.

8. Ja

n.8.

Jan.

8. Ja

n.8.

Jan.

P [M

W]

0,00

20,00

40,00

60,00

80,00

100,00

120,00

€ / M

Wh FPL

FPL Base/PeakSpotpreisFuturepreis

Expected hourly prices, unhedgable

Base/Peak-Quotation, hedgable

Power schedule accordingto hourly prices

HedgeableBase/Peak schedule

Page 8: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 8VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Hydro Storage Energy @ Verbund

River Drau

Reißeck Kölnbrein

SOUTH

7 big (yearly) storagesplus many other small (daily) storages, rivers, and run-of-river plantsNorth and south system coupled via reserve responsibilitiesSeasonal hydrologic inflows,x TWh storage energy p.a. vs. ≈ x GW capacity (+ pumping)

€€€, worth to optimize

Malta

Inflow

Zillergrund

Wasserfallboden

River Inn / Danube

Schlegeis Durlaßboden Mooseboden

Inflow

Kaprun

NORTH

InflowInflow

Page 9: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 9VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Challenge in (Hydro) Storage Optimization

….

Task: Turbine water when price is highChallenge (among others):Uncertainty of inflows and spot prices, optionality of resources

[ uncertainty tree ] x [ decision tree ]Hedging! ( = Selling power on forward market) but inflows cannot be hedged …

Page 10: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 10VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Hydro Storage Planning Process @ Verbund

Medium-term optimizationPSR SDDP weekly

Medium-term optimizationSiemens RO

Short-term optimizationSiemens HTC/TOS daily

Watervalues

Watervalues

spot thresholds / benchmarks

Inflow scenarios / statisticsPFC / Spot price scenarios

hedging

Watervalues

Inflow forecastSpot price forecast actual schedules

Page 11: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 11VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Overview

Introduction: medium-term optimization of power generation @ Verbund

Stochastic Programming> (Mixed-integer) Linear Programming in power generation> 2-stage Stochastic Programming> Multi-stage Stochastic Programming> Scenario Trees

Application: A scenario-tree based mean-risk model for optimal hedging

Dynamic Programming Approaches> Dynamic Programming> Stochastic Dynamic Programming> Stochastic Dual Dynamic Programming (SDDP)

Application: SDDP @ Verbund

Conclusion

Page 12: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 12VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

(Mixed-integer) Linear Program:

Mathematical Programming / Mathematical Optimization

or)(cost vect R, vector)side hand(right R,R mnnm cbA ∈∈∈ ×

parameters, given!

Case k=0: LP,very efficient solution algorithms

Case k>0: MIP, NP-hard, good heuristics for special problems

(LP) /(MIP) min. c · x over x ∈ Zk × Rn−k subject to Ax ≥ b

Scalar product ComponentwiseInteger numbers

n, m

calculationtime

Page 13: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 13VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Mathematical Programming in Power Generation

E.g., power plant scheduling, gas and hydro storage management Typical: time structure, e.g., hourly decisions (induced by hourly EPEX prices)

indexation xt,c instead of xj where t=1,…,T and c refers to model component

E.g.:

Hourly price curve (forecast / PFC) hourly schedule for power plant

t=1 2 3 T

subject to T)1,...,(t R over 'minimize1

bAxxxc tnt

T

t tt ≥=∈∑ =

Gassupply

contract

CCGTplant

Gas

Page 14: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 14VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Stochastic Programming:

Deterministic frameworkOptimization / Solver has perfect information about all time steps(as if decision maker were clairvoyant)

somewhat unrealistic

„Scenario Analysis“ / „Monte Carlo“,i.e., repeated solution of LP / MIP with various c, A, b (scenarios)

doesn‘t overcome this problem!

Uncertainty and decision structure / information structure have to be modeled properly

„Stochastic Programming“, „Robust Optimization“, „Online Optimization“, …

Page 15: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 15VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Two-stage Stochastic Programming

LP / MIPSome data (some components of c, A, b) may be uncertain (random)Some decisions may depend on outcome of randomness and some must not!

Segmentation of decision vector x into x=(x1,x2)> x1: here-and-now decisions – one decision for all possible realizations (non-anticipative)

but may depend on the probability distribution of the random data (prospective)> x2: wait-and-see decisions – decision depending on outcome / realization

Example: day-ahead spot auction @ EPEX

Make 1st stage decisions x1

„here and now“

Make 2nd stage decisions x2

„wait and see“

Observe random data

timet=1 t=2

Decision Structure:

Page 16: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 16VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Two-stage Stochastic Programming:

, of nsrealizatio possible allfor subject to

R ),,( ,R over 'minimize

2

1

2212

1 21

bAbxx

A

bAcxxxxx

cE nn

≥⎟⎟⎠

⎞⎜⎜⎝

∈=∈⎥⎦

⎤⎢⎣

⎡⎟⎟⎠

⎞⎜⎜⎝

⎛(SP)

E[.] = expected value functional (linear) as objective, alternatively: risk measure, e.g., VaR(.) / AVaR(.) minimizing risk (nonlinear) “Markowitz”

x2 is a random vector (to be chosen optimally)

In practice: distribution of (c, A, b) must be finite(or be approximated by a finitely many scenarios)

distribution of x2 is also finite can be solved by ordinary LP / MIP solver

Limitation: Decisions must not affect randomnessx1 x2

Page 17: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 17VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Two-stage Stochastic Programming:

Obtain scenarios from samples / quatization from stoch. ModelFor each scenario a “copy” of x2 has to be introducedx1 couples different scenarios

x1 x2

t=1 t=2

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

0 ... 000

0 00

O

M

L

A

( )=A bxx

A ≥⎟⎟⎠

⎞⎜⎜⎝

2

1

≠⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

Sx

xx

x

2

12

1

M

Page 18: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 18VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Two-stage Stochastic Programming:

Use “scenario reduction”techniques to selectrepresentative scenarios !E.g. methods by [Heitsch/Römisch]

Based on Stability theory,approximation such that solutionof stochastic program changes only little

x1 x2

available in GAMS (“scenred”)

Page 19: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 19VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Multi-stage Stochastic Programming

Iteration / generalization of two-stage SP ( 2 T) - dynamic decision process:

Make 1st stage decisions x1

Make final stage decisions xT

Observe some random data

timet=1 t=2

Observe further random data

t=3t=T

Segmentation of decision vector x into x=(x1,x2,x3,…,xT)Each xt> may depend on random outcome observed until time t> must not depend on random outcome observed after time t (non-anticipativity)> may depend on (conditional) probability distribution of all random data (prospectivity)

Make 2nd stage decisions x2

Observe further random data

Page 20: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 20VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Multi-stage Stochastic Programming:

[ ]( )

)1,...,0(, possible allfor T)1,...,(t subject to

T)1,...,(t R ,...,),1,...,0(,...,,,...,over

'minimize

,1

0 ,

1,0,11

1

−==≥

=∈−==

= −

=

tsAbbxA

bbtsAAccxx

xcE

stttt

s stst

ntstttt

T

t tt

t

Theoretically: Universal framework, copes with all kinds of stochastic processes and optionalitiesE[.] expected value functional (linear) as objective, alternatively: risk measure, e.g., VaR(.) / AVaR(.) minimizing risk (nonlinear) “Markowitz”stochastic input data (ct, At,s, bt) (t=1,…,T) is a stochastic process

In practice: distribution of stochastic input process must be finite

(or be approximated by a finite one)Scenario tree

(SP)

Page 21: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 21VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Multi-stage Stochastic Programming:

… xT

t=1 2 3 4 T=5Branching in tree represents consecutive uncertainty

Structure of input data tree= decision structure;

introduce copies ofx2, x3, …, xT

ordinary LP / MIP

scenario tree gets big as Tincreases “curse of dimensionality”

deterministic

Stochastic“scenario tree”

Page 22: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 22VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Scenario Trees

Scenario tree generation via Conditional Sampling orordinary sampling + Scenario Tree Generation techniques (e.g. [Heitsch/Römisch] )

individual scenarios

scenario tree

available in GAMS (“scenred”)

Page 23: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 23VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Scenario Trees

Example: Some electricity demand, 1 week, branching every day

Page 24: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 24VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Overview

Introduction: medium-term optimization of power generation @ Verbund

Stochastic Programming> (Mixed-integer) Linear Programming in power generation> 2-stage Stochastic Programming> Multi-stage Stochastic Programming> Scenario Trees

Application: A scenario-tree based mean-risk model for optimal hedging

Dynamic Programming Approaches> Dynamic Programming> Stochastic Dynamic Programming> Stochastic Dual Dynamic Programming (SDDP)

Application: SDDP @ Verbund

Conclusion

Page 25: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 25VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Situation:

perspective ofa small retailerwith just onepower plant

Page 26: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 26VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Purpose: optimal Hedge-volumes to be sold here-and-now(rolling horizon for future actions)Linear Stochastic ProgramOptimization objective:

Stochastic input data:given by scenario tree(each node carries valuesfor heat and electr. demand, spot prices and arbitrage-freefuture prices, respectively)

t=1,…,T=8760Resulting LPsolved with CPLEX

min 0.9 · ρ(z1, ..., zt, ..., zT )− 0.1 · E[zT ]

Accumulated revenue until t

Expected total revenue (“mean”)Risk Measure

∑ =−=

tt xcz

1':

τ ττ

Page 27: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 27VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Polyhedal risk measuresOur optimization problem (abstract form):

Definition of Polyhedral Risk Measures:

Leads to i.e., a linearstochasticprogram

minx{ρ(z1(x), ..., zT (x)) | Ax ≥ b}

Risk Measure

ρ(z1, ..., zT ) = miny

⎧⎪⎨⎪⎩EhPT

t=1 ct · yti ¯¯ Wy =

⎛⎜⎝ z1...zT

⎞⎟⎠⎫⎪⎬⎪⎭

Artificial Decision vector

Artificial linear objective

minx,y

½EhPT

t=1 ct · yti ¯ Ax ≥ bWy = z(x)

¾

Page 28: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 28VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Polyhedal Risk MeasuresExample: Average-Value-at-Risk (AVaR = CVaR)

Example: Multiperiod Extention of AVaR

AVaRα(zT ) =1α

Z α

0

VaRα(zT )dα = minr∈R

nr + 1

αEh(r + zT )

−io

ρ(z1, ..., zT ) = minr∈R

(r + 1

α(T−1)

TXt=2

Eh(zt + r)

−i)

Evaluates only zT (total profit)

Evaluates entire sequence of revenues

Page 29: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 29VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Results:Accumulated revenues

No risk measure ( max. E[zT] )

AVaR(zT)

MultiperiodPolyhedral Risk Measure

Huge spread (“risk”)

Small spreadStrongly negative values

Even spreadEven spread

[€]

t=

Page 30: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 30VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Results:Total Future Stock

No risk measure ( max. E[zT] )

AVaR(zT)

MultiperiodPolyhedral Risk Measure

[MWh]

Page 31: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 31VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

A scenario-tree based mean-risk model for optimal hedging

Optimal Hedging according to risk measure

Limitation:Only LPLimited level of technical detailLimited number of componentsOnly 40 scenarios (not much more is possible)

poor representation of uncertainty

Page 32: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 32VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Overview

Introduction: medium-term optimization of power generation @ Verbund

Stochastic Programming> (Mixed-integer) Linear Programming in power generation> 2-stage Stochastic Programming> Multi-stage Stochastic Programming> Scenario Trees

Application: A scenario-tree based mean-risk model for optimal hedging

Dynamic Programming Approaches> Dynamic Programming> Stochastic Dynamic Programming> Stochastic Dual Dynamic Programming (SDDP)

Application: SDDP @ Verbund

Conclusion

Page 33: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 33VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

0 00

000

L

M

M

L

A

Mathematical Programming in Power Generation

E.g., power plant scheduling, gas and hydro storage management Typical: time structure, e.g., hourly decisions (induced by hourly EPEX prices)

indexation xt,c instead of xj where t=1,…,T and c refers to model component

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

nt

t

t

t

T x

xx

x

x

xx

x

,

2,

1,

2

1

MM

sparse constraint matrix [ Ax ≥ b ] with staircase structure:t=1 2 3 T

subject to T)1,...,(t R over 'minimize1

bAxxxc tnt

T

t tt ≥=∈∑ =

Page 34: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 34VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Mathematical Programming in Electricity

Often also:

Can easily betransformed into(by introducing additional decision variables)

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

0 00

000

L

M

M

L

A

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

0 00

000

L

M

M

L

A

Time spanning constraint, e.g., yearly maximum

volume of gas contract

Page 35: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 35VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

subject to R over )('min)( 111

⎭⎬⎫

⎩⎨⎧

≥⎟⎟⎠

⎞⎜⎜⎝

⎛∈+= −

+− tt

tt

nttttttt b

xx

AxxCxcxC t

Dynamic Programming:

where CT+1≡0

Bellman principle: Solving C1 problem is equivalent to (LP) / (MIP)

Staircase structure possible to exploit the time structure recursive solution of smaller sub-problems for each time step t:

Future Cost Function

block („stair“) of original matrix A

ImmidiateCost

subject to T)1,...,(t R over 'minimize1

bAxxxc tnt

T

t tt ≥=∈∑ =

(LP) /(MIP)

Page 36: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 36VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Dynamic Programming:

…….

Algorithm:start at t=T with given CT+1 (e.g. CT+1≡0) and proceed backwards t=T-1, T-2,…, 1

Calculate (approximation of) value function / future cost function Ct(xt-1)for all possible (or some representative selection of) states

t=1 t=2 t=3 t=TSt

ates e.g. reservoir /

storage content

Finally, calculate solution xt for t=1,…,T (forward) by using the calculated Ct(.)

subject to R over )('min)( 111

⎭⎬⎫

⎩⎨⎧

≥⎟⎟⎠

⎞⎜⎜⎝

⎛∈+= −

+− tt

tt

nttttttt b

xx

AxxCxcxC t

Page 37: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 37VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Dynamic Programming:

Ct(.) can only be calculated for all possible statesif [# possible states] resp. [ # state variables ] at time t is small

Numerical calculation effort:

> Linear in T (# time steps)major motivation since ordinary LP / MIP effort is superlinear in T

> Exponential in number of state variables („Curse of Dimensionality“)( often prohibitive, e.g. coupled multi-storage system)

Page 38: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 38VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Stochastic Dynamic Programming

= Solving a Multistage Stochastic Program by Dynamic Programming

If (SP) has suitable staircase structure equivalent to minimize C1 where

⎥⎥⎦

⎢⎢⎣

⎪⎭

⎪⎬⎫

⎪⎩

⎪⎨⎧

≥+∈

+=−

+−− −

R

)data,('min)data,(11,0,

1data|data11 1ttttt

nt

tttttttt bxAxAx

xCxcExCt

tt

Can be applied only ifDecision basis / system at time t can be described by few number of statesOnly few components of data is random and is Markov process (or ARq) [ respective past random data additional states ]

Example: gas storage against spot

Future Cost Function

ImmidiateCost

Conditional expectation

datat=(ct,At0,At1,bt)

Page 39: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 39VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Stochastic Dynamic Programming

Advantage: Numerical calculation effort linear in T (# time steps)Verbund Hydro system: too manystates and random components (prices and inflows for each reservoir)

Curse of dimensionality …

…….t=1 t=2 t=3 t=T

…….t=1 t=2 t=3 t=T

Markov process (e.g. spot prices) –„recombining scenario tree“

States (e.g. storage contents)

Algorithm: Recursion1 Backward pass to calculate Ct t=T,T-1,…,11 forward pass for optimal solution

Random components states

Page 40: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 40VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP – Stochastic Dual Dynamic Programming

Based on recursive formulation of multistage stochastic programming

⎥⎥⎦

⎢⎢⎣

⎪⎭

⎪⎬⎫

⎪⎩

⎪⎨⎧

≥+∈

+=−

+−− −

R

)data,('min)data,(11,0,

1data|data11 1ttttt

nt

tttttttt bxAxAx

xCxcExCt

tt

Key observation: Ct(.,.) is convex w.r.t. reservoir contents and inflows (bt)

Idea: Successive systematic approximationof Ct(.,.) from below by cut(ting plane)sobtained via shadow pricesDon‘t calculate Ct(.,.) for all possible states!

Replace Ct+1 by xC and add linear constraint[ xC ≥ cutn ] for each cut

True Ct

Piecwise linear understimator

reservoir content

cutscuts

Page 41: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 41VERBUND APT/STA I Andreas Eichhorn

Algorithm:Fix recombinig scenario tree for spot prices and inflowsas well as some sampled scenarios for the whole time horizonSet Ct≡0 for t=1,…,T and initialize reservoir contents associated to each scenario and each tLoop n=1,2,…> start at t=T with and proceed backwards t=T-1, T-2,…, 1

> caluclate a further cut at current content state for each scenario tree pointby solving Ct problem with current cut approximation of Ct+1(.,.)

> calculate solution for t=1,…,T (forward) by using the calculated Ct(.)and update reservoir contents for each scenario and each t

Stop when reservoir contents don‘t change anymore

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Method

…….t=1 t=2 t=3 t=T

Page 42: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 42VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Overview

Introduction: medium-term optimization of power generation @ Verbund

Stochastic Programming> (Mixed-integer) Linear Programming in power generation> 2-stage Stochastic Programming> Multi-stage Stochastic Programming> Scenario Trees

Application: A scenario-tree based mean-risk model for optimal hedging

Dynamic Programming Approaches> Dynamic Programming> Stochastic Dynamic Programming> Stochastic Dual Dynamic Programming (SDDP)

Application: SDDP @ Verbund

Conclusion

Page 43: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 43VERBUND APT/STA I Andreas Eichhorn

PSR SDDP / Maxrev (www.psr-inc.com) since 1986

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software

Add-in „Maxrev“for handling

stochastic prices

Page 44: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 44VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software – Key characteristics:

Software for medium / long term energy planning (hydro power, thermal power, power grid, gas network, … focus on hydro storage energy!)

Weekly time grid ( t one week)intra-week structure considered by using 5 price segments („blocks“)

Heuristic consideration of head level differences

Hydrologic Inflow stochastics: ARq (auto regressive) where q ≤ 6Price stochastics: must be Markov (can be deduced from given scenarios by clustering method)

Parallel computing possible (we use 8 CPU computer with Win XP 64bit)Cloud computing possible

Excel interface

Page 45: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 45VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software – InputInflow Sum Series

0.00

20.00

40.00

60.00

80.00

100.00

120.00

140.00

160.00

180.00

01/20

1103

/2011

05/20

1107

/2011

09/20

1111

/2011

13/20

1115

/2011

17/20

1119

/2011

21/20

1123

/2011

25/20

1127

/2011

29/20

1131

/2011

33/20

1135

/2011

37/20

1139

/2011

41/20

1143

/2011

45/20

1147

/2011

49/20

1151

/2011

m3/s What you cannot see:Transition probabilities

Page 46: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 46VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software – InputSpot Prices

0.00

20.00

40.00

60.00

80.00

100.00

120.00

140.00

160.00

180.00

06/20

1009

/2010

12/20

1015

/2010

18/20

1021

/2010

24/20

1027

/2010

30/20

1033

/2010

36/20

1039

/2010

42/20

1045

/2010

48/20

1051

/2010

02/20

1105

/2011

08/20

1111

/2011

14/20

1117

/2011

20/20

1123

/2011

26/20

1129

/2011

32/20

1135

/2011

38/20

1141

/2011

44/20

1147

/2011

50/20

11

€/MWh What you cannot see:Transition probabilities

Page 47: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 47VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software – Output content curve scenariosSpeicherganglinien Zillergründl

0.00

10.00

20.00

30.00

40.00

50.00

60.00

70.00

80.00

90.00

100.00

09/20

1011

/2010

13/20

1015

/2010

17/20

1019

/2010

21/20

1023

/2010

25/20

1027

/2010

29/20

1031

/2010

33/20

1035

/2010

37/20

1039

/2010

41/20

1043

/2010

45/20

1047

/2010

49/20

1051

/2010

01/20

1103

/2011

05/20

1107

/2011

09/20

1111

/2011

13/20

1115

/2011

17/20

1119

/2011

21/20

1123

/2011

25/20

1127

/2011

29/20

1131

/2011

33/20

1135

/2011

37/20

1139

/2011

41/20

1143

/2011

45/20

1147

/2011

49/20

1151

/2011

hm3

Page 48: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 48VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP Software – Output water valuesWatervalues Zillergründl

0.00

50.00

100.00

150.00

200.00

250.00

09/20

1011

/2010

13/20

1015

/2010

17/20

1019

/2010

21/20

1023

/2010

25/20

1027

/2010

29/20

1031

/2010

33/20

1035

/2010

37/20

1039

/2010

41/20

1043

/2010

45/20

1047

/2010

49/20

1051

/2010

01/20

1103

/2011

05/20

1107

/2011

09/20

1111

/2011

13/20

1115

/2011

17/20

1119

/2011

21/20

1123

/2011

25/20

1127

/2011

29/20

1131

/2011

33/20

1135

/2011

37/20

1139

/2011

41/20

1143

/2011

45/20

1147

/2011

49/20

1151

/2011

k€/hm3

Page 49: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 49VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

SDDP approach

Pros:Excessive branching (good representation of uncertainty)

Limitation:No consideration of risk / hedgingOnly Markov price processes possibleApproximation scheme SDDP / Maxrev software by PSR Inc.:> weekly time grid only> no integer variables

Page 50: Stochastic Programming in Energy: Theory vs. Practical ... · Stochastic Programming in Energy: Theory vs. Practical Application ... (Mixed-integer) Linear Programming in power generation

23.09.2010 50VERBUND APT/STA I Andreas Eichhorn

Stochastic Programming in Energy:Theory vs. Practical Application

Conclusion

Multistage Stochastic Programming> Most correct method to cope with uncertainty and optionality

from a theoretical point of view> Risk management (Hedging) can be incorporated> Discretization of randomness necessary (“scenario trees”)> „Curse of Dimensionality“ in practiceWhat can we expect?

For Hedging power sales and generation and management of energy storages:> Mean-Risk models incorporating future tradingvs.> Expectation-based stochastic optimization (e.g., SDDP)

+ ex-post calculation of hedge volumesvs.> Deterministic optimization + ex-post calculation of hedge volumesHow much do we lose by using deterministic optimization + hedging?