Hi all,
I was trying to get a part of a larger parameter using GAMS indexing with a subset. Following is an example from UserGuide:
from gamspy import Container, Set, Parameter, Sum
m = Container()
i = Set(m, "i", records=[(f"i{i}", i) for i in range(10)])
k = Parameter(m, domain=i)
k[i] = 4
j = Set(m, "j", domain=i, records=i.records[0:5])
print(k[j].records)
I would expect that the last line will print the record of the k parameter filtered by subset j. Instead, it still prints the entire parameter records:
i value
0 i0 4.0
1 i1 4.0
2 i2 4.0
3 i3 4.0
4 i4 4.0
5 i5 4.0
6 i6 4.0
7 i7 4.0
8 i8 4.0
9 i9 4.0
Of course, I can easily filter it after converting to data frames, but I was wondering how it can be achieved using GAMS syntax.
As always, I appreciate your help and time.
Best,
Adam