Sudoku-Encoding1

# Sudoku-Encoding1 - What is Sudoku 6 3 1 2 9 Played on a nn...

This preview shows pages 1–3. Sign up to view the full content.

What is Sudoku? • Played on a n×n board. • A single number from 1 to n must be put in each cell; some cells are pre-filled. • Board is subdivided into n × n blocks. • Each number must appear exactly once in each row, column, and block. • Designed to have a unique solution. 6 1 2 5 3 9 1 4 4 9 2 3 4 1 8 7 1 3 6 8 9 1 5 4 9 1 7 5 3 2 1 Puzzle-Solving Process Mapping of SAT variables to Sudoku cells Encoder SAT Solver Decoder CNF SAT Sol'n Puzzle Puzzle Sol'n 2 Naive Encoding (1) • Use n 3 variables, labelled “ x 0,0,0 ” to “ x n , n , n ”. • Variable x r,c,d represents whether the number d is in the cell at row r , column c . 3 • “Number d must occur exactly once in column c “Exactly one of { x 1,c,d , x 2,c,d , ... , x n,c,d } is true”. • How do we encode the constraint that exactly one variable in a set is true? Variable x r,c,d represents whether the digit d is in the cell at row r , column c . 1 4 3 2 2 3 4 1 3 2 1 4 4 1 2 3 Example of Variable Encoding 4 row column digit

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Naive Encoding (2) How do we encode the constraint that exactly one variable in a set is true? We can encode “ exactly one ” as the conjunction of “ at least one ” and “ at most one ”. 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

Sudoku-Encoding1 - What is Sudoku 6 3 1 2 9 Played on a nn...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online