didppy.FloatTable1D

class didppy.FloatTable1D

1-dimensional table of continuous constants.

t[x] returns an continuous expression referring to an item where t is FloatTable1D and x is ElementExpr, ElementVar, ElementResourceVar, or int. If x is SetExpr, SetVar, or SetConst, t[x] returns the sum of constants over x.

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(set)

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

min(set)

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

product(set)

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

max(set)

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

Parameters:

set (SetExpr, SetVar, or SetConst) – Set of indices

Returns:

The maximum.

Return type:

FloatExpr

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(set)

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

Parameters:

set (SetExpr, SetVar, or SetConst) – Set of indices

Returns:

The minimum.

Return type:

FloatExpr

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(set)

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

Parameters:

set (SetExpr, SetVar, or SetConst) – Set of indices

Returns:

The product.

Return type:

FloatExpr

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