didppy.FloatTable3D
- class didppy.FloatTable3D
Table of continuous constants.
t[x, y, z]returns a continuous expression referring to an item wheretisFloatTable3Dandx,y, andzareElementExpr,ElementVar,ElementResourceVar, orint. Ifx,y, and/orzare/isSetExpr,SetVar, orSetConst,t[x, y, z]returns the sum of constants overx,y, andz.Examples
>>> import didppy as dp >>> model = dp.Model() >>> obj = model.add_object_type(number=2) >>> table = model.add_float_table([[[2.5, 3.5], [0.5, 1.5]], [[0.5, -1.5], [2.5, 2.5]]]) >>> 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.0
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:
x (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the first dimension.
y (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the second dimension.
z (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the third dimension.
- Returns:
The maximum.
- Return type:
- 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_float_table([[[2.5, 3.5], [0.5, 1.5]], [[0.5, -1.5], [2.5, 2.5]]]) >>> 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.5
- min(x, y, z)
Takes the minimum of constants in a table over the set of indices.
- Parameters:
x (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the first dimension.
y (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the second dimension.
z (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the third dimension.
- Returns:
The minimum.
- Return type:
- 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_float_table([[[2.5, 3.5], [0.5, 1.5]], [[0.5, -1.5], [2.5, 2.5]]]) >>> 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.5
- product(x, y, z)
Takes the product of constants in a table over the set of indices.
- Parameters:
x (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the first dimension.
y (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the second dimension.
z (tuple of int, ElementExpr, ElementVar, ElementResourceVar, SetExpr, SetVar, or SetConst) – Set of indices for the third dimension.
- Returns:
The product.
- Return type:
- Raises:
OverflowError – If x, y, or z is a negative integer.
Examples
>>> import didppy as dp >>> model = dp.Model() >>> table = model.add_float_table([[[2.5, 3.5], [0.5, 1.5]], [[0.5, -1.5], [2.5, 2.5]]]) >>> obj = model.add_object_type(number=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) -3.75