File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ def all_models(names: 't.Iterable[Name]') -> t.Iterator[Model]:
6060T_NNF_co = t .TypeVar ('T_NNF_co' , bound = 'NNF' , covariant = True )
6161_Tristate = t .Optional [bool ]
6262
63+ # Valid values: native, kissat, and pysat
64+ SAT_BACKEND = 'native'
65+
6366if t .TYPE_CHECKING :
6467 def memoize (func : T ) -> T :
6568 ...
@@ -594,10 +597,17 @@ def to_CNF(self) -> 'And[Or[Var]]':
594597 from nnf import tseitin
595598 return tseitin .to_CNF (self )
596599
597- def _cnf_satisfiable (self ) -> bool :
598- """Call a SAT solver (kissat) on the presumed CNF theory."""
599- from nnf import kissat
600- return kissat .solve (self ) is not None
600+ def _cnf_satisfiable (self : 'And[Or[Var]]' ) -> bool :
601+ """Call a SAT solver on the presumed CNF theory."""
602+ if 'native' == SAT_BACKEND :
603+ return self ._cnf_satisfiable_native ()
604+ elif 'kissat' == SAT_BACKEND :
605+ from nnf import kissat
606+ return kissat .solve (self ) is not None
607+ elif 'pysat' == SAT_BACKEND :
608+ raise NotImplementedError ('pysat backend not yet implemented' )
609+ else :
610+ raise NotImplementedError ('Unrecognized SAT backend: ' + SAT_BACKEND )
601611
602612 def _cnf_satisfiable_native (self ) -> bool :
603613 """A naive DPLL SAT solver."""
You can’t perform that action at this time.
0 commit comments