def get_model(self): assignment = {} for var, vid in self._var_ids.items(): v = picosat.picosat_deref(self.pico, vid) assert v != 0, "Error when translating variable." value = self.mgr.Bool(v == 1) assignment[var] = value return EagerModel(assignment=assignment, environment=self.environment)
def get_model(self): assignment = {} for var, vid in iteritems(self._var_ids): v = picosat.picosat_deref(self.pico, vid) if v == 0: assert False value = self.mgr.Bool(v == 1) assignment[var] = value return EagerModel(assignment=assignment, environment=self.environment)
def get_model(self): assignment = {} for var, vid in iteritems(self._var_ids): v = picosat.picosat_deref(self.pico, vid) if v == 0: assert False value = self.mgr.Bool(v == 1) assignment[var] = value return EagerModel(assignment=assignment, environment=self.environment)
def modelValue(self, l, default=None): if self.last_sat_result is not None and not self.last_sat_result: raise RuntimeError( 'modelValue can only be invoked when solve returns SAT.') v = picosat.picosat_deref(self.p, l) if v == 1: return True elif v == -1: return False else: if default is None: raise ValueError("No assignment for literal: %d" % l) else: return default