pymdd.ixmdd module

class pymdd.ixmdd.IxInfo(node, min_suffix=None, max_suffix=None, min_prefix=None, max_prefix=None)[source]

Bases: object

IxInfo represents -ix information about a single MDDNode.

IxInfo reprsents prefix and suffix information about a single MDDNode.

Parameters:
  • node (MDDNode) – associated node
  • min_suffix (IxTuple) – minimum weight suffix
  • max_suffix (IxTuple) – maximum weight suffix
  • min_prefix (IxTuple) – minimum weight prefix
  • max_prefix (IxTuple) – maximum weight prefix
class pymdd.ixmdd.IxMDD(name='ixmdd', nodes=None)[source]

Bases: pymdd.mdd.MDD

IxMDD is an MDD that maintains the optimal -ix at every node.

IxMDD is an extension of the MDD class that maintains the minimum and maximum prefix and suffix at every node.

Parameters:
  • name (str) – name of IxMDD (default: ‘ixmdd’)
  • nodes (List[Dict[MDDNode, MDDNodeInfo]]) – nodes of MDD; if None (default), set to empty list
opt_ixpath(ixType, node)[source]

Return optimal ix associate with node.

NOTE: This function returns an error if the total weight of the traversed path does not match the optimal ix weight of node. It also does not verify that the ixes are checked.

Parameters:
  • ixType (str) – type of ix
  • node (MDDNode) – node being queried
Returns:

optimal weight and ix path

Return type:

Tuple[float, List[object]]

opt_ixweight(ixType, node)[source]

Return weight of optimal ix associated with node.

Return weight of optimal ix associated with node. :param ixType: type of ix :type ixType: str :param node: node being queried

Returns:next arc of optimal ix
Return type:float
update_ixinfo_all()[source]

Update IxInfo for all nodes via bottom-up/top-down passes.

class pymdd.ixmdd.IxParam(ixType, numNodeLayers)[source]

Bases: object

IxParam stores parameters specific to each IxInfo.

IxParam stores parameters specific to each IxInfo.

Parameters:
  • ixType (str) – type of ixinfo
  • numNodeLayers – current number of node layers in MDD
all_ix_types = ('min_suffix', 'max_suffix', 'min_prefix', 'max_prefix')
class pymdd.ixmdd.IxTuple(node, ixtype, weight, nextarc=None, need_check=True)[source]

Bases: object

IxTuple represents info about one type of -ix at one MDDNode.

IxTuple represents information about one type of prefix or suffix for a single MDDNode.

Parameters:
  • node (MDDNode) – associated node
  • ixtype (str) – type of ix
  • weight (float) – weight of -ix
  • nextarc (MDDArc) – next arc of optimal -ix (default: None)
  • need_check (bool) – True if optimal -ix may have changed (default: True)
need_check
nextarc
weight