Consider the following example code:
from gamspy import Container, Set, Parameter
m = Container()
i = j = Set(container=m, name="i", records=range(3))
p = Parameter(container=m, name="p", domain=[i, j])
p[i, j] = 1
You would probably expect that the value for p_{i,j} is equal to one for each combination of (i,j)
>>> p.records
value
i j
0 0 1
0 1 1
0 2 1
1 0 1
1 1 1
1 2 1
2 0 1
2 1 1
2 2 1
Only by declaring j
an Alias
of i
you will get the desired outcome:
from gamspy import Alias, Container, Set, Parameter
m = Container()
i = Set(container=m, name="i", records=range(3))
j = Alias(container=m, name='j', alias_with=i)
p = Parameter(container=m, name="p", domain=[i, j])
p[i, j] = 1
>>> p.records
value
i j
0 0 1
1 1
2 1
1 0 1
1 1
2 1
2 0 1
1 1
2 1