42111_DynamicOptimization

download 42111_DynamicOptimization

of 20

Transcript of 42111_DynamicOptimization

  • 7/25/2019 42111_DynamicOptimization

    1/20

    42111 Static and Dynamic OptimizationThe Technical University of Denmark

    Project Two

    Author:Kristn Nanna rmannsdttir, s131163

    Collaborator:Harpa Baldursdttir, s131025

    December 15, 2014

    Teacher:Niels Kjlstad Poulsen

    Department of Mathematical Modelling and Computation

    Technical University of Denmark

  • 7/25/2019 42111_DynamicOptimization

    2/20

    42111 Static and Dynamic Optimization Project Two

    Contents

    Part 1: The Chain 2

    Question 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Question 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Question 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Question 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Part B:Booking Profiles 14

    Question 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Question 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Question 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    1

  • 7/25/2019 42111_DynamicOptimization

    3/20

    42111 Static and Dynamic Optimization Project Two

    Part 1: The Chain

    A chain, which is suspended in two points (0,0), (h,0) has a total length L, the mass Mand consists ofNelements. For a start leth= 4, L= 7, M = 14 and N = 6. The size of the gravity isg = 9.81. The

    elements have equal length and mass. Let

    l= L

    N m=

    M

    N

    The shape of the chain is characterized by the position of the end point of each elements. If i is theelement number andui andvi is the difference between start and end point of the chain in the z - and y-direction, respectively, then

    zy

    i+1

    =

    zy

    i

    +

    uv

    i

    i= 0, 1, ....N1

    Due to the length of each element we have the constraints:

    u2i +v2i =l

    2 (1)

    and since the end point are fixed:

    zy

    0

    =

    00

    zy

    N

    =

    h0

    In steady state the potential energy is minimal. The potential energy can be written as:

    J=N1i=0

    mgyi+yi+1

    2

    This expression do not follow the standard formation, but can be rephrased in several different ways.One way is to rewrite the potential energy as:

    J= 1

    2

    mgy0+1

    2

    mgyN+N1

    i=1

    mgyi

    Another way of rewriting (using the expression for yi+1) the potential energy is:

    J=

    N1i=0

    mg(yi+1

    2vi)

    The constraint in (1) can be respected by introducing the angle between the z-axis and the chain elementand using the fact

    uvi

    =lcos(i)

    sin(i)

    (2)

    2

  • 7/25/2019 42111_DynamicOptimization

    4/20

    42111 Static and Dynamic Optimization Project Two

    Question 1

    The problem is solved by using the relation in equation 2. First we determine the value of the costatevector at the beginning of the chain and then the number of elements in the chain is increased and the

    chain is plotted again.

    In this case the Nterm in the performance index J is zero and the L term is L= mg(yi+ 1

    2vi). The

    Hamiltonian function therefore is:

    Hi = mg(yi+1

    2vi) + (

    zi+1,

    yi+1)

    zy

    i

    +l

    cos(i)sin(i)

    =mg(yi+1

    2 lsin(i) +

    zi+1(zi+lcos(i)) +

    yi+1(yi+lsin(i))

    The necessary condition is given by the Euler-Lagrange equations (for i = 0,...,N 1).

    State equation: zy

    i+1

    =

    zy

    i

    +l

    cos(i)sin(i)

    Costate equations:

    zi =

    zHi=

    zi+1

    yi =

    yHi = mg +

    yi+1

    Stationarity condition:

    0 =

    Hi=1

    2 mglcos(i)zi+1lsin(i) +

    yi+1lcos(i)

    The boundary conditions are:

    zy

    0

    =

    00

    zy

    N

    =

    h0

    The stationarity condition is now solved with respect to decision variable :

    = arctan0.5mg+yi+1

    zi+1

    The costate equations are solved so they are forward in time.

    zi+1= zi

    yi+1= yi mg

    Now we plot the shape of the chain in Matlab, first for N = 6 and then forN= 100.

    3

  • 7/25/2019 42111_DynamicOptimization

    5/20

    42111 Static and Dynamic Optimization Project Two

    1 %The function that calculates the initial values and plots the chain.

    2 function a=q1(l_0,x_0,h,L,M,N)

    3 lz(1)=l_0(1);

    4 ly(1)=l_0(2);

    5 z(1)=x_0(1);

    6 y(1)=x_0(2);7 l=L/N;

    8 m=M/N;

    9 g=9.81;

    10 for i=1:N

    11 lz(1+i)=lz(i);

    12 ly(i+1)=ly(i)m*g;

    13 th(i)=atan((0.5*m*g+ly(1+i))/lz(i+1));

    14 z(i+1)=z(i)+l*cos(th(i));

    15 y(i+1)=y(i)+l*sin(th(i));

    16 end

    17

    18 a=[z(N+1)h; y(N+1)];

    19

    20 plot(z,y);grid;title('The Chain')

    21 xlabel('z axis')

    22 ylabel('y axis')

    1 %Give values to the variables in a separate file.

    2 x_0=[0;0];

    3 h=4;

    4 L=7;

    5 M=14;

    6 N=100;

    7

    8 l_0=[1;1]; %intial guess

    9 opt=optimset;

    10 opt=optimset(opt, 'Display','off');

    11 l_0=fsolve('q1',l_0,opt,x_0,h,L,M,N)

    0 0.5 1 1.5 2 2.5 3 3.5 42.5

    2

    1.5

    1

    0.5

    0

    The Chain

    z axis

    y

    axis

    Figure 1: The chain plotted for N= 6

    The input is a fictional value of the initial costate vector [-1,1] and the output is the error in the terminal

    4

  • 7/25/2019 42111_DynamicOptimization

    6/20

    42111 Static and Dynamic Optimization Project Two

    boundary condition. The value of the initial costate vector forN = 6is:z0y0

    =

    20.299768.6700

    0 0.5 1 1.5 2 2.5 3 3.5 43

    2.5

    2

    1.5

    1

    0.5

    0

    The Chain

    z axis

    y

    axis

    Figure 2: The chain plotted for N= 100

    Corresponding, the value of the initial costate vector forN= 100 is:

    z0y0

    =

    20.299768.6700

    Question 2

    Next we solve the problem by using Pontryagins principle, i.e. by using the constraint in equation 1directly.

    The Hamiltonian function is:

    Hi = mg(yi+ 12 vi) + (zi+1, yi+1)

    zyi

    +

    uvi

    =mg(yi+

    1

    2vi) +

    zi+1(zi+ui) +

    yi+1(yi+vi)

    =vi(1

    2mg+yi+1) +ui

    zi+1+mgyi+

    yi+1yi+

    zi+1zi

    Due to the lenght of each element we have the constraint:

    u2i +v2i =l

    2

    Fori = 0,...,N 1, the necessary conditions are:

    5

  • 7/25/2019 42111_DynamicOptimization

    7/20

    42111 Static and Dynamic Optimization Project Two

    State equation: zy

    i+1

    =

    zy

    i

    +

    uv

    i

    Costate equations:zi =

    zHi=

    zi+1

    yi =

    yHi = mg +

    yi+1

    Optimality condition:uv

    i

    =arg minuiUi,viVi

    [Hi] =arg minuiUi,viVi

    vi(1

    2mg+yi+1) +ui

    zi+1+mgyi+

    yi+1yi+

    zi+1zi)

    The boundary conditions: zy0

    =

    00

    zy

    N

    =

    h0

    zN= 0

    yN= 0

    Because the term in the performance index J and TN = xN

    is equal to zero, the last two boundary

    condition are also zero.

    Next we consider the optimality conditions, the minimization ofHi with respect to ui and vi subject to

    u2i + v2i =l

    2. If the vector

    uv

    i

    is anti parallel to the vector

    zi+1

    1

    2mg+yi+1

    it minimizes the Hamiltonian

    function.

    The optimal vector is:

    uv

    i

    =

    zi+1

    1

    2mg+yi+1

    l

    (zi+1)2 + ( 1

    2mg+yi+1)

    2

    In Matlab, the chain is plotted for N = 6 and N = 100 and the value of the costate vector at thebeginning of the chain is determined by using the fsolve function.

    1 %The function that calculates the initial values and plots the chain.

    2 function a=q2(l_0,x_0,h,L,M,N)

    3 lz(1)=l_0(1);

    4 ly(1)=l_0(2);

    5 z(1)=x_0(1);

    6 y(1)=x_0(2);

    7 l=L/N;

    8 m=M/N;

    9 g=9.81;

    10 for i=1:N

    11 lz(1+i)=lz(i);

    12 ly(i+1)=ly(i)m*g;

    13 u(i)=

    lz(1+i)*l/((lz(1+i))^2+(0.5*m*g+ly(1+i))^2)^0.5;14 v(i)=(0.5*m*g+ly(1+i))*(1/(lz(1+i))^2+(0.5*m*g+ly(1+i))^2)^0.5;

    6

  • 7/25/2019 42111_DynamicOptimization

    8/20

    42111 Static and Dynamic Optimization Project Two

    15 z(i+1)=z(i)+u(i);

    16 y(i+1)=y(i)+v(i);

    17 end

    18

    19 a=[z(N+1)h; y(N+1)];

    20

    21 plot(z,y);grid;title('The Chain')

    22 xlabel('z axis')

    23 ylabel('y axis')

    1 %Give values to the variables in a separate file.

    2 x_0=[0;0];

    3 h=4;

    4 L=7;

    5 M=14;

    6 N=100;

    7

    8 l_0=[1;1]; %intial guess

    9 opt=optimset;

    10 opt=optimset(opt, 'Display','off');11 l_0=fsolve('q2',l_0,opt,x_0,h,L,M,N)

    0 0.5 1 1.5 2 2.5 3 3.5 45000

    4500

    4000

    3500

    3000

    2500

    2000

    1500

    1000

    500

    0

    The Chain

    z axis

    y

    axis

    Figure 3: The chain plotted for N= 6

    The input is a fictional value of the initial costate vector [-1,1] and the output is the error in the terminalboundary condition. The value of the initial costate vector forN = 6 is:

    z0y0

    =

    20.299768.6700

    7

  • 7/25/2019 42111_DynamicOptimization

    9/20

    42111 Static and Dynamic Optimization Project Two

    0 0.5 1 1.5 2 2.5 3 3.5 48

    7

    6

    5

    4

    3

    2

    1

    0x 10

    4 The Chain

    z axis

    y

    axis

    Figure 4: The chain plotted for N= 100

    Corresponding, the value of the initial costate vector forN= 100 is:z0y0

    =

    20.299768.6700

    Question 3

    Now the chain is considered as two symmetric half chains. The symmetry in the problem is utilized toreduce the investigation to a problem just involving the one half of the chain. For simplicity N is assumedeven (i.e. N= 2n). In this case the potential energy is:

    J12

    =1

    2mgyn+

    n1i=1

    mgyi+1

    2mgy0

    The Hamiltonian function is:

    Hi= mgyi+12

    mgy0+ (zi+1,

    yi+1)

    zy

    i

    +

    uv

    i

    =mgyi+1

    2mgy0+ (

    zi+1,

    yi+1)

    zy

    i

    +l

    cos(i)sin(i)

    =mgyi+1

    2mgy0+

    zi+1(zi+lcos(i)) +

    yi+1(yi+lsin(i))

    Nowy0 is equal to zero so 1

    2mgy0 in the Hamiltonian function is zero and the Euler-Lagrange equation

    gives the necessary condition:

    State equation:

    zyi+1 =

    zyi +l

    cos(i)sin(i)

    8

  • 7/25/2019 42111_DynamicOptimization

    10/20

    42111 Static and Dynamic Optimization Project Two

    Costate equations:

    zi =

    zHi =

    zi+1 (3)

    yi =

    yHi= mg +

    yi+1 (4)

    Stationarity condition:

    0 =

    Hi=

    yi+1lcos(i)

    zi+1lsin(i)

    We have a simple partial end point constraint where only a part of the terminal state is fixed. We areonly considering one half of the chain and therefore zn = h/2 and yn is unknown.

    The boundary conditions are:

    zy

    0

    =

    00

    zy

    n

    =

    z

    y

    n

    =

    h/2yn

    zn= z (5)

    yn=

    ynn=

    1

    2mg (6)

    By combining equations3 6 we get:

    zi =z

    yi =mg(ni) +1

    2mg

    By solving the stationary condition with respect to we get:

    = arctan

    yi+1zi+1

    In Matlab we plot the shape of the chain for N= 100 and determine the value of the costate vector atthe end of the chain. The input to the function is our fictional value ofz =1.

    1 %The function that calculates the initial values and plots the chain.

    2 function a=q3(vz,x_0,h,L,M,N)

    3 n=N/2;

    4 l=L/N;

    5 m=M/N;

    6 z(1)=x_0(1);

    7 y(1)=x_0(2);

    8 l=L/N;9 g=9.81;

    9

  • 7/25/2019 42111_DynamicOptimization

    11/20

    42111 Static and Dynamic Optimization Project Two

    10 lz=vz;

    11 for i=1:n

    12 ly(i+1)=m*g*(ni)+0.5*m*g

    13 th(i)=atan((ly(i+1))/lz);

    14 z(i+1)=z(i)+l*cos(th(i));

    15 y(i+1)=y(i)+l*sin(th(i))16 end

    17

    18 a=z(n+1)h/2; %error

    19

    20 plot(z,y);grid;title('The Chain')

    21 xlabel('z axis')

    22 ylabel('y axis')

    1 %Give values to the variables in a separate file.

    2 x_0=[0;0];

    3 h=4;

    4 L=7;

    5 M=14;

    6

    N=100;7

    8 vz=1; %intial guess

    9 opt=optimset;

    10 opt=optimset(opt, 'Display','off');

    11 vz=fsolve('q3',vz,opt,x_0,h,L,M,N)

    0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 23

    2.5

    2

    1.5

    1

    0.5

    0

    The Chain

    z axis

    y

    axis

    Figure 5: The chain plotted for N= 100

    The value of the initial costate vector for N= 100 is:z0y0

    =

    20.299768.6700

    The value of the Lagrange multipier is z =20.2997and yn= 2.6129.

    Question 4

    Now we formulate and solve the problem as a continuous problem.

    10

  • 7/25/2019 42111_DynamicOptimization

    12/20

    42111 Static and Dynamic Optimization Project Two

    Lets denote the distance along the wire and = M/L. The positions along the wire obey:

    d

    ds zsys =

    cos(s)sin(s)i

    with zy

    0

    =

    00

    ,

    zy

    L

    =

    h0

    The potential energy (in equilibrium) is

    J=

    L0

    gysds

    We consider a case with simple end point constraints and = 0.

    The Hamiltonian function is:

    Hs= gys+ [zs,

    ys ]

    cos(s)sin(s)

    =gys+zs cos(s) +

    ys sin(s)

    The state equation:

    d

    ds zsys =

    cos(s)sin(s)

    i

    The costate equation:

    Ts = [

    zsHs,

    ysHs] = [0, g]

    The stationarity condition:

    0T =

    sHs=

    zs sin(s) +

    ys cos(s)

    or

    tan(s) =yszs

    Solving it with respect to gives:

    s= arctan(yszs

    )

    The boundary condition are:

    = zLhyL

    0i

    = 1 00 1

    zLyL

    h0 =

    00

    11

  • 7/25/2019 42111_DynamicOptimization

    13/20

    42111 Static and Dynamic Optimization Project Two

    zy

    0

    =

    00

    We associate two Lagrangian multipliers, z and y, to each of the two terminal constraints:

    [zL, yL] = [z, y]

    1 00 1

    or

    zL= z yL= y

    Combined with the costate equations:

    zs =z ys =y+ g(Ls)

    and from the stationarity condition we get:

    tan(s) = y+g(Ls)

    z

    When determiningz andy, its important that the end point constraints are met.

    Matlab is used to plot the wire and determine the value of the costate vector at the beginning of thewire. The input to the function is our fictional value of the Lagrange multipliers, z =1 and y = 1.

    1 function q4b

    2 x_0=[0;0];

    3 h=4;

    4 L=7;

    5 M=14;

    6 g=9.81;

    7 rho=M/L;

    8 v_0=[1;1];

    9

    10 opt=optimset;

    11 opt=optimset(opt,'Display','off');

    12 [v,a]=fsolve('q4a',v_0,opt,L,rho,g,x_0,h);

    13

    14 [a,s,xs]=q4a(v,L,rho,g,x_0,h);

    15

    16 z=xs(:,1);

    17 y=xs(:,2);

    18 plot(z,y);grid;title('The wire');xlabel('z');ylabel('y')19 s=0;

    20 l=[v(1), v(2)+(Ls)*rho*g]'

    1 function [a,s,xs]=q4a(v_0,L,rho,g,x_0,h)

    2 range=0:0.01:L;

    3 [s,xs]=ode45(@q4,range,x_0,[],v_0,L,rho,g);

    4 zL=xs(end,1);

    5 yL=xs(end,2);

    6 a=[zLh, yL0];

    1 function b=q4(s,x_0,v_0,L,rho,g)

    2 vz=v_0(1);

    3 vy=v_0(2);4 l=[vz, vy+rho*g*(Ls)];

    12

  • 7/25/2019 42111_DynamicOptimization

    14/20

    42111 Static and Dynamic Optimization Project Two

    5 th=atan(l(2)/l(1));

    6 b=[cos(th);sin(th)];

    0 0.5 1 1.5 2 2.5 3 3.5 43

    2.5

    2

    1.5

    1

    0.5

    0

    The wire

    z

    y

    Figure 6: The shape of the wire

    The value of the initial costate vector is:

    z0y0 =

    20.300068.6701

    A new function is created in Matlab in order to plot the Hamiltonian function:

    1 function hamiltonian

    2 x_0=[0;0];

    3 h=4;

    4 L=7;

    5 M=14;

    6 g=9.81;

    7 rho=M/L;

    8 v_0=[1;1];

    9

    10 range=0:0.1:L;

    11 opt=optimset;

    12 opt=optimset(opt,'Display','off');

    13 [v,a]=fsolve('q4a',v_0,opt,L,rho,g,x_0,h);

    14 [a,s,xs]=q4a(v,L,rho,g,x_0,h);

    15 y=xs(:,2);

    16

    17 for i=1:length(s)

    18 l=[v(1), v(2)+rho*g*(Ls(i))];

    19 th=atan(l(2)/l(1));

    20 ys=y(i);

    21 H(i)=rho*g*ys+l(1)*cos(th)+l(2)*sin(th);

    22 end

    23

    24 plot(s,H);grid;title('Hamiltonian function');xlabel('s');ylabel('H(s)')

    13

  • 7/25/2019 42111_DynamicOptimization

    15/20

    42111 Static and Dynamic Optimization Project Two

    0 1 2 3 4 5 6 771.61

    71.6095

    71.609

    71.6085

    71.608

    71.6075

    71.607

    71.6065

    71.606

    71.6055

    Hamiltonian function

    s

    H(s)

    Figure 7: The Hamiltonian plotted as a function of s

    Part B: Booking Profiles

    A small air company has specialized in low profile connections. On one of these connections the companyapplies planes which only have 3 seats available for passengers. If the company does not have passengersbooked for all 3 seats, it costs the company 2000 DKK for each unused seat. On the other hand, if thecompany has booked more passengers than seats available it has to pay 250 DKK in compensation toeach passenger who has booked a seat, but has not got one due to over booking.

    It is possible to book a seat 2 days before departure. The total number of seats that are booked andcanceled in one day, only depends on the number of booked seats (at the beginning of the day). Thenumber of no-shows, i.e. passengers that are not present at departure, depends only on the number ofbooked seats (before departure).

    The company has decided to find a booking strategy that minimizes the average costs due to no-showsand over booking, i.e. minimizing

    J=E{max(2000(3x4), 250(x43))}

    The strategy should be a limit, ui, on the number of allowed bookings on one day. The limit shoulddepend on the number of accepted bookings (at the beginning of the day).

    Letwi be a stochastic variable, which is the result of the booking applications and cancellation in a day(i= 1, 2). That means

    xi+1= xi+min(ui, i) for i= 1, 2

    andx4= x3+3

    where 3 denotes the number of no-shows at departure. Notice, the involved stochastic variables areintegers and ui 0.

    The natural constraint between xi and i (i.e. i xi) is embedded in the (conditional) distributioni.

    14

  • 7/25/2019 42111_DynamicOptimization

    16/20

    42111 Static and Dynamic Optimization Project Two

    The following probabilities are estimated (and assumed to be correct). The total number of bookings onday one is given by the following probabilities:

    P1(w1|x1) = 0.2 0w1 4

    0 otherwise

    or as

    Table 1: The probabilities of the total bookings, 1, on day one

    x1/1 0 1 2 3 40.2 0.2 0.2 0.2 0.2

    The total number of booking applications and cancellations, 2, in day two is given by the probabilities:

    P2(w2|x2) =

    0.1 x2 w2< 3x20.4 w2= 3x2 x3 {0, 1}0.1 3x2< w2 6x20.05 x2 w2< 3x20.7 w2= 3x2 x3 20.05 3x2< w2 6x2

    or as:

    Table 2: Probabilites ofw2 given x2

    x2/w2 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 60 0.1 0.1 0.1 0.4 0.1 0.1 0.11 0.1 0.1 0.1 0.4 0.1 0.1 0.12 0.05 0.05 0.05 0.7 0.05 0.05 0.053 0.05 0.05 0.05 0.7 0.05 0.05 0.054 0.05 0.05 0.05 0.7 0.05 0.05 0.055 0.05 0.05 0,05 0.7 0.05 0.05 0.056 0.05 0.05 0.05 0.7 0.05 0.05

    wherex2 is the total number of accepted bookings after day one.

    The number of no-shows, 3, is given by the following probabilities:

    P2(w3|x3) =

    1 w3= 00 otherwise x3= 00.7 w3= 00.3x3

    x3 w 0

    0 otherwise

    or as:

    15

  • 7/25/2019 42111_DynamicOptimization

    17/20

    42111 Static and Dynamic Optimization Project Two

    Table 3: The probabilities of no-shows, 3, given x3

    x3/3 6 5 4 3 2 1 00 1

    1 0.3 0.72 0.15 0.15 0.73 0.1 0.1 0.1 0.74 0.075 0.075 0.075 0.075 0.75 0.06 0.06 0.06 0.06 0.06 0.76 0.05 0.05 0.05 0.05 0.05 0.05 0.7

    wherex3 is the total number of bookings after the two days and 3 is the (signed) number of no-shows.

    Question 5

    Dynamic programming is used for solving the problem, i.e. for determining the optimal booking strategyfor day 1.

    The performance index, J, is the average cost due to over booking and no-shows:

    J=E{max(2000(3x4), 250(x43))}

    The Bellman function Vi:

    Vi(xi) =mui

    in Ei{Li(xi, ui, i) +Vi+1(xi+1)}

    with the boundary condition:

    VN(xN) = E{N(xN, N)}

    The stochastic Bellman equation:

    Vi(xi) = mui

    inr

    k=1

    pki Li(xi, ui, ki) +Vi+1(fi(xi, ui,

    ki))

    In order to be able to establish V3(x3)we first have to establish V4(x4):

    V4(x4) =E{max(2000(3x4), 250(x43))}

    The results are given in Table4.

    Table 4: The cost of booking

    x4 V40 60001 40002 20003 04 2505 5006 750

    16

  • 7/25/2019 42111_DynamicOptimization

    18/20

    42111 Static and Dynamic Optimization Project Two

    Now we establishV3(x3). The values are denoted as13,23, ...,

    73 and the corresponding probabilities as

    p13, p23, ..., p

    73. In Table3 , the seven possible values of3 with corresponding probabilities can be seen.

    V3(x3) =

    7k=1

    pk3{V4(x3+k3 ) = p13V4(x3+13) +p23V4(x3+23) +...+p73V4(x3+73)

    The numerical values can found in Table5:

    Table 5: Values ofV3

    x3/3 6 5 4 3 2 1 0 V3(x3)0 6000 60001 1800 2800 46002 900 600 1400 29003 600 400 200 0 12004 450 300 150 0 175 1075

    5 360 240 120 0 15 350 10856 300 200 100 0 12.5 25 525 1162.5

    Next we establish the W2(x2, u2) function for each possible combination ofx2 and u2.

    For i=1,2 we have:xi+1= xi+min(ui, i)

    Therefore

    W2(x2, u2) =13k=1

    pk2V3(x2+min(u2, k2 ))

    =p

    1

    2V3(x2+min(u2+

    1

    2 +p

    2

    2V3(x2+min(u2+

    2

    2)+p

    3

    2V3(x2+min(u2+

    3

    2)...+p

    13

    2 V3(x2+min(u2+

    13

    2 )

    In table2 the thirteen values2 can take with the corresponding probabilities are given. The values aredenoted with 12,

    22, ...,

    132 and the corresponding probabilities asp

    12, p

    22, ..., p

    132 .

    In Table6 the Bellman equation is performed on function W2 and the last two columns show the results.The values ofV2(x2)are the minimal values ofW2 for each x2 andu

    2(x2) is the optimizing decision.

    Table 6: Values ofV2

    W2 u2 V2(x2) u

    2(x2)x2 0 1 2 3 4 5 60 6000 4740 3380 2190 2152.5 2154.5 2162.25 2152.5 4

    1 4740 3380 2190 2152.5 2154.5 2162.25 2152.5 32 3140 1695 1676.25 1677.25 1681.13 1676.25 23 1695 1676.25 1677.25 1681.13 1676.25 14 1676.25 1677.25 1681.13 1676.25 05 1677.25 1681.13 1677.25 06 1681.13 1681.13 0

    There is no booking allowed before day one, i.e. x1 = 0. By applying this method we can iterate thesolution backward and find W1 function and therefore V1(x1).

    The results are shown in Table7.

    17

  • 7/25/2019 42111_DynamicOptimization

    19/20

    42111 Static and Dynamic Optimization Project Two

    Table 7: Values ofV1

    W1 u1 V1(x1) u

    1(x1)x1 0 1 2 3 4

    0 2,152.5 2,152.5 1,866.75 1,866.75 1,866.75 1866.75 2,3,4

    Now we know that the number of allowed bookings on day 1, is u1 = 2 4, making up the optimalbooking strategy for day 1 with expected cost of 1,866.75 DKK.

    When there is one booking allowed after day one, i.e. x2= 1, the limit on the number of allowed bookingson day 2 is u2= 3, with the expected cost of 2,152.5 DKK.

    Question 6

    The first pilot has got a special offer. He can book one seat in advance (i.e. before day one). It is assumed

    that the probabilities from question 1 are valid. Lets now find the optimal strategy for day one.To find V1, we use the same method as in question 5. What has changed is that now we have theadditional possibility of having one booking before day one, i.e. x= 0 and x = 1.

    The following Table8 shows the results:

    Table 8: Values ofV1

    W1 u1 V1(x1) u

    1(x1)x1 0 1 2 3 40 2152.5 2152.5 1866.75 1886.75 1866.75 1866.75 2,3,41 2152.5 1771.5 1771.5 1771.5 1771.5 1771.5 1,2,3

    As before, when there is no seat booked in advance i.ex1= 0, the limit on the number of allowed bookingson day one, is u1= 24 with the expected cost of 1,866.75 DKK.

    When there is one seat booked in advance i.e. x1 = 1, the limit on the number of allowed bookings isu1= 13 and expected cost is 1,771.5 DKK.

    The company will give the first pilot a discount. Lets calculate how much discount the company will givethe first pilot if the arrangement is to be neutral.

    The possible discount is 1, 886.751771.5 = 95.25DKK.

    Question 7

    The company is considering if it is profitable to make a more precise forecast for t. The (theoreti-cal) best forecast is obtained, when the outcome of the process t is known precisely beforehand (i.e.full information). If the booking processt is known beforehand overbooking can be avoided. Emptyseat situations can, however, not be avoided, due to the fact that x4 =0, 1 and 2 occurs with certainprobabilities.

    Lets now determine an upper limit for the expected benefits from improving the information level.

    Because overbooking is avoided as a result of an improved information level the values ofV4for x4= 46change to zero as shown in the following Table 9.

    18

  • 7/25/2019 42111_DynamicOptimization

    20/20

    42111 Static and Dynamic Optimization Project Two

    Table 9: The values ofV4 with improved information level

    x4 V40 6000

    1 40002 20003 04 05 06 0

    As a result, we also get new values for V1 - V3 as can be seen in Tables10 - 12.

    Table 10: The values ofV3 with improved information level

    x3 V3

    0 60001 46002 29003 12004 9005 7206 600

    Table 11: The values ofV2 with improved information level

    x2 V2

    0 20521 20522 16263 16264 16265 16266 1626

    Table 12: Values ofV1 with improved information level

    W1 u1 V1(x1) u

    1(x1)

    x1 0 1 2 3 40 2052 2052 1796.4 1796.4 1796.4 1796.4 2,3,4

    The new optimal expected cost for day one is V1 = 1, 796.4 DKK for u1=2, 3 or 4, compared to V1 =1, 866.75 in Question 5.

    The upper limit for the expected benefits from improving the information level is therefore

    1, 866.751, 796.4 = 70.35DKK

    If the limit of number of bookings is u1= 0 or 1, the upper limit is:

    2, 152.52, 052 = 100.5 DKK

    19