normalize_index

(function from pyomo.core.base.indexed_component)

pyomo.core.base.indexed_component.normalize_index(x)[source]

Normalize a component index.

This flattens nested sequences into a single tuple. There is a “global” flag (normalize_index.flatten) that will turn off index flattening across Pyomo.

Scalar values will be returned unchanged. Tuples with a single value will be unpacked and returned as a single value.

Return type:

scalar or tuple