Substitute_Pyomo2Casadi_Visitor

(class from pyomo.dae.simulator)

class pyomo.dae.simulator.Substitute_Pyomo2Casadi_Visitor(templatemap)[source]

Bases: ExpressionReplacementVisitor

Expression walker that replaces

  • _UnaryFunctionExpression instances with unary functions that point to casadi intrinsic functions.

  • _GetItemExpressions with _GetItemIndexer objects that references CasADi variables.

__init__(templatemap)[source]

Methods

__init__(templatemap)

acceptChildResult(node, data, child_result, ...)

beforeChild(node, child, child_idx)

Replace a node if it's a _GetItemExpression.

dfs_postorder_stack(expr)

DEPRECATED.

enterNode(node)

exitNode(node, data)

Replace a node if it's a unary function.

initializeWalker(expr)

walk_expression(expr)

Walk an expression, calling registered callbacks.

walk_expression_nonrecursive(expr)

Nonrecursively walk an expression, calling registered callbacks.

Attributes

client_methods

Member Documentation

beforeChild(node, child, child_idx)[source]

Replace a node if it’s a _GetItemExpression.

dfs_postorder_stack(expr)

DEPRECATED.

Deprecated since version 6.2: ExpressionReplacementVisitor: this walker has been ported to derive from StreamBasedExpressionVisitor. dfs_postorder_stack() has been replaced with walk_expression()

exitNode(node, data)[source]

Replace a node if it’s a unary function.

walk_expression(expr)

Walk an expression, calling registered callbacks.

This is the standard interface for running the visitor. It defaults to using an efficient recursive implementation of the visitor, falling back on walk_expression_nonrecursive() if the recursion stack gets too deep.

walk_expression_nonrecursive(expr)

Nonrecursively walk an expression, calling registered callbacks.

This routine is safer than the recursive walkers for deep (or unbalanced) trees. It is, however, slightly slower than the recursive implementations.