Dear GAMS users,
I used EMP to modelling risk averse stochastic programming model but I am not handle an error. This error is “Unknown symbol in position three in scenario dictionaryâ€
My model is given below:
sets
i resources /15/
j demands /110/
s scenarios /1*5/
;
table vplus(j,s) revenue earned for meeting demand
1 2 3 4 5
1 61.7339 92.6008 92.6008 92.6008 92.6008
2 65.6236 87.4982 65.6236 87.4982 65.6236
3 58.3977 116.795 58.3977 87.5965 87.5965
4 55.8842 83.8263 111.768 83.8263 111.768
5 146.956 110.217 110.217 146.956 146.956
6 52.5879 78.8819 105.176 78.8819 78.8819
7 78.9768 105.302 105.302 105.302 78.9768
8 87.1911 87.1911 58.1274 87.1911 58.1274
9 89.2922 59.5281 59.5281 59.5281 119.056
10 52.8557 105.711 105.711 79.2835 79.2835
;
table vminus(j,s) revenue lost for not meeting demand
1 2 3 4 5
1 4.30892 6.46339 6.46339 6.46339 6.46339
2 2.7388 3.65174 2.7388 3.65174 2.7388
3 1.74214 3.48428 1.74214 2.61321 2.61321
4 1.14463 1.71695 2.28927 1.71695 2.28927
5 7.39115 5.54337 5.54337 7.39115 7.39115
6 1.64888 2.47331 3.29775 2.47331 2.47331
7 3.71647 4.95529 4.95529 4.95529 3.71647
8 1.31119 1.31119 0.874125 1.31119 0.874125
9 6.66814 4.44543 4.44543 4.44543 8.89086
10 1.9531 3.90621 3.90621 2.92965 2.92965
;
parameter bincost(i) cost of buying resource
/1 379.82,
2 998.71,
3 660.982,
4 450.587,
5 705.414
/;
parameter bincapacity(i) capacity of each resource
/1 56.3192,
2 56.6673,
3 64.3774,
4 56.0216,
5 56.9795/
;
table demandsize(j,s) capacity request of each customer under scenario s
1 2 3 4 5
1 4 6 6 6 6
2 6 8 6 8 6
3 4 8 4 6 6
4 4 6 8 6 8
5 8 6 6 8 8
6 4 6 8 6 6
7 6 8 8 8 6
8 6 6 4 6 4
9 6 4 4 4 8
10 4 8 8 6 6
;
parameter binQoS(i) Quality of Service Level offered by backbone
/1 2,
2 2,
3 1,
4 1,
5 1
/
;
parameter demandQoS(j) Quality of Service Level requested by customer
/1 2,
2 1,
3 1,
4 1,
5 2,
6 1,
7 1,
8 1,
9 2,
10 1
/
;
parameter prob(s) probability of scenarios
/
1 0.133469,
2 0.314772,
3 0.273688,
4 0.27726,
5 0.00081085
/;
scalar
theta relative volume / [1-0.9] /
lambda weight EV versus CVaR /0/
;
alias(j,jj);
parameter
mvp(j)
mvm(j)
mds(j)
dvp(j,s)
dvm(j,s)
dds(j,s)
cvp(j,jj)
cvm(j,jj)
cds(j,jj)
tvp
tvm
tds
mv(j)
p(j)
sd(j)
;
mvp(j) = sum(s, vplus(j,s))/card(s);
mvm(j) = sum(s, vminus(j,s))/card(s);
mds(j) = sum(s, demandsize(j,s))/card(s);
dvp(j,s) = vplus(j,s)-mvp(j);
dvm(j,s) = vminus(j,s)-mvm(j);
dds(j,s) = demandsize(j,s)-mds(j);
cvp(j,jj) =sum(s, dvp(j,s)*dvp(jj,s))/(card(s)-1);
cvm(j,jj) =sum(s, dvm(j,s)*dvm(jj,s))/(card(s)-1);
cds(j,jj) =sum(s, dds(j,s)*dds(jj,s))/(card(s)-1);
tvp = sum(j, mvp(j))/card(j);
tvm = sum(j,mvm(j))/card(j);
tds = sum(j,mds(j))/card(j);
mv(j) = mvp(j);
p(j) =mvm(j);
sd(j) = mds(j);
binary variables
x(i) is 1 if resource is selected otherwise 0;
positive variables
y(i,j) amount of bandwidth of customer j satisfied from resource i in scenario s
v(j) total amount of satisfied bandwidth demand of customer j in scenario s;
variables
r objective of subscenarios
obj objective of master
CVaR_r conditional value at risk of subscenarios
EV_r expected value of subscearios
;
equations
fobj
sobj
cap(i) Capacity constraints
qos(i,j) QoS constraints
dsc(j) Demand satisfaction constraints
;
fobj… obj=e= lambda*EV_r+(1-lambda)*CVaR_r+sum(i,x(i)*bincost(i));
sobj… r=e=sum(j,p(j)*sum(i,y(i,j)))-sum(j, mv(j)*v(j));
cap(i)… sum(j,y(i,j)*sd(j))=l= x(i)bincapacity(i);
qos(i,j)… y(i,j)(binQoS(i)-demandQoS(j))=g=0;
dsc(j)… v(j)+sum(i,y(i,j))=e=1;
model minrisk /all/;
file emp / ‘%emp.info%’ /
put emp ‘* problem %gams.i%’
/‘ExpectedValue r EV_r’
/‘cvarlo r CVaR_r’ theta
/‘stage 2 r y v mv p sd sobj cap qos dsc’
/‘stage 1 obj fobj’
/"jrandvar sd(‘1’) p(‘1’) mv(‘1’) sd(‘2’) p(‘2’) mv(‘2’) sd(‘3’) p(‘3’) mv(‘3’) sd(‘4’) p(‘4’) mv(‘4’) sd(‘5’) p(‘5’) mv(‘5’) sd(‘6’) p(‘6’) mv(‘6’) sd(‘7’) p(‘7’) mv(‘7’) sd(‘8’) p(‘8’) mv(‘8’) sd(‘9’) p(‘9’) mv(‘9’) sd(‘10’) p(‘10’) mv(‘10’) "
loop(s,
put /prob(s) demandsize(‘1’,s) vplus(‘1’,s) vminus(‘1’,s) demandsize(‘2’,s) vplus(‘2’,s) vminus(‘2’,s) demandsize(‘3’,s) vplus(‘3’,s) vminus(‘3’,s) demandsize(‘4’,s) vplus(‘4’,s) vminus(‘4’,s) demandsize(‘5’,s) vplus(‘5’,s) vminus(‘5’,s) demandsize(‘6’,s) vplus(‘6’,s) vminus(‘6’,s) demandsize(‘7’,s) vplus(‘7’,s) vminus(‘7’,s) demandsize(‘8’,s) vplus(‘8’,s) vminus(‘8’,s) demandsize(‘9’,s) vplus(‘9’,s) vminus(‘9’,s) demandsize(‘10’,s) vplus(‘10’,s) vminus(‘10’,s));
putclose emp;
Set dict / s .scenario.‘’
sd. randvar. s_sd
p. randvar. s_p
mv. randvar. s_mv
r. level. s_r
y. level. s_y
v. level. s_v /;
solve minrisk using emp max obj scenario dict;
display s_r;
display CVaR_r.l;
display EV_r.l;
Thanks in advance,
Have a nice day,
Nazmi
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.