expression_to_string

(function from pyomo.core.expr.visitor)

pyomo.core.expr.visitor.expression_to_string(expr, verbose=None, labeler=None, smap=None, compute_values=False)[source]

Return a string representation of an expression.

Parameters:
  • expr (ExpressionBase) – The root node of an expression tree.

  • verbose (bool) – If True, then the output is a nested functional form. Otherwise, the output is an algebraic expression. Default is retrieved from common.TO_STRING_VERBOSE

  • labeler (Callable) – If specified, this labeler is used to generate the string representation for leaves (Var / Param objects) in the expression.

  • smap (SymbolMap) – If specified, this SymbolMap is used to cache labels.

  • compute_values (bool) – If True, then parameters and fixed variables are evaluated before the expression string is generated. Default is False.

  • Returns – A string representation for the expression.