Implemented a SAT Solver using C++.
- Make sure
g++
is installed on your system. - Move to the directory in termina in which
main.cpp
is located - Run the following commands in order
g++ main.cpp -o sat
where./sat filePath
filePath
(without inverted commas) is relative path to the input cnf file.
Directory contains the following source code files:
-
main.cpp
: contains the driver code. -
Solver.hpp
: header file containing the Solver class -
Formula.hpp
: header file containing the Formula class -
Utils.hpp
: header file containing the STLs and function for calculation of runtime.
Directory contains following files apart from the source code:
-
README.md
: This file, containing instructions to run the code and directory structure. -
input.txt
: contains a cnf file, in case of no input provided in arguments, it will be taken by default. -
tests/
: A folder containing 5 sample test cases. Inputs in the cnf specified form are intest_x.txt
and curresponding solutions are insol_test_x.txt
where x is test number. -
Solution generated by The program will be shown on terminal along with the time taken by program. If SAT, the generated model will also be displayed. The positive number represents that the literal is assigned
True
value and the negative number represents otherwise.