Using 2 dimensional sets

Problems with syntax of GAMS
Post Reply
sepid-az
User
User
Posts: 2
Joined: 1 week ago

Using 2 dimensional sets

Post by sepid-az » 1 week ago

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: 54
Joined: 1 year ago

Re: Using 2 dimensional sets

Post by Fred » 1 week ago

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
User
Posts: 2
Joined: 1 week ago

Re: Using 2 dimensional sets

Post by sepid-az » 1 week ago

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
formula.png (3.37 KiB) Viewed 58 times

Post Reply