OK. If you use that cod you must add an condition after equation definition:

Set i;

Alias(i,j);

Binary variable x(i), y(j);

Equation cons(i,j);

cons(i,j)$(Ord(i)=Ord(j)) … x(i)*y(j) =L= 0;

On Tue, May 22, 2012 at 3:42 PM, Nazmi Åžener wrote:

Sorry,i misunderstood the case but you may use this form of explanation

pcons(j,k)$(ord(j) eq ord(k))… x(j)+y(k)=e=1;

\

Date: Tue, 22 May 2012 04:36:05 -0700

Subject: Re: “modified negation” modelling in GAMS

From: markusinjapan@googlemail.com

To: gamsworld@googlegroups.com

Thanks again to all of you.

I think I understood the “alias” command.

Could you confirm if I got it right:

With alias, I can duplicate a existing set. In my case with

“alias(I,J)”, the new set J consists of as many elements as set I

In the following model i can differentiate for both as if I had

created different sets initially, e.g. can create cost matrices

c(i,j).

In the equations (and this is the advantage of sets now), I can refer

with my definded binary variables x(i) and y(j) use the index i also

for variable y, which is not possible, if both sets are defined

separately.

equation x(i) + y(i) =l= 1 is thus possible, denominating i=j → y(i)

= y(j)

On 22 Mai, 11:44, Nazmi Åžener wrote:

you may use alias command

Date: Tue, 22 May 2012 02:38:24 -0700

Subject: Re: “modified negation” modelling in GAMS

From: markusinja...@googlemail.com

To: gamsworld@googlegroups.com

Hello and thanks to both of you,

A.R., your comment is right, it becomes a MINLP then.

Additionally cases like the following example would also be not

allowed: x(2)=1, y(3)=1 → would violate both constraints (x(i)*y(j)

=L= 0 and x(i) + y(j) =L= 1)

Is there nothing in the equation settings where i can limit to i=j?

Denominating “for all”, i use the brackets, e.g. “equation(k)…” means

for all k. Is there something like “equation(i=j)…”? the I could use

x(i) + y(j) =l=1, because the constraints would be limited to i=j

cases.

If I use your solution: Can I then treat the sets still independent

from each other?

I.e. create e.g. cost matrices as input? Before I used e.g. c(i,j) to

denominate cost from i to j.

How would I handle this with the alias command?

Thanks again!

On 22 Mai, 09:11, “A.R. Bahari” wrote:

Hi Yan

Your suggestion is so good but i think that equation changes the model into

MINLP.

On Tue, May 22, 2012 at 11:02 AM, ä»»å½¦ wrote:

Let’s assume we have binary variables x(i) and y(j) (Sets I and J are

equivalent in size)

How can I model the following:

Allowed

- x(i)=1 y(j)=0 for i=j
- x(i)=0 y(j)=1 for i=j
- x(i)=0 y(j)=0 for i=j
- all binary cases for iâ‰ j

Not allowed
- x(i)=1 and y(j)=1 for i=j should not be allowed

x(i)=1 y(j)=0 => prod = 0

x(i)=0 y(j)=1 => prod = 0

x(i)=0 y(j)=0 => prod = 0

x(i)=1 y(j)=1 => prod = 1

so x(i)*y(j) =L= 0 allows the first three and dont allow the last.

x(i) + y(j) =L= 1 should also work.

Set i;

Alias(i,j);

Binary variable x(i), y(j);

Equation cons(i,j);

cons(i,j) … x(i)*y(j) =L= 0;

HTH,

Yan

–

“gamsworld” group.

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 athttp://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.

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.