compare_expressions

(function from pyomo.core.expr.compare)

pyomo.core.expr.compare.compare_expressions(expr1, expr2, include_named_exprs=True)[source]

Returns True if 2 expression trees are identical, False otherwise.

Parameters:
  • expr1 (NumericValue) – A Pyomo Var, Param, or expression

  • expr2 (NumericValue) – A Pyomo Var, Param, or expression

  • include_named_exprs (bool) – If False, then named expressions will be ignored. In other words, this function will return True if one expression has a named expression and the other does not as long as the rest of the expression trees are identical.

Returns:

res – A bool indicating whether or not the expressions are identical.

Return type:

bool