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 /13/
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?

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

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

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.
formula.png