A SAT solver dedicated to solving instances derived from a Weil descent.
WDSat was introduced at CP20 (see paper) as a joint work with Sorina Ionica and Gilles Dequen.
WDSat is built from scratch and has no particular dependencies, apart from the essential tools.
make
in the src
folder wil create the wdsat_solver
executable in the root folder.
-i file : where file is the input file
-x : to enable Gaussian Elimination
-g mvc : where mvc is a string of comma-separated variables that defines statically the branching order
The core structures in the different WDSat modules are statically allocated and, currently, several constants need to be set manually in the config.h
file.
- When __XG_ENHANCED__ is defined, the XORGAUSS-extended module is used for Gaussian Elimination and the input instance has to be in ANF form. (see input forms section)
- When __FIND_ALL_SOLUTIONS__ is defined, the solver outputs all solutions instead of stopping after the first solution is found, and outputs UNSAT at the end.
- __MAX_ANF_ID__ defines the maximum number of unary variables, i.e. variables in the ANF form. Always add +1 to the actual value.
- __MAX_DEGREE__ defines the maximum degree of the Boolean polynomial systems from which SAT instances are derived. Always add +1 to the actual value.
- __MAX_ID__ defines the maximum number of variables in the CNF-XOR form, but has to be set even when the given input is in ANF. For good performance, it is important to set this constant to the exact value. If the estimation is badly made, the solver will alert you at the beginning and will give you the correct value for the current instance.
- __MAX_BUFFER_SIZE__ is complicated to estimate. Start with 5000 and increase if not enough (execution will stop immediately, with an appropriate error message).
- __MAX_EQ__ defines the maximum number of OR-clauses.
- __MAX_EQ_SIZE__ defines the maximum size of OR-clauses. Always add +1 to the actual value. This value always corresponds to (__MAX_DEGREE__ + 1).
- __MAX_XEQ__ defines the maximum number of XOR-clauses.
- __MAX_XEQ_SIZE__ defines the maximum size of XOR-clauses. Be careful, the size of XOR-clauses can increase when Gaussian Elimination is performed. Try to estimate, or at worst, set to __MAX_ID__. When this value is underestimated, execution fails, but not necessarily straightaway.
This input corresponds to the classical dimacs CNF form.
¬ x3 ∨ x2
¬ x3 ∨ x1
¬ x1 ∨ ¬ x2 ∨ x3
is written as
p cnf 3 3
-3 2 0
-3 1 0
-1 -2 3 0
This input corresponds to the classical CNF-XOR input, where XOR-clauses are distinguished from OR-clauses by adding an 'x' at the start of the line.
¬ x3 ∨ x2
¬ x3 ∨ x1
¬ x1 ∨ ¬ x2 ∨ x3
x1 ⊕ x2 ⊕ ¬ x4 ⊕ x5
x1 ⊕ x3 ⊕ x6
is written as
p cnf 6 5
-3 2 0
-3 1 0
-1 -2 3 0
x 1 2 -4 5 0
x 1 3 6 0
This input describes XOR-clauses that can contain both unary literals and conjunctions of two or more literals. When a term is unary, only the corresponding literal is written. When a term is a conjunction, first we write .d
, where d
is the number of literals that comprise the conjunction and then, we list the literals. There can not be negative literals in the formula, but we can add a ⊤ constant instead.
x1 ⊕ x2 ⊕ x4 ⊕ x5 ⊕ ⊤
x1 ⊕ (x1 ∧ x2) ⊕ x6
(x2 ∧ x3 ∧ x6) ⊕ x6 ⊕ ⊤
is written as
p cnf 6 3
x 1 2 4 5 T 0
x 1 .2 1 2 6 0
x .3 2 3 6 6 T 0