Universe Alias#

class gamspy.UniverseAlias(container: Container | None = None, name: str = 'universe')[source]#

Bases: BaseSymbol

Represents a UniverseAlias symbol in GAMS.

Parameters:
containerContainer
namestr
Attributes:
alias_with

Returns aliased object

container

Container of the symbol

description

Always ‘Aliased with *’ for universe alias

dimension

Always 1 for universe alias

domain

Always “*” for universe alias

domain_labels

Always [“uni”] for universe alias

domain_names

Always [“*”] for universe alias

domain_type

Always none for universe alias

is_singleton

Whether a symbol is a singleton set

number_records

Number of symbol records

records

Records of the UniverseAlias

summary

Returns a dict of only the metadata

synchronize

Synchronization state of the symbol.

Methods

gamsRepr()

Representation of the UniverseAlias in GAMS language.

getDeclaration()

Declaration of the UniverseAlias in GAMS

getSparsity()

Get the sparsity of the symbol w.r.t the cardinality

latexRepr()

Representation of the UniverseAlias in LaTeX.

product(*indices)

Equivalent to Product(indices, obj[obj.domain]).

sand(*indices)

Equivalent to Sand(indices, obj[obj.domain]).

smax(*indices)

Equivalent to Smax(indices, obj[obj.domain]).

smin(*indices)

Equivalent to Smin(indices, obj[obj.domain]).

sor(*indices)

Equivalent to Sor(indices, obj[obj.domain]).

sum(*indices)

Equivalent to Sum(indices, obj[obj.domain]).

toList()

Convenience method to return symbol records as a python list

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> universe = gp.UniverseAlias(m)
>>> universe.records
Empty DataFrame
Columns: [uni]
Index: []
>>> i = gp.Set(m, "i", records=['i1', 'i2'])
>>> universe.records
  uni
0  i1
1  i2
gamsRepr() str[source]#

Representation of the UniverseAlias in GAMS language.

Returns:
str

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.UniverseAlias(m, name="universe")
>>> i.gamsRepr()
'universe'
getDeclaration() str[source]#

Declaration of the UniverseAlias in GAMS

Returns:
str

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.UniverseAlias(m, name="universe")
>>> i.getDeclaration()
'Alias(universe,*);'
getSparsity() float[source]#

Get the sparsity of the symbol w.r.t the cardinality

Returns:
float

Always 0

latexRepr() str[source]#

Representation of the UniverseAlias in LaTeX.

Returns:
str

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.UniverseAlias(m, name="universe")
>>> i.latexRepr()
'universe'
product(*indices: Set | Alias) Product#

Equivalent to Product(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.product() is equivalent to Product((i,j), v[i, j, k]) v.product(i) is equivalent to Product(i, v[i, j, k]) v.product(i, j) is equivalent to Product((i, j), v[i, j, k])

Returns:
Product

Generated Product operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.product().gamsRepr()
'prod((i,j),x(i,j))'
>>> gp.Product((i, j), x[i, j]).gamsRepr()
'prod((i,j),x(i,j))'
sand(*indices: Set | Alias) Sand#

Equivalent to Sand(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.sand() is equivalent to Sand((i,j), v[i, j, k]) v.sand(i) is equivalent to Sand(i, v[i, j, k]) v.sand(i, j) is equivalent to Sand((i, j), v[i, j, k])

Returns:
Sand

Generated Sand operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.sand().gamsRepr()
'sand((i,j),x(i,j))'
>>> gp.Sand((i, j), x[i, j]).gamsRepr()
'sand((i,j),x(i,j))'
smax(*indices: Set | Alias) Smax#

Equivalent to Smax(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.smax() is equivalent to Smax((i,j), v[i, j, k]) v.smax(i) is equivalent to Smax(i, v[i, j, k]) v.smax(i, j) is equivalent to Smax((i, j), v[i, j, k])

Returns:
Smax

Generated Smax operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.smax().gamsRepr()
'smax((i,j),x(i,j))'
>>> gp.Smax((i, j), x[i, j]).gamsRepr()
'smax((i,j),x(i,j))'
smin(*indices: Set | Alias) Smin#

Equivalent to Smin(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.smin() is equivalent to Smin((i,j), v[i, j, k]) v.smin(i) is equivalent to Smin(i, v[i, j, k]) v.smin(i, j) is equivalent to Smin((i, j), v[i, j, k])

Returns:
Smin

Generated Smin operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.smin().gamsRepr()
'smin((i,j),x(i,j))'
>>> gp.Smin((i, j), x[i, j]).gamsRepr()
'smin((i,j),x(i,j))'
sor(*indices: Set | Alias) Sor#

Equivalent to Sor(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.sor() is equivalent to Sor((i,j), v[i, j, k]) v.sor(i) is equivalent to Sor(i, v[i, j, k]) v.sor(i, j) is equivalent to Sor((i, j), v[i, j, k])

Returns:
Sor

Generated Sor operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.sor().gamsRepr()
'sor((i,j),x(i,j))'
>>> gp.Sor((i, j), x[i, j]).gamsRepr()
'sor((i,j),x(i,j))'
sum(*indices: Set | Alias) Sum#

Equivalent to Sum(indices, obj[obj.domain]). For example:

v = Variable(m, domain=[i, j, k]) v.sum() is equivalent to Sum((i,j), v[i, j, k]) v.sum(i) is equivalent to Sum(i, v[i, j, k]) v.sum(i, j) is equivalent to Sum((i, j), v[i, j, k])

Returns:
Sum

Generated Sum operation.

Raises:
ValidationError

In case the symbol is scalar.

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i")
>>> j = gp.Set(m, "j")
>>> x = gp.Parameter(m, "x", domain=[i, j])
>>> y = gp.Parameter(m, "y")
>>> x.sum().gamsRepr()
'sum((i,j),x(i,j))'
>>> gp.Sum((i, j), x[i, j]).gamsRepr()
'sum((i,j),x(i,j))'
toList() list[str] | None[source]#

Convenience method to return symbol records as a python list

Returns:
list[str] | None

A list of symbol records

Examples

>>> import gamspy as gp
>>> m = gp.Container()
>>> i = gp.Set(m, "i", records=["seattle", "san-diego"])
>>> j = gp.Set(m, "j", records=["new-york", "chicago", "topeka"])
>>> ij = gp.UniverseAlias(m, "ij")
>>> print(ij.toList())
['seattle', 'san-diego', 'new-york', 'chicago', 'topeka']
property alias_with: str#

Returns aliased object

Returns:
str

Always “*”

property container: Container#

Container of the symbol

property description: str#

Always ‘Aliased with *’ for universe alias

Returns:
str

Always ‘Aliased with *

property dimension: int#

Always 1 for universe alias

Returns:
int

Always 1

property domain: Literal['*']#

Always “*” for universe alias

Returns:
Literal

Always “*”

property domain_labels: list[str]#

Always [“uni”] for universe alias

Returns:
list[str]

Always [“uni”]

property domain_names: list[str]#

Always [“*”] for universe alias

Returns:
list[str]

Always [“*”]

property domain_type: str#

Always none for universe alias

Returns:
str

Always ‘none’

property is_singleton: bool#

Whether a symbol is a singleton set

Returns:
bool

Always False

property number_records: int#

Number of symbol records

Returns:
int

Number of symbol records

property records: DataFrame#

Records of the UniverseAlias

Returns:
list[str]

Examples

>>> import gamspy as gp
>>> import numpy as np
>>> m = gp.Container()
>>> i = gp.Set(m, name="i", records=["seattle", "san-diego"])
>>> uni = gp.UniverseAlias(m)
>>> uni.records
         uni
0    seattle
1  san-diego
property summary: dict#

Returns a dict of only the metadata

Returns:
dict

Outputs a dict of only the metadata

property synchronize: bool#

Synchronization state of the symbol. If True, the symbol data will be communicated with GAMS. Otherwise, GAMS state will not be updated.

Returns:
bool