Centered hexagonal number: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>PrimeHunter
Undid revision 588236831 by 2.223.219.14 (talk). Unexplained removal of see also links
link to OEIS sequence
Line 1: Line 1:
In [[computer science]], '''2-satisfiability''' (abbreviated as 2-SAT or just 2SAT) is the problem of determining whether a collection of two-valued ([[Boolean logic|Boolean]] or [[Binary numeral system|binary]]) variables with [[Constraint (mathematics)|constraints]] on pairs of variables can be assigned values satisfying all the constraints. It is a special case of the general [[Boolean satisfiability problem]], which can involve constraints on more than two variables, and of [[constraint satisfaction problem]]s, which can allow more than two choices for the value of each variable. But in contrast to those problems, which are [[NP-complete]], it has a known [[polynomial time]] solution. Instances of the 2-satisfiability problem are typically expressed as [[Conjunctive normal form|2-CNF]] or '''Krom formulas'''.


==Problem representations==
[[File:Implication graph.svg|thumb|300px|The implication graph for the example 2-SAT instance shown in this section.]]
A 2-SAT problem may be described using a [[Boolean expression]] with a special restricted form: a [[Logical conjunction|conjunction]] of [[disjunction]]s (and of ors), where each disjunction (or operation) has two arguments that may either be variables or the negations of variables. The variables or their negations appearing in this formula are known as [[Term (logic)|terms]] and the disjunctions of pairs of terms are known as [[Clause (logic)|clauses]]. For example, the following formula is in conjunctive normal form, with seven variables and eleven clauses:


:<math> (x_0\lor x_2)\land(x_0\lor\lnot x_3)\land(x_1\lor\lnot x_3)\land(x_1\lor\lnot x_4)\land</math>
My person who wrote all of the article is called Leland but it's not all most masucline name on the internet. To go to karaoke is the thing which is why he loves most of each of the. He operates as a cashier. His wife and him live all through Massachusetts and he enjoys everything that he needs there. He's not godd at design but locate want to check his website: http://circuspartypanama.com<br><br>Here is my [http://data.gov.uk/data/search?q=blog+post blog post] ... [http://circuspartypanama.com Clash of clans hack]
:<math>(x_2\lor\lnot x_4)\land{}(x_0\lor \lnot x_5)\land (x_1\lor\lnot x_5)\land (x_2\lor\lnot x_5)\land </math>
:<math>(x_3\lor x_6)\land (x_4\lor x_6)\land (x_5\lor x_6).</math>
 
The 2-satisfiability problem is to find a [[truth assignment]] to these variables that makes a formula of this type true: we must choose whether to make each of the variables true or false, so that every clause has at least one term that becomes true. For the expression shown above, one possible satisfying assignment is the one that sets all seven of the variables to true. There are also 15 other ways of setting all the variables so that the formula becomes true. Therefore, the 2-SAT instance represented by this expression is satisfiable.
 
Formulas with the form described above are known as 2-CNF formulas; the "2" in this name stands for the number of terms per clause, and "CNF" stands for [[conjunctive normal form]], a type of Boolean expression in the form of a conjunction of disjunctions. They are also called Krom formulas, after the work of [[University of California, Davis|UC Davis]] mathematician Melven R. Krom, whose 1967 paper was one of the earliest works on the 2-satisfiability problem.<ref name="Krom1967">{{citation
| last1 = Krom | first1 = Melven R.
| title = The Decision Problem for a Class of First-Order Formulas in Which all Disjunctions are Binary
| journal = Zeitschrift für Mathematische Logik und Grundlagen der Mathematik
| volume = 13
| pages = 15–20
| year = 1967
| doi = 10.1002/malq.19670130104
}}.</ref>
 
Each clause in a 2-CNF formula is [[logical equivalence|logically equivalent]] to an implication from one variable or negated variable to the other. For example,
:<math>(x_0\lor\lnot x_3) \;\equiv\; (\lnot x_0\Rightarrow\lnot x_3) \;\equiv\; (x_3\Rightarrow x_0).</math>
Because of this equivalence between these different types of operation, a 2-satisfiability instance may also be written in [[implicative normal form]], in which we replace each or operation in the conjunctive normal form by both of the two implications to which it is equivalent.
 
A third, more graphical way of describing a 2-satisfiability instance is as an [[implication graph]]. An implication graph is a [[directed graph]] in which there is one [[vertex (graph theory)|vertex]] per variable or negated variable, and an edge connecting one vertex to another whenever the corresponding variables are related by an implication in the implicative normal form of the instance. An implication graph must be a [[skew-symmetric graph]], meaning that the [[undirected graph]] formed by forgetting the orientations of its edges has a [[graph automorphism|symmetry]] that takes each variable to its negation and reverses the orientations of all of the edges.<ref name="APT79">{{citation
| last1 = Aspvall | first1 = Bengt
| last2 = Plass | first2 = Michael F.
| authorlink3 = Robert Tarjan | last3 = Tarjan | first3 = Robert E.
| title = A linear-time algorithm for testing the truth of certain quantified boolean formulas
| url = http://www.math.ucsd.edu/~sbuss/CourseWeb/Math268_2007WS/2SAT.pdf
| journal = [[Information Processing Letters]]
| volume = 8 | issue = 3 | pages = 121–123 | year = 1979
| doi = 10.1016/0020-0190(79)90002-4}}.</ref>
 
==Algorithms==
Several algorithms are known for solving the 2-satisfiability problem; the most efficient of them take [[linear time]].<ref name="Krom1967"/><ref name="APT79"/><ref name="EIS76"/>
 
===Resolution and transitive closure===
{{harvtxt|Krom|1967}} described the following [[polynomial time]] decision procedure for solving 2-satisfiability instances.<ref name="Krom1967"/>
 
Suppose that a 2-satisfiability instance contains two clauses that both use the same variable ''x'', but that ''x'' is negated in one clause and not in the other. Then we may combine the two clauses to produce a third clause, having the two other terms in the two clauses; this third clause must also be satisfied whenever the first two clauses are both satisfied. For instance, we may combine the clauses <math>(a\lor b)</math> and <math>(\lnot b\lor\lnot c)</math> in this way to produce the clause <math>(a\lor\lnot c)</math>. In terms of the implicative form of a 2-CNF formula, this rule amounts to finding two implications <math>\lnot a\Rightarrow b</math> and <math>b\Rightarrow \lnot c</math>, and inferring by [[transitive relation|transitivity]] a third implication <math>\lnot a\Rightarrow \lnot c</math>.
 
Krom writes that a formula is ''consistent'' if repeated application of this inference rule cannot generate both the clauses <math>(x\lor x)</math> and <math> (\lnot x\lor\lnot x)</math>, for any variable <math> x</math>. As he proves, a 2-CNF formula is satisfiable if and only if it is consistent. For, if a formula is not consistent, it is not possible to satisfy both of the two clauses <math> (x\lor x)</math> and <math>(\lnot x\lor\lnot x)</math> simultaneously. And, if it is consistent, then the formula can be extended by repeatedly adding one clause of the form <math> (x\lor x)</math> or <math> (\lnot x\lor\lnot x)</math> at a time, preserving consistency at each step, until it includes such a clause for every variable. At each of these extension steps, one of these two clauses may always be added while preserving consistency, for if not then the other clause could be generated using the inference rule. Once all variables have a clause of this form in the formula, a satisfying assignment of all of the variables may be generated by setting a variable <math> x</math> to true if the formula contains the clause <math> (x\lor x)</math> and setting it to false if the formula contains the clause <math>(\lnot x\lor\lnot x)</math>.<ref name="Krom1967"/>  If there were a clause not satisfied by this assignment, i.e., one in which both variables appeared with sign opposite to their appearances in the added clauses, it would be possible to resolve this clause with one to reverse the sign of that variable, and then to resolve it with the original clause to produce a clause of the other variable in double with the sign it held in the original clause.  Since the formula is known to have remained consistent, this is impossible, so the assignment must satisfy the original formula as well{{Citation needed|date=June 2011}}.
 
Krom was concerned primarily with [[completeness]] of systems of inference rules, rather than with the efficiency of algorithms. However, his method leads to a [[polynomial time]] bound for solving 2-satisfiability problems.
By grouping together all of the clauses that use the same variable, and applying the inference rule to each pair of clauses, it is possible to find all inferences that are possible from a given 2-CNF instance, and to test whether it is consistent, in total time {{math|O(''n''<sup>3</sup>)}}, where {{math|''n''}} is the number of variables in the instance: for each variable, there may be {{math|O(''n''<sup>2</sup>)}} pairs of clauses involving that variable, to which the inference rule may be applied. Thus, it is possible to determine whether a given 2-CNF instance is satisfiable in time {{math|O(''n''<sup>3</sup>)}}. Because finding a satisfying assignment using Krom's method involves a sequence of {{math|O(''n'')}} consistency checks, it would take time {{math|O(''n''<sup>4</sup>)}}. {{harvtxt|Even|Itai|Shamir|1976}} quote a faster time bound of {{math|O(''n''<sup>2</sup>)}} for this algorithm, based on more careful ordering of its operations. Nevertheless, even this smaller time bound was greatly improved by the later linear time algorithms of {{harvtxt|Even|Itai|Shamir|1976}} and {{harvtxt|Aspvall|Plass|Tarjan|1979}}.
 
In terms of the implication graph of the 2-satisfiability instance, Krom's inference rule can be interpreted as constructing the [[transitive closure]] of the graph. As {{harvtxt|Cook|1971}} observes, it can also be seen as an instance of the [[Davis–Putnam algorithm]] for solving satisfiability problems using the principle of [[Resolution (logic)|resolution]]. Its correctness follows from the more general correctness of the Davis-Putnam algorithm, and its polynomial time bound is clear since each resolution step increases the number of clauses in the instance, which is upper bounded by a quadratic function of the number of variables.<ref>{{citation|first=Stephen A.|last=Cook|authorlink=Stephen Cook|contribution=The complexity of theorem-proving procedures|title=Proc. 3rd ACM Symp. Theory of Computing (STOC)|year=1971|pages=151–158|doi=10.1145/800157.805047}}.</ref>
 
===Limited backtracking===
{{harvtxt|Even|Itai|Shamir|1976}} describe a technique involving limited [[backtracking]] for solving constraint satisfaction problems with binary variables and pairwise constraints; they apply this technique to a problem of classroom scheduling, but they also observe that it applies to other problems including 2-SAT.<ref name="EIS76">{{citation|first1=S.|last1=Even|author1-link=Shimon Even|first2=A.|last2=Itai|first3=A.|last3=Shamir|author3-link=Adi Shamir|title=On the complexity of time table and multi-commodity flow problems|journal=[[SIAM Journal on Computing]]|volume=5|issue=4|year=1976|pages=691–703|doi=10.1137/0205048}}.</ref>
 
The basic idea of their approach is to build a partial truth assignment, one variable at a time. Certain steps of the algorithms are "choice points", points at which a variable can be given either of two different truth values, and later steps in the algorithm may cause it to backtrack to one of these choice points. However, only the most recent choice can be backtracked over; all choices made earlier than the most recent one are permanent.<ref name="EIS76"/>
 
Initially, there is no choice point, and all variables are unassigned.
At each step, the algorithm chooses the variable whose value to set, as follows:
*If there is a clause in which both of the variables are set, in a way that falsifies the clause, then the algorithm backtracks to its most recent choice point, undoing the assignments it made since that choice, and reverses the decision made at that choice. If no choice point has been reached, or if the algorithm has already backtracked over the most recent choice point, then it aborts the search and reports that the input 2-CNF formula is unsatisfiable.
*If there is a clause in which one of the variables has been set, and the clause may still become either true or false, then the other variable is set in a way that forces the clause to become true.
*If all clauses are either guaranteed to be true for the current assignment or have two unset variables, then the algorithm creates a choice point and sets one of the unassigned variables to an arbitrarily chosen value.
 
Intuitively, the algorithm follows all chains of inference after making each of its choices; this either leads to a contradiction and a backtracking step, or, if no contradiction is derived, it follows that the choice was a correct one that leads to a satisfying assignment. Therefore, the algorithm either correctly finds a satisfying assignment or it correctly determines that the input is unsatisfiable.<ref name="EIS76"/>
 
Even et al. did not describe in detail how to implement this algorithm efficiently; they state only that by "using appropriate data structures in order to find the implications of any decision", each step of the algorithm (other than the backtracking) can be performed quickly. However, some inputs may cause the algorithm to backtrack many times, each time performing many steps before backtracking, so its overall complexity may be nonlinear. To avoid this problem, they modify the algorithm so that, after reaching each choice point, it tests in parallel both alternative assignments for the variable set at the choice point, interleaving both parallel tests to produce a sequential algorithm. As soon as one of these two parallel tests reaches another choice point, the other parallel branch is aborted. In this way, the total time spent performing both parallel tests is proportional to the size of the portion of the input formula whose values are permanently assigned. As a result, the algorithm takes [[linear time]] in total.<ref name="EIS76"/>
 
===Strongly connected components===
{{harvtxt|Aspvall|Plass|Tarjan|1979}} found a simpler linear time procedure for solving 2-satisfiability instances, based on the notion of [[strongly connected component]]s from [[graph theory]].<ref name="APT79"/>
 
Two vertices in a directed graph are said to be strongly connected to each other if there is a directed path from one to the other and vice versa. This is an [[equivalence relation]], and the vertices of the graph may be partitioned into strongly connected components, subsets within which every two vertices are strongly connected. There are several efficient linear time algorithms for finding the strongly connected components of a graph, based on [[depth first search]]: [[Tarjan's strongly connected components algorithm]]<ref>{{citation|first=Robert E.|last=Tarjan|authorlink=Robert Tarjan|title=Depth-first search and linear graph algorithms|journal=[[SIAM Journal on Computing]]|volume=1|year=1972|issue=2|pages=146–160|doi=10.1137/0201010}}.</ref> and the [[path-based strong component algorithm]]<ref>First published by {{citation
| last1 = Cheriyan | first1 = J.
| last2 = Mehlhorn | first2 = K. | author2-link = Kurt Mehlhorn
| doi = 10.1007/BF01940880
| journal = [[Algorithmica]]
| pages = 521–549
| title = Algorithms for dense graphs and networks on the random access computer
| volume = 15
| year = 1996
| issue = 6}}. Rediscovered in 1999 by Harold N. Gabow, and published in {{citation
| last = Gabow | first = Harold N.| contribution = Searching (Ch 10.1)
| editor1-last = Gross | editor1-first = J. L.
| editor2-last = Yellen | editor2-first = J.
| pages = 953–984
| publisher = CRC Press
| title = Discrete Math. and its Applications: Handbook of Graph Theory
| volume = 25
| year = 2003}}.</ref> each perform a single depth first search. [[Kosaraju's algorithm]] performs two depth first searches, but is very simple.
 
In terms of the implication graph, two terms belong to the same strongly connected component whenever there exist chains of implications from one term to the other and vice versa. Therefore, the two terms must have the same value in any satisfying assignment to the given 2-satisfiability instance. In particular, if a variable and its negation both belong to the same strongly connected component, the instance cannot be satisfied, because it is impossible to assign both of these terms the same value. As Aspvall et al. showed, this is a [[necessary and sufficient condition]]: a 2-CNF formula is satisfiable if and only if there is no variable that belongs to the same strongly connected component as its negation.<ref name="APT79"/>
 
This immediately leads to a linear time algorithm for testing satisfiability of 2-CNF formulae: simply perform a strong connectivity analysis on the implication graph and check that each variable and its negation belong to different components. However, as Aspvall et al. also showed, it also leads to a linear time algorithm for finding a satisfying assignment, when one exists. Their algorithm performs the following steps:
*Construct the implication graph of the instance, and find its strongly connected components using any of the known linear-time algorithms for strong connectivity analysis.
*Check whether any strongly connected component contains both a variable and its negation. If so, report that the instance is not satisfiable and halt.
*Construct the [[Strongly connected component|condensation]] of the implication graph, a smaller graph that has one vertex for each strongly connected component, and an edge from component {{math|''i''}} to component {{math|''j''}} whenever the implication graph contains an edge {{math|''uv''}} such that {{math|''u''}} belongs to component {{math|''i''}} and {{math|''v''}} belongs to component {{math|''j''}}. The condensation is automatically a [[directed acyclic graph]] and, like the implication graph from which it was formed, it is [[Skew-symmetric graph|skew-symmetric]].
*[[Topological sorting|Topologically order]] the vertices of the condensation; the order in which the components are generated by Kosaraju's algorithm is automatically a topological ordering.
*For each component in this order, if its variables do not already have truth assignments, set all the terms in the component to be false. This also causes all of the terms in the complementary component to be set to true.
 
Due to the topological ordering, when a term {{math|''x''}} is set to false, all terms that lead to it via a chain of implications will themselves already have been set to false. Symmetrically, when a term is set to true, all terms that can be reached from it via a chain of implications will already have been set to true. Therefore, the truth assignment constructed by this procedure satisfies the given formula, which also completes the proof of correctness of the necessary and sufficient condition identified by Aspvall et al.<ref name="APT79"/>
 
As Aspvall et al. show, a similar procedure involving topologically ordering the strongly connected components of the implication graph may also be used to evaluate [[True quantified Boolean formula|fully quantified Boolean formulae]] in which the formula being quantified is a 2-CNF formula.<ref name="APT79"/>
 
==Applications==
===Conflict-free placement of geometric objects===
A number of exact and approximate algorithms for the [[automatic label placement]] problem are based on 2-satisfiability. This problem concerns placing textual labels on the features of a diagram or map. Typically, the set of possible locations for each label is highly constrained, not only by the map itself (each label must be near the feature it labels, and must not obscure other features), but by each other: two labels will be illegible if they overlap each other. In general, label placement is an [[NP-hard]] problem. However, if each feature has only two possible locations for its label (say, extending to the left and to the right of the feature) then it may be solved in polynomial time. For, in this case, one may create a 2-satisfiability instance that has a variable for each label and constraints preventing each pair of labels from being assigned overlapping positions. If the labels are all congruent rectangles, the corresponding 2-SAT instance can be shown to have only linearly many constraints, leading to near-linear time algorithms for finding a labeling.<ref name="fw91">{{citation|first1=M.|last1=Formann|first2=F.|last2=Wagner|contribution=A  packing problem  with  applications  to  lettering  of  maps|title=Proc. 7th ACM Symposium on Computational Geometry|year=1991|pages=281–288|doi=10.1145/109648.109680}}.</ref> {{harvtxt|Poon|Zhu|Chin|1998}} describe a map labeling problem in which each label is a rectangle that may be placed in one of three positions with respect to a line segment that it labels: it may have the segment as one of its sides, or it may be centered on the segment. They represent these three positions using two binary variables in such a way that, again, testing the existence of a valid labeling becomes a 2-SAT problem.<ref>{{citation|first1=Chung Keung|last1=Poon|first2=Binhai|last2=Zhu|first3=Francis|last3=Chin|author3-link=Y. L. Chin|title=A polynomial time solution for labeling a rectilinear map|journal=Information Processing Letters|volume=65|issue=4|year=1998|pages=201–207|doi=10.1016/S0020-0190(98)00002-7}}.</ref>
 
{{harvtxt|Formann|Wagner|1991}} use this observation as part of an [[approximation algorithm]] for the problem of finding square labels of the largest possible size for a given set of points, with the constraint that each label has one of its corners on the point that it labels. To find a labeling with a given size, they eliminate squares that, if doubled, would overlap another points, and they eliminate points that can be labeled in a way that cannot possibly overlap with another point's label, and they show that the remaining points have only two possible label placements, allowing the 2-SAT approach to be used. By searching for the largest size that leads to a solvable 2-SAT instance, they find a solution with [[approximation ratio]] at most two.<ref name="fw91"/><ref>{{citation|first1=Frank|last1=Wagner|first2=Alexander|last2=Wolff|title=A practical map labeling algorithm|journal=Computational Geometry: Theory and Applications|volume=7|issue=5–6|year=1997|pages=387–404|doi=10.1016/S0925-7721(96)00007-7}}.</ref> Similarly, if each label is rectangular and must be placed in such a way that the point it labels is somewhere along its bottom edge, then using 2-SAT to find the optimal solution in which the label has the point on a bottom corner leads to an approximation ratio of at most two.<ref>{{citation|first1=Srinivas|last1=Doddi|first2=Madhav V.|last2=Marathe|first3=Andy|last3=Mirzaian|first4=Bernard M. E.|last4=Moret|first5=Binhai|last5=Zhu|contribution=Map labeling and its generalizations|title=Proc. 8th ACM-SIAM Symp. Discrete Algorithms (SODA)|year=1997|pages=148–157|url=http://portal.acm.org/citation.cfm?id=314250}}.</ref>
 
Similar reductions to 2-satisfiability have been applied to other geometric placement problems. In [[graph drawing]], if the vertex locations are fixed and each edge must be drawn as a circular arc with one of two possible locations (for instance as an [[arc diagram]]), then the problem of choosing which arc to use for each edge in order to avoid crossings is a 2SAT problem with a variable for each edge and a constraint for each pair of placements that would lead to a crossing. However, in this case it is possible to speed up the solution, compared to an algorithm that builds and then searches an explicit representation of the implication graph, by searching the graph [[implicit graph|implicitly]].<ref>{{citation|first1=Alon|last1=Efrat|first2=Cesim|last2=Erten|first3=Stephen G.|last3=Kobourov|title=Fixed-location circular arc drawing of planar graphs|journal=[[Journal of Graph Algorithms and Applications]]|volume=11|issue=1|pages=145–164|year=2007|url=http://jgaa.info/accepted/2007/EfratErtenKobourov2007.11.1.pdf|doi=10.7155/jgaa.00140}}.</ref>
In [[VLSI]] integrated circuit design, if a collection of modules must be connected by wires that can each bend at most once, then again there are two possible routes for the wires, and the problem of choosing which of these two routes to use, in such a way that all wires can be routed in a single layer of the circuit, can be solved as a 2SAT instance.<ref>{{citation|first1=Raghunath|last1=Raghavan|first2= James|last2=Cohoon|first3=Sartaj|last3=Sahni|author3-link=Sartaj Sahni|title=Single bend wiring|journal=Journal of Algorithms|volume=7|issue=2|year=1986|pages=232–237|doi=10.1016/0196-6774(86)90006-4}}.</ref>
 
{{harvtxt|Boros|Hammer|Minoux|Rader|1999}} consider another VLSI design problem: the question of whether or not to mirror-reverse each module in a circuit design. This mirror reversal leaves the module's operations unchanged, but it changes the order of the points at which the input and output signals of the module connect to it, possibly changing how well the module fits into the rest of the design. Boros ''et al.'' consider a simplified version of the problem in which the modules have already been placed along a single linear channel, in which the wires between modules must be routed, and there is a fixed bound on the density of the channel (the maximum number of signals that must pass through any cross-section of the channel). They observe that this version of the problem may be solved as a 2-SAT instance, in which the constraints relate the orientations of pairs of modules that are directly across the channel from each other; as a consequence, the optimal density may also be calculated efficiently, by performing a binary search in which each step involves the solution of a 2-SAT instance.<ref>{{citation|first1=Endre|last1=Boros|first2=Peter L.|last2=Hammer|author2-link=Peter Hammer|first3=Michel|last3=Minoux|first4=David J., Jr.|last4=Rader|title=Optimal cell flipping to minimize channel density in VLSI design and pseudo-Boolean optimization|journal=Discrete Applied Mathematics|volume=90|issue=1–3|year=1999|pages=69–88|doi=10.1016/S0166-218X(98)00114-0}}.</ref>
 
===Data clustering===
One way of [[data clustering|clustering a set of data points]] in a [[metric space]] into two clusters is to choose the clusters in such a way as to minimize the sum of the [[diameter]]s of the clusters, where the diameter of any single cluster is the largest distance between any two of its points; this is preferable to minimizing the maximum cluster size, which may lead to very similar points being assigned to different clusters. If the target diameters of the two clusters are known, a clustering that achieves those targets may be found by solving a 2-satisfiability instance. The instance has one variable per point, indicating whether that point belongs to the first cluster or the second cluster. Whenever any two points are too far apart from each other for both to belong to the same cluster, a clause is added to the instance that prevents this assignment.
 
The same method also can be used as a subroutine when the individual cluster diameters are unknown. To test whether a given sum of diameters can be achieved without knowing the individual cluster diameters, one may try all maximal pairs of target diameters that add up to at most the given sum, representing each pair of diameters as a 2-satisfiability instance and using a 2-satisfiability algorithm to determine whether that pair can be realized by a clustering. To find the optimal sum of diameters one may perform a binary search in which each step is a feasibility test of this type. The same approach also works to find clusterings that optimize other combinations than sums of the cluster diameters, and that use arbitrary dissimilarity numbers (rather than distances in a metric space) to measure the size of a cluster.<ref>{{citation|first1=P.|last1=Hansen|first2=B.|last2=Jaumard|title=Minimum sum of diameters clustering|journal=Journal of Classification|volume=4|issue=2|year=1987|pages=215–226|doi=10.1007/BF01896987}}.</ref> The time bound for this algorithm is dominated by the time to solve a sequence of 2-SAT instances that are closely related to each other, and {{harvtxt|Ramnath|2004}} shows how to solve these related instances more quickly than if they were solved independently from each other, leading to a total time bound of {{math|''O''(''n''<sup>3</sup>)}} for the sum-of-diameters clustering problem.<ref>{{citation|first1=Sarnath|last1=Ramnath|title=Dynamic digraph connectivity hastens minimum sum-of-diameters clustering|journal=SIAM Journal on Discrete Mathematics|volume=18|issue=2|pages=272–286|year=2004|doi=10.1137/S0895480102396099}}.</ref>
 
===Scheduling===
{{harvtxt|Even|Itai|Shamir|1976}} consider a model of classroom scheduling  in which a set of ''n'' teachers must be scheduled to teach each of ''m'' cohorts of students; the number of hours per week that teacher ''i'' spends with cohort ''j'' is described by entry ''R<sub>ij</sub>'' of a matrix ''R'' given as input to the problem, and each teacher also has a set of hours during which he or she is available to be scheduled. As they show, the problem is [[NP-complete]], even when each teacher has at most three available hours, but it can be solved as an instance of 2-satisfiability when each teacher only has two available hours. (Teachers with only a single available hour may easily be eliminated from the problem.) In this problem, each variable ''v<sub>ij</sub>'' corresponds to an hour that teacher ''i'' must spend with cohort ''j'', the assignment to the variable specifies whether that hour is the first or the second of the teacher's available hours, and there is a 2-SAT clause preventing any conflict of either of two types: two cohorts assigned to a teacher at the same time as each other, or one cohort assigned to two teachers at the same time.<ref name="EIS76"/>
 
{{harvtxt|Miyashiro|Matsui|2005}} apply 2-satisfiability to a problem of sports scheduling, in which the pairings of a [[round-robin tournament]] have already been chosen and the games must be assigned to the teams' stadiums. In this problem, it is desirable to alternate home and away games to the extent possible, avoiding "breaks" in which a team plays two home games in a row or two away games in a row. At most two teams can avoid breaks entirely, alternating between home and away games; no other team can have the same home-away schedule as these two, because then it would be unable to play the team with which it had the same schedule. Therefore, an optimal schedule has two breakless teams and a single break for every other team. Once one of the breakless teams is chosen, one can set up a 2-satisfiability problem in which each variable represents the home-away assignment for a single team in a single game, and the constraints enforce the properties that any two teams have a consistent assignment for their games, that each team have at most one break before and at most one break after the game with the breakless team, and that no team has two breaks. Therefore, testing whether a schedule admits a solution with the optimal number of breaks can be done by solving a linear number of 2-satisfiability problems, one for each choice of the breakless team. A similar technique also allows finding schedules in which every team has a single break, and maximizing rather than minimizing the number of breaks (to reduce the total mileage traveled by the teams).<ref>{{citation|first1=Ryuhei|last1=Miyashiro|first2=Tomomi|last2=Matsui|title=A polynomial-time algorithm to find an equitable home–away assignment|journal=Operations Research Letters|volume=33|issue=3|year=2005|pages=235–241|doi=10.1016/j.orl.2004.06.004}}.</ref>
 
===Discrete tomography===
[[File:Paint by numbers Animation.gif|thumb|250px|Example of a nonogram puzzle being solved.]]
[[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. For instance, in the popular [[nonogram]] puzzles, also known as paint by numbers or griddlers, the set of squares to be determined represents the dark [[pixel]]s in a [[binary image]], and 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. 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.
 
Although there exist polynomial time algorithms to find a matrix having given row and column sums,<ref>{{citation|first=R. A.|last=Brualdi|title=Matrices of  zeros and ones with fixed row and column sum vectors|journal=Linear  Algebra Appl.|volume=33|year=1980|pages=159–231|doi=10.1016/0024-3795(80)90105-6}}.</ref> the solution may be far from unique: any submatrix in the form of a 2&nbsp;&times;&nbsp;2 [[identity matrix]] can be complemented without affecting the correctness of the solution. Therefore, researchers have searched for constraints on the shape to be reconstructed that can be used to restrict the space of solutions. For instance, one might assume that the shape is connected; however, testing whether there exists a connected solution is NP-complete.<ref>{{citation|first=G. J.|last=Woeginger|title=The reconstruction of polyominoes from their  orthogonal projections|series=Technical Report SFB-65|publisher=TU Graz|location=Graz, Austria|year=1996}}.</ref> An even more constrained version that is easier to solve is that the shape is [[orthogonal convexity|orthogonally convex]]: having a single contiguous block of squares in each row and column.
Improving several previous solutions, {{harvtxt|Chrobak|Dürr|1999}} showed how to reconstruct connected orthogonally convex shapes efficiently, using 2-SAT.<ref>{{citation|first1=Marek|last1=Chrobak|first2=Christoph|last2=Dürr|title=Reconstructing hv-convex polyominoes from orthogonal projections|journal=Information Processing Letters|volume=69|issue=6|year=1999|pages=283–289|doi=10.1016/S0020-0190(99)00025-3}}.</ref> The idea of their solution is to guess the indexes of rows containing the leftmost and rightmost cells of the shape to be reconstructed, and then to set up a 2-SAT problem that tests whether there exists a shape consistent with these guesses and with the given row and column sums. They use four 2-SAT variables for each square that might be part of the given shape, one to indicate whether it belongs to each of four possible "corner regions" of the shape, and they use constraints that force these regions to be disjoint, to have the desired shapes, to form an overall shape with contiguous rows and columns, and to have the desired row and column sums. Their algorithm takes time {{math|O(''m''<sup>3</sup>''n'')}} where {{math|''m''}} is the smaller of the two dimensions of the input shape and {{math|''n''}} is the larger of the two dimensions.  The same method was later extended to orthogonally convex shapes
that might be connected only diagonally instead of requiring orthogonal connectivity.<ref>{{citation|first1=Attila|last1=Kuba|first2=Emese|last2=Balogh|title=Reconstruction of convex 2D discrete sets in polynomial time|journal=Theoretical Computer Science|volume=283|issue=1|year=2002|pages=223–242|doi=10.1016/S0304-3975(01)00080-9}}; {{citation|first1=Sara|last1=Brunetti|first2=Alain|last2=Daurat|title=An algorithm reconstructing convex lattice sets|journal=Theoretical computer science|volume=304|issue=1–3|pages=35–57|year=2003|doi=10.1016/S0304-3975(03)00050-1}}.</ref>
 
More recently, as part of a solver for full nonogram puzzles, {{harvs|last1=Batenburg|last2=Kosters|year=2008|year2=2009|txt}} used 2-SAT to combine information obtained from several other [[heuristic]]s. 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-SAT approach with the limited backtracking of {{harvtxt|Even|Itai|Shamir|1976}}<ref name="EIS76"/> are significantly more effective than the dynamic programming and flow heuristics without 2-SAT when applied to more difficult randomly generated nonograms.<ref>{{citation|first1=K. Joost|last1=Batenburg|first2=Walter A.|last2=Kosters|contribution=A reasoning framework for solving Nonograms|title=Combinatorial Image Analysis, 12th International Workshop, IWCIA 2008, Buffalo, NY, USA, April 7–9, 2008, Proceedings|series=Lecture Notes in Computer Science|volume=4958|year=2008|publisher=Springer-Verlag|pages=372–383|doi=10.1007/978-3-540-78275-9_33}}; {{citation|first1=K. Joost|last1=Batenburg|first2=Walter A.|last2=Kosters|title=Solving Nonograms by combining relaxations|journal=Pattern Recognition|volume=42|issue=8|year=2009|pages=1672–1683|doi=10.1016/j.patcog.2008.12.003}}.</ref>
 
===Other applications===
2-satisfiability has also been applied to problems of recognizing [[undirected graph]]s that can be partitioned into an [[Independent set (graph theory)|independent set]] and a small number of [[complete bipartite graph|complete bipartite subgraphs]],<ref>{{citation|first1=Andreas|last1=Brandstädt|first2=Peter L.|last2=Hammer|author2-link=Peter Hammer|first3=Van Bang|last3=Le|first4=Vadim V.|last4=Lozin|title=Bisplit graphs|journal=[[Discrete Mathematics (journal)|Discrete Mathematics]]|volume=299|issue=1–3|year=2005|pages=11–32|doi=10.1016/j.disc.2004.08.046}}.</ref> inferring business relationships among autonomous subsystems of the internet,<ref>{{citation|first1=Hao|last1=Wang|first2=Haiyong|last2=Xie|first3=Yang Richard|last3=Yang|first4=Avi|last4=Silberschatz|first5=Li Erran|last5=Li|first6=Yanbin|last6=Liu|contribution=Stable egress route selection for interdomain traffic engineering: model and analysis|title=13th IEEE Conf. Network Protocols (ICNP)|year=2005|pages=16–29|doi=10.1109/ICNP.2005.39}}.</ref> and reconstruction of [[evolutionary tree]]s.<ref>{{citation|first1=Eleazar|last1=Eskin|first2=Eran|last2=Halperin|first3=Richard M.|last3=Karp|authorlink3=Richard Karp|title=Efficient reconstruction of haplotype structure via perfect phylogeny|journal=Journal of Bioinformatics and Computational Biology|year=2003|volume=1|issue=1|pages=1–20|url=http://www.worldscinet.com/cgi-bin/details.cgi?id=pii:S0219720003000174&type=html|doi=10.1142/S0219720003000174|pmid=15290779}}.</ref>
 
==Complexity and extensions==
===NL-completeness===
A nondeterministic algorithm for determining whether a 2-satisfiability instance is ''not'' satisfiable, using only a [[logarithm]]ic amount of writable memory, is easy to describe: simply choose (nondeterministically) a variable ''v'' and search (nondeterministically) for a chain of implications leading from ''v'' to its negation and then back to ''v''. If such a chain is found, the instance cannot be satisfiable. By the [[Immerman–Szelepcsényi theorem]], it is also possible in nondeterministic logspace to verify that a satisfiable 2-SAT instance is satisfiable.
 
2-satisfiability is [[NL-complete]],<ref>{{citation
| last = Papadimitriou | first = Christos H.
| authorlink = Christos Papadimitriou
| title = Computational Complexity
| pages = chapter 4.2
| publisher = Addison-Wesley
| year = 1994
| isbn = 0-201-53082-1}}., Thm. 16.3.</ref> meaning that it is one of the "hardest" or "most expressive" problems in the [[complexity class]] '''[[NL (complexity)|NL]]''' of problems solvable nondeterministically in logarithmic space. Completeness here means that a deterministic Turing machine using only logarithmic space can transform any other problem in '''NL''' into an equivalent 2-satisfiability problem.  Analogously to similar results for the more well-known complexity class ''[[NP (complexity)|NP]]'', this transformation together with the Immerman–Szelepcsényi theorem allow any problem in NL to be represented as a [[second order logic]] formula with a single existentially quantified predicate with clauses limited to length 2; such formulae are known as SO-Krom.<ref name="ck04">{{citation
| last1 = Cook | first1 = Stephen | author1-link = Stephen Cook
| last2 = Kolokolova | first2 = Antonina
| doi = 10.1109/LICS.2004.1319634
| title = 19th Annual IEEE Symposium on Logic in Computer Science (LICS'04)
| pages = 398–407
| contribution = A Second-Order Theory for NL
| year = 2004}}.</ref>  Similarly, the [[implicative normal form]] can be expressed in [[first order logic]] with the addition of an operator for [[transitive closure]].<ref name="ck04"/>
 
===The set of all solutions===
[[File:2SAT median graph.svg|thumb|300px|The [[median graph]] representing all solutions to the example 2-SAT instance whose implication graph is shown above.]]
The set of all solutions to a 2-satisfiability instance has the structure of a [[median graph]], in which an edge corresponds to the operation of flipping the values of a set of variables that are all constrained to be equal or unequal to each other. In particular, by following edges in this way one can get from any solution to any other solution. Conversely, any median graph can be represented as the set of solutions to a 2-satisfiability instance in this way. The median of any three solutions is formed by setting each variable to the value it holds in the [[majority function|majority]] of the three solutions; this median always forms another solution to the instance.<ref>{{citation
| last1 = Bandelt | first1 = Hans-Jürgen
| last2 = Chepoi | first2 = Victor
| year = 2008
| title = Metric graph theory and geometry: a survey
| url = http://www.lif-sud.univ-mrs.fr/%7Echepoi/survey_cm_bis.pdf
| journal = Contemporary Mathematics}}, to appear. {{citation
| first1 = F. R. K. | last1 = Chung | authorlink1 = Fan Chung
| first2 = R. L. | last2 = Graham | authorlink2 = Ronald Graham
| first3 = M. E. | last3 = Saks
| title = A dynamic location problem for graphs
| url = http://www.math.ucsd.edu/~fan/mypaps/fanpap/101location.pdf
| journal = Combinatorica | volume = 9 | year = 1989 | pages = 111–132
| doi = 10.1007/BF02124674
| issue = 2}}. {{citation
| last = Feder | first = T.
| title = Stable Networks and Product Graphs
| series = Memoirs of the American Mathematical Society
| volume = 555 | year = 1995}}.</ref>
 
{{harvtxt|Feder|1994}} describes an algorithm for efficiently listing all solutions to a given 2-satisfiability instance, and for solving several related problems.<ref>{{citation|first=Tomás|last=Feder|title=Network flow and 2-satisfiability|journal=Algorithmica|volume=11|issue=3|year=1994|pages=291–319|doi=10.1007/BF01240738}}.</ref>
There also exist algorithms for finding two satisfying assignments that have the maximal [[Hamming distance]] from each other.<ref>{{citation|first1=Ola|last1=Angelsmark|first2=Johan|last2=Thapper|contribution=Algorithms for the maximum Hamming distance problem|title=Recent Advances in Constraints|publisher=Springer-Verlag|series=Lecture Notes in Computer Science|volume=3419|year=2005|pages=128–141|doi=10.1007/11402763_10}}.</ref>
 
===Counting the number of satisfying assignments===
'''#2SAT''' is the problem of counting the number of satisfying assignments to a given 2-CNF formula. This [[Counting problem (complexity)|counting problem]] is [[Sharp-P-complete|#P-complete]],<ref>{{citation
| last1 = Valiant | first1 = Leslie G. | authorlink = Leslie Valiant
| year = 1979
| title = The complexity of enumeration and reliability problems
| journal = SIAM Journal on Computing
| volume=8
| pages= 410–421
| doi = 10.1137/0208032
| issue = 3}}</ref> which implies that it is not solvable in [[polynomial time]] unless [[P versus NP problem|P&nbsp;=&nbsp;NP]]. Moreover, there is no [[Polynomial-time approximation scheme|fully polynomial randomized approximation scheme]] for #2SAT unless [[NP (complexity)|NP]] = [[RP (complexity)|RP]] and this even holds when the input is restricted to monotone 2-CNF formulas, i.e., 2-CNF formulas in which each [[Literal (mathematical logic)|literal]] is a positive occurrence of a variable.<ref>{{citation
| last1 = Welsh | first1 = Dominic
| last2 = Gale | first2 = Amy
| year = 2001
| title = The complexity of counting problems
| journal = Aspects of complexity: minicourses in algorithmics, complexity and computational algebra: mathematics workshop, Kaikoura, January 7–15, 2000
| pages = 115ff}}, Theorem 57.</ref>
 
The fastest known algorithm for computing the exact number of satisfying assignments to a 2SAT formula runs in time <math>O(1.246^n)</math>.<ref>{{citation|first1=Vilhelm|last1=Dahllöf|first2=Peter|last2=Jonsson|first3=Magnus|last3=Wahlström|title=Counting models for 2SAT and 3SAT formulae|journal=Theoretical Computer Science|volume=332|issue=1–3|year=2005|pages=265–291|doi=10.1016/j.tcs.2004.10.037}}</ref>
<ref>{{citation|first1=Martin|last1=Fürer|first2=Shiva Prasad|last2=Kasiviswanathan|contribution=Algorithms for counting 2-SAT solutions and colorings with applications|title=Algorithmic Aspects in Information and Management|publisher=Springer-Verlag|series=Lecture Notes in Computer Science|volume=4508|year=2007|pages=47–57|doi=10.1007/978-3-540-72870-2_5}}.</ref>
 
===Random 2-satisfiability instances===
 
One can form a 2-satisfiability instance at random, for a given number ''n'' of variables and ''m'' of clauses, by choosing each clause uniformly at random from the set of all possible two-variable clauses. When ''m'' is small relative to ''n'', such an instance will likely be satisfiable, but larger values of ''m'' have smaller probabilities of being satisfiable. More precisely, if ''m''/''n'' is fixed as a constant α ≠ 1, the probability of satisfiability tends to a [[Limit of a sequence|limit]] as ''n'' goes to infinity: if α&nbsp;&lt;&nbsp;1, the limit is one, while if α&nbsp;&gt;&nbsp;1, the limit is zero. Thus, the problem exhibits a [[phase transition]] at α&nbsp;=&nbsp;1.<ref>{{citation|first1=Béla|last1=Bollobás|author1-link=Béla Bollobás|first2=Christian|last2=Borgs|first3=Jennifer T.|last3=Chayes|first4=Jeong Han|last4=Kim|first5=David B.|last5=Wilson|title=The scaling window of the 2-SAT transition|journal=Random Structures and Algorithms|volume=18|issue=3|pages=201–256|year=2001|doi=10.1002/rsa.1006}}; {{citation|first1=V.|last1=Chvátal|authorlink1=Václav Chvátal|first2=B.|last2=Reed|author2-link=Bruce Reed (mathematician)|contribution=Mick gets some (the odds are on his side)|title=Proc. 33rd IEEE Symp. Foundations of Computer Science (FOCS)|year=1992|pages=620–627|doi=10.1109/SFCS.1992.267789}}; {{citation|first=A.|last=Goerdt|title=A threshold for unsatisfiability|journal=Journal of Computer and System Sciences|volume=53|year=1996|pages=469–486|doi=10.1006/jcss.1996.0081|issue=3}}.</ref>
 
===Maximum-2-satisfiability ===<!-- MAX-2-SAT redirects here -->
 
In the maximum-2-satisfiability problem ('''MAX-2-SAT'''), the input is a formula in [[conjunctive normal form]] with two [[Literal (mathematical logic)|literals]] per clause, and the task is to determine the maximum number of clauses that can be simultaneously satisfied by an assignment. MAX-2-SAT is [[NP-hard]] and it is a particular case of a [[maximum satisfiability problem]].
 
By formulating MAX-2-SAT as a problem of finding a [[Cut (graph theory)|cut]] (that is, a partition of the vertices into two subsets) maximizing the number of edges that have one endpoint in the first subset and one endpoint in the second, in a graph related to the implication graph, and applying [[semidefinite programming]] methods to this cut problem, it is possible to find in polynomial time an approximate solution that satisfies at least 0.940... times the optimal number of clauses.<ref>{{citation|first1=Michael|last1=Lewin|first2=Dror|last2=Livnar|first3=Uri|last3=Zwick|title=Improved Rounding Techniques for the MAX 2-SAT and MAX DI-CUT Problems|journal=Proceedings of the 9th International IPCO Conference on Integer Programming and Combinatorial Optimization|year=2002|pages=67–82|isbn=3-540-43676-6|publisher=Springer-Verlag}}</ref> A ''balanced'' MAX 2-SAT instance is an instance of MAX 2-SAT where every variable appears positively and negatively with equal weight. For this problem, one can improve the approximation ratio to <math>\min \left\{(3 - \cos \theta)^{-1} (2 + (2/\pi)\theta) \,:\, \pi/2 \leq \theta \leq \pi \right\} = 0.943...</math>.
 
If the [[unique games conjecture]] is true, then it is impossible to approximate MAX 2-SAT, balanced or not, with an [[approximation ratio|approximation constant]] better than 0.943... in polynomial time.<ref>{{citation|first1=Subhash|last1=Khot|author1-link=Subhash Khot|first2=Guy|last2=Kindler|first3=Elchanan|last3=Mossel|first4=Ryan|last4=O'Donnell|title=Optimal Inapproximability Results for MAX-CUT and Other 2-Variable CSPs?|journal=FOCS '04: Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science|year=2004|pages=146–154|doi=10.1109/FOCS.2004.49|isbn=0-7695-2228-9|publisher=IEEE}}</ref>
Under the weaker assumption that [[P versus NP problem|P&nbsp;≠&nbsp;NP]], the problem is only known to be inapproximable within a constant better than 21/22 = 0.95454...<ref>{{citation|first=Johan|last=Håstad|authorlink=Johan Håstad|title=Some optimal inapproximability results|journal=Journal of the Association for Computing Machinery|volume=48|issue=4|year=2001|pages=798–859|doi=10.1145/502090.502098}}.</ref>
 
Various authors have also explored exponential worst-case time bounds for exact solution of MAX-2-SAT instances.<ref>{{citation|first1=N.|last1=Bansal|first2=V.|last2=Raman|contribution=Upper bounds for MaxSat: further improved|editor1-first=A.|editor1-last=Aggarwal|editor2-first=C.|editor2-last=Pandu Rangan|title=Proc. 10th Conf. Algorithms and Computation, ISAAC’99|series=Lecture Notes in Computer Science|volume=1741|publisher=Springer-Verlag|year=1999|pages=247–258}}; {{citation|first1=Jens|last1=Gramm|first2=Edward A.|last2=Hirsch|first3=Rolf|last3=Niedermeier|first4=Peter|last4=Rossmanith|title=Worst-case upper bounds for MAX-2-SAT with an application to MAX-CUT|journal=Discrete Applied Mathematics|volume=130|issue=2|year=2003|pages=139–155|doi=10.1016/S0166-218X(02)00402-X}}; {{citation|first1=Arist|last1=Kojevnikov|first2=Alexander S.|last2=Kulikov|contribution=A new approach to proving upper bounds for MAX-2-SAT|title=Proc. 17th ACM-SIAM Symp. Discrete Algorithms|year=2006|pages=11–17|doi=10.1145/1109557.1109559}}</ref>
 
===Weighted-2-satisfiability===
In the weighted 2-satisfiability problem ('''W2SAT'''), the input is an <math>n</math>-variable 2SAT instance and an integer {{math|''k''}}, and the problem is to decide whether there exists a satisfying assignment in which at most {{math|''k''}} of the variables are true. One may easily encode the [[vertex cover problem]] as a W2SAT problem: given a graph {{math|''G''}} and a bound {{math|''k''}} on the size of a vertex cover, create a variable for each vertex of a graph, and for each edge {{math|''uv''}} of the graph create a 2SAT clause {{math|''u'' ∨ ''v''}}. Then the satisfying instances of the resulting 2SAT formula encode solutions to the vertex cover problem, and there is a satisfying assignment with  {{math|''k''}} true variables if and only if there is a vertex cover with  {{math|''k''}} vertices. Therefore, W2SAT is [[NP-complete]].
 
Moreover, in [[parameterized complexity]] W2SAT provides a natural [[W(1)|W[1]-complete]] problem,<ref>{{Citation
| last=Flum  | first=Jörg
| last2=Grohe | first2=Martin
| title = Parameterized Complexity Theory | year = 2006 | publisher = Springer
| url = http://www.springer.com/east/home/generic/search/results?SGWID=5-40109-22-141358322-0
| isbn = 978-3-540-29952-3 |ref=harv
}}</ref> which implies that W2SAT is not [[fixed-parameter tractable]] unless  this holds for all problems in [[W(1)|W[1]]]. That is, it is unlikely that there exists an algorithm for W2SAT whose running time takes the form {{math|''f''(''k'')&middot;''n''<sup>''O''(1)</sup>}}. Even more strongly, W2SAT cannot be solved in time {{math|''n''<sup>''o''(''k'')</sup>}} unless the [[exponential time hypothesis]] fails.<ref>{{citation
  |first1=Jianer | last1=Chen
  |first2=Xiuzhen | last2=Huang
  |first3=Iyad A. | last3=Kanj
  |first4=Ge | last4=Xia
  |title=Strong computational lower bounds via parameterized complexity
  |journal=J. Comput. Syst. Sci.
  |volume=72
  |year=2006
  |pages=1346–1367
  |doi=10.1016/j.jcss.2006.04.007
  |issue=8}}</ref>
 
===Quantified Boolean formulae===
As well as finding the first polynomial-time algorithm for 2-satisfiability, {{harvtxt|Krom|1967}} also formulated the problem of evaluating [[True quantified Boolean formula|fully quantified Boolean formulae]] in which the formula being quantified is a 2-CNF formula. The 2-satisfiability problem is the special case of this quantified 2-CNF problem, in which all quantifiers are [[existential quantifier|existential]]. Krom also developed an effective decision procedure for these formulae; {{harvtxt|Aspvall|Plass|Tarjan|1979}} showed that it can be solved in linear time, by an extension of their technique of strongly connected components and topological ordering.<ref name="Krom1967"/><ref name="APT79"/>
 
===Many-valued logics===
The 2-SAT problem can also be asked for propositional [[many-valued logic]]s. The algorithms are not usually linear, and for some logics the problem is even NP-complete; see {{harvs|last=Hähnle|year=2001|year2=2003|txt}} for surveys.<ref>{{citation|editor1-first=Dov M.|editor1-last=Gabbay|editor2-first=Franz|editor2-last=Günthner|title=Handbook of philosophical logic|url=http://books.google.com/books?id=_ol81ow-1s4C&pg=PA373|year=2001|publisher=Springer|isbn=978-0-7923-7126-7|page=373|chapter=Advanced many-valued logics|first=Reiner|last=Hähnle|edition=2nd|volume=2}}; {{citation|editor1-first=Melvin|editor1-last=Fitting|editor2-first=Ewa|editor2-last=Orlowska|title=Beyond two: theory and applications of multiple-valued logic|year=2003|publisher=Springer|isbn=978-3-7908-1541-2|first=Reiner|last=Hähnle|chapter=Complexity of Many-valued Logics}}</ref>
 
==See also==
* [[HORNSAT]]
 
==References==
{{reflist|colwidth=25em}}
 
{{DEFAULTSORT:2-Satisfiability}}
[[Category:NL-complete problems]]
[[Category:Satisfiability problems]]

Revision as of 17:45, 12 February 2014


My person who wrote all of the article is called Leland but it's not all most masucline name on the internet. To go to karaoke is the thing which is why he loves most of each of the. He operates as a cashier. His wife and him live all through Massachusetts and he enjoys everything that he needs there. He's not godd at design but locate want to check his website: http://circuspartypanama.com

Here is my blog post ... Clash of clans hack