! windh4.lng;
! Stochastic dynamic programming in Markov Chains (for spatial pulse harvesting)
  solved with linear programming when there are stochastic windthrows.;
! Lohmander Peter 99-10-15;

model:
sets:
time/1..5/:rev1, rev2, rev12;
state/1..4/:;
ss(state, state):trans;
ts(time, state):w;
endsets
 

horizon = 5;
r = .03;
perl = 5;

v01 = 100;
v11 = 9;
p01 = 200;
p11 = 1;
L1 = 2000;

v02 = 100;
v12 = 9;
p02 = 200;
p12 = 1;
L2 = 2000;

min = @sum(ts(t,s):w(t,s));

@for(ts(t,s1)|t#LT#horizon: [wait]w(t,s1) > @sum(state(s2):trans(s1,s2) * w(t+1,s2)) );

@for(time(t)|t#LT#horizon: [cut1if1]w(t,2) > rev1(t));

@for(time(t)|t#LT#horizon: [cut2if2]w(t,3) > rev2(t));

@for(time(t)|t#LT#horizon: [cut1if12]w(t,4) > rev1(t)+@sum(state(s2):trans(3,s2) * w(t+1,s2)));

@for(time(t)|t#LT#horizon: [cut2if12]w(t,4) > rev2(t)+@sum(state(s2):trans(2,s2) * w(t+1,s2)));

@for(time(t)|t#LT#horizon: [cut12if12]w(t,4) > rev12(t));

w(horizon,1) = 0;
w(horizon,2) = rev1(horizon);
w(horizon,3) = rev2(horizon);
w(horizon,4) = rev12(horizon);

@for(ts(t,s):rev1(t) = @exp(-t*perl*r)*((p01+p11*perl*t)*(v01+v11*perl*t)+L1));
@for(ts(t,s):rev2(t) = @exp(-t*perl*r)*((p02+p12*perl*t)*(v02+v12*perl*t)+L2));
@for(ts(t,s):rev12(t) = rev1(t)+rev2(t)+500);
 

! State = 1 when no stand is standing.
  State = 2 when stand 1 is standing and stand 2 is down.
  State = 3 when stand 2 is standing and stand 1 is down.
  State = 4 when both stands (1 and 2) are standing.
;

data:

trans =  .0  .0   .0    .0
            .1   .9   .0    .0
            .1   0.   .9    .0
            .01 .02 .02   .95
;

enddata
end
 

-----------------------------------------------------
RESULTS:
Objective value:                 665864.5

                       Variable           Value        Reduced Cost
                        HORIZON        5.000000           0.0000000E+00
                              R       0.3000000E-01       0.0000000E+00
                           PERL        5.000000           0.0000000E+00
                            V01        100.0000           0.0000000E+00
                            V11        9.000000           0.0000000E+00
                            P01        200.0000           0.0000000E+00
                            P11        1.000000           0.0000000E+00
                             L1        2000.000           0.0000000E+00
                            V02        100.0000           0.0000000E+00
                            V12        9.000000           0.0000000E+00
                            P02        200.0000           0.0000000E+00
                            P12        1.000000           0.0000000E+00
                             L2        2000.000           0.0000000E+00

                       REV1( 1)        27305.96           0.0000000E+00
                       REV1( 2)        31040.28           0.0000000E+00
                       REV1( 3)        33491.42           0.0000000E+00
                       REV1( 4)        34904.42           0.0000000E+00
                       REV1( 5)        35486.54           0.0000000E+00

                       REV2( 1)        27305.96           0.0000000E+00
                       REV2( 2)        31040.28           0.0000000E+00
                       REV2( 3)        33491.42           0.0000000E+00
                       REV2( 4)        34904.42           0.0000000E+00
                       REV2( 5)        35486.54           0.0000000E+00

                      REV12( 1)        55111.92           0.0000000E+00
                      REV12( 2)        62580.57           0.0000000E+00
                      REV12( 3)        67482.84           0.0000000E+00
                      REV12( 4)        70308.84           0.0000000E+00
                      REV12( 5)        71473.07           0.0000000E+00

                   TRANS( 1, 1)       0.0000000E+00       0.0000000E+00
                   TRANS( 1, 2)       0.0000000E+00       0.0000000E+00
                   TRANS( 1, 3)       0.0000000E+00       0.0000000E+00
                   TRANS( 1, 4)       0.0000000E+00       0.0000000E+00
                   TRANS( 2, 1)       0.1000000           0.0000000E+00
                   TRANS( 2, 2)       0.9000000           0.0000000E+00
                   TRANS( 2, 3)       0.0000000E+00       0.0000000E+00
                   TRANS( 2, 4)       0.0000000E+00       0.0000000E+00
                   TRANS( 3, 1)       0.1000000           0.0000000E+00
                   TRANS( 3, 2)       0.0000000E+00       0.0000000E+00
                   TRANS( 3, 3)       0.9000000           0.0000000E+00
                   TRANS( 3, 4)       0.0000000E+00       0.0000000E+00
                   TRANS( 4, 1)       0.1000000E-01       0.0000000E+00
                   TRANS( 4, 2)       0.2000000E-01       0.0000000E+00
                   TRANS( 4, 3)       0.2000000E-01       0.0000000E+00
                   TRANS( 4, 4)       0.9500000           0.0000000E+00

                       W( 1, 1)       0.0000000E+00        1.000000
                       W( 1, 2)        27936.25           0.0000000E+00
                       W( 1, 3)        27936.25           0.0000000E+00
                       W( 1, 4)        64055.38           0.0000000E+00

                       W( 2, 1)       0.0000000E+00        1.210000
                       W( 2, 2)        31040.28           0.0000000E+00
                       W( 2, 3)        31040.28           0.0000000E+00
                       W( 2, 4)        66119.76           0.0000000E+00

                       W( 3, 1)       0.0000000E+00        1.019500
                       W( 3, 2)        33491.42           0.0000000E+00
                       W( 3, 3)        33491.42           0.0000000E+00
                       W( 3, 4)        68189.58           0.0000000E+00

                       W( 4, 1)       0.0000000E+00        1.028525
                       W( 4, 2)        34904.42           0.0000000E+00
                       W( 4, 3)        34904.42           0.0000000E+00
                       W( 4, 4)        70308.84           0.0000000E+00

                       W( 5, 1)       0.0000000E+00       0.0000000E+00
                       W( 5, 2)        35486.54           0.0000000E+00
                       W( 5, 3)        35486.54           0.0000000E+00
                       W( 5, 4)        71473.07           0.0000000E+00

                            Row    Slack or Surplus      Dual Price

                    WAIT( 1, 1)       0.0000000E+00       0.0000000E+00
                    WAIT( 1, 2)       0.0000000E+00       -1.000000
                    WAIT( 1, 3)       0.0000000E+00       -1.000000
                    WAIT( 1, 4)       0.0000000E+00       -1.000000

                    WAIT( 2, 1)       0.0000000E+00       0.0000000E+00
                    WAIT( 2, 2)        898.0070           0.0000000E+00
                    WAIT( 2, 3)        898.0070           0.0000000E+00
                    WAIT( 2, 4)       0.0000000E+00       -1.950000

                    WAIT( 3, 1)       0.0000000E+00       0.0000000E+00
                    WAIT( 3, 2)        2077.438           0.0000000E+00
                    WAIT( 3, 3)        2077.438           0.0000000E+00
                    WAIT( 3, 4)       0.0000000E+00       -2.852500

                    WAIT( 4, 1)       0.0000000E+00       0.0000000E+00
                    WAIT( 4, 2)        2966.539           0.0000000E+00
                    WAIT( 4, 3)        2966.539           0.0000000E+00
                    WAIT( 4, 4)        989.9609           0.0000000E+00

                    CUT1IF1( 1)        630.2939           0.0000000E+00
                    CUT1IF1( 2)       0.0000000E+00       -1.920000
                    CUT1IF1( 3)       0.0000000E+00       -1.039000
                    CUT1IF1( 4)       0.0000000E+00       -1.057050

                    CUT2IF2( 1)        630.2939           0.0000000E+00
                    CUT2IF2( 2)       0.0000000E+00       -1.920000
                    CUT2IF2( 3)       0.0000000E+00       -1.039000
                    CUT2IF2( 4)       0.0000000E+00       -1.057050

                   CUT1IF12( 1)        8813.164           0.0000000E+00
                   CUT1IF12( 2)        4937.197           0.0000000E+00
                   CUT1IF12( 3)        3284.181           0.0000000E+00
                   CUT1IF12( 4)        3466.539           0.0000000E+00

                   CUT2IF12( 1)        8813.164           0.0000000E+00
                   CUT2IF12( 2)        4937.197           0.0000000E+00
                   CUT2IF12( 3)        3284.181           0.0000000E+00
                   CUT2IF12( 4)        3466.539           0.0000000E+00

                  CUT12IF12( 1)        8943.458           0.0000000E+00
                  CUT12IF12( 2)        3539.190           0.0000000E+00
                  CUT12IF12( 3)        706.7425           0.0000000E+00
                  CUT12IF12( 4)       0.0000000E+00       -3.709875
 

Welcome to the home page of Peter Lohmander: http://www.sekon.SLU.se/~PLO