![]() | ||
In constraint satisfaction, backmarking is a variant of the backtracking algorithm.
Backmarking works like backtracking by iteratively evaluating variables in a given order, for example,
- for each variable
x i a , the algorithm records information about the last timex i a ; in particular, it stores the minimal indexj < i such that the assignment tox 1 , … , x j , x i - for each variable
x i x i k < i of a variable that was changed since then.
The first information is collected and stored every time the algorithm evaluates a variable
The second information is changed every time another variable is evaluated. In particular, the index of the "maximal unchanged variable since the last evaluation of
The data collected this way is used to avoid some consistency checks. In particular, whenever backtracking would set
- if
j < k , the evaluation ofx 1 , … , x j , x i - if
j ≥ k , the evaluationx 1 , … , x k , x i x 1 , … , x i
Contrary to other variants to backtracking, backmarking does not reduce the search space but only possibly reduce the number of constraints that are satisfied by a partial solution.