Product#

class gamspy.Product(domain: Set | Alias | tuple[Set | Alias] | Domain | Expression, expression: Expression | int | bool)[source]#

Bases: Operation

Represents a product operation over a domain.

Parameters:
domainSet | Alias | Tuple[Set | Alias], Domain, Expression
expression(

Expression | ImplicitVariable | ImplicitParameter | int | bool | Variable | Parameter | Operation

)

Methods

gamsRepr()

Representation of the Product operation in GAMS language.

latexRepr()

Representation of this operation in Latex.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=['i1','i2', 'i3'])
>>> v = gp.Variable(m, "v")
>>> e = gp.Equation(m, "e", type="eq")
>>> p = gp.Parameter(m, "p", domain=[i], records=[("i1", 1), ("i2", 2), ("i3", 4)])
>>> e[...] = gp.Product(i, p[i]) <= v
gamsRepr()[source]#

Representation of the Product operation in GAMS language.

Returns:
str

Examples

>>> from gamspy import Container, Set, Parameter, Variable, Product
>>> m = Container()
>>> i = Set(m, "i", records=['i1','i2', 'i3'])
>>> c = Parameter(m, "c", domain=i)
>>> v = Variable(m, "v", domain=i)
>>> Product(i, c[i]*v[i]).gamsRepr()
'prod(i,(c(i) * v(i)))'