Dear all,

I want to determine a subset based on the indices of elements.

for example, I have a set i /0,4,3,1,5,2,6/ and the order of elements in this set is important to me. I want to define a subset that contains the third element of i to the sixth element. In more details, I want the subset to be as subi(i) /3,1,5,2/ but i do not want to type each element manually.

How should I define the mentioned subset based on the order of elements?

I appreciate it if someone can help me.

Thanks and regards,

Bahar

## defining a subset in GAMS Topic is solved

### Re: defining a subset in GAMS

Code: Select all

```
set subi(i);
subi(i) $(ord(i) ge 3 and ord(i) le 6) = yes;
```

Hope this helps.

- Atharv

### Re: defining a subset in GAMS

Thanks a lot for your help.