NamedExpressionData
(class from pyomo.core.base.expression
)
- class pyomo.core.base.expression.NamedExpressionData[source]
Bases:
NumericValue
An object that defines a generic “named expression”.
This is the base class for both
ExpressionData
andObjectiveData
.- __init__()
Methods
__init__
()arg
(index)clone
()Return a clone of this expression (no-op).
create_node_with_local_data
(values[, classtype])Construct a simple expression after constructing the contained expression.
getname
(*args, **kwargs)If this is a component, return the component's name on the owning block; otherwise return the value converted to a string
Return True if this class is a Pyomo component
A boolean indicating whether this expression is constant.
is_expression_type
([expression_system])A boolean indicating whether this in an expression.
is_fixed
()A boolean indicating whether this expression is fixed.
Return True if this numeric value is an indexed object
Return True if this class is a Pyomo Boolean object.
A boolean indicating whether this in a named expression.
Return True if this class is a Pyomo numeric object
Return False unless this class is a parameter object
Return True if variables can appear in this expression
Return True if this object is a reference.
DEPRECATED.
Return False unless this class is a variable object
nargs
()A tuple of subexpressions involved in this expressions operation.
set_value
(expr)Set the expression on this expression.
to_string
([verbose, labeler, smap, ...])Return a string representation of the expression tree.
Attributes
PRECEDENCE
args
expr
local_name
name
Member Documentation
- create_node_with_local_data(values, classtype=None)[source]
Construct a simple expression after constructing the contained expression.
This class provides a consistent interface for constructing a node, which is used in tree visitor scripts.
- getname(*args, **kwargs)
If this is a component, return the component’s name on the owning block; otherwise return the value converted to a string
- is_component_type()
Return True if this class is a Pyomo component
- is_expression_type(expression_system=None)[source]
A boolean indicating whether this in an expression.
- is_indexed()
Return True if this numeric value is an indexed object
- is_logical_type()
Return True if this class is a Pyomo Boolean object.
Boolean objects include constants, variables, or logical expressions.
- is_numeric_type()
Return True if this class is a Pyomo numeric object
- is_parameter_type()
Return False unless this class is a parameter object
- is_reference()
Return True if this object is a reference.
- is_relational()
DEPRECATED.
Return True if this numeric value represents a relational expression.
Deprecated since version 6.4.3: is_relational() is deprecated in favor of is_expression_type(ExpressionType.RELATIONAL)
- is_variable_type()
Return False unless this class is a variable object
- to_string(verbose=None, labeler=None, smap=None, compute_values=False)
Return a string representation of the expression tree.
- Parameters:
verbose (bool) – If
True
, then the string representation consists of nested functions. Otherwise, the string representation is an infix algebraic equation. Defaults toFalse
.labeler – An object that generates string labels for non-constant in the expression tree. Defaults to
None
.smap – A SymbolMap instance that stores string labels for non-constant nodes in the expression tree. Defaults to
None
.compute_values (bool) – If
True
, then fixed expressions are evaluated and the string representation of the resulting value is returned.
- Returns:
A string representation for the expression tree.