filtering (i,j)

Hello everyone
I have this constraint:
sum((i,j,t),x(i,j,t)*r(j,t))
this constraint certify for each i that is negative to j
(I mean i not equal to j)
please help me to add it to the constraint.

Thank you

\

Hi
Use the to filter index sum((i,j,t)(ord(I)Ord(J)),x(i,j,t)*r(j,t))

On Tue, Jun 19, 2012 at 5:24 AM, s gerami.p wrote:

Hello everyone
I have this constraint:
sum((i,j,t),x(i,j,t)*r(j,t))
this constraint certify for each i that is negative to j
(I mean i not equal to j)
please help me to add it to the constraint.

Thank you


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.

\

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.

I have this constraint:
sum((i,j,t),x(i,j,t)*r(j,t))
this constraint certify for each i that is negative to j
(I mean i not equal to j)
you may use control and ord(): sum( (i,j,t) ( ord(i) ord(j) ), x(i,j,t)*r(j,t) )

HTH,

Yan


\

Hi Yan,

I was not part of this discussion but I want to know
about the working of the condition. ord(i) ord(j).
Can u please explain how it works by giving some example.

Regards,
Dharmender Y.
dddyadav@gmail.com




On Tuesday, 19 June 2012 13:25:44 UTC+5:30, Ryan Ren wrote:

\

I have this constraint:
sum((i,j,t),x(i,j,t)*r(j,t))
this constraint certify for each i that is negative to j
(I mean i not equal to j)
you may use control and ord(): sum( (i,j,t) ( ord(i) ord(j) ), x(i,j,t)*r(j,t) )

HTH,

Yan

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/1QC66NAwBCkJ.
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.

Hi Yan,
I was not part of this discussion but I want to know
about the working of the condition. ord(i) ord(j).
Can u please explain how it works by giving some example.

ord(i) means the order of current index in set i,
ord(i) ord(j) , means the order numbers of two different index are not equal, i.e. they are different indices.
Since we cannot compare two indices directly in GAMS, to compare the order is a workable workaround.
Note that there is a pre-requirement that i and j are identical sets.

  • Here is an example, a will be 90, since there will be 10 occurrences that i=j (ord(i)=ord(j) )

set i /1*10/;
set t /1/;
Alias(i, j);

Parameter X(i,j,t), r(j,t), a;
X(i,j,t) = 1;
r(j,t) = 1;

  • sum up when (i != j)
    a = sum( (i,j,t) $ ( ord(i) ord(j) ), x(i,j,t)*r(j,t) );
    display a;

  • End of example

HTH,

Yan

\

Thnaks alot Mr. Yan.

On Mon, Jun 25, 2012 at 11:44 AM, 任彦 wrote:

Hi Yan,
I was not part of this discussion but I want to know
about the working of the condition. ord(i) ord(j).
Can u please explain how it works by giving some example.

ord(i) means the order of current index in set i,
ord(i) ord(j) , means the order numbers of two different index are not equal, i.e. they are different indices.
Since we cannot compare two indices directly in GAMS, to compare the order is a workable workaround.
Note that there is a pre-requirement that i and j are identical sets.

  • Here is an example, a will be 90, since there will be 10 occurrences that i=j (ord(i)=ord(j) )

set i /1*10/;
set t /1/;
Alias(i, j);

Parameter X(i,j,t), r(j,t), a;
X(i,j,t) = 1;
r(j,t) = 1;

  • sum up when (i != j)
    a = sum( (i,j,t) $ ( ord(i) ord(j) ), x(i,j,t)*r(j,t) );
    display a;

  • End of example

HTH,

Yan


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.

\

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.