Domain#

class gamspy.Domain(*sets)[source]#

Bases: object

Domain class needed for where statements on multidimensional index list in operations

Parameters:
sets: tuple[Set | str]
Parameters:

sets (Set | Alias | ImplicitSet) –

Examples

>>> from gamspy import Container, Set, Ord, Card, Variable, Equation, Sum, Domain
>>> m = Container()
>>> X = Set(m, name="X", records=[f"I{i}" for i in range(1, 22)])
>>> Y = Set(m, name="Y", records=[f"J{j}" for j in range(1, 22)])
>>> inside = Set(m, name="inside", domain=[X, Y])
>>> inside[X, Y].where[~((Ord(X) == 1) & (Ord(X) == Card(X)))] = True
>>> f = Variable(m, name="f", domain=[X, Y], type="positive")
>>> obj = Variable(m, name="obj")
>>> objfun = Equation(m, name="objfun", type="regular")
>>> objfun[...] = obj == Sum(Domain(X, Y).where[inside[X, Y]], f[X.lead(1), Y] - f[X, Y])

Methods

gamsRepr()

Representation of this Domain in GAMS language.

gamsRepr()[source]#

Representation of this Domain in GAMS language.

Returns:
str
Return type:

str