Heterogeneous Object Containers
- class pyomo.core.kernel.heterogeneous_container.IHeterogeneousContainer[source]
Bases:
ICategorizedObjectContainer
A partial implementation of the ICategorizedObjectContainer interface for implementations that store multiple categories of objects.
Complete implementations need to set the _ctype attribute and declare the remaining required abstract properties of the ICategorizedObjectContainer base class.
- child_ctypes(*args, **kwds)[source]
Returns the set of child object category types stored in this container.
- collect_ctypes(active=True, descend_into=True)[source]
Returns the set of object category types that can be found under this container.
- Parameters:
active (
True
/None
) – Controls whether or not to filter the iteration to include only the active part of the storage tree. The default isTrue
. Setting this keyword toNone
causes the active status of objects to be ignored.descend_into (bool, function) – Indicates whether or not to descend into a heterogeneous container. Default is True, which is equivalent to lambda x: True, meaning all heterogeneous containers will be descended into.
- Returns:
A set of object category types
- components(ctype=<class 'pyomo.core.kernel.base._no_ctype'>, active=True, descend_into=True)[source]
Generates an efficient traversal of all components stored under this container. Components are categorized objects that are either (1) not containers, or (2) are heterogeneous containers.
- Parameters:
ctype – Indicates the category of components to include. The default value indicates that all categories should be included.
active (
True
/None
) – Controls whether or not to filter the iteration to include only the active part of the storage tree. The default isTrue
. Setting this keyword toNone
causes the active status of objects to be ignored.descend_into (bool, function) – Indicates whether or not to descend into a heterogeneous container. Default is True, which is equivalent to lambda x: True, meaning all heterogeneous containers will be descended into.
- Returns:
iterator of components in the storage tree
- pyomo.core.kernel.heterogeneous_container.heterogeneous_containers(node, ctype=<class 'pyomo.core.kernel.base._no_ctype'>, active=True, descend_into=True)[source]
A generator that yields all heterogeneous containers included in an object storage tree, including the root object. Heterogeneous containers are categorized objects with a category type different from their children.
- Parameters:
node – The root object.
ctype – Indicates the category of objects to include. The default value indicates that all categories should be included.
active (
True
/None
) – Controls whether or not to filter the iteration to include only the active part of the storage tree. The default isTrue
. Setting this keyword toNone
causes the active status of objects to be ignored.descend_into (bool, function) – Indicates whether or not to descend into a heterogeneous container. Default is True, which is equivalent to lambda x: True, meaning all heterogeneous containers will be descended into.
- Returns:
iterator of heterogeneous containers in the storage tree, include the root object.