slice_component_along_sets

(function from pyomo.util.slices)

pyomo.util.slices.slice_component_along_sets(comp, sets, context=None)[source]

Slice a component along the indices corresponding to some sets, wherever they appear in the component’s block hierarchy.

Given a component or component data object, for all parent components and parent blocks between the object and the context block, replace any index corresponding to a set in sets with slices or an ellipsis.

Parameters:

comp: Component or ComponentData

Component whose parent structure to search and replace

sets: ~pyomo.common.collections.ComponentSet

Contains the sets to replace with slices

context: Block or BlockData

Block below which to search for sets

Returns:

~pyomo.core.base.indexed_component_slice.IndexedComponent_slice:

Slice of comp with wildcards replacing the indices of sets