CMSI 485 Answers to Quiz 1 Spring 2006 =========================================================================== 1. An offline bookstore shopping bot senses and acts in the real world where it will bump into and communicate with other agents and try not to get run over on its way to and from the store. Its environment is partially observable (real world robots aren't omnipotent) stochastic (earthquakes, floods, ...) sequential (the books you buy deplete the in-store inventory) dynamic (other agents are buying) continuous (it's moving around in the world) multi-agent (there are other customers) 2. a) There are 4*2*2*2*2 = 64 states. b) The algorithm is (note that I have embedded the agent's "knowledge" in comments within the code): if (current_square_dirty()) suck; up; if (received_bump()) { // In A or B, with A or B clean left(); if (received_bump()) { // In A, A is clean right(); if (current_square_dirty()) suck; down(); if (current_square_dirty()) suck; left(); if (current_square_dirty()) suck; } else { // In A, with B clean if (current_square_dirty()) suck; down(); if (current_square_dirty()) suck; right(); if (current_square_dirty()) suck; } } else { // In A or B, with C or D clean if (current_square_dirty()) suck; left; if (received_bump()) { // In A, with A and C clean right(); if (current_square_dirty()) suck; down(); if (current_square_dirty()) suck; } else { // In A, with B and D clean if (current_square_dirty()) suck; down(); if (current_square_dirty()) suck; } } 3. We're looking for the fewest possible number of nodes generated for different algorithms. For all of the cases in this problem, the best case is where the (shallowest) goal node is the leftmost on level d. Answers vary depending on whether you check for goalness at expansion or generation time. a) DFS with backtracking. This algorithm by nature does not do expansion, so we check at generation time. d+1 nodes are generated. (1 at level 0, 1 at level 1, 1 at level 2, ..., 1 at level d.) b) Depth-first expansion. If the test is made at generation time: 1 + b + b + b + ... + 1 = 1 + (d-1)b + 1 = b(d-1)+2. If the test is made at expansion time: 1 + b + b + ... + b = bd+1. c) Breadth-First search: If test is made at generation time: 1 + b + b^2 + b^3 + ... b^(d-1) + 1. If the test is made at expansion time: 1 + b + b^2 + b^3 + ... b^(d-1) + b. Don't worry, you did not have to create closed form expressions for these. :) e) Iterative Deepening: We never expand nodes at level d, so: 1 + (1 + b) + (1 + b + b^2) + (1 + b + b^2 + b^3) + ... (1 + b + b^2 + ... + b^(d-1)) + (1 + b + b^2 + ... + b^(d-1) + 1) = d + (d-1)b + (d-2)b^2 + ... + 2b^(d-1) + 1. (As always, only one node at level d is generated. Plus, you weren't required to produce a closed form expression.) 4. If h was a perfect estimate, A* would directly expand the least cost path to the goal. If h(n) was always 0, A* "degenerates" into uniform-cost search. 5. A where A is the start state and is not / \ a goal. B and C are both goals. B is B(2) C(1) generated first. B isn't optimal though; you have to fully expand A so that C will be considered.