Beispiel #1
0
    def getStateStr(self, state, nodes=None):
        if state not in self.__states:
            raise Exception(str(state) + " has not been added!")
        if nodes is None:
            nodes = self.__nodes

        st= myutils.bool2int(self.getStateVec(state, nodes))
        full = bin(st)[2:].rjust(len(nodes), '0')
        return full
Beispiel #2
0
def subsetOLD(state, nodes):
    "extract a subset of node states"
    for node in nodes:
        if node not in state.nodes():
            raise Exception("node not in state: " + node)

    stateObj = State(nodes)
    for st in state.states:
        vec = state.getStateVec(st, nodes)
        newst = myutils.bool2int(vec)
        stateObj.addState(newst)
    return stateObj