CachingNumericSuffixFinder

(class from pyomo.repn.plugins.nl_writer)

class pyomo.repn.plugins.nl_writer.CachingNumericSuffixFinder(name, default=None, context=None)[source]

Bases: SuffixFinder

__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

Attributes

scale

Member Documentation

find(component_data)

Find suffix value for a given component data object in model tree

Suffixes are searched by traversing the model hierarchy in three passes:

  1. 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.

  2. 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.

  3. 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.

  4. 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.