Search found 2 matches

by Roving2416
1 year ago
Forum: Modeling
Topic: Referencing n-th element of a subset
Replies: 2
Views: 1351

Re: Referencing n-th element of a subset

Thank you, Michael. This solution works for a set with one index. What if we have sets with 2 indices. Set i /a1*a20/ n /n1, n2/ ii(n, i) /n1.a2, n1.a7, n1.a13, n1.a15, n1.a18, n2.a3, n2.a5, n2.a20/ iii(n, i) '2nd element of ii to the 2nd to last element' ; In this case, how do I get iii('n2', i) --...
by Roving2416
1 year ago
Forum: Modeling
Topic: Referencing n-th element of a subset
Replies: 2
Views: 1351

Referencing n-th element of a subset

Hi everyone, I am having trouble referencing the n-th element of a subset. One example is the following: Set i /a1*a20/ ii(i) /a2, a7, a13, a15, a18/ ; I want to write a constraint for ii = {a7,a13,a15} which starts from the 2nd element of ii to the 2nd to last element. Is there a syntax on GAMS for...