## two-stage stochastic programming with recourse

Problems with modeling
Norshela
User
Posts: 4
Joined: 2 years ago

### two-stage stochastic programming with recourse

Hi, I run below code to maximize oil refinery profit using two-stage stochastic programming with recourse model and I found that there is no value for decision variable y1w1,y1w2, x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19, x20. Is there something wrong with my model? Please help me. Thank you.

[\$TITLE Stochastic Two-stage program with all prices and demand scenarios
set i row labels /1*6/
s column lables /H, L/
k production shortfall and surplus or yield decrement or increment /1, 2/

Table pc(i,s) "price of product type i per realization j"

H L
1 476.4 453.8
2 965.7 932.0
3 547.2 529.3
4 652.7 623.7
5 998.7 955.3
6 462.5 413.6;

Table d(i,s) "demand of product type i per realization j"

H L
2 9054.24 8530.92
3 228.79 184.48
4 1797.94 1676.61
5 4898.06 4690.22
6 399.46 313.69;

Table c(i,k) penalty cost for product type r due to production shortfall or surplus
1 2
2 25 20
3 17 13
4 5 4
5 6 5
6 10 8;

Positive Variables

y1w1,y1w2, x2, x3, x4, x5, x6,x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20,
z211, z212, z221, z222, z231, z232,z241,z242,
z311, z312, z321, z322, z331, z332,z341,z342,
z411, z412, z421, z422, z431, z432,z441,z442,
z511, z512, z521, z522, z531, z532,z541,z542,
z611, z612, z621, z622, z631, z632,z641,z642;

Variables

Z2;

Scalars

p1 "probability for crude oil price scenario 1" /0.5/
p2 "probability for crude oil price scenario 2" /0.5/
pgPH "probability for gasoline price high " /0.4764/
pgPL "probability for gasoline price low" /0.5236/
pnPH "probability for naphtha price high " /0.5091/
pnPL "probability for naphtha price low" /0.4908 /
pjfPH "probability for jet fuel price high " /0.5/
pjfPL "probability for jet fuel price low" /0.5 /
phoPH "probability for jet fuel price high " /0.4531 /
phoPL "probability for jet fuel price low" /0.5468 /
pfoPH "probability for jet fuel price high " /0.5064 /
pfoPL "probability for jet fuel price low" /0.4935 /

pgDH "probability for gasoline demand high " /0.5/
pgDL "probability for gasoline demand low" /0.5/
pnDH "probability for naphtha demand high " /0.5/
pnDL "probability for naphtha demand low" /0.5/
pjfDH "probability for jet fuel demand high " /0.5/
pjfDL "probability for jet fuel demand low" /0.5/
phoDH "probability for heating oil demand high " /0.5/
phoDL "probability for heating oil demand low" /0.5/
pfoDH "probability for fuel oil demand high " /0.5/
pfoDL "probability for fuel oil demand low" /0.5/

Equations

OBJ "maximize profit",
CON1,CON2,CON65,
EQN66, EQN67,
EQN130, EQN131,
EQN194, EQN195,
EQN258, EQN259,
EQN322, EQN323,
EQN386,EQN387,EQN388,EQN389,EQN453,EQN517,EQN581,EQN645,EQN709,EQN710,
EQN711,EQN712,

CONgas1, CONgas2, CONgas3, CONgas4,
CONnap1, CONnap2, CONnap3,CONnap4,
CONjf1, CONjf2, CONjf3,CONjf4,
CONho1, CONho2, CONho3,CONho4,
CONfo1, CONfo2, CONfo3,CONfo4;

OBJ.. Z2 =E=
-150*x14
+[p1*(-pc('1','H')-50)*y1w1 + p2*(-pc('1','L')-50)*y1w2]
+[(pgPH*pgDH)*( pc('2','H')*d('2','H') -(c('2','1')*z211 + c('2','2')*z212))]
+[(pgPH*pgDL)*( pc('2','H')*d('2','L') - (c('2','1')*z221 + c('2','2')*z222))]
+[(pgPL*pgDH)*( pc('2','L')*d('2','H') - (c('2','1')*z231 + c('2','2')*z232))]
+[(pgPL*pgDL)*( pc('2','L')*d('2','L') - (c('2','1')*z241 + c('2','2')*z242))]
+[(pnPH*pnDH)*( pc('3','H')*d('3','H') - (c('3','1')*z311 + c('3','2')*z312))]
+[(pnPH*pnDL)*( pc('3','H')*d('3','L') - (c('3','1')*z321 + c('3','2')*z322))]
+[(pnPL*pnDH)*( pc('3','L')*d('3','H') - (c('3','1')*z331 + c('3','2')*z332))]
+[(pnPL*pnDL)*( pc('3','L')*d('3','L') - (c('3','1')*z341 + c('3','2')*z342))]
+ [(pjfPH*pjfDH)*( pc('4','H')*d('4','H')- (c('4','1')*z411 + c('4','2')*z412))]
+ [(pjfPH*pjfDL)*( pc('4','H')*d('4','L') - (c('4','1')*z421 + c('4','2')*z422))]
+ [(pjfPL*pjfDH)*( pc('4','L')*d('4','H') - (c('4','1')*z431 + c('4','2')*z432))]
+ [(pjfPL*pjfDL)*( pc('4','L')*d('4','L') - (c('4','1')*z441 + c('4','2')*z442))]
+ [(phoPH*phoDH)*( pc('5','H')*d('5','H') - (c('5','1')*z511 + c('5','2')*z512))]
+ [(phoPH*phoDL)*( pc('5','H')*d('5','L') - (c('5','1')*z521 + c('5','2')*z522))]
+ [(phoPL*phoDH)*( pc('5','L')*d('5','H') - (c('5','1')*z531 + c('5','2')*z532))]
+ [(phoPL*phoDL)*( pc('5','L')*d('5','L') - (c('5','1')*z541 + c('5','2')*z542))]
+ [(pfoPH*pfoDH)*( pc('6','H')*d('6','H') - (c('6','1')*z611 + c('6','2')*z612))]
+ [(pfoPH*pfoDL)*( pc('6','H')*d('6','L') - (c('6','1')*z621 + c('6','2')*z622))]
+ [(pfoPL*pfoDH)*( pc('6','L')*d('6','H') - (c('6','1')*z631 + c('6','2')*z632))]
+ [(pfoPL*pfoDL)*( pc('6','L')*d('6','L') - (c('6','1')*z641 + c('6','2')*z642))]
;

CON1.. y1w1 =L= 15000;
CON2.. y1w2 =L= 15000;
CON65.. x14 =L= 2500;
EQN66.. -0.25*y1w1 + x7 =E= 0;
EQN67.. -0.25*y1w2 + x7 =E= 0;
EQN130.. -0.17*y1w1 + x4 =E= 0;
EQN131.. -0.17*y1w2 + x4 =E= 0;
EQN194.. -0.22*y1w1 + x8 =E= 0;
EQN195.. -0.22*y1w2 + x8 =E= 0;
EQN258.. -0.20*y1w1 + x9 =E= 0;
EQN259.. -0.20*y1w2 + x9 =E= 0;
EQN322.. -0.16*y1w1 + x10 =E= 0;
EQN323.. -0.16*y1w2 + x10 =E= 0;
EQN386.. -0.05*x14 + x20 =E= 0;
EQN387.. -0.40*x14 + x16 =E= 0;
EQN388.. -0.55*x14 + x17 =E= 0;
EQN389.. 0.5*x2 - x11 =E= 0;
EQN453.. 0.5*x2 - x16 =E= 0;
EQN517.. 0.75*x5 - x12 =E= 0;
EQN581.. 0.25*x5 - x18 =E= 0;
EQN645.. -x7 + x3 +x11 =E= 0;
EQN709.. -x8 + x12 +x13 =E= 0;
EQN710.. -x9 + x14 +x15 =E= 0;
EQN711.. -x17 + x18 +x19 =E= 0;
EQN712.. -x10 - x13 - x15 - x19 + x6 =E= 0;

CONgas1.. x2 + z211 - z212 =E= d('2','H');
CONnap1.. x3 + z311 - z312 =E= d('3','H');
CONjf1.. x4 + z411 - z412 =E= d('4','H');
CONho1.. x5 + z511 - z512 =E= d('5','H');
CONfo1.. x6 + z611 - z612 =E= d('6','H');

CONgas2.. x2 + z221 - z222 =E= d('2','L');
CONnap2.. x3 + z321 - z322 =E= d('3','L');
CONjf2.. x4 + z421 - z422 =E= d('4','L');
CONho2.. x5 + z521 - z522 =E= d('5','L');
CONfo2.. x6 + z621 - z622 =E= d('6','L');

CONgas3.. x2 + z231 - z232 =E= d('2','H');
CONnap3.. x3 + z331 - z332 =E= d('3','H');
CONjf3.. x4 + z431 - z432 =E= d('4','H');
CONho3.. x5 + z531 - z532 =E= d('5','H');
CONfo3.. x6 + z631 - z632 =E= d('6','H');

CONgas4.. x2 + z241 - z242 =E= d('2','L');
CONnap4.. x3 + z341 - z342 =E= d('3','L');
CONjf4.. x4 + z441 - z442 =E= d('4','L');
CONho4.. x5 + z541 - z542 =E= d('5','L');
CONfo4.. x6 + z641 - z642 =E= d('6','L');

Model REFINERY / ALL /;

Solve REFINERY Using LP Maximizing Z2;]