IndexTemplate
(class from pyomo.core.expr.template_expr
)
- class pyomo.core.expr.template_expr.IndexTemplate(_set, index=0, _id=None, _group=None)[source]
Bases:
NumericValue
A “placeholder” for an index value in template expressions.
This class is a placeholder for an index value within a template expression. That is, given the expression template for “m.x[i]”, where m.z is indexed by m.I, the expression tree becomes:
- _GetItem:
m.x
IndexTemplate(_set=m.I, _value=None)
- Constructor Arguments:
_set: the Set from which this IndexTemplate can take values
Methods
__init__
(_set[, index, _id, _group])getname
([fully_qualified, name_buffer, ...])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
Return True if this numeric value is a constant value
is_expression_type
([expression_system])Return True if this numeric value is an expression
is_fixed
()Returns True because this value is fixed.
Return True if this numeric value is an indexed object
Return True if this class is a Pyomo Boolean object.
Return True if this numeric value is a named expression
Return True if this class is a Pyomo numeric object
Return False unless this class is a parameter object
Returns False because index values cannot be variables.
Return True if this object is a reference.
DEPRECATED.
Return False unless this class is a variable object
lock
(lock)Return the polynomial degree of the expression.
set_value
([values, lock])to_string
([verbose, labeler, smap, ...])Return a string representation of the expression tree.
unlock
(lock)Attributes
local_name
name
Member Documentation
- getname(fully_qualified=False, name_buffer=None, relative_to=None)[source]
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_constant()
Return True if this numeric value is a constant value
- is_expression_type(expression_system=None)
Return True if this numeric value is 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_named_expression_type()
Return True if this numeric value is a named expression
- 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_potentially_variable()[source]
Returns False because index values cannot be variables.
The IndexTemplate represents a placeholder for an index value for an IndexedComponent, and at the moment, Pyomo does not support variable indirection.
- 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
- polynomial_degree()
Return the polynomial degree of the expression.
- Returns:
None
- 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.