COMP 590-096 Fall 2010Assignment 2: SearchDue date: October 7, 11:59 PMInstructionsThe goal of this assignment is to implement the various search algorithms we have covered in class so far. You will need to turn in the following:
Late policy: You lose 25% of the points for every day the assignment is late. If you have a compelling reason for not being able to submit the assignment on time and would like to make a special arrangement, you must let me know ahead of the due date. WARNING: We are well aware that the following are popular computer science problems and that numerous solutions are available on the Web in numerous programming languages. You should approach the main part of this assignment in good faith and refrain from consulting the Web (if you do, you will probably have to do lots of busywork to keep us from finding out, and you'll just be ruining your own fun, anyway). For the extra credit part (see bottom of this page), feel free to search the Web for ideas and/or code snippets. As per class policy, whenever you use outside code or references, please be sure to acknowledge them in your report. Problem 1: 8-puzzleThe 8-puzzle was introduced in this lecture. Implement the following search algorithms for solving 8-puzzle instances:
Problem 2: n-queensImplement hill-climbing search to generate legal n-queens configurations. Use the formulation from this lecture: start by placing a queen in a random location in each column, and at each step, try to move a queen within its column to reduce the number of conflicts. Experiment with a few simple ways of selecting the successor state and escaping local minima until you get an algorithm that works reasonably well. Report on your implementation choices and their relative performance.Start with n = 4 and keep increasing n as far as you can (the values don't have to be consecutive). For each n you tried, report the average number of uphill moves and restarts needed to successfully generate an n-queens instance. Empirically, how does the complexity of your implementation scale as a function of n? Once again, a scatter plot would be a good way to answer this question. Problem 3: Sudoku as a Constraint Satisfaction ProblemImplement backtracking search with forward checking to solve Sudoku puzzles (see this lecture). Use the minimum remaining values (MRV) heuristic for choosing the next variable to assign. Forward checking should take the following simple form: every time you assign a value to a variable, eliminate that value from the list of possible values for the variables in the same row, column, and 3x3 unit. If the list of possible values for any variable becomes empty, report failure and backtrack.Apply your algorithm to the Sudoku puzzles in this file. For each puzzle, report the solution and the number of variable assignments attempted in the course of finding the solution. Finally, try to "break" your algorithm by replacing the MRV heuristic by something "dumber" (fixed order of assigning variables, random order, maximum remaining values). How does this affect the number of attempted assignments? (As with Problem 1, feel free to cut off the search after some maximum number of attempted assignments.) For Extra CreditFeel free to try out and report on various extensions or improvements based on information from the textbook or from the Web. Here are some possible ideas:
|