Card#

class gamspy.Card(symbol: Set | Alias | Parameter)[source]#

Bases: Operable

The operator card may be used with any symbol and returns its number of records.

Parameters:
symbolSet | Alias | Parameter | Variable | Equation | Model

Methods

gamsRepr()

Representation of the Card operation in GAMS language.

latexRepr()

Representation of Card function in Latex.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> t = gp.Set(m, name="t", description="time periods", records=[str(x) for x in range(1985, 1996)])
>>> s = gp.Parameter(m, name="s")
>>> s[...] = gp.Card(t)
gamsRepr() str[source]#

Representation of the Card operation in GAMS language.

Returns:
str

Examples

>>> from gamspy import Container, Set, Card
>>> m = Container()
>>> i = Set(m, "i", records=['i1','i2', 'i3'])
>>> Card(i).gamsRepr()
'card(i)'
latexRepr() str[source]#

Representation of Card function in Latex.

Returns:
str