Ejemplo n.º 1
0
    def solve(self, assumptions=None):
        if assumptions is not None:
            self.push()
            self.add_assertion(self.mgr.And(assumptions))
            self.pending_pop = True

        out = yicespy.yices_check_context(self.yices, self.yices_params)

        if self.model is not None:
            yicespy.yices_free_model(self.model)
            self.model = None

        assert out in [STATUS_SAT, STATUS_UNSAT, STATUS_UNKNOWN]
        if out == STATUS_UNKNOWN:
            raise SolverReturnedUnknownResultError()
        elif out == STATUS_SAT:
            self.model = yicespy.yices_get_model(self.yices, 1)
            return True
        else:
            return False
Ejemplo n.º 2
0
    def solve(self, assumptions=None):
        if assumptions is not None:
            self.push()
            self.add_assertion(self.mgr.And(assumptions))
            self.pending_pop = True

        out = yicespy.yices_check_context(self.yices, None)

        if self.model is not None:
            yicespy.yices_free_model(self.model)
            self.model = None

        assert out in [STATUS_SAT, STATUS_UNSAT, STATUS_UNKNOWN]
        if out == STATUS_UNKNOWN:
            raise SolverReturnedUnknownResultError()
        elif out == STATUS_SAT:
            self.model = yicespy.yices_get_model(self.yices, 1)
            return True
        else:
            return False