Filtering variables

Hello,

I have a set of facilities in my problem. There can be connections between each pairs of these cities. I defined a variable to see if a connection is possible between the two nodes but I want tho code to consider the value of 0 if the origin and destination cities in the pair are the same.

set cities /1, 2, 3, 4, 5/

I want the code to consider x(1,1) = 0

Thanks,


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/groups/opt_out.

Hello,

If I understood well your problem then you have the following:

set i /1*5/
and a binary (?) variable x(i,j).

You can use alias(i,j) (wheras j has the same dimensions with i) and write the following in an equation:

eq1(i,j)$(ORD(i) EQ ORD(j))… x(i,j)=E=0;

Hope that helped.

Konstantinos

Τη Τρίτη, 19 Νοεμβρίου 2013 6:37:32 μ.μ. UTC+2, ο χρήστης Fateme Fotuhi έγραψε:

Hello,

I have a set of facilities in my problem. There can be connections between each pairs of these cities. I defined a variable to see if a connection is possible between the two nodes but I want tho code to consider the value of 0 if the origin and destination cities in the pair are the same.

set cities /1, 2, 3, 4, 5/

I want the code to consider x(1,1) = 0

Thanks,


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/groups/opt_out.

Yes I followed the same approach and my problem was solved. Thanks

On Tuesday, November 19, 2013 1:04:13 PM UTC-5, Κωνσταντίνος Πετρίδης wrote:

Hello,

If I understood well your problem then yo u have the following:

set i /1*5/
and a binary (?) variable x(i,j).

You can use alias(i,j) (wheras j has the same dimensions with i) and write the following in an equation:

eq1(i,j)$(ORD(i) EQ ORD(j))… x(i,j)=E=0;

Hope that helped.

Konstantinos

Τη Τρίτη, 19 Νοεμβρίου 2013 6:37:32 μ.μ. UTC+2, ο χρήστης Fateme Fotuhi έγραψε:

Hello,

I have a set of facilities in my problem. There can be connections between each pairs of these cities. I defined a variable to see if a connection is possible between the two nodes but I want tho code to consider the value of 0 if the origin and destination cities in the pair are the same.

set cities /1, 2, 3, 4, 5/

I want the code to consider x(1,1) = 0

Thanks,


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/groups/opt_out.