EE266 Homework 8 Solutions
|
|
- Linette Williams
- 6 years ago
- Views:
Transcription
1 EE266, Spring Professor S. Lall EE266 Homework 8 Solutions 1. Dijkstra s Algorithm. In this problem, you will write an implementation of Dijkstra s algorithm, and use it to find the shortest path in a social network. Consider a weighted, directed graph with vertex set V = {1,..., n}, and edge set E. We can describe such a graph using a matrix W R n n, where W ij is the weight of the edge (i, j) if the graph contains the edge (i, j), and W ij = 0 otherwise (we assume that there are no zero-weight edges). (a) A key step in Dijkstra s algorithm is computing the neighbors of a vertex x: N (x) = {y (x, y) E}. Implement the following MATLAB function. [Nx, WNx] = get_neighbors(x,w) % x : a vertex % W : the matrix of edges weights (0 if there is no edge) % Nx : cell array containing the neighbors of x % WNx : vector containing the weights % of edges between x and its neighbors Report the output of get_neighbors(246,w) for the matrix W defined in facebook_data.m. The function get_neighbors is called a successor oracle. (b) Implement the version of Dijkstra s algorithm given on page 23 of the Shortest Paths lecture. Use the following function header. [dist, path] = dijkstra(neighbors, s, t) % neighbors : function handle [Nx,WNx] = neighbors(x) % where Nx is a cell array of the neighbors of x % and WNx is a vector of weights % s : the source vertex % t : the destination vertex % dist : the distance from s to t % path : cell array containing a shortest path from s to t % path{i} is the i-th vertex of the path (c) The file facebook_data.m define a matrix W that describes part of the Facebook social network. Report the shortest path between nodes s = 800 and t = Choose five random source/destination pairs, and compute the distance from each source to the corresponding destination. Report the maximum distance among the five pairs. 1
2 Implementation hints. You need to figure out how to store the sets F and E, and the value function v. Since MATLAB does not offer data structures such as priority queues and hashtables, you need to use arrays. This is not the most efficient approach, and is not something you would do in most programming languages. However, it is the best solution we have found in MATLAB. In order to recover the optimal path, you need to keep track of the index P(i) that was last used to update the distance v(i). You can use P(i) (which is called the predecessor of i), to trace the optimal path backwards from the target to the source. However, note that your algorithm should output the vertices in a path from s to t. Note that the get_neighbors function you wrote in (a) is slightly different from the neighbors function that you must pass to dijkstra. You can address this discrepancy using an anonymous function. If you have a function f(x, y), you can define a function g(x) = f(x, y 0 ) for some fixed value of y 0 using the expression g f(x,y0). The right side of this expression is called an anonymous function because it is not defined in a named function file. When searching for the state in F with minimum distance, break ties by always selecting the state that was inserted last in the frontier. This will reduce the number of states extracted from F before a solution is found. Solution: (a) The neighbors of 246 are: [1] [9] [24] [92] [260] and all the edges have unit cost. (b) The part of the implementation that was left to figure out is how to store and index the frontier F, closed set E and value function v. Our approach is to keep a cell array ID such that ID{i} contains the i-th state that was inserted in the frontier F for the first time. Then, we use this index i to refer to the actual state ID{i}. This allows us to store F,E,v as simple arrays. The only overhead induced is that, when we explore the neighbors of a state, we need for each neighboring state y to search the whole cell array ID to either find the index j that was assigned to the state ID{j}=y, or assign a new index by expanding the cell array. Another valid approach is to use functions sub2ind, ind2sub to encode an n- dimensional vector of integers in a single integer (index) that will be used to represent the state internally. This simplifies the implementation a bit, since one only has to deal with indices and arrays and not cell arrays. Nevertheless, such an implementation has its own problems. For instance, if one adds a large number to every element of the state, then using an internal representation (indexing the array v) through sub2ind, might not be possible. (c) The length of the shortest path between nodes 800 and 3000 is 5 and is given by: [800] [687] [699] [861] [1685] [3000] 2
3 The maximum value that we observed was 6. Aside. In general, it is a well established fact, both theoretically and experimentally, that most real world networks have a diameter (maximum distance between vertices) that scales logarithmically with the number n of nodes in the network, i.e. diam(n) C log n for some C. For instance take C = 1/3 and n = , then log n 6. The fact that you can connect any two people in the world with a short chain of personal acquaintances is known as the Small World Phenomenon or as Six Degrees of Separation. 2. Navigating a maze. In this problem, you will reproduce and extend the maze example from the lecture slides. You are given a two-dimensional maze (Figure 1) as a matrix A {0, 1} 81 81, where A ij = 1 means that the position (i, j) is free, and A ij = 0 that it is blocked. You are allowed to move horizontally or vertically between adjacent free positions. Figure 1: The maze along with the way-points graph. The cost of moving horizontally is p, and the cost of moving vertically is q. Furthermore, this maze has a special structure in that it is partitioned into smaller mazes by vertical and horizontal lines in positions X=[ ], and Y=[ ] respectively. One can move between smaller mazes only through some way-points, that are marked in blue in Figure 1. The data are available in the maze.dat file. You will use Dijkstra s algorithm to investigate the impact of different heuristics for finding shortest paths in this maze. (a) Implement the function maze_succ that plays the role of the successor oracle for the maze problem. Use the prototype [Nbors,costs]=maze_succ(x,A,h,p,q), where A is an matrix indicating whether locations are free or blocked x is a vector of length 2 given the current position in the maze, p and q are the costs of moving horizontally and vertically, respectively h is a function handle that defines a heuristic. 3
4 Recall that the heuristic function affects the costs through the formula ĝ ij = g ij + h j h i. (b) Uninformed Search. Find the shortest path between s = (1, 19) and t = (81, 61). Report the total cost of the path, the number of states extracted from the frontier F, and the 100-th state along the optimal path, i.e., path{100}, where path{1} is considered to be the source. (c) Manhattan Heuristic. Define the Manhattan heuristic for this problem, and implement it in the function manh(x,t,p,q). Show that it is a consistent heuristic. Report manh(s,t,p,q). (d) A* with Manhattan heuristic. Repeat (b) using the function manh. (e) Finding Close Way-points. Implement the following helper function, which will be useful later in the problem. wpind = waypts(x,x,y,w) % x : the current location % X : locations of the horizontal lines % Y : locations of the vertical lines % W : a matrix with two columns; % each row is the location of a waypoint % wpind : the indices of waypoints that can be accessed from x % without going through any other waypoints For states that are way-points. your function should simply return the index of the way-point. Report waypts(s,x,y,w). (f) Waypoint Distance heuristic. Implement the following helper function. hx = heurmap(x,t,x,y,w,d) % x : the current state % t : the target state % X : the locations of the horizontal lines % Y : the locations of the vertical lines % W : the locations of the waypoints % D : a matrix of estimates of the distances between way-points % hx : an estimate of the distance from x to t (see below) The function should output the following number: { } manh(x, W(i,:)) + D(i, j) + manh(w(j,:), t), h D (x) = min for i waypts(x), j waypts(t) when waypts(x) waypts(t) and h D (x) = manh(x,t) 4
5 when the sets of way-points of the states x,t are identical (x is near the goal). (g) Way-point Manhattan Distance. There is a graph associated with the way-points (also shown in blue in Figure 1). The data file defines the matrix W, which gives the locations of the way-points, and the adjacency matrix G of the graph associated with the way-points. Use this information to compute the weighted adjacency matrix Gw of the way-points graph, where we take the Manhattan distance between two way-points to be the weight of an edge. We have provided the following function for your convenience. D = allpairssp(a) % A : weighted adjacency matrix % D : matrix of distances between vertices of A Use this function to compute Dmanh = allpairssp(gw). (h) A* with way-point Manhattan heuristic. Repeat (b) using the heuristic heurmap with the matrix Dmanh of estimated distances. (i) A* with actual way-point Distance. Construct the matrix of actual distances between waypoints Dtrue by running dijkstra for each adjacent pair of way-points. Report Dtrue and repeat steps (g) and (h) using Dtrue. Remark. The function showpath.m can be used to plot a path given in a cell array. Solution: (b) The total cost of the path found is 652 using 218 edges. The number of states extracted from the frontier were The 100-th state along the optimal path is [55 36]. Figure 2: Uninformed search and solution found by Dijkstra. 5
6 (c) The Manhattan heuristic is given by: h(x) = p x 1 t 1 + q x 2 t 2 To prove consistency consider without loss of generality a horizontal edge with cost p between states x and y = x ± e 1, where e 1 = (1, 0). We have: g xy + h(y) = p + p y 1 t 1 + q y 2 t 2 = p + p x 1 ± 1 t 1 + q x 2 t 2 p p + p x 1 t 1 + q x 2 t 2 = h(x) The same proof can be applied for vertical edges and thus we get that our heuristic is consistent. The value of manh(s,t,p,q) is 404. (d) The total cost of the path found is 652 using 218 edges. The number of states extracted from the frontier were The 100-th state along the optimal path is [55 36]. Figure 3: Informed search by Manhattan heuristic and solution found by A*. (e) One way to implement the function waypts is to first use the positions of the separators X,Y to find the sub-maze where the state x belongs and then find the way-points on or inside the boundary of the sub-maze by using the information in W. The way-points for the starting state are: [1 4] (h) (i) The total cost of the path found is 652 using 218 edges. The number of states extracted from the frontier were The 100-th state along the optimal path is [55 36]. The total cost of the path found is 652 using 218 edges. The number of states extracted from the frontier were The 100-th state along the optimal path is [55 36]. The first 14 columns of the matrix Dtrue are: 6
7 Figure 4: Informed search by Way-point Manhattan heuristic and solution found by A*. Figure 5: Informed search by Way-point Distance heuristic and solution found by A*. 7
8 3. Convoy on a graph. You are a rich merchant, and you want to move some valuable cargo from city s to city t. Unfortunately, the road is full of bands of thieves aiming to steal your cargo. Your network of informants has given you an accurate map of the routes between different cities, and the number of bandits along each road. You can hire mercenaries to guard you on your journey You know that if the number of bandits along any road in your itinerary is at most half the number of mercenaries guarding your cargo, then you will not be attacked. Once you hire the mercenaries, you also need to plan your route. Each mercenary you hire costs 10 gold coins, and you want to find the minimum number of coins you need to spend in order to safely transport your cargo. (a) Explain how to modify Dijkstra s algorithm to solve this problem. (b) The file convoy.mat defines an instance of this problem. Report the minimum number of coins that you need to spend to hire mercenaries, and a corresponding path from s = 1 to t = 23. Solution: (a) Our goal is to find the minimum number of coins that we will have to spend. This amount is: ( ) C = 2 10 min max w ij p P (s,t) (i,j) p where P (s, t) is the set of paths going from s to t, p P (s, t) is a simple path from s to t and w ij is the estimated number of thieves being active between cities i and j. We are going to modify Dijkstra s algorithm to calculate the quantity in the parenthesis. Define the cost c(p) of a path p as: and the distance of two vertices as: c(p) = max (i,j) p w ij d(x, y) = min c(p) p P (x,y) Our problem essentially boils down to finding d(s, t). This notion of distance satisfies the ultrametric inequality (stricter than triangular): d(x, y) max{d(x, z), w zy }, z : y N(z) as well as the following principle of optimality: d(x, y) = min z:y N(z) max{d(x, z), w zy} where N(z) is the set of neighbors of z. Thus, when expanding the neighbors of node i, just extracted from the frontier, we can perform label relaxation in Dijkstra by using the following update: v(j) = min {v(j), max{v(i), w ij }}, j N(i) 8
9 Figure 6: Goal state of the 8-Tile puzzle. starting again from F = {s} and v(s) = 0. That is, instead of performing the check v(i) + w ij < v(j), we check whether max{v(i), w ij } < v(j) and if so we set v(j) max{v(i), w ij }. (b) We will have to spend C = 520 coins and follow the route: [1] [5] [10] [13] [20] [23] 4. The 8-tile puzzle. The 8-tile puzzle is a sliding puzzle in which 8 tiles, labeled 1,..., 8, are placed in a 3 3 box. Note that there is always one empty space in the puzzle. The rules are that you can change the the configuration of the puzzle by sliding any tile adjacent to the empty space into the empty space. The goal is to reach the configuration shown in Figure 2. In this problem, you will solve the 8-tile puzzle using Dijkstra algorithm and heuristics. (a) We can think of the 8-tile puzzle in terms of a graph. Let each configuration of the puzzle be a vertex, and let there be an edge between two vertices if the corresponding configurations can be reached from one another in one move. We assume that each edge has weight one. Given a starting configuration s, we can we can solve the 8-tile puzzle by finding a shortest path from s to the configuration t shown in Figure 2. Give a consistent heuristic h for this problem, and prove that your heuristic is consistent. (b) We can represent a configuration of the puzzle using a vector of length 9; for example, the goal configuration is x = (1, 8, 7, 2, 0, 6, 3, 4, 5). Implement the following function. [Nx, WNx] = tile8_neighbors(x,h) % x : a configuration of the 8-tile puzzle % h : a heuristic % Nx : the neighbors of x (that is, the configurations % that can be reached from x in one move) % WNx : the cost of moving to each neighbor using the heuristic 9
10 (c) Solve the 8-tile puzzle from the starting state s = (7, 8, 1, 5, 4, 0, 3, 2, 6). Report your sequence of moves, as well as the number of states that you extracted from the frontier. Use can use the function solution8tile(path) to animate your solution of the puzzle. This function assumes that path is a cell array, where path{i} is the ith state in the path. Solution: (a) Since, we can move one tile at a time, and we want each tile to be in a particular final position in the goal state, we can relax the problem and assume that we can freely move each tile independently of other tiles. In order to get a tile l from position (x (l) 1, x (l) 2 ) {1, 2, 3} 2 to its final position (t (l) 1, t (l) 2 ), a lower bound for the number of moves required is given by the Manhattan distance for the coordinates. The heuristic function is simply the sum of this quantity for all tiles {1,..., 8}: h(x) = l {1,...,8} x (l) 1 t (l) 1 + x (l) 2 t (l) 2 To prove consistency, consider that to get from state x to sate y = x ± e (l 0) 1 we move a particular tile l 0 (adjacent to the empty space) horizontally. Then we have: g xy + h(y) = 1 + y (l) 1 t (l) 1 + y (l) 2 t (l) 2 l {1,...,8} = 1 + x (l 0) 1 ± 1 t (l 0) 1 + x (l 0) 2 t (l 0) x (l 0) 1 t (l 0) 1 + x (l 0) 2 t (l = h(x) l {1,...,8}\{l 0 } l {1,...,8}\{l 0 } x (l) 1 t (l) 1 + x (l) 2 t (l) 2 x (l) 1 t (l) 1 + x (l) 2 t (l) 2 The same holds also for vertical moves and since tile l 0 was arbitrary it holds also for all tiles. Hence, we have proved consistency of the heuristic. A different consistent heuristic is given by the number of misplaced tiles and one can essentially follow the same line of proof. (c) Using A* with the Manhattan heuristic, we extracted 3802 states from the frontier and found the following sequence of moves: The number of states extracted can differ both depending on the heuristic as well as various implementation details. For instance, you might get different results depending on how you break ties when extracting the state with the minimum distance v(i) from F, or how you choose to store (index) you states. 10
EE365 Homework 8. (a) A key step in Dijkstra s algorithm is computing the neighbors of a vertex x:
EE365, Spring 2013-14 Professor S. Lall EE365 Homework 8 1. Dijkstra s Algorithm. In this problem, you will write an implementation of Dijkstra s algorithm, and use it to find the shortest path in a social
More informationClass Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions
Class Overview COMP 3501 / COMP 4704-4 Lecture 2 Prof. JGH 318 Problem Solving Agents Problem Solving Agents: Assumptions Requires a goal Assume world is: Requires actions Observable What actions? Discrete
More information1 Introduction and Examples
1 Introduction and Examples Sequencing Problems Definition A sequencing problem is one that involves finding a sequence of steps that transforms an initial system state to a pre-defined goal state for
More informationChapter 10. Fundamental Network Algorithms. M. E. J. Newman. May 6, M. E. J. Newman Chapter 10 May 6, / 33
Chapter 10 Fundamental Network Algorithms M. E. J. Newman May 6, 2015 M. E. J. Newman Chapter 10 May 6, 2015 1 / 33 Table of Contents 1 Algorithms for Degrees and Degree Distributions Degree-Degree Correlation
More informationInformed Search A* Algorithm
Informed Search A* Algorithm CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2018 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Most slides have
More informationClass Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents
Class Overview COMP 3501 / COMP 4704-4 Lecture 2: Search Prof. 1 2 Problem Solving Agents Problem Solving Agents: Assumptions Requires a goal Assume world is: Requires actions Observable What actions?
More informationInformed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016
Informed search CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Outline Best-first search Greedy
More informationCMPUT 396 Sliding Tile Puzzle
CMPUT 396 Sliding Tile Puzzle Sliding Tile Puzzle 2x2 Sliding Tile States Exactly half of the states are solvable, the other half are not. In the case of 2x2 puzzles, I can solve it if I start with a configuration
More informationSearch Algorithms for Discrete Optimization Problems
Search Algorithms for Discrete Optimization Problems Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text ``Introduction to Parallel Computing'', Addison Wesley, 2003. 1 Topic
More informationLecture 5 Heuristics. Last Time: A* Search
CSE 473 Lecture 5 Heuristics CSE AI Faculty Last Time: A* Search Use an evaluation function f(n) for node n. f(n) = estimated total cost of path thru n to goal f(n) = g(n) + h(n) g(n) = cost so far to
More informationCS510 \ Lecture Ariel Stolerman
CS510 \ Lecture02 2012-10-03 1 Ariel Stolerman Midterm Evan will email about that after the lecture, at least 2 lectures from now. The exam will be given in a regular PDF (not an online form). We will
More informationA* optimality proof, cycle checking
A* optimality proof, cycle checking CPSC 322 Search 5 Textbook 3.6 and 3.7.1 January 21, 2011 Taught by Mike Chiang Lecture Overview Recap Admissibility of A* Cycle checking and multiple path pruning Slide
More informationLecture I: Shortest Path Algorithms
Lecture I: Shortest Path Algorithms Dr Kieran T. Herley Department of Computer Science University College Cork October 201 KH (21/10/1) Lecture I: Shortest Path Algorithms October 201 1 / 28 Background
More informationARTIFICIAL INTELLIGENCE. Informed search
INFOB2KI 2017-2018 Utrecht University The Netherlands ARTIFICIAL INTELLIGENCE Informed search Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html
More information521495A: Artificial Intelligence
521495A: Artificial Intelligence Informed Search Lectured by Abdenour Hadid Adjunct Professor, CMVS, University of Oulu Slides adopted from http://ai.berkeley.edu Today Informed Search Heuristics Greedy
More informationHeuris'c Search. Reading note: Chapter 4 covers heuristic search.
Heuris'c Search Reading note: Chapter 4 covers heuristic search. Credits: Slides in this deck are drawn from or inspired by a multitude of sources including: Shaul Markovitch Jurgen Strum Sheila McIlraith
More informationTheory of Computing. Lecture 7 MAS 714 Hartmut Klauck
Theory of Computing Lecture 7 MAS 714 Hartmut Klauck Shortest paths in weighted graphs We are given a graph G (adjacency list with weights W(u,v)) No edge means W(u,v)=1 We look for shortest paths from
More informationcs/ee 143 Fall
cs/ee 143 Fall 2018 5 2 Ethernet 2.1 W&P, P3.2 3 Points. Consider the Slotted ALOHA MAC protocol. There are N nodes sharing a medium, and time is divided into slots. Each packet takes up a single slot.
More informationProblem Solving: Informed Search
Problem Solving: Informed Search References Russell and Norvig, Artificial Intelligence: A modern approach, 2nd ed. Prentice Hall, 2003 (Chapters 1,2, and 4) Nilsson, Artificial intelligence: A New synthesis.
More informationLesson 1 Introduction to Path Planning Graph Searches: BFS and DFS
Lesson 1 Introduction to Path Planning Graph Searches: BFS and DFS DASL Summer Program Path Planning References: http://robotics.mem.drexel.edu/mhsieh/courses/mem380i/index.html http://dasl.mem.drexel.edu/hing/bfsdfstutorial.htm
More informationChapter 3: Informed Search and Exploration. Dr. Daisy Tang
Chapter 3: Informed Search and Exploration Dr. Daisy Tang Informed Search Definition: Use problem-specific knowledge beyond the definition of the problem itself Can find solutions more efficiently Best-first
More informationEE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Today: Informed search algorithms
More informationIntroduction to Computer Science and Programming for Astronomers
Introduction to Computer Science and Programming for Astronomers Lecture 9. István Szapudi Institute for Astronomy University of Hawaii March 21, 2018 Outline Reminder 1 Reminder 2 3 Reminder We have demonstrated
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 07 Single-Source Shortest Paths (Chapter 24) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/36 Introduction
More informationShortest Paths. Nishant Mehta Lectures 10 and 11
Shortest Paths Nishant Mehta Lectures 0 and Communication Speeds in a Computer Network Find fastest way to route a data packet between two computers 6 Kbps 4 0 Mbps 6 6 Kbps 6 Kbps Gbps 00 Mbps 8 6 Kbps
More informationDiscrete Motion Planning
RBE MOTION PLANNING Discrete Motion Planning Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering http://users.wpi.edu/~zli11 Announcement Homework 1 is out Due Date - Feb 1 Updated
More informationHeuristic Search and Advanced Methods
Heuristic Search and Advanced Methods Computer Science cpsc322, Lecture 3 (Textbook Chpt 3.6 3.7) May, 15, 2012 CPSC 322, Lecture 3 Slide 1 Course Announcements Posted on WebCT Assignment1 (due on Thurs!)
More informationInformed Search. CS 486/686 University of Waterloo May 10. cs486/686 Lecture Slides 2005 (c) K. Larson and P. Poupart
Informed Search CS 486/686 University of Waterloo May 0 Outline Using knowledge Heuristics Best-first search Greedy best-first search A* search Other variations of A* Back to heuristics 2 Recall from last
More informationShortest Paths. Nishant Mehta Lectures 10 and 11
Shortest Paths Nishant Mehta Lectures 0 and Finding the Fastest Way to Travel between Two Intersections in Vancouver Granville St and W Hastings St Homer St and W Hastings St 6 Granville St and W Pender
More informationCS 771 Artificial Intelligence. Informed Search
CS 771 Artificial Intelligence Informed Search Outline Review limitations of uninformed search methods Informed (or heuristic) search Uses problem-specific heuristics to improve efficiency Best-first,
More informationfrom notes written mostly by Dr. Carla Savage: All Rights Reserved
CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among
More informationDO NOT RE-DISTRIBUTE THIS SOLUTION FILE
Professor Kindred Math 104, Graph Theory Homework 2 Solutions February 7, 2013 Introduction to Graph Theory, West Section 1.2: 26, 38, 42 Section 1.3: 14, 18 Section 2.1: 26, 29, 30 DO NOT RE-DISTRIBUTE
More informationSearching for Shortest Path in A Large, Sparse Graph under Memory Limitation: A Successive Mixed Bidirectional Search Method
Searching for Shortest Path in A Large, Sparse Graph under Memory Limitation: A Successive Mixed Bidirectional Search Method Xugang Ye Department of Applied Mathematics and Statistics, The Johns Hopkins
More information(Refer Slide Time: 00:18)
Programming, Data Structures and Algorithms Prof. N. S. Narayanaswamy Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 11 Lecture 58 Problem: single source shortest
More informationVertex Cover Approximations
CS124 Lecture 20 Heuristics can be useful in practice, but sometimes we would like to have guarantees. Approximation algorithms give guarantees. It is worth keeping in mind that sometimes approximation
More informationGraphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402
Graphs (MTAT.05.080, 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402 homepage: http://courses.cs.ut.ee/2012/graafid (contains slides) For grade: Homework + three tests (during or after
More informationAll Shortest Paths. Questions from exercises and exams
All Shortest Paths Questions from exercises and exams The Problem: G = (V, E, w) is a weighted directed graph. We want to find the shortest path between any pair of vertices in G. Example: find the distance
More informationInformed search methods
CS 2710 Foundations of AI Lecture 5 Informed search methods Milos Hauskrecht milos@pitt.edu 5329 Sennott Square Announcements Homework assignment 2 is out Due on Tuesday, September 19, 2017 before the
More informationAlgorithms for Data Science
Algorithms for Data Science CSOR W4246 Eleni Drinea Computer Science Department Columbia University Thursday, October 1, 2015 Outline 1 Recap 2 Shortest paths in graphs with non-negative edge weights (Dijkstra
More informationChapter 11 Search Algorithms for Discrete Optimization Problems
Chapter Search Algorithms for Discrete Optimization Problems (Selected slides) A. Grama, A. Gupta, G. Karypis, and V. Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 2003.
More informationDIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 19 January, 2018
DIT411/TIN175, Artificial Intelligence Chapter 3: Classical search algorithms CHAPTER 3: CLASSICAL SEARCH ALGORITHMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 19 January, 2018 1 DEADLINE FOR
More informationCMPSCI611: The Simplex Algorithm Lecture 24
CMPSCI611: The Simplex Algorithm Lecture 24 Let s first review the general situation for linear programming problems. Our problem in standard form is to choose a vector x R n, such that x 0 and Ax = b,
More information2.3 Optimal paths. E. Amaldi Foundations of Operations Research Politecnico di Milano 1
. Optimal paths E. Amaldi Foundations of Operations Research Politecnico di Milano Optimal (minimum or maximum) paths have a wide range of applications: Google maps, GPS navigators planning and management
More information1 Dijkstra s Algorithm
Lecture 11 Dijkstra s Algorithm Scribes: Himanshu Bhandoh (2015), Virginia Williams, and Date: November 1, 2017 Anthony Kim (2016), G. Valiant (2017), M. Wootters (2017) (Adapted from Virginia Williams
More informationFast Hierarchical Clustering via Dynamic Closest Pairs
Fast Hierarchical Clustering via Dynamic Closest Pairs David Eppstein Dept. Information and Computer Science Univ. of California, Irvine http://www.ics.uci.edu/ eppstein/ 1 My Interest In Clustering What
More informationIntroduction. I Given a weighted, directed graph G =(V, E) with weight function
ntroduction Computer Science & Engineering 2/82 Design and Analysis of Algorithms Lecture 06 Single-Source Shortest Paths (Chapter 2) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu
More informationLecture 12: Grids Steven Skiena. skiena
Lecture 12: Grids Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Rectilinear Grids Rectilinear grids are typically
More informationSpanning Trees 4/19/17. Prelim 2, assignments. Undirected trees
/9/7 Prelim, assignments Prelim is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for details. Deadline for submitting conflicts has passed.
More informationCS 343: Artificial Intelligence
CS 343: Artificial Intelligence Informed Search Prof. Scott Niekum University of Texas at Austin [These slides based on ones created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley.
More informationSpanning Trees. Lecture 22 CS2110 Spring 2017
1 Spanning Trees Lecture 22 CS2110 Spring 2017 1 Prelim 2, assignments Prelim 2 is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for
More information2.3 Optimal paths. Optimal (shortest or longest) paths have a wide range of applications:
. Optimal paths Optimal (shortest or longest) paths have a wide range of applications: Google maps, GPS navigators planning and management of transportation, electrical and telecommunication networks project
More informationSingle Source Shortest Path
Single Source Shortest Path A directed graph G = (V, E) and a pair of nodes s, d is given. The edges have a real-valued weight W i. This time we are looking for the weight and the shortest path from s
More informationSingle Source Shortest Path (SSSP) Problem
Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,
More informationCharacterizations of Trees
Characterizations of Trees Lemma Every tree with at least two vertices has at least two leaves. Proof. 1. A connected graph with at least two vertices has an edge. 2. In an acyclic graph, an end point
More informationArtificial Intelligence Informed Search
Artificial Intelligence Informed Search Instructors: David Suter and Qince Li Course Delivered @ Harbin Institute of Technology [Many slides adapted from those created by Dan Klein and Pieter Abbeel for
More informationA and Branch-and-Bound Search
A and Branch-and-Bound Search CPSC 322 Lecture 7 January 17, 2006 Textbook 2.5 A and Branch-and-Bound Search CPSC 322 Lecture 7, Slide 1 Lecture Overview Recap A Search Optimality of A Optimal Efficiency
More informationShortest path problems
Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths
More informationMaterial handling and Transportation in Logistics. Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena
Material handling and Transportation in Logistics Paolo Detti Dipartimento di Ingegneria dell Informazione e Scienze Matematiche Università di Siena Introduction to Graph Theory Graph Theory As Mathematical
More informationCSCI 446: Artificial Intelligence
CSCI 446: Artificial Intelligence Informed Search Instructor: Michele Van Dyne [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available
More informationMath 443/543 Graph Theory Notes 10: Small world phenomenon and decentralized search
Math 443/543 Graph Theory Notes 0: Small world phenomenon and decentralized search David Glickenstein November 0, 008 Small world phenomenon The small world phenomenon is the principle that all people
More informationInformed search algorithms
Informed search algorithms This lecture topic Chapter 3.5-3.7 Next lecture topic Chapter 4.1-4.2 (Please read lecture topic material before and after each lecture on that topic) Outline Review limitations
More informationReview of course COMP-251B winter 2010
Review of course COMP-251B winter 2010 Lecture 1. Book Section 15.2 : Chained matrix product Matrix product is associative Computing all possible ways of parenthesizing Recursive solution Worst-case running-time
More informationMST & Shortest Path -Prim s -Djikstra s
MST & Shortest Path -Prim s -Djikstra s PRIM s - Minimum Spanning Tree - A spanning tree of a graph is a tree that has all the vertices of the graph connected by some edges. - A graph can have one or more
More informationIntroduction Single-source shortest paths All-pairs shortest paths. Shortest paths in graphs
Shortest paths in graphs Remarks from previous lectures: Path length in unweighted graph equals to edge count on the path Oriented distance (δ(u, v)) between vertices u, v equals to the length of the shortest
More information22 Elementary Graph Algorithms. There are two standard ways to represent a
VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph
More informationThe big picture: from Perception to Planning to Control
The big picture: from Perception to Planning to Control Perception Location, Map Signals: video, inertial, range Sensors Real World 1 Planning vs Control 0. In control we go from to A to B in free space
More informationIntroduction. I Given a weighted, directed graph G =(V, E) with weight function
ntroduction Computer Science & Engineering 2/82 Design and Analysis of Algorithms Lecture 05 Single-Source Shortest Paths (Chapter 2) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu
More informationCS 106X, Lecture 23 Dijkstra and A* Search
CS 106X, Lecture 23 Dijkstra and A* Search reading: Programming Abstractions in C++, Chapter 18 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative Commons
More information{ 1} Definitions. 10. Extremal graph theory. Problem definition Paths and cycles Complete subgraphs
Problem definition Paths and cycles Complete subgraphs 10. Extremal graph theory 10.1. Definitions Let us examine the following forbidden subgraph problems: At most how many edges are in a graph of order
More informationInformed/Heuristic Search
Informed/Heuristic Search Outline Limitations of uninformed search methods Informed (or heuristic) search uses problem-specific heuristics to improve efficiency Best-first A* Techniques for generating
More informationComputer Science and Software Engineering University of Wisconsin - Platteville. 3. Search (Part 1) CS 3030 Lecture Notes Yan Shi UW-Platteville
Computer Science and Software Engineering University of Wisconsin - Platteville 3. Search (Part 1) CS 3030 Lecture Notes Yan Shi UW-Platteville Read: Textbook Chapter 3.7-3.9,3.12, 4. Problem Solving as
More informationCS 5522: Artificial Intelligence II
CS 5522: Artificial Intelligence II Search Algorithms Instructor: Wei Xu Ohio State University [These slides were adapted from CS188 Intro to AI at UC Berkeley.] Today Agents that Plan Ahead Search Problems
More informationDefinition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1
Graph fundamentals Bipartite graph characterization Lemma. If a graph contains an odd closed walk, then it contains an odd cycle. Proof strategy: Consider a shortest closed odd walk W. If W is not a cycle,
More informationAlgorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm. ADS: lects 14 & 15 slide 1
Algorithms and Data Structures: Minimum Spanning Trees I and II - Prim s Algorithm ADS: lects 14 & 15 slide 1 Weighted Graphs Definition 1 A weighted (directed or undirected graph) is a pair (G, W ) consisting
More informationIntroduction to Algorithms November 17, 2011 Massachusetts Institute of Technology Fall 2011 Professors Erik Demaine and Srini Devadas Quiz 2
Introduction to Algorithms November 17, 2011 Massachusetts Institute of Technology 6.006 Fall 2011 Professors Erik Demaine and Srini Devadas Quiz 2 Quiz 2 Do not open this quiz booklet until directed to
More informationCS 460/560 Introduction to Computational Robotics Fall 2017, Rutgers University. Lecture 08 Extras. A* In More Detail. Instructor: Jingjin Yu
CS 460/560 Introduction to Computational Robotics Fall 2017, Rutgers University Lecture 08 Extras A* In More Detail Instructor: Jingjin Yu Outline A* in more detail Admissible and consistent heuristic
More informationSearching with Partial Information
Searching with Partial Information Above we (unrealistically) assumed that the environment is fully observable and deterministic Moreover, we assumed that the agent knows what the effects of each action
More informationHW Graph Theory Name (andrewid) - X. 1: Draw K 7 on a torus with no edge crossings.
1: Draw K 7 on a torus with no edge crossings. A quick calculation reveals that an embedding of K 7 on the torus is a -cell embedding. At that point, it is hard to go wrong if you start drawing C 3 faces,
More informationData Structure Lecture#24: Graphs 2 (Chapter 11) U Kang Seoul National University
Data Structure Lecture#24: Graphs 2 (Chapter 11) U Kang Seoul National University U Kang 1 In This Lecture Shortest path problem Main idea of Dijkstra s algorithm Cost analysis of Dijkstra s algorithm
More informationHeuristic (Informed) Search
Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap. 4, Sect. 4.1 3 1 Recall that the ordering of FRINGE defines the search strategy Search Algorithm #2 SEARCH#2 1. INSERT(initial-node,FRINGE)
More information22 Elementary Graph Algorithms. There are two standard ways to represent a
VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph
More informationGraph and A* Analysis
Graph and A* Analysis Kyle Ray Entertainment Arts and Engineering University of Utah Salt Lake City, Ut 84102 kray@eng.utah.edu Abstract: Pathfinding in video games is an essential tool to have for both
More informationHeuristic Search. Heuristic Search. Heuristic Search. CSE 3401: Intro to AI & LP Informed Search
CSE 3401: Intro to AI & LP Informed Search Heuristic Search. Required Readings: Chapter 3, Sections 5 and 6, and Chapter 4, Section 1. In uninformed search, we don t try to evaluate which of the nodes
More informationWeek 12: Minimum Spanning trees and Shortest Paths
Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601
More informationCSci 231 Final Review
CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.
More informationCS2223: Algorithms D-Term, Assignment 5
CS2223: Algorithms D-Term, 2015 Assignment 5 Teams: To be done individually Due date: 05/01/2015 (1:50 PM) Note: no late submission of HW5 will be accepted; we will talk about the solution of HW5 during
More informationOutline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:
Outline for today s lecture Informed Search II Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing 2 Review: Greedy best-first search: f(n): estimated
More informationProblem Set 8 Solutions
Introduction to Algorithms November 22, 25 Massachusetts Institute of Technology 6.46J/8.4J Professors Erik D. Demaine and Charles E. Leiserson Handout 27 Problem Set 8 Solutions Problem 8-. No left turns
More informationGraph Theory. Part of Texas Counties.
Graph Theory Part of Texas Counties. We would like to visit each of the above counties, crossing each county only once, starting from Harris county. Is this possible? This problem can be modeled as a graph.
More informationCMU-Q Lecture 4: Path Planning. Teacher: Gianni A. Di Caro
CMU-Q 15-381 Lecture 4: Path Planning Teacher: Gianni A. Di Caro APPLICATION: MOTION PLANNING Path planning: computing a continuous sequence ( a path ) of configurations (states) between an initial configuration
More informationNotes for Lecture 24
U.C. Berkeley CS170: Intro to CS Theory Handout N24 Professor Luca Trevisan December 4, 2001 Notes for Lecture 24 1 Some NP-complete Numerical Problems 1.1 Subset Sum The Subset Sum problem is defined
More information11.1 Facility Location
CS787: Advanced Algorithms Scribe: Amanda Burton, Leah Kluegel Lecturer: Shuchi Chawla Topic: Facility Location ctd., Linear Programming Date: October 8, 2007 Today we conclude the discussion of local
More informationLecture 4 of Artificial Intelligence. Heuristic Search. Produced by Qiangfu Zhao (2008), All rights reserved
Lecture 4 of Artificial Intelligence Heuristic Search AI Lec04/1 Topics of this lecture What are heuristics? What is heuristic search? Best first search A* algorithm Generalization of search problems AI
More informationby conservation of flow, hence the cancelation. Similarly, we have
Chapter 13: Network Flows and Applications Network: directed graph with source S and target T. Non-negative edge weights represent capacities. Assume no edges into S or out of T. (If necessary, we can
More informationCS 4700: Foundations of Artificial Intelligence
CS 4700: Foundations of Artificial Intelligence Bart Selman selman@cs.cornell.edu Informed Search Readings R&N - Chapter 3: 3.5 and 3.6 Search Search strategies determined by choice of node (in queue)
More informationAlgorithms for Integer Programming
Algorithms for Integer Programming Laura Galli November 9, 2016 Unlike linear programming problems, integer programming problems are very difficult to solve. In fact, no efficient general algorithm is
More information******** Chapter-4 Dynamic programming
repeat end SHORT - PATHS Overall run time of algorithm is O ((n+ E ) log n) Example: ******** Chapter-4 Dynamic programming 4.1 The General Method Dynamic Programming: is an algorithm design method that
More informationInformed Search. Xiaojin Zhu Computer Sciences Department University of Wisconsin, Madison
Informed Search Xiaojin Zhu jerryzhu@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [Based on slides from Andrew Moore http://www.cs.cmu.edu/~awm/tutorials ] slide 1 Main messages
More informationCS521 \ Notes for the Final Exam
CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )
More informationThe Shortest Path Problem
The Shortest Path Problem 1 Shortest-Path Algorithms Find the shortest path from point A to point B Shortest in time, distance, cost, Numerous applications Map navigation Flight itineraries Circuit wiring
More information