Base Object Storage Interface¶
-
class
pyomo.core.kernel.base.
ICategorizedObject
[source]¶ Bases:
object
Interface for objects that maintain a weak reference to a parent storage object and have a category type.
This class is abstract. It assumes any derived class declares the attributes below with or without slots:
-
_ctype
¶ Stores the object’s category type, which should be some class derived from ICategorizedObject. This attribute may be declared at the class level.
-
_parent
¶ Stores a weak reference to the object’s parent container or
None
.
-
_storage_key
¶ Stores key this object can be accessed with through its parent container.
-
_active
¶ Stores the active status of this object.
Type: bool
-
active
¶ The active status of this object.
-
clone
()[source]¶ 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.
-
ctype
¶ The object’s category type.
-
getname
(fully_qualified=False, name_buffer={}, convert=<type 'str'>, relative_to=None)[source]¶ Dynamically generates a name for this object.
Parameters: - fully_qualified (bool) – Generate a full name by
iterating through all anscestor 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
.- fully_qualified (bool) – Generate a full name by
iterating through all anscestor containers.
Default is
-
local_name
¶ The object’s local name within the context of its parent. Alias for obj.getname(fully_qualified=False).
-
name
¶ The object’s fully qualified name. Alias for obj.getname(fully_qualified=True).
-
parent
¶ The object’s parent (possibly None).
-
storage_key
¶ The object’s storage key within its parent
-
-
class
pyomo.core.kernel.base.
ICategorizedObjectContainer
[source]¶ Bases:
pyomo.core.kernel.base.ICategorizedObject
Interface for categorized containers of categorized objects.