SymbolMap
(class from pyomo.core.expr.symbol_map
)
- class pyomo.core.expr.symbol_map.SymbolMap(labeler=None)[source]
Bases:
object
A class for tracking assigned labels for modeling components.
Symbol maps are used, for example, when writing problem files for input to an optimizer.
Warning
A symbol map should never be pickled. This class is typically constructed by solvers and writers, and it may be owned by models.
Note
We should change the API to not use camelcase.
- default_labeler
used to compute a string label from an object
Methods
__init__
([labeler])addSymbol
(obj, symb)Add a symbol for a given object
addSymbols
(obj_symbol_tuples)Add (object, symbol) tuples from an iterable object.
alias
(obj, name)Create an alias for an object.
createSymbol
(obj[, labeler])Create a symbol for an object with a given labeler.
createSymbols
(objs[, labeler])Create a symbol for iterable objects with a given labeler.
getObject
(symbol)Return the object corresponding to a symbol
getSymbol
(obj[, labeler])Return the symbol for an object.
removeSymbol
(obj)Member Documentation
- addSymbol(obj, symb)[source]
Add a symbol for a given object
This method assumes that objects and symbol names will not conflict.
- addSymbols(obj_symbol_tuples)[source]
Add (object, symbol) tuples from an iterable object.
This method assumes that objects and symbol names will not conflict.
- alias(obj, name)[source]
Create an alias for an object. An aliases are symbols that do not have a one-to-one correspondence with objects.
- createSymbol(obj, labeler=None, *args)[source]
Create a symbol for an object with a given labeler. No error checking is done to ensure that the generated symbol name is unique.