|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
2-SAT solver based on Tarjan's SCC algorithm. More...
#include <cassert>#include <utility>#include <limits>#include <ah-errors.H>#include <tpl_array.H>#include <tpl_dynArray.H>#include <tpl_graph.H>#include <tpl_dynSetTree.H>#include <Tarjan.H>Go to the source code of this file.
Classes | |
| class | Aleph::Two_Sat< GT > |
| 2-SAT solver using Tarjan's SCC algorithm. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
2-SAT solver based on Tarjan's SCC algorithm.
The 2-satisfiability problem (2-SAT) involves determining if a conjunction of clauses, each with exactly two literals, can be satisfied by a truth assignment.
This implementation uses an implication graph and Tarjan's strongly connected components (SCC) algorithm. A formula is satisfiable if and only if no variable and its negation are in the same SCC.
Variables are 0-indexed from 0 to n-1. Each variable i has two literals:
2*i2*i + 1Signed 1-based indices are also supported: +k for x_{k-1} and -k for ~x_{k-1}.
Definition in file Two_Sat.H.