Class Sat4jSolver
java.lang.Object
org.tweetyproject.logics.pl.sat.SatSolver
org.tweetyproject.logics.pl.sat.DimacsSatSolver
org.tweetyproject.logics.pl.sat.Sat4jSolver
- All Implemented Interfaces:
BeliefSetConsistencyTester<PlFormula>,ConsistencyTester<BeliefSet<PlFormula, ?>>,ConsistencyWitnessProvider<PlBeliefSet, PlFormula>
Uses the Sat4j library for SAT solving (note that currently only the light version is used).
- Author:
- Matthias Thimm
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new solver with default parameters (maxvar=1000000, nbclauses=500000).Sat4jSolver(int maxvar, int nbclauses) Creates a new solver with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptiongetWitness(Collection<PlFormula> formulas, Map<Proposition, Integer> prop_index, Map<Integer, Proposition> prop_inverted_index, List<String> additional_clauses) If the collection of formulas is consistent this method returns some model of it or, if it is inconsistent, null.booleanReturn whether the solve ris installedbooleanisSatisfiable(Collection<PlFormula> formulas, Map<Proposition, Integer> prop_index, List<String> additional_clauses) Checks whether the given set of formulas is satisfiable.Methods inherited from class org.tweetyproject.logics.pl.sat.DimacsSatSolver
convertToDimacs, convertToDimacs, getWitness, isSatisfiable, setTempFolderMethods inherited from class org.tweetyproject.logics.pl.sat.SatSolver
getDefaultSolver, getWitness, getWitness, hasDefaultSolver, isConsistent, isConsistent, isConsistent, setDefaultSolver
-
Constructor Details
-
Sat4jSolver
public Sat4jSolver(int maxvar, int nbclauses) Creates a new solver with the given parameters.- Parameters:
maxvar- Max number of variables for this solver.nbclauses- Max number of expected clauses for this solver.
-
Sat4jSolver
public Sat4jSolver()Creates a new solver with default parameters (maxvar=1000000, nbclauses=500000).
-
-
Method Details
-
isSatisfiable
public boolean isSatisfiable(Collection<PlFormula> formulas, Map<Proposition, Integer> prop_index, List<String> additional_clauses) Description copied from class:DimacsSatSolverChecks whether the given set of formulas is satisfiable.- Specified by:
isSatisfiablein classDimacsSatSolver- Parameters:
formulas- a set of formulas.prop_index- maps propositions to the number that shall be used to represent it (a natural number > 0).additional_clauses- additional clauses in text form to be added (already correctly formatted in CNF!)- Returns:
- "true" if the set is consistent.
-
getWitness
public Interpretation<PlBeliefSet, PlFormula> getWitness(Collection<PlFormula> formulas, Map<Proposition, Integer> prop_index, Map<Integer, Proposition> prop_inverted_index, List<String> additional_clauses) Description copied from class:DimacsSatSolverIf the collection of formulas is consistent this method returns some model of it or, if it is inconsistent, null.- Specified by:
getWitnessin classDimacsSatSolver- Parameters:
formulas- a set of formulasprop_index- mapping propositions to numbers used for representing the SAT instanceprop_inverted_index- inverted index of prop_indexadditional_clauses- additional clauses in text form to be added (already correctly formatted in CNF!)- Returns:
- some model of the formulas or null.
-
isInstalled
public boolean isInstalled()Description copied from class:SatSolverReturn whether the solve ris installed- Specified by:
isInstalledin classDimacsSatSolver- Returns:
- whether the solve ris installed
-