how to use subsets in equations

My problem requirement is as follows:

sets
n / a, b, c, d/
i(n) /a,b/
j(n) /c/
k(n) /d/ ;

Variables inv(i,n), F(i,n),y(n,j);

Equation eq1, eq2;

  • eq1 is loop from b to d excluding a (condition?)

eq1(i,n)$()… inv(i,n) =e= inv(i,n-1) - F(i,n-1);


*in eq2, n1 is intersection of i and j and exclusion of k

  • and n2 is usage of j and k intersection by excluding i

eq2(i,n1,n2)$()… y(n1,j) + y(n2,j) =l= 1;


It would be grateful, if some helps in bulding code for my requirement. thanks in advance.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi Rajesekhar

You can use $(not sameas(n,”a”)) or any variation of this (see the documentation).

This checks if an element of n is equal to a. If yes, due to the “not” the equation is excluded.

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Rajasekhar Kadambur
Sent: Dienstag, 9. September 2014 12:33
To: gamsworld@googlegroups.com
Subject: how to use subsets in equations



My problem requirement is as follows:

sets
n / a, b, c, d/
i(n) /a,b/
j(n) /c/
k(n) /d/ ;

Variables inv(i,n), F(i,n),y(n,j);

Equation eq1, eq2;

  • eq1 is loop from b to d excluding a (condition?)

eq1(i,n)$()… inv(i,n) =e= inv(i,n-1) - F(i,n-1);


*in eq2, n1 is intersection of i and j and exclusion of k

  • and n2 is usage of j and k intersection by excluding i

eq2(i,n1,n2)$()… y(n1,j) + y(n2,j) =l= 1;


It would be grateful, if some helps in bulding code for my requirement. thanks in advance.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

thanks for your quick response,

  1. if it is for one term its fine but i have a large set for ‘a’. could you explain how to handle those.

  2. kindly look in to equation 2 and post your response

On Tuesday, September 9, 2014 4:03:27 PM UTC+5:30, Rajasekhar Kadambur wrote:

My problem requirement is as follows:

sets
n / a, b, c, d/
i(n) /a,b/
j(n) /c/
k(n) /d/ ;

Variables inv(i,n), F(i,n),y(n,j);

Equation eq1, eq2;

  • eq1 is loop from b to d excluding a (condition?)

eq1(i,n)$()… inv(i,n) =e= inv(i,n-1) - F(i,n-1);


*in eq2, n1 is intersection of i and j and exclusion of k

  • and n2 is usage of j and k intersection by excluding i

eq2(i,n1,n2)$()… y(n1,j) + y(n2,j) =l= 1;


It would be grateful, if some helps in bulding code for my requirement. thanks in advance.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Why don’t you use subsets for the first equation:

nna(n) /b,c,d/,

inna(n) /c,d/



same thing for the second one.

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Rajasekhar Kadambur
Sent: Dienstag, 9. September 2014 13:31
To: gamsworld@googlegroups.com
Subject: Re: how to use subsets in equations



thanks for your quick response,

  1. if it is for one term its fine but i have a large set for ‘a’. could you explain how to handle those.

  2. kindly look in to equation 2 and post your response

On Tuesday, September 9, 2014 4:03:27 PM UTC+5:30, Rajasekhar Kadambur wrote:

My problem requirement is as follows:

sets
n / a, b, c, d/
i(n) /a,b/
j(n) /c/
k(n) /d/ ;

Variables inv(i,n), F(i,n),y(n,j);

Equation eq1, eq2;

  • eq1 is loop from b to d excluding a (condition?)

eq1(i,n)$()… inv(i,n) =e= inv(i,n-1) - F(i,n-1);


*in eq2, n1 is intersection of i and j and exclusion of k

  • and n2 is usage of j and k intersection by excluding i

eq2(i,n1,n2)$()… y(n1,j) + y(n2,j) =l= 1;


It would be grateful, if some helps in bulding code for my requirement. thanks in advance.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.