def clear(self): """ /*! * @brief Clears the node map. */ """ self.__forward_map = [undefined_node() for i in range(len(self.__forward_map))] self.__backward_map = [undefined_node() for i in range(len(self.__backward_map))]
def pre_image(self, node): if node < len(self._backward_map): return self._backward_map[node] else: raise Exception( 'The node with ID ', str(node), ' is not contained in the target nodes of the node map.') return undefined_node()
def as_relation(self, relation): relation.clear() for i in range(0, len(self._forward_map)): k = self._forward_map[i] if k != undefined_node(): relation.append(tuple((i, k))) for k in range(0, len(self._backward_map)): i = self._backward_map[k] if i == dummy_node(): relation.append(tuple((i, k)))
def __init__(self, num_nodes_g, num_nodes_h): self._forward_map = [undefined_node()] * num_nodes_g self._backward_map = [undefined_node()] * num_nodes_h self._induced_cost = np.inf