Using 2 dimensional sets

Problems with syntax of GAMS
sepid-az
User Posts: 2
Joined: 11 months ago

Using 2 dimensional sets

Hi,
I would like to define a 2 dimensional set, use it as a variable index and use them in an equation. But I get error using following lines:"Dimensions different"

sets
f /1*3/
r /1*3/
fr(f,r) /1.1
2.(1,2)
3.(1,3)/;
binary variables
v(f,r,gb);
equatios:
e7(d,gb).. k(d,gb)=e= sum(fr,(1-min(abs(mod(d,f)-r),1))*v(fr,gb));
Could anyone help me with please?

Fred
Posts: 134
Joined: 2 years ago

Re: Using 2 dimensional sets

Hi,

To me it seems that the problem isn't caused by variable v or its domain but by the fact that you use the mod function on sets which isn't possible. I also notice that f and r are not under control in the sum.
Maybe you want something like

Code: Select all

``````e7(d,gb).. k(d,gb)=e= sum(fr(f,r),(1-min(abs(mod(d.val,f.val)-r.val),1))*v(fr,gb));
``````
but that's just a guess. If you could share your code along with an explanation of what you try to implement, you might get better help.

Best,
Fred

sepid-az
User Posts: 2
Joined: 11 months ago

Re: Using 2 dimensional sets

Thank you Fred
Im actually trying to write this formula and but didnt know how to make r index to be less then f index.
Attachments formula.png (3.37 KiB) Viewed 386 times