def get_ut_index(self, node_value_pairs): nodes, values = zip(*node_value_pairs) index = [] for node in self.variables: index_in_values_list = nodes.index(node) value = values[index_in_values_list] index.append(node.value_range.index(value)) return tuple(index)
def get_cpt_index(self, node_value_pairs): ''' Can be used to determine the index in this densitys cpt that accords to a completely specified node-value combination for all nodes that this density depends on @param node_value_pairs: A list of (Node,Value) pairs @returns: A tuple representing the index ''' nodes, values = zip(*node_value_pairs) index = [] for node in self.variables: index_in_values_list = nodes.index(node) value = values[index_in_values_list] index.append(node.value_range.index(value)) return tuple(index)