Look-ahead (backtracking)

In backtracking algorithms, look ahead is the generic term for a subprocedure that attempts to foresee the effects of choosing a branching variable to evaluate one of its values.

Look ahead is used to check the effects of choosing a given variable to evaluate or to decide the order of values to give to it.

The simpler technique for evaluating the effect of a specific assignment to a variable is called forward checking.

[1] Given the current partial solution and a candidate assignment to evaluate, it checks whether another variable can take a consistent value.

The most common way of using look-ahead for solving constraint satisfaction problems is the maintaining arc-consistency (MAC) algorithm.

This is different than enforcing global arc consistency, which may possibly require a pair of variables to be reconsidered more than once.

Partial look ahead is similar, but a given order of variables is considered, and arc consistency is only enforced once for every pair

The choice of the next variable and the choice of the next value to give it are complementary, in that the value is typically chosen in such a way that a solution (if any) is found as quickly as possible, while the next variable is typically chosen in such a way unsatisfiability (if the current partial solution is unsatisfiable) is proven as quickly as possible.

The choice of the next variable to evaluate is particularly important, as it may produce exponential differences in running time.

In order to prove unsatisfiability as quickly as possible, variables leaving few alternatives after being assigned are the preferred ones.

In particular, the next variable that is chosen is the one having a minimal number of values that are consistent with the current partial solution.

The following are three methods for ordering the values to tentatively assign to a variable: Experiments proved that these techniques are useful for large problems, especially the min-conflicts one.

In this example, x 1 =2 and the tentative assignment x 2 =1 is considered.
Forward checking only checks whether each of the unassigned variables x 3 and x 4 is consistent with the partial assignment, removing the value 2 from their domains.
Arc consistency look ahead also checks whether the values of x 3 and x 4 are consistent with each other (red lines) removing also the value 1 from their domains.