Gather-Update-Solve-Scatter (GUSS) (link:https://www.gams.com/latest/docs/S_GUSS.html)gives me a very good insight to solve multiple models with different parameters efficiently. However when I was going to implement my own model, it has some problems which I cannot figure out. I tried to solve one model with 64 different parameters, i.e.64 LPs via GUSS modeling like follows.

Code: Select all

```
Set i /1*4/
j /1*3/
s /1*64/;
**** Scenario Data ****
parameter rhsy(s,j);
loop(s$(ord(s)<=16),
rhsy(s,'1') = 0;
);
loop(s$(ord(s)<=32 and ord(s)>16),
rhsy(s,'1') = 1;
);
loop(s$(ord(s)<=48 and ord(s)>32),
rhsy(s,'1') = 2;
);
loop(s$(ord(s)>49),
rhsy(s,'1') = 3;
);
loop(s$(ord(s)=1 or ord(s)=17 or ord(s)=32 or ord(s)=49),
rhsy(s,'2') = 0;
rhsy(s+1,'2') = 0;
rhsy(s+2,'2') = 0;
rhsy(s+3,'2') = 0;
);
loop(s$(ord(s)=5 or ord(s)=21 or ord(s)=36 or ord(s)=53),
rhsy(s,'2') = 1;
rhsy(s+1,'2') = 1;
rhsy(s+2,'2') = 1;
rhsy(s+3,'2') = 1;
);
loop(s$(ord(s)=9 or ord(s)=25 or ord(s)=40 or ord(s)=57),
rhsy(s,'2') = 2;
rhsy(s+1,'2') = 2;
rhsy(s+2,'2') = 2;
rhsy(s+3,'2') = 2;
);
loop(s$(ord(s)=13 or ord(s)=29 or ord(s)=44 or ord(s)=61),
rhsy(s,'2') = 3;
rhsy(s+1,'2') = 3;
rhsy(s+2,'2') = 3;
rhsy(s+3,'2') = 3;
);
loop(s$(ord(s)=1 or ord(s)=5 or ord(s)=9 or ord(s)=13 or ord(s)=17 or ord(s)=21 or ord(s)=25 or ord(s)=29 or ord(s)=33 or ord(s)=37 or ord(s)=41 or ord(s)=45 or ord(s)=49 or ord(s)=53 or ord(s)=57 or ord(s)=61),
rhsy(s,'3') = 0;
rhsy(s+1,'3') = 1;
rhsy(s+2,'3') = 2;
rhsy(s+3,'3') = 3;
);
display rhsy;
parameter prob(s);
prob(s)=0.25*0.25*0.25;
**** Model Data ****
Parameter coefy(i,j),x(i);
coefy('1','1')=40;
coefy('2','1')=45;
coefy('3','1')=32;
coefy('4','1')=55;
coefy('1','2')=24;
coefy('2','2')=27;
coefy('3','2')=19.2;
coefy('4','2')=33;
coefy('1','3')=4;
coefy('2','3')=4.5;
coefy('3','3')=3.2;
coefy('4','3')=5.5;
x('1') = 0; x('2') = 0; x('3') = 0; x('4') = 12;
equation obj,s2c2,s2d2;
variable objective;
positive variable y(i,j);
parameter rhsy2(j);
parameter Ds2c2p(s,i);
parameter Ds2d2p(s,j);
obj.. sum(i,sum(j,coefy(i,j)*y(i,j))) =e= objective;
s2c2(i).. sum(j,y(i,j))-x(i) =l= 0;
S2d2(j).. sum(i,y(i,j)) =g= rhsy2(j);
model mymodel /all/;
Set dict /s. scenario. ''
rhsy2. param. rhsy
s2c2. marginal. Ds2c2p
s2d2. marginal. Ds2d2p
/;
* GUSS Method
solve mymodel min objective use lp scenario dict;
$ontext
loop(s,
rhsy2(j) = rhsy(s,j);
solve mymodel use lp min objective;
Ds2c2p(s,i) = s2c2.m(i);
Ds2d2p(s,j) = s2d2.m(j);
);
$offtext
```

If you delete the solving code of GUSS method, and the $ontext $offtext in the very end, which is going to solve the problem traditionally, it works fine.

I have gone through the GUSS documentation but found nothing useful for this issue. Does anybody have any idea?

BTW you might find the way I created the rhsy parameter a little bit tedious, but I do not have any other idea to do this. My another topic is relevant to this.

viewtopic.php?f=9&t=10428

Best,

Gabriel