In
backtracking algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
s, backjumping is a technique that reduces
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
is used, but the same considerations apply to a dynamic order of evaluation.
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
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
is the current partial assignment and all values for
have been tried without finding a solution, backtracking concludes that no solution extending
exists. The algorithm then "goes up" to
, changing
's value if possible, backtracking again otherwise.
The partial assignment is not always necessary in full to prove that no value of
lead to a solution. In particular, a prefix of the partial assignment may have the same property, that is, there exists an index