コード例 #1
0
 def iterworlds(self):
     '''
     Iterates over the possible worlds of this MRF taking into account the evidence vector of truth values.
     
     :returns:    a generator of (idx, possible world) tuples.
     '''
     for res in self._iterworlds(self.variables, list(self.evidence), CallByRef(0), self.evidence_dicti()):
         yield res
コード例 #2
0
 def iterallworlds(self):
     '''
     Iterates over all possible worlds (without) taking evidence into account).
     
     :returns:    a generator of possible worlds.
     '''
     world = [None] * len(self.evidence)
     for i, w in self._iterworlds(self.variables, world, CallByRef(0), {}):
         yield i, w