A constraint search does not refer to any specific search algorithm but to a layer of complexity added to existing algorithms that limit the possible solution set. A Constraint Search Problem (CSP) is an Artificial Intelligence Algorithm defined by a set of variables and a set of constraints where each variable has a non empty domain of possible values. Each domain in variable is evaluated with defined constraints.
C# Sudoku Solver is an example implementation using CSP search algorithm. The code is optimized to solve 9 x 9 sudoku in 1ms.
A define flag FORWARD_CHECKING in code is used to enable / disable forward checking to eliminate domains in variables which does not comply with defined constraints.
To visualize search algorithm execution, subscribe to CellValueChanged event in MainForm constructor to show value change on each iteration. Disable this line to get maximum performance of the algorithm.
Constraint Satisfaction Problems (CSP) in Artificial Intelligence