INGI2261 Articial Intelligence Problem Set 2: Informed Search October 2008. Authors: Pierre Schaus and Yves Deville. To achieve correctly this problem set, you have to read AIMA Chapters 4.1 and 4.2. Delivery Instructions This problem set is due to friday 17 october, 10h30 am (Brussels hour). • No delay will be tolerated. • Not making a running implementation able so solve (some instances of) the problems is equivalent to fail. Writing some lines of codes is easy but writing a correct program is much more dicult 1 . • your code source (at least the dicult or more technical parts of your programs). Some python docstrings for some important functions/methods are also welcome. Document • Indicate clearly in your report if you have the instructor discover it. bugs or problems with your program. Don't let • Copying or be inspired by programs of other groups (or from the internet) is strictly forbidden and very risky. Each source of inspiration must be clearly indicated. The consequences of plagiarism is 0/20 for the rest of the problem sets (unfortunately, each year we detect some plagiarism cases). • Answers to all the questions must be delivered at the INGI secretary (paper version). • Source code is submitted via the svn tool: https://scm.info.ucl.ac.be/cgi-bin/inscription.sh. • Only programs submitted via the sent by email will be corrected. • Respect carefully the svn procedure will be corrected. No report or programs input/output formats and your program must pass this test. . We provide a program to test your solution 1 Sokoban You will make a program solving the Sokoban planning problem. A person is in a 2d grid maze environment with walls on some positions. This person can potentially move in the 4 directions. In the initial state, some positions (say m) contain blocks and as many other positions are labeled to accept blocks. Blocks can be pushed one at a time in the moving direction of the person. The objective is to reach a nal state where every block lies in a labeled position as illustrated on the next gure. Train yourself at http://jeuxflashsokoban. free.fr/Jeux%20Flash%20Sokoban.html. 1 remember B. Lecharlier's courses. 1 Initial State Final Goal State Some example of allowed and not allowed moves are illustrated on the next gure. 1. Move OK: The person pushes the block since the position behind the block is empty. 2. Move KO: The position behind the block is not empty, the block cannot be pushed in this direction. 3. This state cannot lead to a solution since one block is stuck in a corner that is not a labeled position (it will not be possible to push it in any direction). 1: Move OK 2: Move KO 3: Dead Situation 2 Input and output format Ressource available at https://webdav.info.ucl.ac.be/webdav/ingi2261/. Your are given a set of 20 sokoban instances in xsb format le. File test01.xsb is illustrated next: • # are the wall positions, • @ is the position of the avatar, • $ are the positions of the boxes and • . are the target positions for the boxes. 2 ########## # . # # $ $ # #@ . # ########## The three last states of a solution le for test01.xsb are represented next. Each state is separated with an empty line. The target positions should not be represented in the states. The avatar can move only from one position between two successive states in the solution le (of course it can be dierent in your model but not in the solution le). ########## # $ @ # # $ # # # ########## ########## # $@ # # $ # # # ########## ########## # $ # # @ # # $ # ########## We provide a binary le check_sokoban to check your solution and the respect of the format. Arguments of the checker are the instance and the solution le: check_sokoban test01.xsb sol01.txt. It prints a message status ok and the number of states if this is a correct solution le and a diagnosis of the problem otherwise. 3 2.1 The problem and questions • Explain your Python representation of states. • Formultate this problem as a search problem (Your successor function must be described very precisely). What is the branching factor of your model? • What is the complexity of your successor function? How many successors are there at maxi- mum? • As illustrated on previous gures some situations cannot lead to a solution. Are there other similar situations? Why is it important to identify these situations in your successor function? • Describe possible (non trivial) heuristic(s) to reach a goal state (with reference if any). Is(are) your heuristic(s) admissible and/or consistent? Give the complexity? • Give an upper bound on the number of states? • Implement this problem. Extend the Problem class and implement the necessary methods and other class(es) if necessary. Your le must be named sokoban_grXX.py. You program must print to the standard output a solution to the sokoban instance given in argument satisfying the above format. • Implement your heuristic function. • Experiments and compare and analyse informed (astar_search) and uninformed (breadth_first_graph_search) graph search of aima on the 20 instances of sokoban provided. Report in a table the results on the 20 instances. Interesting metrics to report are: the time, and possibly the memory consumption. Are the number of explored nodes always smaller with astar_search, why? When no solution can be found by a strategy in a reasonable time (say 5 min), explain the reason (time-out and/or swap of the memory). the number of explored nodes, the number of steps to reach the solution • Implement and experiment the eect of avoiding the expansion of dead end states (that cannot lead to a solution)? 4
© Copyright 2026 Paperzz