### defining a subset in GAMS

Posted:

**Mon Dec 28, 2020 9:57 am**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

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