Number#

class gamspy.Number(value: int | float)[source]#

Bases: Operable

Needed for conditions on numbers.

Parameters:
valueint | float

Methods

gamsRepr()

Representation of this Number in GAMS language.

latexRepr()

Representation of this Number in Latex.

unicodeRepr()

Representation of this Number in mathematical notation with Unicode characters.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> k = gp.Set(m, "k", records=["1964-i","1964-ii","1964-iii","1964-iv"])
>>> ki = gp.Set(m, name="ki", domain=[k], description="initial period")
>>> ki[k] = gp.Number(1).where[gp.Ord(k) == 1]
gamsRepr() → str[source]#

Representation of this Number in GAMS language.

Returns:
str

Examples

>>> import gamspy as gp
>>> gp.Number(2.0).gamsRepr()
'2.0'
latexRepr() → str[source]#

Representation of this Number in Latex.

Returns:
str

Examples

>>> import gamspy as gp
>>> print(gp.Number(-1.5e-7).latexRepr())
-1.5 \cdot 10^{-7}
unicodeRepr() → str[source]#

Representation of this Number in mathematical notation with Unicode characters.

Returns:
str

Examples

>>> import gamspy as gp
>>> print(gp.Number(-1.5e-7).unicodeRepr())
-1.5 · 10⁻⁷