def __init__(self): """Creates a new IntConversion""" # void* -> int p2i = lambda p: _utils.void_star_to_int(p) # int -> void* i2p = lambda i: _utils.int_to_void_star(i) super().__init__(p2i, i2p)
def solve_groups(self, groups): """ Tries to solve formulas from the groups in the list. ..:note: - The permanent group is automatically added to the list. - the model property may be accessed iff this function returns SatSolverResult.SATISFIABLE :return: a flag whether the solving was successful. """ me = self._as_SatIncSolver_ptr() olist= _utils.Olist_create() for g in groups: _utils.Olist_append(olist, int_to_void_star(g)) result = _sat.SatIncSolver_solve_groups(me, olist) _utils.Olist_destroy(olist) return SatSolverResult(result)
def solve_without_groups(self, groups): """ Tries to solve formulas in groups belonging to the solver except the groups in the given list `groups_olist` ..:note: - The permanent group may not be in the groups_olist - the model property may be accessed iff this function returns SatSolverResult.SATISFIABLE :return: a flag whether the solving was successful. """ if self.permanent_group in groups: raise ValueError("The permanent group may be in the groups_olist") me = self._as_SatIncSolver_ptr() olist= _utils.Olist_create() for g in groups: _utils.Olist_append(olist, int_to_void_star(g)) result = _sat.SatIncSolver_solve_without_groups(me, olist) _utils.Olist_destroy(olist) return SatSolverResult(result)