UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Dijkstra’s Algorithm: Notes to Complement.

Slides:



Advertisements
Similar presentations
Chapter 4: Informed Heuristic Search
Advertisements

Single Source Shortest Paths
Great Theoretical Ideas in Computer Science for Some.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture– 4, 5, 6: A* properties 9 th,10 th and 12 th January,
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Chapter 3 Solving Problems by Searching. 2 Outline Problem-solving agentsProblem-solving agents Problem typesProblem types Problem formulationProblem.
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
CS 380: Artificial Intelligence Lecture #3 William Regli.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Blind State-Space Search Notes for Ch.11 of Bratko For CSCE 580 Sp03 Marco.
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
CSCE 580 Artificial Intelligence Ch.3: Uninformed (Blind) Search
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Properties of Heuristics that Guarantee A* Finds Optimal Paths Robert Holte this talk:
1 Solving problems by searching Chapter 3. 2 Why Search? To achieve goals or to maximize our utility we need to predict what the result of our actions.
Informed Search Idea: be smart about what paths to try.
CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Monotonicity 13 th Jan, 2011.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Informed (Heuristic) Search
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.3: Uninformed (Blind) Search Fall 2011.
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
CS344: Introduction to Artificial Intelligence (associated lab: CS386)
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
An Introduction to Artificial Intelligence Lecture 3: Solving Problems by Sorting Ramin Halavati In which we look at how an agent.
Advanced Artificial Intelligence Lecture 2: Search.
SOLVING PROBLEMS BY SEARCHING Chapter 3 August 2008 Blind Search 1.
A General Introduction to Artificial Intelligence.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3 - Search.
Solving problems by searching 1. Outline Problem formulation Example problems Basic search algorithms 2.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.3: Uninformed (Blind) Search Fall 2011.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 3 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
Informed Search CSE 473 University of Washington.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 3 –Problem Solving Agents State space search –Programming Assignment Thursday.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.3: Uninformed (Blind) Search Fall 2011.
Fahiem Bacchus © 2005 University of Toronto 1 CSC384: Intro to Artificial Intelligence Search II ● Announcements.
EMIS 8374 Shortest Path Trees Updated 11 February 2008 Slide 1.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 17– Theorems in A* (admissibility, Better performance.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lectures 18, 19, 20– A* Monotonicity 2 nd, 6 th and 7 th September, 2010.
Artificial Intelligence Lecture No. 8 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 3: Search, A*
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CSCE 580 Artificial Intelligence Ch.3: Uninformed (Blind) Search
Artificial Intelligence
Prof. Dechter ICS 270A Winter 2003
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
Solving problems by searching
Dijkstra’s Algorithm Run by hand Dijkstra's Algorithm (as stated in slide 68 at on the example.
CS 4100 Artificial Intelligence
CSE 373: Data Structures and Algorithms
Artificial Intelligence
Artificial Intelligence
CS621: Artificial Intelligence
CS621: Artificial Intelligence
Artificial Intelligence Chapter 9 Heuristic Search
Solving problems by searching
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
CS621: Artificial Intelligence
Artificial Intelligence
Solving problems by searching
Solving Problems by Searching
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Dijkstra’s Algorithm: Notes to Complement and Reinforce the Graduate Student Presentation Fall 2008 Marco Valtorta

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Example: Romania

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Single-State Problem Formulation A problem is defined by four items: 1.initial state e.g., "at Arad" 2.actions or successor function S(x) = set of action–state pairs –e.g., S(Arad) = {,, … } 3.goal test, can be –explicit, e.g., x = "at Bucharest" –implicit, e.g., Checkmate(x) 4.path cost (additive) –e.g., sum of distances, number of actions executed, etc. –c(x,a,y) is the step cost, assumed to be ≥ 0 A solution is a sequence of actions leading from the initial state to a goal state An optimal solution is a solution of lowest cost

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Uniform-Cost (Dijkstra) for Graphs Original Reference: Dijkstra, E. W. "A Note on Two Problems in Connexion with Graphs.“ Numerische Matematik, 1 (1959), Put the start node s in OPEN. Set g(s) to 0 2. If OPEN is empty, exit with failure 3. Remove from OPEN and place in CLOSED a node n for which g(n) is minimum; in case of ties, favor a goal node 4. If n is a goal node, exit with the solution obtained by tracing back pointers from n to s 5. Expand n, generating all of its successors. For each successor n' of n: –a. compute g'(n')=g(n)+c(n,n') –b. if n' is already on OPEN, and g'(n')<g(n'), let g(n')=g'(n’) and redirect the pointer from n' to n –c. if n' is neither on OPEN or on CLOSED, let g(n')=g'(n'), attach a pointer from n' to n, and place n' on OPEN 6. Go to 2

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Properties of Dijkstra’s Algorithm g(n) is the distance (cost) of some path from the start node to node n f*(n) is the minimum of g(n) over all possible paths from the start node to node n f*(k) is the distance of the goal node from the start node---assume a single goal node, k, for simplicity A search algorithm is admissible if it returns the shortest path 1. When node n is closed in step 3, g(n)=f*(n) 2. When node n is closed at step 3, g(n) is at least as high as the g value of all already closed nodes and all nodes with lower g values than g(n) have already been closed 3. Only nodes for which g(n)<f*(k) are expanded in step 5 (if there is a path from the start node to the goal node) 4. Dijkstra's algorithm never expands the same node twice 5. Dijkstra's algorithm expands the least number of nodes among all admissible blind, unidirectional search algorithms

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Property 1 of Dijkstra’s Algorithm When node n is closed in step 3, g(n)=f*(n) The proof is by induction on the number of closed nodes. For the base case, g(s) = f*(s) = 0. Let n 1,…,n q be the nodes in OPEN. Let n = n i Consider the path to n through nodes in CLOSED that establishes that n is to be closed in step 3 Assume that there is a shorter path to n than the one chosen by Dijkstra’s algorithm. Let n p be the first node in OPEN on that path. Since path s  n p  n i is shorter than g(n), then path s  n p is shorter than path s  n i. This means that when executing step 3, g(n p ) < g(n i ), and therefore n p would be closed in step 3 instead of n i : contradiction!

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Property 2 of Dijkstra’s Algorithm When node n is closed at step 3, g(n) is at least as high as the g value of all already closed nodes and all nodes with lower g values than g(n) have already been closed This can also be proven by induction. For the induction step, note that the node that is closed at step 3 has g(n) value that is at least as high than that of all previously closed nodes---otherwise it would have been closed before! Also note that this proof depends crucially on having non- negative edge costs

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Property 3 and 4 of Dijkstra’s Algorithm Only nodes for which g(n)<f*(k) are expanded in step 5 (if there is a path from the start node to the goal node) Since nodes are expanded in non-decreasing order of shortest-path distance from the start node, only nodes for which g(n) <= f*(k) are expanded To get the result with a strict inequality, note that ties are broken in favor of the goal node Dijkstra's algorithm never expands the same node twice Nodes are expanded only when they are moved from OPEN to CLOSED in step 3. Since CLOSED nodes cannot be re-OPENed, no node can be expanded twice.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Property 5 of Dijkstra’s Algorithm Dijkstra's algorithm expands the least number of nodes among all admissible blind, unidirectional search algorithms Adversary argument I claim there is an algorithm (say, B) that does not expand node m, for which g(m) < f*(k) on some graph search problem (say, G) and is admissible Let f*(k)-g(m) = e Consider an instance of graph search problem identical to G except for the additional edge m  k of cost e/2 Since B does not expand node m, it will not return the shortest path of length f*(k)-(e/2) Therefore, B is not admissible

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Lower Bound Assumptions and notation: –decision-tree model (count comparisons of edge costs) –blind unidirectional algorithms –n is the number of nodes and m is the number of edges in the (implicit) graph been searched Property 5 implies Ω(m) Ω(n log(n)) follows from a transformation of sorting to finding the shortest path spanning tree and a sequence of all the n nodes ordered in increasing distance from the start node Overall: Ω(m + n log(n)) The Fibonacci tree implementation of Dijkstra’s algorithm matches the lower bound and is therefore optimal See reference in notes

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Bidirectional Uniform-Cost Algorithm (Assume that there is only one goal node, k.) 1. Put the start node s in OPEN1 and the goal node k in OPEN2. Set g(s) and h(k) to 0 2'. If OPEN1 is empty, exit with failure 3'. Remove from OPEN1 and place in CLOSED1 a node n for which g(n) is minimum 4'. If n is in CLOSED2, exit with the solution obtained by tracing backpointers from n to s and forward pointers from n to k 5'. Expand n, generating all of its successors. For each successor n' of n: –a. compute g'(n')=g(n)+c(n,n') –b. if n' is already on OPEN1, and g'(n')<g(n'), let g(n')=g'(n) and redirect the pointer from n' to n –c. if n' is neither on OPEN1 or on CLOSED1, let g(n')=g'(n'), attach a pointer from n' to n, and place n' on OPEN1 2". If OPEN2 is empty, exit with failure 3". Remove from OPEN2 and place in CLOSED2 a node n for which h(n) is minimum 4". If n is in CLOSED1, exit with the solution obtained by tracing forwards pointers from n to k and backpointers from s to n 5". Expand n, generating all of its predecessors. For each predecessor n' of n: –a. compute h'(n')=h(n)+c(n',n) –b. if n' is already on OPEN2, and h'(n')<h(n'), let h(n')=h'(n) and redirect the pointer from n' to n –c. if n' is neither on OPEN2 or on CLOSED2, let n(n')=n'(n'), attach a pointer from n' to n, and place n' on OPEN2 6. Go to 2'.