Package net.sf.tweety.logics.qbf.parser
Class QdimacsParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<net.sf.tweety.logics.pl.syntax.PlBeliefSet,net.sf.tweety.logics.pl.syntax.PlFormula>
-
- net.sf.tweety.logics.pl.parser.DimacsParser
-
- net.sf.tweety.logics.qbf.parser.QdimacsParser
-
public class QdimacsParser extends net.sf.tweety.logics.pl.parser.DimacsParserThis class implements a parser for the QDIMACS input format. It is an extension of the DIMACS format used in sat solver competitions. See http://www.qbflib.org/qdimacs.html for more information.
The BNF for a QDIMACS input file is given by (starting symbol is QDIMACS-FILE):
QDIMACS-FILE ::== PREAMBLE PREFIX MATRIX
PREAMBLE ::== "p" "cnf" PNUM PNUM "\n"
PREFIX ::== [QUANT_SETS]
QUANT_SETS ::== QUANT_SET QUANT_SETS | QUANT_SET
QUANT_SET ::== QUANTIFIER ATOM_SET "0\n"
QUANTIFIER ::== "e" | "a"
ATOM_SET ::== PNUM ATOM_SET | PNUM
MATRIX ::== CLAUSE_LIST
CLAUSE_LIST ::== CLAUSE CLAUSE_LIST | CLAUSE
CLAUSE ::== LITERAL CLAUSE | LITERAL "0\n"
Lines starting with "c" and consisting of non-special-ASCII characters (comments) are ignored.
LITERAL is a signed integer != 0.
PNUM is a signed integer > 0.
The two numbers in PREAMBLE specify the number of variables and the number of clauses.
To parse QDIMACS output files, useparseQDimacsOutput(String)- Author:
- Anna Gessler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQdimacsParser.AnswerPossible answers that solvers can find for a given QDIMACS problem.
-
Constructor Summary
Constructors Constructor Description QdimacsParser()
-
Method Summary
Modifier and Type Method Description net.sf.tweety.logics.pl.syntax.PlBeliefSetparseBeliefBase(Reader reader)QdimacsParser.AnswerparseQDimacsOutput(String output)Parses the answer from a given QDIMACS output file.
-
-
-
Method Detail
-
parseBeliefBase
public net.sf.tweety.logics.pl.syntax.PlBeliefSet parseBeliefBase(Reader reader) throws IOException, net.sf.tweety.commons.ParserException
- Overrides:
parseBeliefBasein classnet.sf.tweety.logics.pl.parser.DimacsParser- Throws:
IOExceptionnet.sf.tweety.commons.ParserException
-
parseQDimacsOutput
public QdimacsParser.Answer parseQDimacsOutput(String output)
Parses the answer from a given QDIMACS output file. The rest of the file is ignored.- Parameters:
output- string containing a QDIMACS output file- Returns:
- either SAT, UNSAT or UNKNOWN
-
-