Hello GAMS Community,

I am a beginner in GAMS and learning to model things using its syntax.

Here is my problem,

Given,

```
set i /1,2/
x(i)
y(i);
```

**How can I write constraints equations say, x1 + y2 <= 1 similarly, x2 + y1 <= 1 ?**

I know, defining an equation like this

```
eq(i).. x(i) + y(i) <= 1
```

will cover x(1) + y(1) <= 1 and x(2) + y(2) <= 1.

But How can I do x1 + y2 <= 1?

Do I have to use a condition somewhere?

Arvind,

In such cases it helps to think in terms of indices and sets. For example, key question to ask here is how many equations do you need? for each i, you need i-1 equations (total i * (i-1) equations) This gives you a hint that your equation should be defined over 2 dimensions. However, in the equation, you need to distinguish between two dimensions. This where you can use an alias. Finally, just a condition that you write this equation only when i is not same as ii. The following code block achieves this.

```
alias(i, ii);
eq(i, ii)$(ord(ii) ne ord(i)).. x(i) + y(ii) <= 1;
```