Hello every body

I want to define a set which its components are indices of some variables. Set of components i and j which x(i,j)=1. Let me define it with an example: Suppose we have x(1,2)=1,x(3,4)=0,x(2,4)=1

I want a set which its components are indices of x variables which are equal to 1. Here x(1,2) and x(2,4) are equal to 1 so the set I’m looking for should contain 1,2 and 4. How can a set be defined in GAMS which yields such result?

–

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/jOy8Pq7ASQQJ.

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.

set i /1,2,3,4/

k(i);

alias(i,ii);

parameters x(i,ii)

;

x(‘1’,‘2’) = 1;

x(‘3’,‘4’) = 0;

x(‘2’,‘4’) = 1;

k(i) = yes$(sum(ii, x(i,ii)) >= 1 or sum(ii, x(ii,i)) >= 1);

display k;

On Monday, August 6, 2012 6:07:23 AM UTC-5, /\ l_ ! wrote:

Hello every body

I want to define a set which its components are indices of some variables. Set of components i and j which x(i,j)=1. Let me define it with an example: Suppose we have x(1,2)=1,x(3,4)=0,x(2,4)=1

I want a set which its components are indices of x variables which are equal to 1. Here x(1,2) and x(2,4) are equal to 1 so the set I’m looking for should contain 1,2 and 4. How can a set be defined in GAMS which yields such result?

–

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/w5xd8-eq5zoJ.

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.