02.11.2014 Views

Optimization under Uncertainty

Optimization under Uncertainty

Optimization under Uncertainty

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Stochastic optmization<br />

with applications to network<br />

planning <strong>under</strong> uncertainty<br />

Professor Alexei A. Gaivoronski<br />

Department of Industrial Economics and Technology Management<br />

Norwegian University of Science and Technology<br />

Alexei.Gaivoronski@iot.ntnu.no<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

1


Topics of the course<br />

• Theory of stochastic programming<br />

– Decision models<br />

– Recourse problems<br />

– Approximations<br />

– Simulation and optimization<br />

• Algorithms<br />

– Benders decomposition<br />

– Stochastic dynamic programming<br />

– Stochastic dual dynamic programming<br />

– Stochastic gradients<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

2


Topics of the course<br />

• Applied Decision Models with emphasis on<br />

networks<br />

– Electricity<br />

– Finance<br />

– Telecommunications<br />

– Production planning<br />

– Supply chain management<br />

• Software<br />

– Building blocks for implementation of stochastic<br />

programming models<br />

– Matlab, GAMS, MPL, CPLEX<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

3


Optimal decisions <strong>under</strong> uncertainty<br />

• Worst case analysis<br />

– Too conservative<br />

• Scenario analysis<br />

– Solve deterministic problems for representative scenarios of<br />

uncertainty<br />

– Try to extract the common features from their solutions<br />

• Multiobjective optimization<br />

– Pareto - optimality<br />

• Stochastic optimization<br />

– Provides balanced solution that is not optimal for a given scenario, but<br />

optimal in average<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

4


<strong>Uncertainty</strong><br />

• Demand<br />

• Prices<br />

• Weather<br />

• <strong>Uncertainty</strong> on financial markets<br />

• Actions of competition<br />

<strong>Uncertainty</strong> is described by possible scenarios<br />

with given probabilities (probability<br />

distributions)<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

5


Scenario analysis versus stochastic<br />

optimization<br />

• Example 1: two investment options in energy<br />

sector (per 1000 MW)<br />

• <strong>Uncertainty</strong>: two demand scenarios – 1000 and<br />

2000 MW with 0.5 probability each<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

6


Comparison, continued<br />

• Scenario analysis: find optimal policy for each<br />

scenario and take robust elements which are<br />

good for all scenarios<br />

– hydro is better in both cases.<br />

• Stochastic optimization: minimize average costs<br />

and find flexibilities<br />

– build hydro for first 1000 MW and thermal for<br />

remaining 1000 MW. Expected cost of operation is<br />

smaller because there is no operating costs in the<br />

first scenario<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

7


Example 2: Development of<br />

Telecommunication network<br />

• Three regions example<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

8


Stochastic programming<br />

methodology for decision support <strong>under</strong> uncertainty<br />

expectation model<br />

x - decision variables<br />

- uncertain parameters<br />

maximize average profit<br />

- objective function<br />

- constraints<br />

X - admissible set of simple structure<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

9


Example 3: constant rebalanced<br />

portfolios<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

10


Example 3: constant rebalanced portfolios<br />

Blue lost 25%, black got 120% increase in value<br />

How we should divide our investment between these stocks?<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

11


Questions:<br />

• How should we invest? In blue? black? both?<br />

• What if we keep, say, 30% of our wealth during the<br />

whole period in blue stock? How this compares with<br />

portfolio only from black stock? Shall we obtain better<br />

results? Worse? The same?<br />

• What is the best division of our wealth between two<br />

stocks if our aim is to obtain as much wealth as<br />

possible at the end of the period?<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

12


Change of portfolio value<br />

Black -ABF, blue - AEM, red - 30% AEM and 70% ABF<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

13


Answers:<br />

• We should invest in both stocks<br />

• The final wealth increases by 27% compared to<br />

portfolio which contains only black stock<br />

• Solve fix-mix optimization problem<br />

- portfolio composition<br />

- relative change in asset prices between periods<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

14


Example 4: Markowitz portfolio<br />

Minimize variance of return subject to constraint<br />

on expected return<br />

- fraction of portfolio value invested in asset i<br />

- return of asset i<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

15


performance<br />

Risk-return tradeoff<br />

risk<br />

- vector of average returns<br />

- covariance matrix<br />

Estimates of A and λ<br />

are needed<br />

mean/variance efficient portfolio, Markowitz (1952)<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

16


Risk measures<br />

• Relative regret<br />

• Value at Risk<br />

• Conditional VaR<br />

Uryasev & Rockafellar (1999)<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

17


Stochastic programming<br />

Probabilistic constraints, reliability constraints<br />

x - decision variables<br />

- uncertain parameters<br />

- objective function<br />

- constraints<br />

X - admissible set of simple structure<br />

maximize probability that<br />

profit exceeds some given<br />

level v<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

18


Example: Value at Risk<br />

- profit<br />

- Value at Risk<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

19


Value at Risk (VaR)<br />

distribution of return (value)<br />

VaR<br />

the maximal value which can be lost in<br />

“almost” worst case<br />

• intuitive measure<br />

• industrial standard for risk management<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

20


VaR, %<br />

Value at Risk: examples<br />

Sample VaR of Ford/IBM portfolio<br />

Gaivoronski & Pflug (1999)<br />

blue - 500 trading days, red - 2000 trading days<br />

Fraction of IBM stock<br />

portfolio 1: (0.51283, 0, 0.48717), portfolio 2: (0, 0.67798, 0.32202)<br />

21<br />

Alexei A.Gaivoronski<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

July 2012, University of Cagliari


Mean-Variance/VaR/CVaR efficient frontiers<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

22


Mean-Variance/VaR/CVaR efficient frontiers<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

23


Stochastic Dynamic Programming (SDP)<br />

v t – the state of the system<br />

u t – decision variables<br />

w t – uncertain (random) variables<br />

Goal: identify feasible decisions u that achieve the best<br />

system<br />

performance for a given state v and averaged over a<br />

range of<br />

uncertain inputs w.<br />

v t+1 =T t (v t ,u t ,w t )<br />

C t (v t ,u t ,w t )<br />

state equation<br />

costs at time t<br />

total costs<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

24


Stochastic Dynamic Programming (SDP)<br />

This is a very difficult problem due to large number of<br />

variables and scenarios. It is substituted by a sequence<br />

of smaller problems<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

25


System of connected reservours<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

26


The hydrotermal dispatch problem<br />

(Pereira, 2000)<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

27


Production cost<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

28


Basic SDP step<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

29


Discretizing states<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

30


Last stage calculation<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

31


Future cost function for stage T-1<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

32


Cost calculation for stage T-1<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

33


Implementation of SDP<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

34


Implementation of SDP, continued<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

35


System architecture<br />

MATLAB<br />

Data<br />

Spreadsheet<br />

model<br />

performance<br />

scenarios<br />

Modeler<br />

Top level algorithms<br />

Scenario generation<br />

Postprocessing<br />

Results<br />

User intervention<br />

Excel<br />

LP-solvers<br />

NLP solvers<br />

C,C++,Fortran<br />

NAG<br />

CPLEX<br />

XPRESS(XBSL)<br />

SQG<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

36


LP of the last period T<br />

state equation<br />

demand constraint<br />

bounds<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

37


All other periods T-1,…,1<br />

Objective function<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

38


LP of the all other periods T-1,…,1<br />

state equation<br />

FCF approximation<br />

demand constraint<br />

bounds<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

39


Implementation approach<br />

• Quick prototyping in Matlab possibly with<br />

additional toolboxes<br />

• Compile critical parts of code<br />

• Substitute Matlab solvers by faster compiled<br />

off-shelf solvers (may accelerate execution<br />

20-50 times)<br />

• Use EXCEL link for data input/visualization<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

40


Alternative implementations:<br />

• Direct coding in Fortran/C/C++<br />

– will be somewhat faster, but… for really fast implementation<br />

commercial solvers are needed anyway, so the speed gain<br />

will not be high<br />

• EXCEL and Visual Basic<br />

– possible approach but Matlab architecture is likely to be<br />

faster<br />

• AMPL<br />

– another interpretative language for optimization<br />

• Modeling libraries in MPL, CPLEX, XPRESS<br />

– good for heavier subproblems<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

41


Representation of dependent<br />

inflows<br />

Markov chain approach<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

42


SDP implementation with dependent<br />

inflows: additional state variable<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

43


Continued<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

44


Alternative process<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

45


Alternative process, continued<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

46


Limitations of Stochastic Dynamic<br />

Programming<br />

• Requires solution of optimization problem for<br />

all combination of states of the system<br />

Example: N reservours, M inflow states, K demand<br />

states, P price states, T periods<br />

number of problems T(MKP) N<br />

2 reservour, 3 periods, 10 scenarios for each random<br />

variable: 3000000<br />

- Aggregation and approximation<br />

- Better interpolation schemes<br />

Alexei A.Gaivoronski<br />

July 2012, University of Cagliari<br />

<strong>Optimization</strong> <strong>under</strong> <strong>Uncertainty</strong><br />

47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!