slice_component_along_sets
(function from pyomo.dae.flatten
)
- pyomo.dae.flatten.slice_component_along_sets(component, sets, context_slice=None, normalize=None)[source]
This function generates all possible slices of the provided component along the provided sets. That is, it will iterate over the component’s other indexing sets and, for each index, yield a slice along the sets specified in the call signature.
- Parameters:
component (Component) – The component whose slices will be yielded
sets (ComponentSet) – ComponentSet of Pyomo sets that will be sliced along
context_slice (IndexedComponent_slice) – If provided, instead of creating a new slice, we will extend this one with appropriate getattr and getitem calls.
normalize (Bool) – If False, the returned index (from the product of “other sets”) is not normalized, regardless of the value of normalize_index.flatten. This is necessary to use this index with _fill_indices.
- Yields:
tuple – The first entry is the index in the product of “other sets” corresponding to the slice, and the second entry is the slice at that index.