! stdph3.lng;
! Stochastic dynamic programming in Markov chains (for pulse harvesting)
  solved with linear programming;
! Lohmander Peter 99-10-14;

! Adjusted after clever comments by Kristina Rylander 99-10-22. The index definitions are easier to understand in this version.  However, the results are the same as with the earlier version of the model.;

model:

sets:
time/1..5/:;
price/1..5/:;
pp(price, price):trans;
tp(time, price):w, rev;
endsets

r = .03;
perl = 5;
v0 = 100;
v1 = 5;
p0 = 50;
p1 = 50;
horizon = 5;
L = 2000;

min = @sum(tp(t,p):w(t,p));

@for(price(p):w(horizon,p) = rev(horizon,p));

@for(tp(t,p):rev(t,p) = @exp(-t*perl*r)*((v0 + t*perl*v1)*(p0 + p*p1) + L));

@for(tp(t,p)|t#LT#horizon: [cut]w(t,p) > @exp(-t*perl*r)*((v0 + t*perl*v1)*(p0 + p*p1) + L) );

@for(tp(t,pt1)|t#LT#horizon: [wait]w(t,pt1) > @sum(price(pt2):trans(pt1,pt2) * w(t+1,pt2)) );

data:

trans = .3 .4 .3 .0 .0
            .2 .5 .2 .1 .0
            .1 .2 .4 .2 .1
            .0 .1 .2 .5 .2
            .0 .0 .3 .4 .3
;

enddata

end
-----------------------------------------------------------
RESULTS:

 Objective value:                 621874.9

                       Variable           Value        Reduced Cost
                              R       0.3000000E-01       0.0000000E+00
                           PERL        5.000000           0.0000000E+00
                             V0        100.0000           0.0000000E+00
                             V1        5.000000           0.0000000E+00
                             P0        50.00000           0.0000000E+00
                             P1        50.00000           0.0000000E+00
                        HORIZON        5.000000           0.0000000E+00
                              L        2000.000           0.0000000E+00
                   TRANS( 1, 1)       0.3000000           0.0000000E+00
                   TRANS( 1, 2)       0.4000000           0.0000000E+00
                   TRANS( 1, 3)       0.3000000           0.0000000E+00
                   TRANS( 1, 4)       0.0000000E+00       0.0000000E+00
                   TRANS( 1, 5)       0.0000000E+00       0.0000000E+00
                   TRANS( 2, 1)       0.2000000           0.0000000E+00
                   TRANS( 2, 2)       0.5000000           0.0000000E+00
                   TRANS( 2, 3)       0.2000000           0.0000000E+00
                   TRANS( 2, 4)       0.1000000           0.0000000E+00
                   TRANS( 2, 5)       0.0000000E+00       0.0000000E+00
                   TRANS( 3, 1)       0.1000000           0.0000000E+00
                   TRANS( 3, 2)       0.2000000           0.0000000E+00
                   TRANS( 3, 3)       0.4000000           0.0000000E+00
                   TRANS( 3, 4)       0.2000000           0.0000000E+00
                   TRANS( 3, 5)       0.1000000           0.0000000E+00
                   TRANS( 4, 1)       0.0000000E+00       0.0000000E+00
                   TRANS( 4, 2)       0.1000000           0.0000000E+00
                   TRANS( 4, 3)       0.2000000           0.0000000E+00
                   TRANS( 4, 4)       0.5000000           0.0000000E+00
                   TRANS( 4, 5)       0.2000000           0.0000000E+00
                   TRANS( 5, 1)       0.0000000E+00       0.0000000E+00
                   TRANS( 5, 2)       0.0000000E+00       0.0000000E+00
                   TRANS( 5, 3)       0.3000000           0.0000000E+00
                   TRANS( 5, 4)       0.4000000           0.0000000E+00
                   TRANS( 5, 5)       0.3000000           0.0000000E+00

                       W( 1, 1)        22168.67           0.0000000E+00
                       W( 1, 2)        22693.85           0.0000000E+00
                       W( 1, 3)        25538.85           0.0000000E+00
                       W( 1, 4)        28659.25           0.0000000E+00
                       W( 1, 5)        33997.96           0.0000000E+00

                       W( 2, 1)        20757.53           0.0000000E+00
                       W( 2, 2)        21379.29           0.0000000E+00
                       W( 2, 3)        24632.33           0.0000000E+00
                       W( 2, 4)        29262.32           0.0000000E+00
                       W( 2, 5)        34818.46           0.0000000E+00

                       W( 3, 1)        19161.13           0.0000000E+00
                       W( 3, 2)        19816.22           0.0000000E+00
                       W( 3, 3)        23609.00           0.0000000E+00
                       W( 3, 4)        29171.49           0.0000000E+00
                       W( 3, 5)        34750.73           0.0000000E+00

                       W( 4, 1)        16887.10           0.0000000E+00
                       W( 4, 2)        17949.93           0.0000000E+00
                       W( 4, 3)        23050.09           0.0000000E+00
                       W( 4, 4)        28538.21           0.0000000E+00
                       W( 4, 5)        34026.32           0.0000000E+00

                       W( 5, 1)        11572.98           0.0000000E+00
                       W( 5, 2)        16887.10           0.0000000E+00
                       W( 5, 3)        22201.23           0.0000000E+00
                       W( 5, 4)        27515.35           0.0000000E+00
                       W( 5, 5)        32829.48           0.0000000E+00

                     REV( 1, 1)        12480.27           0.0000000E+00
                     REV( 1, 2)        17859.69           0.0000000E+00
                     REV( 1, 3)        23239.12           0.0000000E+00
                     REV( 1, 4)        28618.54           0.0000000E+00
                     REV( 1, 5)        33997.97           0.0000000E+00

                     REV( 2, 1)        12593.91           0.0000000E+00
                     REV( 2, 2)        18150.05           0.0000000E+00
                     REV( 2, 3)        23706.18           0.0000000E+00
                     REV( 2, 4)        29262.32           0.0000000E+00
                     REV( 2, 5)        34818.46           0.0000000E+00

                     REV( 3, 1)        12433.75           0.0000000E+00
                     REV( 3, 2)        18013.00           0.0000000E+00
                     REV( 3, 3)        23592.24           0.0000000E+00
                     REV( 3, 4)        29171.49           0.0000000E+00
                     REV( 3, 5)        34750.73           0.0000000E+00

                     REV( 4, 1)        12073.86           0.0000000E+00
                     REV( 4, 2)        17561.97           0.0000000E+00
                     REV( 4, 3)        23050.09           0.0000000E+00
                     REV( 4, 4)        28538.21           0.0000000E+00
                     REV( 4, 5)        34026.32           0.0000000E+00

                     REV( 5, 1)        11572.98           0.0000000E+00
                     REV( 5, 2)        16887.10           0.0000000E+00
                     REV( 5, 3)        22201.23           0.0000000E+00
                     REV( 5, 4)        27515.35           0.0000000E+00
                     REV( 5, 5)        32829.48           0.0000000E+00

                            Row    Slack or Surplus      Dual Price
                     CUT( 1, 1)        9688.407           0.0000000E+00
                     CUT( 1, 2)        4834.156           0.0000000E+00
                     CUT( 1, 3)        2299.737           0.0000000E+00
                     CUT( 1, 4)        40.70540           0.0000000E+00
                     CUT( 1, 5)       0.0000000E+00       -1.000000
                     CUT( 2, 1)        8163.619           0.0000000E+00
                     CUT( 2, 2)        3229.241           0.0000000E+00
                     CUT( 2, 3)        926.1470           0.0000000E+00
                     CUT( 2, 4)       0.0000000E+00       -1.800000
                     CUT( 2, 5)       0.0000000E+00       -1.300000
                     CUT( 3, 1)        6727.380           0.0000000E+00
                     CUT( 3, 2)        1803.228           0.0000000E+00
                     CUT( 3, 3)        16.76230           0.0000000E+00
                     CUT( 3, 4)       0.0000000E+00       -1.640000
                     CUT( 3, 5)       0.0000000E+00       -1.210000
                     CUT( 4, 1)        4813.247           0.0000000E+00
                     CUT( 4, 2)        387.9570           0.0000000E+00
                     CUT( 4, 3)       0.0000000E+00       -3.375000
                     CUT( 4, 4)       0.0000000E+00       -1.868000
                     CUT( 4, 5)       0.0000000E+00       -1.276000

                    WAIT( 1, 1)       0.0000000E+00       -1.000000
                    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( 1, 5)        4457.800           0.0000000E+00
                    WAIT( 2, 1)       0.0000000E+00       -1.600000
                    WAIT( 2, 2)       0.0000000E+00       -2.200000
                    WAIT( 2, 3)       0.0000000E+00       -2.100000
                    WAIT( 2, 4)        1023.006           0.0000000E+00
                    WAIT( 2, 5)        5641.940           0.0000000E+00
                    WAIT( 3, 1)       0.0000000E+00       -2.130000
                    WAIT( 3, 2)       0.0000000E+00       -3.160000
                    WAIT( 3, 3)       0.0000000E+00       -2.760000
                    WAIT( 3, 4)        1692.111           0.0000000E+00
                    WAIT( 3, 5)        6212.530           0.0000000E+00
                    WAIT( 4, 1)       0.0000000E+00       -2.547000
                    WAIT( 4, 2)       0.0000000E+00       -3.984000
                    WAIT( 4, 3)        848.8594           0.0000000E+00
                    WAIT( 4, 4)        2085.678           0.0000000E+00
                    WAIT( 4, 5)        6510.969           0.0000000E+00

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