Search in discrete and continuous spaces

Similar documents
Informed search algorithms. Chapter 4

1 Introduction and Examples

Assignment 1 is out! Due: 9 Sep 23:59! Can work in a group of 2-3 students.! NO cheating!!!! Submit in turnitin! Code + report!

Graph and Heuristic Search. Lecture 3. Ning Xiong. Mälardalen University. Agenda

Informed Search. CS 486/686 University of Waterloo May 10. cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart

Heuristic (Informed) Search

CMPUT 396 Sliding Tile Puzzle

Artificial Intelligence

CS 331: Artificial Intelligence Informed Search. Informed Search

CS 331: Artificial Intelligence Informed Search. Informed Search

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:

Artificial Intelligence

Problem Solving & Heuristic Search

Mustafa Jarrar: Lecture Notes on Artificial Intelligence Birzeit University, Chapter 3 Informed Searching. Mustafa Jarrar. University of Birzeit

Lecture 2: Fun with Search. Rachel Greenstadt CS 510, October 5, 2017

Informed Search Algorithms

CS510 \ Lecture Ariel Stolerman

Informed search algorithms. Chapter 4

Heuristic (Informed) Search

Informed search strategies (Section ) Source: Fotolia

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents

Search: Advanced Topics and Conclusion

6.141: Robotics systems and science Lecture 10: Implementing Motion Planning

Announcements. CS 188: Artificial Intelligence

Informed/Heuristic Search

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven

Robotic Motion Planning: A* and D* Search

Search : Lecture 2. September 9, 2003

6.141: Robotics systems and science Lecture 10: Motion Planning III

CPS 170: Artificial Intelligence Search

A.I.: Informed Search Algorithms. Chapter III: Part Deux

Notes. Video Game AI: Lecture 5 Planning for Pathfinding. Lecture Overview. Knowledge vs Search. Jonathan Schaeffer this Friday

CSE 473. Chapter 4 Informed Search. CSE AI Faculty. Last Time. Blind Search BFS UC-BFS DFS DLS Iterative Deepening Bidirectional Search

mywbut.com Informed Search Strategies-I

Artificial Intelligence

CS 188 Introduction to Artificial Intelligence Fall 2018 Note 1

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

ARTIFICIAL INTELLIGENCE. Informed search

Problem Solving: Informed Search

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Artificial Intelligence. Sina Institute, University of Birzeit

Route planning / Search Movement Group behavior Decision making

Artificial Intelligence

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Sina Institute, University of Birzeit

Are We Smart Yet? (Where we try to choose smartly) R&N: Chap. 4, Sect

Overview. Path Cost Function. Real Life Problems. COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

CE 473: Artificial Intelligence. Autumn 2011

Informed (Heuristic) Search. Idea: be smart about what paths to try.

CMU-Q Lecture 2: Search problems Uninformed search. Teacher: Gianni A. Di Caro

Lecture 4: Informed/Heuristic Search

Artificial Intelligence p.1/49. n-queens. Artificial Intelligence p.2/49. Initial state: the empty board or a board with n random

Today s s lecture. Lecture 3: Search - 2. Problem Solving by Search. Agent vs. Conventional AI View. Victor R. Lesser. CMPSCI 683 Fall 2004

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Lecture 4: Search 3. Victor R. Lesser. CMPSCI 683 Fall 2010

Search: Advanced Topics and Conclusion

Chapter 3: Informed Search and Exploration. Dr. Daisy Tang

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

MathZoom, Summer, 2014

Artificial Intelligence

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

CS 380: Artificial Intelligence Lecture #4

Informed Search. Best-first search. Greedy best-first search. Intelligent Systems and HCI D7023E. Romania with step costs in km

CS 771 Artificial Intelligence. Informed Search

Lecture 3 of 42. Lecture 3 of 42

HW#1 due today. HW#2 due Monday, 9/09/13, in class Continue reading Chapter 3

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

In either case, remember to delete each array that you allocate.

3 SOLVING PROBLEMS BY SEARCHING

Introduction to Computer Science and Programming for Astronomers

The wolf sheep cabbage problem. Search. Terminology. Solution. Finite state acceptor / state space

CS 5522: Artificial Intelligence II

INTRODUCTION TO HEURISTIC SEARCH

Motion Planning for a Point Robot (2/2) Point Robot on a Grid. Planning requires models. Point Robot on a Grid 1/18/2012.

Search. CS 3793/5233 Artificial Intelligence Search 1

Lecture 5 Heuristics. Last Time: A* Search

CS 380/480 Foundations of Artificial Intelligence Winter 2007 Assignment 2 Solutions to Selected Problems

Informed Search and Exploration for Agents

Heuristic Search. CPSC 470/570 Artificial Intelligence Brian Scassellati

Informed Search and Exploration

University of Waterloo Department of Electrical and Computer Engineering ECE 457A: Cooperative and Adaptive Algorithms Midterm Examination

1 Project: Fast Trajectory Replanning for Computer Games

Heuristic Search: A* CPSC 322 Search 4 January 19, Textbook 3.6 Taught by: Vasanth

1 Linear programming relaxation

Informed search. Lirong Xia

Solving problems by searching

Chapter 3: Search. c D. Poole, A. Mackworth 2010, W. Menzel 2015 Artificial Intelligence, Chapter 3, Page 1

Algorithms and Path Planning

Notebook Assignments

Practice Problems for the Final

CSE 40171: Artificial Intelligence. Informed Search: A* Search

Heuristic Search. Heuristic Search. Heuristic Search. CSE 3401: Intro to AI & LP Informed Search

Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs)

Informed Search. Xiaojin Zhu Computer Sciences Department University of Wisconsin, Madison

Lecture 3 - States and Searching

Homework #3 (Search) Out: 1/24/11 Due: 2/1/11 (at noon)

Informed search algorithms. Chapter 3 (Based on Slides by Stuart Russell, Dan Klein, Richard Korf, Subbarao Kambhampati, and UW-AI faculty)

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we

Learning Objectives. c D. Poole and A. Mackworth 2010 Artificial Intelligence, Lecture 3.3, Page 1

Outline. Informed Search. Recall: Uninformed Search. An Idea. Heuristics Informed search techniques More on heuristics Iterative improvement

Artificial Intelligence

Transcription:

UNSW COMP3431: Robot Architectures S2 2006 1 Overview Assignment #1 Answer Sheet Search in discrete and continuous spaces Due: Start of Lab, Week 6 (1pm, 30 August 2006) The goal of this assignment is to test your understanding of various search algorithms. While this assignment does not directly ask you to implement or trace all the algorithms discussed in class, it may be advantageous for you to do so. To answer the questions in this assignment, you will have to do some investigation of the algorithms outside of what was explicitly mentioned in class. You should feel free to ask the Lecturer questions and discuss the assignment with others, but you should not copy someone else s work. (e.g. You can get someone to show you how to answer a question, but you should write your answer up yourself from what you remember at least 30 minutes after they ve left.) Total marks for this assignment: 90. It will be scaled to 15% of the comp3431 grade. 2 Discrete Search In the following questions we ll be considering this graph: 1

B E 1.3 1.0 6.2 3.1 A 1.2 C 3.4 F 2.0 H 3.1 3.7 0.8 6.0 2.8 D 2.4 G With the following heuristic costs to node H: Node Distance A 6.0 B 4.0 C 5.1 D 4.5 E 3.0 F 2.0 G 2.5 H 0.0 You should assume that for any node, if we need its children, we can iterate through them in alphabetical order. When asked to trace a discrete search algorithm, you should list the state of the fringe data structure just before a node is removed from it, you should also list what node is removed, and any state associated with that node. This should be repeated from when the start node is added to the fringe, until the algorithm is complete. 2.1 Question 2.1 (5 marks): Write the pseudo-code for a generalised discrete search algorithm. should print out the final path between the start and goal nodes. F {s} the fringe Your algorithm 2

V {s} the set of visited nodes P {s, } the hash of parent pointers while F do n next state from F if n = g then print out the path to the goal this prints it out reversed repeat print n n P (n) until n = Exit end if for all children n of n do if n V then Choose which node you re keeping, n or the current node end if V V {n } P P {n, n} F F {n } end for end while Print No path Something like the function Graph-Search on page 83 of Russell and Norvig would also work, if you remembered to store back-pointers. 2.2 Question 2.2 (5 marks): Trace the behaviour of Depth First Search on the graph starting at node A, with a goal of node H. I ve used subscripts for parent pointers. Fringe: A Remove: A Fringe: B A, C A, D A Remove: D A Fringe: B A, C A, G D Remove: G D could be done here Fringe: B A, C A, H G Remove: H G 2.3 Question 2.3 (5 marks): Trace the behaviour of Breadth First Search on the graph starting at node A, with a goal of node H. 3

Fringe: A Remove: A Fringe: B A, C A, D A Remove: B A Fringe: C A, D A Remove: C A Fringe: D A, F C Remove: D A Fringe: F C, G D Remove: F C could be done here Fringe: G D, H F Remove: G D Fringe: H F Remove: H F 2.4 Question 2.4 (5 marks): Trace the behaviour of Best First Search on the graph starting at node A, with a goal of node H. I ve used superscripts to indicate heuristic values, and shown the fringe as a sorted list. Subscripts are still parent pointers. Fringe: A 6.0 Remove: A 6.0 Fringe: BA 4.0, DA 4.5, CA 5.1 Remove: BA 4.0 Fringe: DA 4.5, CA 5.1 Remove: DA 4.5 Fringe: GD 2.5, CA 5.1 Remove: G 2.5 D could be done here Fringe: HG 0.0, CA 5.1 Remove: HG 0.0 2.5 Question 2.5 (5 marks): Trace the behaviour of Uniform Cost Search on the graph starting at node A, with a goal of node H. Here superscripts are not heuristic values, but rather costs from the start. I ve shown those costs as the old total plus the increment the first time. Again, I ve shown the fringe as a sorted list. Subscripts are still parent pointers. Fringe: A 0.0 Remove: A 0.0 Fringe: C 0.0+1.2=1.2 A, B 0.0+1.3=1.3 A, D 0.0+3.7=3.7 A Remove: C 1.2 A Fringe: BA 1.3, DA 3.7, FC 1.2+3.4=4.6 Remove: BA 1.3 Fringe: DA 3.7, FC 4.6 Remove: DA 3.7 Fringe: FC 4.6, GD 3.7+2.4=6.1 Remove: FC 4.6 could be done here 4

Fringe: G 6.1 D, H 4.6+2.0=6.6 F Remove: G 6.1 D Fringe: HF 6.6, HG 6.1+2.8=8.9 Remove: HF 6.6 strikeout indicates a second path considered but not taken because its cost from the start was higher than the one already in the fringe. That node is never actually added to the fringe. 2.6 Question 2.6 (5 marks): Trace the behaviour of A* Search on the graph starting at node A, with a goal of node H. In this example, superscripts show the cost from the start, the heuristic estimate to the goal, and the sum. Again, I ve shown the fringe as a sorted list. Subscripts are still parent pointers. Fringe: A 0.0+6.0=6.0 Remove: A 0.0+6.0=6.0 Fringe: BA 1.3+4.0=5.3, CA 1.2+5.1=6.3, DA 3.7+4.5=8.2 Remove: BA 1.3+4.0=5.3 Fringe: CA 1.2+5.1=6.3, DA 3.7+4.5=8.2 Remove: CA 1.2+5.1=6.3 Fringe: FC 4.6+2.0=6.6, DA 3.7+4.5=8.2 Remove: FC 4.6+2.0=6.6 A cannot finish here and provably find the shortest path Fringe: HF 6.6+0.0=6.6, DA 3.7+4.5=8.2 Remove: HF 6.6+0.0=6.6 2.7 Question 2.7 (10 marks): In normal A search, the priority of a node, n, is: f(n) = g(n) + h(n). If we add a constant coefficient, α, (greater than one) to the heuristic, we get f(n) = g(n) + αh(n). If the optimal path cost is C, is there a bound on the cost of the path found by our new search algorithm? If so, what is it? Can you prove your bound? One bound is that path found has its cost bounded by αc. The proof uses the standard A proof setup - a proof by contradiction where we look at the last step of the search. Imagine we have a start node s, a goal node g, the node in the fringe furthest along the optimal path to the goal o. We will assume that the goal node is in the fringe, and is about to pulled out of the fringe as it has the lowest f value. g(o) + h(o) < C because o is on the optimal path to the goal and our heuristic is admissible f(o) = g(o) + αh(o) <= αg(o) + αh(o) = α(g(o) + h(o)) <= αc f(g) = g(g) + αh(g) = g(g) + 0 If we are about to extract g from the fringe, then it must have the lowest f value. We see that f(o) no more than αc, so the f value of g must be no more than αc. If we assume that this path was going to violate our bound then, then we have a contradiction. 5

2.8 Question 2.8 (5 marks): Give an admissible heuristic estimate for the minimum number of search steps from each node to H. Your heuristic should assign non-zero values to some nodes. Node Distance A 3 B 4 C 2 D 2 E 1 F 1 G 1 H 0 The above heuristic is the highest possible. Anything underneath that would also be admissible. 2.9 Question 2.9 (5 marks): Use your heuristic to perform Best First Search on the graph. How does use of this heuristic compare with the cost-heuristic above? Fringe: A 3 Remove: A3 Fringe: C 2 A, D 2 A, B 4 A Remove: C 2 A Fringe: F 1 C, D 2 A, B 4 A Remove: F 1 C could be done here Fringe: H 0 F, D 2 A, B 4 A Remove: H 0 F It is faster, although if a poor heuristic is chosen, it could be slower. 3 Continuous Search It is possible to perform a line-search analytically in some situations. Consider a function on a two dimensional space, z = f(x, y). If we restrict ourselves to the line y = mx+c then we can substitute that into the original function to get z = f(x, mx+c). This is now a function of one variable, x. We can differentiate and set the result to 0 to get a minimum or maximum. For example; we start with z = x 2 + y 2 + 2xy, and want to search along the line y = 3x + 7. We substitute to get z = x 2 + (3x + 7) 2 + 2(3x + 7)x = 16x 2 + 56x + 49. Which we can differentiate to get z = 32x + 56. The differential is 0 at x = 56/32 = 1.75. We can back-substitute to get y = 1.75 for a minimum point along the line of ( 1.75, 1.75). 6

3.1 Question 3.1 (10 marks): Show the steps involved in Powell s Direction Set method of minimisation for the function z = 2x 2 + y 2 + 2xy. Assume our initial direction set consists of the (1, 0) and (0, 1) unit vectors, and we start minimising from the point (2, 3). Use the analytic method above to perform the each line minimisation. initially, at the point (2, 3), z = 8 + 9 + 12 = 29 start by minimising in one direction, say (1, 0). This is the line y = 3. Substituting gives z = 2x 2 + 6x + 9, which has a derivative of z = 4x + 6 which is zero at x = 6/4. First min: ( 1.5, 3). At this point z = 4.5. now we iterate through all directions and minimise. I ll start with the second vector to make sure I don t try an minimise in exactly the same direction twice in a row. minimize along direction (0, 1) from the point ( 1.5, 3). This is the line x = 1.5. Substituting gives z = 4.5 + y 2 3y, which has a derivative of z = 2y 3 which is zero at y = 1.5. Second min: ( 1.5, 1.5). At this point z = 2.25 for a drop of 2.25. minimize along direction (1, 0) from the point ( 1.5, 1.5). This is the line y = 1.5. Substituting gives z = 2x 2 + 3x + 2.25, which has a derivative of z = 4x + 3 which is zero at x = 3/4. Third min: ( 0.75, 1.5). At this point z = 1.125 for a drop of 1.125. The total change in location over that set of minimizations is ( 0.75, 1.5) ( 1.5, 3) = (0.75, 1.5). This will be our new minimization direction. We ll replace the direction that had the largest drop in the last set of minimizations which was (0, 1). Our new directions are (0.75, 1.5) and (1, 0). We now minimise along each of these directions in turn minimize along direction (0.75, 1.5) from the point ( 0.75, 1.5). This is the line y = 2x. Substituting gives z = 2x 2 + 4x 2 4x 2, which has a derivative of z = 4x which is zero at x = 0. Back-substituting we find that y = 0 at this point. Fourth min: (0, 0). At this point z = 0 for a drop of 1.125. minimize along direction (1, 0) from the point (0, 0). This is the line y = 0. Substituting gives z = 2x 2, which has a derivative of z = 4x which is zero at x = 0. Fifth min: (0, 0). We haven t moved! Noting that we haven t moved, and that the vector set is not linearly dependent, we decide we must be at the minimum at (0, 0). 7

3.2 Question 3.2 (5 marks): For the function z = 2x 2 + y 2 + 2xy, what direction is conjugate to the vector (1, 0)? This was calculated by Powell s Method. It is the direction (0.75, 1.5). It was because these directions were conjugate that Powell s method took us straight to the minimum when it started minimising in those directions. 4 Representation Consider a small 5 5 gridworld. (i.e. a small world with 25 states laid out on a 5 5 rectangular grid.) We have four actions, each of which moves our agent to a neighbouring state, North, South, East or West. We will assume our world is deterministic. If the agent collides with a wall, then it does not move. We will assume that there are walls around the edge of the world, and between some, but not all, of the states. There is one defined start state, and one defined goal state. 4.1 Question 4.1 (5 marks): What is the standard transformation of this problem into a state space search? Each state in the world corresponds to a node in the graph we search. Actions correspond to edges that move us between states/nodes. A path through the world corresponds to a path through the graph. Consider the following plan space representations of the problem: Partial policy: Each state in our search space is a 25-vector of discrete values. Each element of this vector is drawn from the set {North, South, East, West, Undecided}. The elements of the vector correspond with the actions to be taken in the states of the original problem. The vectors in this space are restricted so that vectors are only in the search space if taking the assigned actions in turn will lead us to the goal in all states for which an action is assigned. Full policy: Each state in our search space is a 25-vector. Each element of this vector is drawn from the set {North, South, East, West}. Stochastic policy: Each state in our search space is a 25 4 matrix of numbers. Each column in the matrix corresponds with a state in the original space. Each row corresponds with an action in the original space. The columns are normalised to find the probability that your agent takes that action in that state. Plan: Each state in the search space is a list of actions to be followed consecutively from the start state. 8

4.2 Question 4.2 (20 marks): Describe a search technique that could be used with each representation. Include a description of any heuristics or evaluation functions you think are necessary. Partial policy: This could be searched with a discrete best-first search. A simple childrenof() operator you might think of is: The children of a node are the partial policies that have one more action assigned. Unfortunately, this doesn t fit with the constraint given. Instead you must choose the subset of those children that meet the specification given. A new node will meet the spec given if the action you just added takes you to a state with an already assigned action. A good heuristic for the best-first search would be to choose the distance from the start state to the closest state with an assigned action. Full Policy: I d probably choose a local search for this plan space search. You get neighbours of a plan by simply changing one action at random. The interesting part is the evaluation function. Note that it is possible to check nodes back from the goal state, searching backwards only where the assigned action matches (is the inverse of) where you re trying to search. This search will peter out before reaching the start state if the current policy can t get you to the goal. Look to have large search trees of this form. Start at the start state and follow the policy. At some point you ll either reach the goal or start to cycle. The heuristic is the closest you ever get to the goal state. Stochastic Policy: here you have a continuous space, not a discrete one. That means you want to use a continuous search method. Conjugate gradient would be a good first choice. To evaluate each plan, you could use the expected number of steps to reach the goal. This could be found by sampling run 100 trials and measure the average number of steps to reach the goal. If you never reach the goal, then record the closest you get. If no policies are reaching the goal, then you could use the closest option, until most of them are reaching the goal, then switch to improving the speed. Plan: This is almost identical to the Partial Policy setup, except that all actions are assigned in a row. You could use best first search, with a heuristic of the distance to goal when you have finished executing the plan from the start state. 9