- java.lang.Object
-
- org.logicng.io.readers.DimacsReader
-
public final class DimacsReader extends Object
A reader for DIMACS CNF files.This reader reads all the clauses and variables - independent of the numbers given in the prefix. Also, it assumes that every clause is in its own line and ends with '0'. Comments are only allowed if the lines start with 'c'. No C style comments are supported (yes, we have actually seen these in DIMACS files).
- Since:
- 1.2
- Version:
- 1.3
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Formula>readCNF(File file, FormulaFactory f)Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.static List<Formula>readCNF(File file, FormulaFactory f, String prefix)Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.static List<Formula>readCNF(String fileName, FormulaFactory f)Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.static List<Formula>readCNF(String fileName, FormulaFactory f, String prefix)Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.
-
-
-
Method Detail
-
readCNF
public static List<Formula> readCNF(File file, FormulaFactory f) throws IOException
Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas. The prefixvis used for the variables names.- Parameters:
file- the filef- the formula factory- Returns:
- the list of formulas (clauses)
- Throws:
IOException- if there was a problem reading the file
-
readCNF
public static List<Formula> readCNF(File file, FormulaFactory f, String prefix) throws IOException
Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.- Parameters:
file- the filef- the formula factoryprefix- the prefix for the variable names- Returns:
- the list of formulas (clauses)
- Throws:
IOException- if there was a problem reading the file
-
readCNF
public static List<Formula> readCNF(String fileName, FormulaFactory f) throws IOException
Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas. The prefixvis used for the variables names.- Parameters:
fileName- the file namef- the formula factory- Returns:
- the list of formulas (clauses)
- Throws:
IOException- if there was a problem reading the file
-
readCNF
public static List<Formula> readCNF(String fileName, FormulaFactory f, String prefix) throws IOException
Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas.- Parameters:
fileName- the file namef- the formula factoryprefix- the prefix for the variable names- Returns:
- the list of formulas (clauses)
- Throws:
IOException- if there was a problem reading the file
-
-