SuffixFinder
(class from pyomo.core.base.suffix
)
- class pyomo.core.base.suffix.SuffixFinder(name, default=None, context=None)[source]
Bases:
object
- __init__(name, default=None, context=None)[source]
This provides an efficient utility for finding suffix values on a (hierarchical) Pyomo model.
- Parameters:
name (str) – Name of Suffix to search for.
default – Default value to return from .find() if no matching Suffix is found.
context (BlockData) – The root of the Block hierarchy to use when searching for Suffix components. Suffixes outside this hierarchy will not be interrogated and components that are queried (with
find(component_data)()
will return the default value.
Methods
__init__
(name[, default, context])This provides an efficient utility for finding suffix values on a (hierarchical) Pyomo model.
find
(component_data)Find suffix value for a given component data object in model tree
Member Documentation
- find(component_data)[source]
Find suffix value for a given component data object in model tree
Suffixes are searched by traversing the model hierarchy in three passes:
Search for a Suffix matching the specific component_data, starting at the root and descending down the tree to the component_data. Return the first match found.
Search for a Suffix matching the component_data’s container, starting at the root and descending down the tree to the component_data. Return the first match found.
Search for a Suffix with key None, starting from the component_data and working up the tree to the root. Return the first match found.
Return the default value
- Parameters:
component_data (ComponentDataBase) – Component or component data object to find suffix value for.
- Return type:
The value for Suffix associated with component data if found, else None.