Use one variable for each cell, with . An empty cell has constraint domain ; a clue containing has singleton constraint domain . Thus all clues are retained automatically.
For every row impose , and for every column impose . For each impose an all-different constraint onThese are the nine prescribed boxes. There are 27 all-different constraints altogether. Nine pairwise distinct values chosen from a set of nine values must use every value exactly once, so these restrictions are precisely the Sudoku requirements. Equivalently, expand each all-different constraint into pairwise binary constraints for cells sharing a row, column, or box.
Articles by others on the same topic
There are currently no matching articles.