Difference between revisions of "2-satisfiability"
Karl Jones (Talk | contribs) (Created page with "In computer science, '''2-satisfiability''' (abbreviated as '''2-SAT''' or just '''2SAT''') is the problem of determining whether a collection of two-valued (Boolean or bi...") |
Karl Jones (Talk | contribs) |
||
Line 26: | Line 26: | ||
A computationally difficult variation of 2-satisfiability, finding a [[truth assignment]] that maximizes the number of satisfied constraints, has an [[approximation algorithm]] whose optimality depends on the [[unique games conjecture]], and another difficult variation, finding a satisfying assignment minimizing the number of true variables, is an important test case for [[parameterized complexity]]. | A computationally difficult variation of 2-satisfiability, finding a [[truth assignment]] that maximizes the number of satisfied constraints, has an [[approximation algorithm]] whose optimality depends on the [[unique games conjecture]], and another difficult variation, finding a satisfying assignment minimizing the number of true variables, is an important test case for [[parameterized complexity]]. | ||
+ | |||
+ | == Discrete tomography == | ||
+ | |||
+ | [[Tomography]] is the process of recovering shapes from their cross-sections. | ||
+ | |||
+ | In [[discrete tomography]], a simplified version of the problem that has been frequently studied, the shape to be recovered is a polyomino (a subset of the squares in the two-dimensional square lattice), and the cross-sections provide aggregate information about the sets of squares in individual rows and columns of the lattice. | ||
+ | |||
+ | In other forms of digital tomography, even less information about each row or column is given: only the total number of squares, rather than the number and length of the blocks of squares. | ||
+ | |||
+ | An equivalent version of the problem is that we must recover a given 0-1 matrix given only the sums of the values in each row and in each column of the matrix. | ||
+ | |||
+ | == Nonogram puzzles == | ||
+ | |||
+ | [[Nonograms]], also known as paint by numbers or griddlers, are a form of [[puzzle]] where the user fills in certain cells in a grid according to instructions. | ||
+ | |||
+ | The filled-in cells represent the dark pixels in a [[binary image]]. The input given to the puzzle solver tells him or her how many consecutive blocks of dark pixels to include in each row or column of the image, and how long each of those blocks should be. | ||
+ | |||
+ | === Nonogram solution theory === | ||
+ | |||
+ | As part of a solver for full nonogram puzzles, Batenburg and Kosters (2008, 2009) used 2-satisfiability to combine information obtained from several other heuristics. | ||
+ | |||
+ | Given a partial solution to the puzzle, they use [[dynamic programming]] within each row or column to determine whether the constraints of that row or column force any of its squares to be white or black, and whether any two squares in the same row or column can be connected by an implication relation. | ||
+ | |||
+ | They also transform the nonogram into a digital tomography problem by replacing the sequence of block lengths in each row and column by its sum, and use a maximum flow formulation to determine whether this digital tomography problem combining all of the rows and columns has any squares whose state can be determined or pairs of squares that can be connected by an implication relation. | ||
+ | |||
+ | If either of these two heuristics determines the value of one of the squares, it is included in the partial solution and the same calculations are repeated. | ||
+ | |||
+ | However, if both heuristics fail to set any squares, the implications found by both of them are combined into a 2-satisfiability problem and a 2-satisfiability solver is used to find squares whose value is fixed by the problem, after which the procedure is again repeated. | ||
+ | |||
+ | This procedure may or may not succeed in finding a solution, but it is guaranteed to run in [[polynomial time]]. | ||
+ | |||
+ | Batenburg and Kosters report that, although most newspaper puzzles do not need its full power, both this procedure and a more powerful but slower procedure which combines this 2-satisfiability approach with the limited backtracking of Even, Itai & Shamir (1976) are significantly more effective than the [[dynamic programming]] and [[flow heuristics]] without 2-satisfiability when applied to more difficult randomly generated nonograms. | ||
== See also == | == See also == | ||
Line 35: | Line 67: | ||
* [[Implication graph]] | * [[Implication graph]] | ||
* [[Median graph]] | * [[Median graph]] | ||
+ | * [[Nonogram ]] | ||
* [[Satisfiability problem]] | * [[Satisfiability problem]] | ||
Revision as of 13:56, 25 May 2016
In computer science, 2-satisfiability (abbreviated as 2-SAT or just 2SAT) is the problem of determining whether a collection of two-valued (Boolean or binary) variables with constraints on pairs of variables can be assigned values satisfying all the constraints.
Contents
Description
2-satisfiability is a special case of the general Boolean satisfiability problem, which can involve constraints on more than two variables, and of constraint satisfaction problems, which can allow more than two choices for the value of each variable. But in contrast to those more general problems, which are NP-complete, 2-satisfiability can be solved in polynomial time.
Instances of the 2-satisfiability problem are typically expressed as 2-CNF, also known as Krom formulas.
An alternative representation is the implication graph, which expresses the variables of an instance and their negations as vertices in a graph, and constraints on pairs of variables as directed edges.
An instance may be solved in polynomial time by resolution.
Linear time solutions include a method based on backtracking and another method based on the strongly connected components of the implication graph.
2-satisfiability may be applied to geometry and data visualization problems in which a collection of objects each have two potential locations and the goal is to find a placement for each object that avoids overlaps with other objects.
Other applications include clustering data to minimize the sum of the diameters of the clusters, classroom and sports scheduling, and recovering shapes from information about their cross-sections.
Computational complexity theory
In computational complexity theory, 2-satisfiability provides an example of an NL-complete problem, one that can be solved non-deterministically using a logarithmic amount of storage and that is among the hardest of the problems solvable in this resource bound.
The set of all solutions to a 2-satisfiability instance can be given the structure of a median graph, but counting these solutions is #P-complete and therefore not expected to have a polynomial-time solution.
Random instances undergo a sharp phase transition from solvable to unsolvable instances as the ratio of constraints to variables increases past 1, a phenomenon conjectured but unproven for more complicated forms of the satisfiability problem.
A computationally difficult variation of 2-satisfiability, finding a truth assignment that maximizes the number of satisfied constraints, has an approximation algorithm whose optimality depends on the unique games conjecture, and another difficult variation, finding a satisfying assignment minimizing the number of true variables, is an important test case for parameterized complexity.
Discrete tomography
Tomography is the process of recovering shapes from their cross-sections.
In discrete tomography, a simplified version of the problem that has been frequently studied, the shape to be recovered is a polyomino (a subset of the squares in the two-dimensional square lattice), and the cross-sections provide aggregate information about the sets of squares in individual rows and columns of the lattice.
In other forms of digital tomography, even less information about each row or column is given: only the total number of squares, rather than the number and length of the blocks of squares.
An equivalent version of the problem is that we must recover a given 0-1 matrix given only the sums of the values in each row and in each column of the matrix.
Nonogram puzzles
Nonograms, also known as paint by numbers or griddlers, are a form of puzzle where the user fills in certain cells in a grid according to instructions.
The filled-in cells represent the dark pixels in a binary image. The input given to the puzzle solver tells him or her how many consecutive blocks of dark pixels to include in each row or column of the image, and how long each of those blocks should be.
Nonogram solution theory
As part of a solver for full nonogram puzzles, Batenburg and Kosters (2008, 2009) used 2-satisfiability to combine information obtained from several other heuristics.
Given a partial solution to the puzzle, they use dynamic programming within each row or column to determine whether the constraints of that row or column force any of its squares to be white or black, and whether any two squares in the same row or column can be connected by an implication relation.
They also transform the nonogram into a digital tomography problem by replacing the sequence of block lengths in each row and column by its sum, and use a maximum flow formulation to determine whether this digital tomography problem combining all of the rows and columns has any squares whose state can be determined or pairs of squares that can be connected by an implication relation.
If either of these two heuristics determines the value of one of the squares, it is included in the partial solution and the same calculations are repeated.
However, if both heuristics fail to set any squares, the implications found by both of them are combined into a 2-satisfiability problem and a 2-satisfiability solver is used to find squares whose value is fixed by the problem, after which the procedure is again repeated.
This procedure may or may not succeed in finding a solution, but it is guaranteed to run in polynomial time.
Batenburg and Kosters report that, although most newspaper puzzles do not need its full power, both this procedure and a more powerful but slower procedure which combines this 2-satisfiability approach with the limited backtracking of Even, Itai & Shamir (1976) are significantly more effective than the dynamic programming and flow heuristics without 2-satisfiability when applied to more difficult randomly generated nonograms.
See also
- Computational complexity theory
- Computer science
- Constraint (mathematics)
- Horn-satisfiability
- Implication graph
- Median graph
- Nonogram
- Satisfiability problem
External links
- 2-satisfiability @ Wikipedia