Problem writing the sets

Problems with syntax of GAMS
Post Reply
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Problem writing the sets

Post by Renger »

Hi
THe trick is to use a mapping (see here in the documentation):

Code: Select all

sets
t   macroperiods  (t=0...T)
s   machine state-oriented microperiods (s=0...S)

;
sets
k   /k0*k3/
t   /t1*t2/
s   /s0*s14/
swith(t,s)    /t1.s1*s7,
        t2.s8*s14/
swithout(t,s) /t1.s1*s6,
        t2.s8*s13/
;   
Equations
    capacitylimit2(k,t,s),
    symetrybreaking2(k,s,t);
...

* Definition of variables and parameters
...
Capacitylimit2(k,t,s)$(swith(t,s))..
    a(k)*q(k,s)+qp(k,s) =l= C(t)*w(k,s)
;
Symetrybreaking2(k,s,t)$swithout(t,s)..
    v(k,s)+v(k,s+1) =l= 1
;
I hope this helps
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply