Hi Ashu

No, this will not work the way you wrote it. First, you define an equation

obj which is not defined over a set but the equation itself is over I and J.

If you define obj over I, you will run into problems because you now have I

and J in the equation but the equation is only over I.

Obj(I)…q(I) =E= (10/3) - (2/3) * P(I) - (1/3)* P(J) ;

To get rid of that problem you could write something like (if the set I has

only two elements):

Obj(I)…q(I) =E= (10/3) - (2/3) * P(I) - sum(J$(not sameas(I,J),(1/3)* P(J))

;

(sameas(J,I) checks if J is equal to I)

Another solution might be: write obj(i,j) and have a flag that drops the

equations obj(1,1) and obj(2,2))

Parameter flag(i,j)

Flag(i,j) = 1;

Flag(“1”,“1”) = 0;

Flag(“2”,“2”) = 0;

Obj(I,J)$flag(I,J)…q(I) =E= (10/3) - (2/3) * P(I) - (1/3)* P(J) ;

Hope this helps

Renger

-----Original Message-----

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On

Behalf Of ashu

Sent: Thursday, June 25, 2009 10:55 PM

To: gamsworld

Subject: Query writing equation

Hi,

I wish to write this equation in GAMS. q1 = 10/3 - (2/3) * P1 - (1/3)* P 2

and q2 = 10/3 - (2/3) * P2 - (1/3)* P 1. If i write it like this will GAMS

differentiate betwen I and J. Pl suggest if it is correct or how else can it

be written.

Set I /1*2/ ;

alias (i, j) ;

Variables P(I) , q(I) ;

Equation

Obj ;

obj…q(I) = (10/3) - (2/3) * P(I) - (1/3)* P(J) ;

Thanks

Ashu

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

\