## Equations with different dimensions Topic is solved

Problems with modeling
Amir48
User Posts: 2
Joined: 3 months ago

### Equations with different dimensions

Hello everybody.
I have some equations with different dimension and variable A is used in both of them. For example. The first equation has one dimension (A(i)). but the second equation has two dimension (i and j).

eq1(i).. A(i) =e= x(i)+y(i);
eq2(i,j).. B(i,j) =e= A(i,j)+c(i,j);

(if i=1:3, j=1,2 and A(i)=[6,7,8] then A(i,j)=[6,7,8;6,7,8] )
Actually, values of variable A are same for different values of the second dimension (j). The dimensions of variable A are different
in two equations, Then GAMS can't solve the problem. How can I solve this problem?
I added another equation and solve this problem but I think It's not a good idea for that. GAMS didn't give me any error for my solution.
My solution:
eq1(i).. A(i) =e= x(i)+y(i);
eq2(i,j).. B(i,j) =e= A2(i,j)+c(i,j);
eq3(i).. A2(i,j) =e=A(i);
Thank you for your help.

Fred
Posts: 86
Joined: 2 years ago

### Re: Equations with different dimensions

Hi,

Not sure if I really understood the problem but to me it seems that you should just drop the j index for A and should be good:

Code: Select all

``````eq1(i).. A(i) =e= x(i)+y(i);
eq2(i,j).. B(i,j) =e= A(i)+c(i,j);
``````
I hope this helps!

Best,
Fred

Amir48
User Posts: 2
Joined: 3 months ago

### Re: Equations with different dimensions

Hi Fred,
Thank you a lot. It's so helpful for me.
Best wishes,
Amir