Class QdimacsWriter
java.lang.Object
org.tweetyproject.logics.qbf.writer.QdimacsWriter
Converts belief bases to QDIMACS format and prints them.
Notes:
- Currently only works for belief bases that have only quantifiers in the left portion of each formula and have only unquantified formulas in the right portion of each formula.
- The right portion of the formulas does not need to be in any special form (it will be converted to cnf).
Notes:
- Currently only works for belief bases that have only quantifiers in the left portion of each formula and have only unquantified formulas in the right portion of each formula.
- The right portion of the formulas does not need to be in any special form (it will be converted to cnf).
- Author:
- Anna Gessler
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Removes zero at the end of the problem line (workaround for some solvers).Will be set to true/false if the input can be simplified to a tautology/contradiction. -
Constructor Summary
ConstructorDescriptionCreates a new QDIMACS writer.QdimacsWriter
(Writer writer) Creates a new QDIMACS writer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying writer resource.printBase
(PlBeliefSet kb) Return Kb in string formatprintVariables
(Set<Proposition> vars, Map<Proposition, Integer> mappings) Prints the variable mappings for a given set of propositions.
-
Field Details
-
DISABLE_PREAMBLE_ZERO
public boolean DISABLE_PREAMBLE_ZERORemoves zero at the end of the problem line (workaround for some solvers). -
special_formula_flag
Will be set to true/false if the input can be simplified to a tautology/contradiction. Used in some of the solver wrappers to immediately return true/false instead of calling the solver in case of a tautology/contradiction.
-
-
Constructor Details
-
QdimacsWriter
-
QdimacsWriter
public QdimacsWriter()Creates a new QDIMACS writer.
-
-
Method Details
-
printBase
Return Kb in string format- Parameters:
kb
- a kb- Returns:
- kb in string format
- Throws:
IOException
- error
-
printVariables
Prints the variable mappings for a given set of propositions. The method generates a string containing the corresponding integer mappings for each proposition in the provided set, using the mappings from the provided map.- Parameters:
vars
- The set of propositions whose mappings are to be printed.mappings
- A map that associates each proposition with an integer value.- Returns:
- A string containing the integer mappings of the propositions, separated by spaces.
-
close
Closes the underlying writer resource. This method should be called when all writing operations are complete to ensure that all resources are properly released.- Throws:
IOException
- If an I/O error occurs during closing the writer.
-