Due Tuesday, April 29 at 11:59 PM via Blackboard. PDF format required. Late assignments penalized 10% per day.

Assignment 2

Sudoku has been shown to be NP-complete for n2×n2 boards1, but small boards can be solved using search trees and the CSP strategies learned in class. Effective computer solutions include strategies we've already learned in class: backtracking (BT), forward checking (FC), and minimum remaining values (MRV).

In comparison, human strategies use more heuristics and less of a brute-force approach. This is because it is much easier for humans to create new strategies as they become more familiar with a problem. Conversely, computers are constrained to the strategies that were specified in advance (by a human).

The goal of this assignment is to compare human strategies with the CSP strategies learned in class.

Questions

  1. Solving Sudoku with CSPs.
    1. 1 point. Define Sudoku as a Constraint Satisfaction search problem. In about one sentence each, specify the states, operators, start state, and goal test you will use.
    2. 1/2 point. Wikipedia's rules for Sudoku state "Fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 sub-grids that compose the grid... contains all of the digits from 1 to 9." In 1-2 sentences, explain how Sudoku's rules give us constraints for CSP problems (i.e. what are the constraints that limit a square's value?).
    3. 1/2 point each. In class, we learned a few strategies to choose the "best" variable to change next as well as which value is least likely to violate constraints in the future. Given the below board:
      • List the Remaining Values for each highlighted yellow square (e.g. "A:123, B:123, etc.").
      • Which of the highlighted squares correspond to the Most Constrained Variables(s) (e.g. "A, B, etc.").
      • Of the Most Constrained Variable(s), which are the Most Constraining Variable(s) (e.g. "A, B, etc.").
      • From the Most Constraining Variable(s), choose one variable and assign the Least Constraining Value (e.g. "A8").
    4. 1/2 point each. For each step in part c, do humans typically use this step when solving Sudoku? Justify your answer in one or two sentences.

  2. Human solutions to problems like Sudoku are often limited by memory (making Breadth-First Search difficult) and backtracking (making Depth-First Search difficult). However, humans adapt quickly and create new heuristics for problems like Sudoku. One example is the Last Remaining Cell in a Box approach, a simple Human strategy.
    1. 1/2 point. Detection: In terms of Remaining Values, how would you know if you can use Last Remaining Cell in a Box?
    2. 1/2 point. Updating: Once you know you can use this method, you know that a variable must have one specific value. How are the Remaining Values in the remainder of the Sudoku board affected?
    3. 1 point. What steps would a computer take to use this method? Provide pseudo-code (a list of steps) that would allow a computer to complete 2a and 2b.
    4. 1 point. We can also identify incorrect Remaining Values for a square using k-Consistency1, a variation of the AC-3 Arc Consistency method discussed in class. For a given square, what is the maximum value for k that would be used in applying k-Consistency to Sudoku?

  3. (1.5 points) Local search algorithms begin with a random initial assignment of values to all of the variables in a CSP. Do you think that using local search to solve a game of Sudoku would be a wise alternative to the search methods above? Why or why not?

What to Turn In

Note: This assignment can be done within your group. Each student must turn in their own, individual homework write-up.

Please submit a pdf via Blackboard that contains your answers to these questions.


1. (Link) Takayuki, Yato, and Seta Takahiro. "Complexity and completeness of finding another solution and its application to puzzles." IEICE transactions on fundamentals of electronics, communications and computer sciences 86.5 (2003): 1052-1060.
2. See page 211 of the book for an explanation of k-Consistency. Wikipedia's explanation is here. It may be useful to know that Arc Consistency is 2-consistency, Path Consistency is 3-consistency, and the Generalizations refer to k-consistency.