Hey guys.
unfortunately my gams modelling is not running perfectly and I hope that sb of you knows an advice. The problem is the following:
I have defined two alias at the beginning in my sets. The alias-function works perfectly in the sum function but some problems occur if i want to use the alias funciton as well in multiplications. The result is the error 148 and 133.
The example:
Sets
p Set of possible wall positions / 035 /
t Set of periods / 15 /
r Set of rows along one corridor / 12 /
z Set of room lengths according to patients beds / 14 /
alias(p, q);
alias(z, z1, z2);
Parameter
lroom(z) Length of room size z
/
1 8
2 8
3 14
4 14 /
lroommax Maximum of all room lenghts /14/
lroommin Minimum of all room lenghts /8/
Ppos(r) Rightmost position for wall in row r
/
1 35
2 35/
vg(q,p) Position q ungleich position p;
vg(q,p)=1$(ord(q) <> ord(p));
Furhtermore the Demand is definded and the variables as well:
binary variable
s(z,r,p,t) 1 if a wall is the left end of a room;
These are the equations:
GSK… UBcost =e= sum[(z1,z2,t), n(z1,z2,t)$(ord(z1) <> ord(z2))];
NB25(z1,t)… sum[z2, n(z1,z2,t)] =e= z1 * a(z1,t);
NB26(z2,t)… sum[z1, n(z1,z2,t)] =e= z2 * sum[(r,p), s(z2,r,p,t)];
NB27(r,t,p)… sum[z, s(z,r,“0”,t)] =e= 1;
NB28(r,p,t,q)((ord(p) <> card(p)) AND ord(q) gt ord(p)).. sum(z, (q * s(z,r,p,t)) - (p * s(z,r,p,t)) ) + [(p + lroommax ) * (1- sum (z, s(z,r,p,t)))] =g= sum[z, lroom(z) * s(z,r,p,t)];
NB29(z,r,p,t).. s(z,r,p,t) =e= 0;
NB30(r,p,t)(ord(t) > 1)… sum[z, s(z,r,p,t-1)] =e= sum[z, s(z,r,p,t)];
The only errors which still occur are the numbers 148 and 133 in the case of the multiplication and the addition within the equations. The relevant output of the solve windows is followed:
68 GSK… UBcost =e
= sum[(z1,z2,t), n(z1,z2,t)$(ord(z1) <> ord(z2))];
69
70 NB25(z1,t)… sum[z2, n
(z1,z2,t)] =e= z1 * a(z1,t);
**** $148
71 NB26(z2,t)… sum[z1, n
(z1,z2,t)] =e= z2 * sum[(r,p), s(z2,r,p,t)];
**** 148
72 NB27(r,t,p).. sum[z, s(
z,r,"0",t)] =e= 1;
73 NB28(r,p,t,q)((ord(p) <> card(p)) AND ord(q) gt ord(p))… sum(z, (q
- s(z,r,p,t)) - (p * s(z,r,p,t)) ) + [(p + lroommax ) * (1- sum (z, s(z,r
**** $148 $148 $148 $133
,p,t)))] =g= sum[z, lroom(z) * s(z,r,p,t)];
74 NB29(z,r,p,t)…
Does anybody know, how to fix the problem with the 148 error and the 133 error in the multiplication and addition sector?
Thanks for the help so far