didppy.FloatTable1D
- class didppy.FloatTable1D
1-dimensional table of continuous constants.
t[x]
returns an continuous expression referring to an item wheret
isFloatTable1D
andx
isElementExpr
,ElementVar
,ElementResourceVar
, orint
. Ifx
isSetExpr
,SetVar
, orSetConst
,t[x]
returns the sum of constants overx
.Examples
>>> import didppy as dp >>> model = dp.Model() >>> obj = model.add_object_type(number=2) >>> table = model.add_float_table([2.5, 3.5]) >>> var = model.add_element_var(object_type=obj, target=1) >>> table[var].eval(model.target_state, model) 3.5 >>> set_var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table[set_var].eval(model.target_state, model) 6.0
Methods
max
(i)Takes the maximum of constants in a table over the set of indices.
min
(i)Takes the minimum of constants in a table over the set of indices.
product
(i)Takes the product of constants in a table over the set of indices.
- max(i)
Takes the maximum of constants in a table over the set of indices.
- Parameters:
- Returns:
The maximum.
- Return type:
Examples
>>> import didppy as dp >>> model = dp.Model() >>> obj = model.add_object_type(number=2) >>> table = model.add_float_table([2.5, 3.5]) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.max(var).eval(model.target_state, model) 3.5
- min(i)
Takes the minimum of constants in a table over the set of indices.
- Parameters:
- Returns:
The minimum.
- Return type:
Examples
>>> import didppy as dp >>> model = dp.Model() >>> table = model.add_float_table([2.5, 3.5]) >>> obj = model.add_object_type(number=2) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.min(var).eval(model.target_state, model) 2.5
- product(i)
Takes the product of constants in a table over the set of indices.
- Parameters:
- Returns:
The product.
- Return type:
Examples
>>> import didppy as dp >>> model = dp.Model() >>> table = model.add_float_table([2.5, 3.5]) >>> obj = model.add_object_type(number=2) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.product(var).eval(model.target_state, model) 8.75