Project 1: comparison of alternative search algorithms (using Numerical Puzzles) Due Date: November 26, 2002, 12:00. The intent of this assignment is to help demonstrate to you the expense of the various search algorithms we've been discussing, and the benefits that KNOWLEDGE accrues when solving problems. We started with BFS and DFS, which are called "WEAK" methods, since they search without much problem specific knowledge available to them. Shortly we'll add heuristic knowledge to our problem-solver in developing the A* algorithm. Each additional bit of knowledge and structure should improve performance, i.e. searching should take less time (fewer states) in computing solutions. The problems in this project are a special category of problems, known as Constraint Satisfaction problems. We have not discussed this category of problems in lecture, so you will want to read about them in the textbook. The puzzles: 1. A demo problem. The water-jug puzzle: You have two jugs, A and B, and an infinite supply of water. A has capacity 4 and B has capacity 3. There are three types of actions that you can use: (1) you can fill a jug to capacity, (2) you can completely empty a jug, and A (3) you can pour from one jug to the other. Pouring B from one jug to the other stops when the first jug is empty or the second jug is full, whichever comes first. For example, if A has 5 gallons and B has 6 gallons and a capacity of 8, then pouring from A to B leaves B full and 3 gallons in A. Our goal is to get exactly 2 gallons of water in jug A. The Lisp code to solve this problem in given to you in the file water-jug.lisp. The purpose of this problem is for you to experiment with the search algorithms. None of the experiments with the water-jug problem are to be turned in. 2. The 9-Number-Puzzle: The numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9 must be put in the depicted square, in such a way that the sums of the numbers in each row, column, and diagonal are equal. How should the numbers be arranged in the square ? There is a partial implementation of this puzzle in the files number-puzzle9.lisp and number-puzzle.lisp. 3. The 19-Number-Puzzle: This puzzle has nineteen circles that have to be filled with the numbers 1 up to (and including) 19. These numbers have to be placed in such a way that all numbers on any horizontal row and any diagonal line add up to the same sum. Warning: there are many horizontal and diagonal lines, which have a different number of circles (3, 4, or 5), nevertheless all these sums have to be equal! How should the nineteen numbers be placed in the net? There is a partial implementation of this puzzle in the file number-puzzle19.lisp and number-puzzle.lisp. Your task is 1-You are given an implementation of DFS and BFS. Make sure you know how to use these implementations. For example you may use them on the water-jug problem. Which of the variants of DFS discussed in lecture is implemented? 2- You are given an implementation of the A* algorithm. Make sure you know how to use this implementation, including the node structure and heuristic evaluation function. So, you should have 3 search algorithms coded and ready to be used. 3-Each of these algorithm you've coded to produce basic statistics: a)the number of nodes generated during search b)the number of nodes expanded during search d)the number of branches followed during search 4- Complete the implementation of the 9-Number puzzle. The implementation given to you does not contain the goalp predicate. Furthermore the successor function successor-fn could use a great deal of improvement. 5- Think of TWO heuristic operator ordering that you can apply to this problem. Hint: check out the section on Constraint Satisfaction Problems in the book. 6-Last define a heuristic evaluation function OF YOUR OWN CHOICE. This Heuristic Evaluation function is to be used by the A* algorithm. 7-Finally, run all of the above algorithms on the two test cases: a) the 9-number puzzle. b) the 19-number puzzle. This means that starting with each of the two puzzles, you should run a)BFS b)DFS (note that the depth bound for these puzzles is fixed and known). d) Any of the above algorithms with the 1st operator ordering heuristic. e) Any of the above algorithms with the 2nd operator ordering heuristic. f) A* with your heuristic evaluation function For each of the above generate solutions (if possible) and the statistics above (number of nodes generated, nodes expanded and branches followed). Important: Some of these experiments will NOT TERMINATE in reasonable time! If that is the case please interrupt the search and report on this result. The 19-number puzzle is something of a computing challenge… Does your heuristic make it manageable? You are to turn in all your code For each search algorithm/heuristic a-f a trace of execution, the solution and statistics.