ToGamsVisitor
(class from pyomo.repn.plugins.gams_writer
)
- class pyomo.repn.plugins.gams_writer.ToGamsVisitor(smap, treechecker, output_fixed_variables=False)[source]
Bases:
_ToStringVisitor
Methods
__init__
(smap, treechecker[, ...])dfs_postorder_stack
(node)Perform a depth-first search in postorder using a stack implementation.
finalize
(ans)This method defines the return value for the search methods in this class.
visit
(node, values)Visit nodes that have been expanded
visiting_potential_leaf
(node)Visiting a potential leaf.
Member Documentation
- dfs_postorder_stack(node)
Perform a depth-first search in postorder using a stack implementation.
Note
This method has the same functionality as the PyUtilib
ValueVisitor.dfs_postorder_stack
method. The difference is that this method is tailored to efficiently walk Pyomo expression trees.- Parameters:
node – The root node of the expression tree that is searched.
- Returns:
The return value is determined by the
finalize()
function, which may be defined by the user.
- finalize(ans)
This method defines the return value for the search methods in this class.
The default implementation returns the value of the initial node (aka the root node), because this visitor pattern computes and returns value for each node to enable the computation of this value.
- Parameters:
ans – The final value computed by the search method.
- Returns:
The final value after the search. Defaults to simply returning
ans
.
- visit(node, values)
Visit nodes that have been expanded