IHeterogeneousContainer
(class from pyomo.core.kernel.heterogeneous_container
)
- 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.
- __init__()
Methods
__init__
()activate
([shallow])Activate this container.
child
(*args, **kwds)Returns a child of this container given a storage key.
child_ctypes
(*args, **kwds)Returns the set of child object category types stored in this container.
children
(*args, **kwds)A generator over the children of this container.
clone
()Returns a copy of this object with the parent pointer set to
None
.collect_ctypes
([active, descend_into])Returns the set of object category types that can be found under this container.
component_data_objects
(*args, **kwds)component_objects
(*args, **kwds)components
([ctype, active, descend_into])Generates an efficient traversal of all components stored under this container.
deactivate
([shallow])Deactivate this container.
getname
([fully_qualified, name_buffer, ...])Dynamically generates a name for this object.
Attributes
The active status of this object.
The object's category type.
The object's local name within the context of its parent.
The object's fully qualified name.
The object's parent (possibly None).
The object's storage key within its parent
Member Documentation
- activate(shallow=True)
Activate this container.
- child(*args, **kwds)
Returns a child of this container given a storage key.
- child_ctypes(*args, **kwds)[source]
Returns the set of child object category types stored in this container.
- children(*args, **kwds)
A generator over the children of this container.
- clone()
Returns a copy of this object with the parent pointer set to
None
.A clone is almost equivalent to deepcopy except that any categorized objects encountered that are not descendents of this object will reference the same object on the clone.
- 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
- deactivate(shallow=True)
Deactivate this container.
- getname(fully_qualified=False, name_buffer={}, convert=<class 'str'>, relative_to=None)
Dynamically generates a name for this object.
- Parameters:
fully_qualified (bool) – Generate a full name by iterating through all ancestor containers. Default is
False
.convert (function) – A function that converts a storage key into a string representation. Default is the built-in function str.
relative_to (object) – When generating a fully qualified name, generate the name relative to this block.
- Returns:
If a parent exists, this method returns a string representing the name of the object in the context of its parent; otherwise (if no parent exists), this method returns
None
.
- property active
The active status of this object.
- property ctype
The object’s category type.
- property local_name
The object’s local name within the context of its parent. Alias for obj.getname(fully_qualified=False).
- property name
The object’s fully qualified name. Alias for obj.getname(fully_qualified=True).
- property parent
The object’s parent (possibly None).
- property storage_key
The object’s storage key within its parent