mxfusion.components.model_component¶
Members¶
-
class
mxfusion.components.model_component.
ModelComponent
¶ Bases:
object
The building block of a Model in MXFusion.
ModelComponents exist in one of two modes.
Mode 1 - Bi-directional mode
If a node is not attached to a FactorGraph, it maintains a list of all of its predecessors and successors directly. These are stored in the
self._predecessors
andself._successors
methods.Mode 2 - Graph mode
If a node is attached to a FactorGraph, it does not store direct references to its successors and predecessors. When accessed, the predecessors/successors properties directly query the graph they are attached to to find out what the respective neighbor nodes are.
-
uuid
¶ Return the UUID of this graph
-
as_json
()¶
-
graph
¶ Return the object’s graph
-
successors
¶ Return a list of nodes pointed to by the edges of this node.
Note: The ordering of this list is not guaranteed to be consistent with assigned order.
-
predecessors
¶ Return a list of nodes whose edges point into this node.
Note: The ordering of this list is not guaranteed to be consistent with assigned order.
-
replicate
(var_map=None, replication_function=None)¶ Replicates this component and its neighbors based on the replication_function logic passed in.
Parameters: var_map – A mapping from the original model’s components to the replicated components. This is used to track which components have already been replicated in a dynamic programming style. :type var_map: {original_node: new_node} :param replication_function: A function that takes in a ModelComponent and returns an answer for how to replicate that node’s predecessors and successors. If None, only replicates this node. :type replication_function: function
-