Sor#
- class gamspy.Sor(domain: Set | Alias | ImplicitSet | Sequence[Set | Alias] | Domain | Condition, expression: Operation | Expression | MathOp | ImplicitSet | ImplicitParameter | ImplicitVariable | int | bool)[source]#
Bases:
Operation
Represents a sor operation over a domain.
- Parameters:
- domainSet | Alias | Sequence[Set | Alias], Domain, Expression
- expression(
Expression | MathOp | ImplicitVariable | ImplicitParameter | int | bool | Variable | Parameter | Operation
)
- Attributes:
records
Evaluates the operation and returns the resulting records.
Methods
gamsRepr
()Representation of the Sor operation in GAMS language.
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']) >>> p = gp.Parameter(m, domain=i) >>> p[i] = gp.math.uniformInt(0,1) >>> result = gp.Parameter(m) >>> result[:] = gp.Sor(i, p[i])
- gamsRepr()[source]#
Representation of the Sor operation in GAMS language.
- Returns:
- str
Examples
>>> from gamspy import Container, Set, Parameter, Variable, Sor >>> m = Container() >>> i = Set(m, "i", records=['i1','i2', 'i3']) >>> v = Variable(m, "v", domain=i, type="binary") >>> Sor(i, v[i]).gamsRepr() 'sor(i,v(i))'
- latexRepr() str #
Representation of this operation in Latex.
- Returns:
- str
- toList() list | None #
Convenience method to return the records of the operation as a list.
- Returns:
- list | None
- 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
- property records: pd.DataFrame | None#
Evaluates the operation and returns the resulting records.
- Returns:
- pd.DataFrame | None