If you look at the constraint, it needs to be indexed by t and j. Your GAMS code indexes by t, j, and tp. I see no reason for tp. Moreover, when you sum over a tuple (tp,k) your syntax was just wrong. Here is the (IMHO) correct version of Eqn11:

```
Eqn11(PL(j),t).. sum((tp,k)$(ord(tp)<=ord(t)),NU(j,k,tp)) =l= Umax2(j) ;
```

Next problem, its your declaration of tp. You have it independent of t. That difficult if you want to index something with tp that is mean to be indexed over t. I suggest you learn the fundamentals of GAMS domains. For now, as tp is same as t, I made tp an alias of t. I understand that this might not be the solution, but it works for this instance.

Next problem, you have not understood how maps work in GAMS. Read more about how to effectively work with GAMS sets:

```
Eqn37(JRPL(j),t-1).. Wvs(j,t-1) + sum(p, Wo2(p,j,t)) + Won2(j,t) + sum(jp, Wl2(Ajj(j,jp),JRPL(j),t)$offdiag2(j,jp)) - sum(JRPL(j), Wl(JRPL(j),jp,t)$offdiag2(j,jp)) - sum(d, Wl3(JRPL(j),d,t)) - Wvs(JRPL(j),t) =e= WD(JRPL(j),t) ;
```

The construct “sum(jp, Wl2(Ajj(j,jp),JRPL(j),t)$offdiag2(j,jp))” does not work. You probably mean “sum(Ajj(j,jp), Wl2(jp,JRPL(j),t)$offdiag2(j,jp))”.

There are many many more errors. Many are of the same type (e.g. you sum over an index that is already controlled or you use JRPL(j) in the equation definition, then you either need to use j or just JRPL to index symbols on the left, but not JRPL(j), …).

You (as everybody) will make lots of mistakes translating a complex model from Word/LaTeX to GAMS. Even if the model in Word/LaTeX is “correct”, have you though about how to debug the GAMS model. This is a major task.

I have attached the model with my edits. It still does not compile but I have corrected some errors and the types of the remaining ones (I believe) I already corrected before.

Good luck.

-Michael

WSC1.gms (22.4 KB)