Max Q: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Hairy Dude
make link to Rolle's theorem clearer
en>Monkbot
 
Line 1: Line 1:
In [[backtracking]] [[algorithm]]s, '''backjumping''' is a technique that reduces [[Candidate solution|search space]], therefore increasing efficiency. While backtracking always goes up one level in the [[search tree]] when all values for a variable have been tested, backjumping may go up more levels. In this article, a fixed order of evaluation of variables <math>x_1,\ldots,x_n</math> is used, but the same considerations apply to a dynamic order of evaluation.
I would like to introduce myself to you, I am Andrew and my spouse doesn't like it at all. Ohio is exactly where his home is and his family members loves it. To climb is something she would by no means give up. He is an information officer.<br><br>Also visit my page ... free online tarot card readings ([http://www.prograd.uff.br/novo/facts-about-growing-greater-organic-garden continue reading this])
 
<gallery>
Image:Backtracking-no-backjumping.svg|A search tree visited by regular backtracking
Image:Backtracking-with-backjumping.svg|A backjump: the grey node is not visited
</gallery>
 
==Definition==
 
Whenever backtracking has tried all values for a variable without finding any solution, it reconsiders the last of the previously assigned variables, changing its value or further backtracking if no other values are to be tried. If <math>x_1=a_1,\ldots,x_k=a_k</math> is the current partial assignment and all values for <math>x_{k+1}</math> have been tried without finding a solution, backtracking concludes that no solution extending
<math>x_1=a_1,\ldots,x_k=a_k</math> exists. It then "goes up" to <math>x_k</math>, changing its value if possible, backtracking again otherwise.
 
The partial assignment is not always necessary in full to prove that no value of <math>x_{k+1}</math> lead to a solution. In particular, a prefix of the partial assignment may have the same property, that is, there exists an index <math>j<k</math> such that <math>x_1,\ldots,x_j=a_1,\ldots,a_j</math> cannot be extended to form a solution with whatever value for <math>x_{k+1}</math>. If the algorithm can prove this fact, it can directly consider a different value for <math>x_j</math> instead of reconsidering <math>x_k</math> as it would normally do.
 
{| cellpadding=20 style="border: thin solid gray;"
|-
| [[Image:Backjump-variables-1.svg]]
| [[Image:Backjump-variables-2.svg]]
| [[Image:Backjump-variables-3.svg]]
|-
| An example in which the current assignment to <math>x_1x_2x_3x_4</math> has been unsuccessfully tried with every possible value of <math>x_5</math>. Backtracking goes back to <math>x_4</math>, trying to assign it a new value.
| Instead of backtracking, the algorithm makes some further elaboration, proving that the evaluations <math>x_1x_2x_5=211</math>, <math>x_1x_5=22</math>, and <math>x_1x_2x_5=213</math> are not part of any solution.
| As a result, the current evaluation of <math>x_1x_2</math> is not part of any solution, and the algorithm can directly backjump to <math>x_2</math>, trying a new value for it.
|}
 
The efficiency of a backjumping algorithm depends on how high it is able to backjump. Ideally, the algorithm could jump from <math>x_{k+1}</math> to whichever variable <math>x_j</math> is such that the current assignment to <math>x_1,\ldots,x_j</math> cannot be extended to form a solution with any value of <math>x_{k+1}</math>. If this is the case, <math>j</math> is called a ''safe jump''.
 
Establishing whether a jump is safe is not always feasible, as safe jumps are defined in terms of the set of solutions, which is what the algorithm is trying to find. In practice, backjumping algorithms use the lowest index they can efficiently prove to be a safe jump. Different algorithms use different methods for determining whether a jump is safe. These methods have different cost, but a higher cost of finding a higher safe jump may be traded off a reduced amount of search due to skipping parts of the search tree.
 
==Backjumping at leaf nodes==
 
The simplest condition in which backjumping is possible is when all values of a variable have been proved inconsistent without further branching. In [[constraint satisfaction]], a partial evaluation is ''consistent'' if and only if it satisfies all constraints involving the assigned variables, and ''inconsistent'' otherwise. It might be the case that a consistent partial solution cannot be extended to a consistent complete solution because some of the unassigned variables may not be assigned without violating other constraints.
 
The condition in which all values of a given variable <math>x_{k+1}</math> are inconsistent with the current partial solution <math>x_1,\ldots,x_k=a_1,\ldots,a_k</math> is called a ''leaf dead end''. This happens exactly when the variable <math>x_{k+1}</math> is a leaf of the search tree (which correspond to nodes having only leaves as children in the figures of this article.)
 
The backjumping algorithm by Gaschnig does a backjump only in leaf dead ends. In other words, it works differently to backtracking only when every possible value of <math>x_{k+1}</math> has been tested and resulted inconsistent without the need of branching over another variable.
 
A safe jump can be found by simply evaluating, for every value <math>a_{k+1}</math>, the shortest prefix of <math>x_1,\ldots,x_k=a_1,\ldots,a_k</math> inconsistent with <math>x_{k+1}=a_{k+1}</math>. In other words, if <math>a_{k+1}</math> is a possible value for <math>x_{k+1}</math>, the algorithm checks the consistency of the following evaluations:
 
{| cellpadding=10
|-
| <math>x_1=a_1</math>
| ...
| <math>x_{k-1}=a_{k-1}</math>
| <math>x_k=a_k</math>
| <math>x_{k+1}=a_{k+1}</math>
|-
| <math>x_1=a_1</math>
| ...
| <math>x_{k-1}=a_{k-1}</math>
|
| <math>x_{k+1}=a_{k+1}</math>
|-
| ...
|-
| <math>x_1=a_1</math>
|
|
|
| <math>x_{k+1}=a_{k+1}</math>
|}
 
The smallest index (lowest the listing) for which evaluations are inconsistent would be a safe jump if <math>x_{k+1}=a_{k+1}</math> were the only possible value for <math>x_{k+1}</math>. Since every variable can usually take more than one value, the maximal index that comes out from the check for each value is a safe jump, and is the point where Gaschnig's algorithm jumps.
 
In practice, the algorithm can check the evaluations above at the same time it is checking the consistency of <math>x_{k+1}=a_{k+1}</math>.
 
==Backjumping at internal nodes==
 
The previous algorithm only backjumps when the values of a variable can be shown inconsistent with the current partial solution without further branching. In other words, it allows for a backjump only at leaf nodes in the search tree.
 
An internal node of the search tree represents an assignment of a variable that is consistent with the previous ones. If no solution extends this assignment, the previous algorithm always backtracks: no backjump is done in this case.
 
Backjumping at internal nodes cannot be done as for leaf nodes. Indeed, if some evaluations of <math>x_{k+1}</math> required branching, it is because they are consistent with the current assignment. As a result, searching for a prefix that is inconsistent with these values of the last variable does not succeed.
 
In such cases, what proved an evaluation <math>x_{k+1}=a_{k+1}</math> not to be part of a solution with the current partial evaluation <math>x_1,\ldots,x_k</math> is the [[Recursion|recursive]] search. In particular, the algorithm "knows" that no solution exists from this point on because it comes back to this node instead of stopping after having found a solution.
 
This return is due to a number of ''dead ends'', points where the algorithm has proved a partial solution inconsistent. In order to further backjump, the algorithm has to take into account that the impossibility of finding solutions is due to these dead ends. In particular, the safe jumps are indexes of prefixes that still make these dead ends to be inconsistent partial solutions.
 
{|
|-
| [[Image:Dead-ends-1.svg]]
| [[Image:Dead-ends-1a.svg]]
| [[Image:Dead-ends-2.svg]]
| [[Image:Dead-ends-3.svg]]
|-
| In this example, the algorithm come back to <math>x_{k+1}</math>, after trying all its possible values, because of the three crossed points of inconsistency.
| The second point remains inconsistent even if the values of <math>x_{k+1}</math> and <math>x_k</math> are removed from its partial evaluation (note that the values of a variable are in its children)
| The other inconsistent evaluations remains so even without <math>x_{k-2}</math>, <math>x_{k-1}</math>, and <math>x_k</math>
| The algorithm can backjump to <math>x_{k-2}</math> since this is the lowest variables that maintains all inconsistencies. A new value for <math>x_{k-2}</math> will be tried.
|}
 
In other words, when all values of <math>x_{k+1}</math> have been tried, the algorithm can backjump to a variable <math>x_i</math> provided that the current truth evaluation of <math>x_1,\ldots,x_i</math> is inconsistent with all the truth evaluations of <math>x_{k+1},x_{k+2},...</math> in the leaf nodes that are descendants of the node <math>x_{k+1}</math>.
 
===Simplifications===
 
[[Image:Backjump-ignored.svg|thumb|200px|While looking for a possible backjump for <math>x_{k+1}</math> or one its ancestors, all nodes in the shaded area can be ignored.]]
Due to the potentially high number of nodes that are in the subtree of <math>x_{k+1}</math>, the information that is necessary to safely backjump from <math>x_{k+1}</math> is collected during the visit of its subtree. Finding a safe jump can be simplified by two considerations. The first is that the algorithm needs a safe jump, but still works with a jump that is not the highest possible safe jump.
 
The second simplification is that nodes in the subtree of <math>x_l</math> that have been skipped by a backjump can be ignored while looking for a backjump for <math>x_l</math>. More precisely, all nodes skipped by a backjump from node <math>x_m</math> up to node <math>x_l</math> are irrelevant to the subtree rooted at <math>x_m</math>, and also irrelevant are their other subtrees.
 
Indeed, if an algorithm went down from node <math>x_l</math> to <math>x_m</math> via a path but backjumps in its way back, then it could have gone directly from <math>x_l</math> to <math>x_m</math> instead. Indeed, the backjump indicates that the nodes between <math>x_l</math> and <math>x_m</math> are irrelevant to the subtree rooted at <math>x_m</math>. In other words, a backjump indicates that the visit of a region of the search tree had been a mistake. This part of the search tree can therefore be ignored when considering a possible backjump from <math>x_l</math> or from one of its ancestors.
 
[[Image:Backjump-collect.svg|thumb|300px|Variables whose values are sufficient to prove unsatisfiability in the subtree rooted at a node are collected in the node and sent (after removing the variable of the node) to the node above when retracting.]]
This fact can be exploited by collecting, in each node, a set of previously assigned variables whose evaluation suffices to prove that no solution exists in the subtree rooted at the node. This set is built during the execution of the algorithm. When retracting from a node, this set is removed the variable of the node and collected in the set of the destination of backtracking or backjumping. Since nodes that are skipped from backjumping are never retracted from, their sets are automatically ignored.
 
===Graph-based backjumping===
 
The rationale of graph-based backjumping is that a safe jump can be found by checking which of the variables <math>x_1,\ldots,x_k</math> are in a constraint with the variables <math>x_{k+1},x_{k+2},...</math> that are instantiated in leaf nodes. For every leaf node and every variable <math>x_i</math> of index <math>i>k</math> that is instantiated there, the indexes less than or equal to <math>k</math> whose variable is in a constraint with <math>x_i</math> can be used to find safe jumps. In particular, when all values for <math>x_{k+1}</math> have been tried, this set contains the indexes of the variables whose evaluations allow proving that no solution can be found by visiting the subtree rooted at <math>x_{k+1}</math>. As a result, the algorithm can backjump to the highest index in this set.
 
The fact that nodes skipped by backjumping can be ignored when considering a further backjump can be exploited by the following algorithm. When retracting from a leaf node, the set of variables that are in constraint with it is created and "sent back" to its parent, or ancestor in case of backjumping. At every internal node, a set of variables is maintained. Every time a set of variables is received from one of its children or descendant, their variables are added to the maintained set. When further backtracking or backjumping from the node, the variable of the node is removed from this set, and the set is sent to the node that is the destination of backtracking or backjumping. This algorithm works because the set maintained in a node collects all variables that are relevant to prove unsatisfiability in the leaves that are descendant of this node. Since sets of variables are only sent when retracing from nodes, the sets collected at nodes skipped by backjumping are automatically ignored.
 
===Conflict-based backjumping (aka conflict-directed backjumping (cbj))===
 
A still more refined backjumping algorithm, sometimes able to achieve larger backjumps, is based on checking not only the common presence of two variables in the same constraint but also on whether the constraint actually caused inconsistency. In particular, this algorithm collects one of the violated constraints in every leaf. At every node, the highest index of a variable that is in one of the constraints collected at the leaves is a safe jump.
 
While the violated constraint chosen in each leaf does not affect the safeness of the resulting jump, choosing constraints of highest possible indices increases the highness of the jump. For this reason, conflict-based backjumping orders constraints in such a way constraints over lower indices variables are preferred over constraints on higher index variables.
 
Formally, a constraint <math>C</math> is preferred over another one <math>D</math> if the highest index of a variable in <math>C</math> but not in <math>D</math> is lower than the highest index of a variable in <math>D</math> but not in <math>C</math>. In other words, excluding common variables, the constraint that has the all lower indices is preferred.
 
In a leaf node, the algorithm chooses the lowest index <math>i</math> such that <math>x_1,\ldots,x_i</math> is inconsistent with the last variable evaluated in the leaf. Among the constraints that are violated in this evaluation, it chooses the most preferred one, and collects all its indices less than <math>k+1</math>. This way, when the algorithm comes back to the variable <math>x_{k+1}</math>, the lowest collected index identifies a safe jump.
 
In practice, this algorithm is simplified by collecting all indices in a single set, instead of creating a set for every value of <math>k</math>. In particular, the algorithm collects, in each node, all sets coming from its descendants that have not been skipped by backjumping. When retracting from this node, this set is removed the variable of the node and collected into the destination of backtracking or backjumping.
 
Conflict-directed backjumping was proposed for [[Constraint Satisfaction Problems]] by [[Patrick Prosser]] in his seminal 1993 paper.
 
==See also==
 
*[[Constraint learning]]
 
==References==
 
*{{cite book
| first=Rina
| last=Dechter
| title=Constraint Processing
| publisher=Morgan Kaufmann
| url=http://www.ics.uci.edu/~dechter/books/index.html
| year=2003
| isbn=1-55860-890-7
}}
*{{cite paper
| first=Patrick
| last=Prosser
| title=Hybrid Algorithms for the Constraint Satisfaction Problem
| publisher=Computational Intelligence 9(3)
| url=http://www.dcs.gla.ac.uk/publications/PAPERS/8104/prosser_cbj.pdf
| year=1993
}}
 
[[Category:Constraint programming]]
[[Category:Search algorithms]]

Latest revision as of 03:16, 18 July 2014

I would like to introduce myself to you, I am Andrew and my spouse doesn't like it at all. Ohio is exactly where his home is and his family members loves it. To climb is something she would by no means give up. He is an information officer.

Also visit my page ... free online tarot card readings (continue reading this)