Smin#

class gamspy.Smin(domain: Set | Alias | ImplicitSet | Sequence[Set | Alias] | Domain | Condition, expression: Operation | Expression | MathOp | ImplicitSet | ImplicitParameter | ImplicitVariable | int | bool)[source]#

Bases: Operation

Represents a smin operation over a domain.

Parameters:
domainSet | Alias | ImplicitSet | Sequence[Set | Alias], Domain, Condition
expressionOperation
Expression
MathOp
ImplicitVariable
ImplicitParameter
int
bool
Variable
Parameter
Attributes:
records

Evaluates the operation and returns the resulting records.

Methods

gamsRepr()

Representation of the Smin operation in GAMS language.

latexRepr()

Representation of this operation in Latex.

toList()

Convenience method to return the records of the operation as a list.

toValue()

Convenience method to return the records of the operation as a Python float.

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.Smin(i, p[i]) <= v
gamsRepr()[source]#

Representation of the Smin operation in GAMS language.

Returns:
str

Examples

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

Representation of this operation in Latex.

Returns:
str

Examples

>>> import numpy as np
>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=range(3))
>>> a = gp.Parameter(m, "a", domain=i, records=np.array([3,5,7]))
>>> print(gp.Sum(i, a[i]).latexRepr())
toList() list | None#

Convenience method to return the records of the operation as a list.

Returns:
list | None

Examples

>>> import numpy as np
>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=["i1", "i2"])
>>> j = gp.Set(m, "j", records=["j1", "j2"])
>>> a = gp.Parameter(m, "a", domain=[i, j], records=np.array([(1,2), (3,4)]))
>>> gp.Sum(i, a[i, j]).toList()
[['j1', 4.0], ['j2', 6.0]]
toValue() float | None#

Convenience method to return the records of the operation as a Python float. Only possible if there is a single record as a result of the operation.

Returns:
float | None

Examples

>>> import numpy as np
>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=["i1", "i2"])
>>> a = gp.Parameter(m, "a", domain=i, records=np.array([1,2]))
>>> gp.Sum(i, a[i]).toValue()
np.float64(3.0)
property records: pd.DataFrame | None#

Evaluates the operation and returns the resulting records.

Returns:
pd.DataFrame | None

Examples

>>> import numpy as np
>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=["i1", "i2"])
>>> a = gp.Parameter(m, "a", domain=i, records=np.array([1,2]))
>>> gp.Sum(i, a[i]).records
   value
0    3.0