didppy.IntTable1D
- class didppy.IntTable1D
1-dimensional table of integer constants.
t[x]returns an integer expression referring to an item wheretisIntTable1DandxisElementExpr,ElementVar,ElementResourceVar, orint. IfxisSetExpr,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_int_table([2, 3]) >>> var = model.add_element_var(object_type=obj, target=1) >>> table[var].eval(model.target_state, model) 3 >>> set_var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table[set_var].eval(model.target_state, model) 5
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_int_table([2, 3]) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.max(var).eval(model.target_state, model) 3
- 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() >>> obj = model.add_object_type(number=2) >>> table = model.add_int_table([2, 3]) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.min(var).eval(model.target_state, model) 2
- 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() >>> obj = model.add_object_type(number=2) >>> table = model.add_int_table([2, 3]) >>> var = model.add_set_var(object_type=obj, target=[0, 1]) >>> table.product(var).eval(model.target_state, model) 6