public abstract class SatSolver extends Object implements net.sf.tweety.logics.commons.analysis.BeliefSetConsistencyTester<PropositionalFormula>, net.sf.tweety.logics.commons.analysis.ConsistencyWitnessProvider<PropositionalFormula>
| Constructor and Description |
|---|
SatSolver() |
| Modifier and Type | Method and Description |
|---|---|
protected static net.sf.tweety.commons.util.Pair<String,List<PropositionalFormula>> |
convertToDimacs(Collection<PropositionalFormula> formulas)
Converts the given set of formulas to their string representation in
Dimacs CNF.
|
protected static String |
convertToDimacs(Collection<PropositionalFormula> formulas,
List<Proposition> props)
Converts the given set of formulas to their string representation in
Dimacs CNF.
|
protected static net.sf.tweety.commons.util.Pair<File,List<PropositionalFormula>> |
createTmpDimacsFile(Collection<PropositionalFormula> formulas)
Creates a temporary file in Dimacs format and also returns a mapping between formulas and clauses.
|
protected static File |
createTmpDimacsFile(Collection<PropositionalFormula> formulas,
List<Proposition> props)
Creates a temporary file in Dimacs format with the given proposition2variable mapping.
|
static SatSolver |
getDefaultSolver()
Returns the default SAT solver.
If a default SAT solver has been configured this solver
is returned by this method.
|
net.sf.tweety.commons.Interpretation |
getWitness(net.sf.tweety.commons.BeliefSet<PropositionalFormula> bs) |
abstract net.sf.tweety.commons.Interpretation |
getWitness(Collection<PropositionalFormula> formulas)
If the collection of formulas is consistent this method
returns some model of it or, if it is inconsistent, null.
|
net.sf.tweety.commons.Interpretation |
getWitness(PropositionalFormula formula) |
static boolean |
hasDefaultSolver()
Returns "true" if a default SAT solver is configured.
|
boolean |
isConsistent(net.sf.tweety.commons.BeliefSet<PropositionalFormula> beliefSet) |
boolean |
isConsistent(Collection<PropositionalFormula> formulas) |
boolean |
isConsistent(PropositionalFormula formula) |
abstract boolean |
isSatisfiable(Collection<PropositionalFormula> formulas)
Checks whether the given set of formulas is satisfiable.
|
static void |
setDefaultSolver(SatSolver solver)
Sets the default SAT solver.
|
static void |
setTempFolder(File tempFolder)
Set the folder for temporary files created by SAT solver.
|
public static void setDefaultSolver(SatSolver solver)
solver - some SAT solverpublic static void setTempFolder(File tempFolder)
tempFolder - some temp folder.public static boolean hasDefaultSolver()
public static SatSolver getDefaultSolver()
net.sf.tweety.pl.sat.Sat4jSolver)
is returned as a fallback and a message is
printed to stderr pointing out that no default SAT solver is configured.protected static String convertToDimacs(Collection<PropositionalFormula> formulas, List<Proposition> props)
convertToDimacs(.) for
obtaining a map between those.formulas - a collection of formulasa - list of propositions (=signature) where the indices are used for writing the clauses.protected static net.sf.tweety.commons.util.Pair<String,List<PropositionalFormula>> convertToDimacs(Collection<PropositionalFormula> formulas)
formulas - a collection of formulas.protected static File createTmpDimacsFile(Collection<PropositionalFormula> formulas, List<Proposition> props) throws IOException
formulas - a collection of formulasa - list of propositions (=signature) where the indices are used for writing the clauses.IOException - if something went wrong while creating a temporary file.protected static net.sf.tweety.commons.util.Pair<File,List<PropositionalFormula>> createTmpDimacsFile(Collection<PropositionalFormula> formulas) throws IOException
formulas - a collection of formulasa - list of propositions (=signature) where the indices are used for writing the clauses
(a list of collections of formulas (all from the given set); the interpretation of this list
is that the generated clause no K originated from the propositional formula given at index k).IOException - if something went wrong while creating a temporary file.public abstract net.sf.tweety.commons.Interpretation getWitness(Collection<PropositionalFormula> formulas)
getWitness in interface net.sf.tweety.logics.commons.analysis.ConsistencyWitnessProvider<PropositionalFormula>public abstract boolean isSatisfiable(Collection<PropositionalFormula> formulas)
formulas - a set of formulas.public boolean isConsistent(net.sf.tweety.commons.BeliefSet<PropositionalFormula> beliefSet)
isConsistent in interface net.sf.tweety.logics.commons.analysis.BeliefSetConsistencyTester<PropositionalFormula>isConsistent in interface net.sf.tweety.logics.commons.analysis.ConsistencyTester<net.sf.tweety.commons.BeliefSet<PropositionalFormula>>public boolean isConsistent(Collection<PropositionalFormula> formulas)
isConsistent in interface net.sf.tweety.logics.commons.analysis.BeliefSetConsistencyTester<PropositionalFormula>public boolean isConsistent(PropositionalFormula formula)
isConsistent in interface net.sf.tweety.logics.commons.analysis.BeliefSetConsistencyTester<PropositionalFormula>public net.sf.tweety.commons.Interpretation getWitness(PropositionalFormula formula)
getWitness in interface net.sf.tweety.logics.commons.analysis.ConsistencyWitnessProvider<PropositionalFormula>public net.sf.tweety.commons.Interpretation getWitness(net.sf.tweety.commons.BeliefSet<PropositionalFormula> bs)
getWitness in interface net.sf.tweety.logics.commons.analysis.ConsistencyWitnessProvider<PropositionalFormula>Copyright © 2018. All rights reserved.