didppy.IntTable3D

class didppy.IntTable3D

3-dimensional table of integer constants.

t[x, y, z] returns an integer expression referring to an item where t is IntTable3D and x, y, and z are ElementExpr, ElementVar, ElementResourceVar, or int. If x, y, and/or z are/is SetExpr, SetVar, or SetConst, t[x, y, z] returns the sum of constants over x, y, and z.

Examples

>>> import didppy as dp
>>> model = dp.Model()
>>> obj = model.add_object_type(number=2)
>>> table = model.add_int_table([[[2, 3], [0, 1]], [[0, -1], [2, 2]]])
>>> var = model.add_element_var(object_type=obj, target=1)
>>> set_var = model.add_set_var(object_type=obj, target=[0, 1])
>>> table[var, set_var, 1].eval(model.target_state, model)
1

Methods

max(x, y, z)

Takes the maximum of constants in a table over the set of indices.

min(x, y, z)

Takes the minimum of constants in a table over the set of indices.

product(x, y, z)

Takes the product of constants in a table over the set of indices.

max(x, y, z)

Takes the maximum of constants in a table over the set of indices.

Parameters:
Returns:

The maximum.

Return type:

IntExpr

Raises:

OverflowError – If x, y, or z is a negative integer.

Examples

>>> import didppy as dp
>>> model = dp.Model()
>>> obj = model.add_object_type(number=2)
>>> table = model.add_int_table([[[2, 3], [0, 1]], [[0, -1], [2, 2]]])
>>> var = model.add_element_var(object_type=obj, target=1)
>>> set_var = model.add_set_var(object_type=obj, target=[0, 1])
>>> table.max(var, set_var, 1).eval(model.target_state, model)
2
min(x, y, z)

Takes the minimum of constants in a table over the set of indices.

Parameters:
Returns:

The minimum.

Return type:

IntExpr

Raises:

OverflowError – If x, y, or z is a negative integer.

Examples

>>> import didppy as dp
>>> model = dp.Model()
>>> obj = model.add_object_type(number=2)
>>> table = model.add_int_table([[[2, 3], [0, 1]], [[0, -1], [2, 2]]])
>>> var = model.add_element_var(object_type=obj, target=1)
>>> set_var = model.add_set_var(object_type=obj, target=[0, 1])
>>> table.min(var, set_var, 1).eval(model.target_state, model)
-1
product(x, y, z)

Takes the product of constants in a table over the set of indices.

Parameters:
Returns:

The product.

Return type:

IntExpr

Raises:

OverflowError – If x, y, or z is a negative integer.

Examples

>>> import didppy as dp
>>> model = dp.Model()
>>> obj = model.add_object_type(number=2)
>>> table = model.add_int_table([[[2, 3], [0, 1]], [[0, -1], [2, 2]]])
>>> var = model.add_element_var(object_type=obj, target=1)
>>> set_var = model.add_set_var(object_type=obj, target=[0, 1])
>>> table.product(var, set_var, 1).eval(model.target_state, model)
-2