Informed search algorithms

Similar documents
Artificial Intelligence

TDT4136 Logic and Reasoning Systems

Informed Search and Exploration

Robot Programming with Lisp

Informed search algorithms

Informed Search. Dr. Richard J. Povinelli. Copyright Richard J. Povinelli Page 1

Outline. Informed search algorithms. Best-first search. Review: Tree search. A search Heuristics. Chapter 4, Sections 1 2 4

Informed search algorithms. Chapter 4, Sections 1 2 1

Informed Search Algorithms. Chapter 4

Introduction to Artificial Intelligence. Informed Search

Artificial Intelligence: Search Part 2: Heuristic search

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 3: Search 2.

CS:4420 Artificial Intelligence

Planning, Execution & Learning 1. Heuristic Search Planning

Lecture Plan. Best-first search Greedy search A* search Designing heuristics. Hill-climbing. 1 Informed search strategies. Informed strategies

Informed search algorithms. Chapter 4

Informed Search and Exploration

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

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

Informed search algorithms

COMP9414/ 9814/ 3411: Artificial Intelligence. 5. Informed Search. Russell & Norvig, Chapter 3. UNSW c Alan Blair,

Informed Search and Exploration

Artificial Intelligence. Informed search methods

COSC343: Artificial Intelligence

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

Problem solving and search

Artificial Intelligence

CS 380: Artificial Intelligence Lecture #4

Problem solving and search

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

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

Informed Search and Exploration

Informed Search and Exploration for Agents

ARTIFICIAL INTELLIGENCE. Informed search

Solving Problems using Search

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

CS414-Artificial Intelligence

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

Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) Computer Science Department

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Problem Solving: Informed Search

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

Problem solving and search

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

Artificial Intelligence

Informed search algorithms. Chapter 4

Artificial Intelligence CS 6364

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

Informed Search and Exploration

Informed Search. Topics. Review: Tree Search. What is Informed Search? Best-First Search

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

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

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

Foundations of Artificial Intelligence

Artificial Intelligence. 2. Informed Search

Artificial Intelligence

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

Introduction to Artificial Intelligence (G51IAI)

Solving Problems by Searching

CS486/686 Lecture Slides (c) 2015 P.Poupart

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

CS486/686 Lecture Slides (c) 2014 P.Poupart

Solving Problems: Intelligent Search

Informed search methods

Searching and NetLogo

Outline. Best-first search

Informed search algorithms

Informed search algorithms

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

Solving problems by searching

Outline. Best-first search

Lecture 4: Informed/Heuristic Search

Chapter4. Tree Search (Reviewed, Fig. 3.9) Best-First Search. Search Strategies. Best-First Search (cont.-2) Best-First Search (cont.

Solving Problems by Searching. Artificial Intelligence Santa Clara University 2016

Foundations of Artificial Intelligence

Artificial Intelligence Informed search. Peter Antal

CS 771 Artificial Intelligence. Informed Search

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 2: Search 1.

TDDC17. Intuitions behind heuristic search. Recall Uniform-Cost Search. Best-First Search. f(n) =... + h(n) g(n) = cost of path from root node to n

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

4. Solving Problems by Searching

Artificial Intelligence

Problem solving and search

DFS. Depth-limited Search

Informed/Heuristic Search

Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS Cut back on A* optimality detail; a bit more on importance of heuristics,

Problem-solving agents. Solving Problems by Searching. Outline. Example: Romania. Chapter 3

Week 3: Path Search. COMP9414/ 9814/ 3411: Artificial Intelligence. Motivation. Example: Romania. Romania Street Map. Russell & Norvig, Chapter 3.

TDDC17. Intuitions behind heuristic search. Best-First Search. Recall Uniform-Cost Search. f(n) =... + h(n) g(n) = cost of path from root node to n

Foundations of Artificial Intelligence

Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu. Blind Searches

Outline for today s lecture. Informed Search I. One issue: How to search backwards? Very briefly: Bidirectional search. Outline for today s lecture

Artificial Intelligence: Search Part 1: Uninformed graph search

Part I. Instructor: Dr. Wei Ding. Uninformed Search Strategies can find solutions to problems by. Informed Search Strategies

Informed search algorithms

Summary. Search CSL302 - ARTIFICIAL INTELLIGENCE 1

16.1 Introduction. Foundations of Artificial Intelligence Introduction Greedy Best-first Search 16.3 A Weighted A. 16.

Informed search. Soleymani. CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2016

Automated Planning & Artificial Intelligence

Artificial Intelligence, CS, Nanjing University Spring, 2016, Yang Yu. Lecture 5: Search 4.

Transcription:

CS 580 1 Informed search algorithms Chapter 4, Sections 1 2, 4 CS 580 2 Outline Best-first search A search Heuristics Hill-climbing Simulated annealing

CS 580 3 Review: General search function General-Search( problem, Queuing-Fn) returns a solution, or failure nodes Make-Queue(Make-Node(Initial-State[problem])) loop do if nodes is empty then return failure node Remove-Front(nodes) if Goal-Test[problem] applied to State(node) succeeds then return node nodes Queuing-Fn(nodes, Expand(node, Operators[problem])) end A strategy is defined by picking the order of node expansion CS 580 4 Best-first search Idea: use an evaluation function for each node estimate of desirability Expand most desirable unexpanded node Implementation: QueueingFn = insert successors in decreasing order of desirability Special cases: greedy search A search

CS 580 5 Romania with step costs in km Oradea 71 Neamt 87 Zerind 75 151 Iasi 140 92 Sibiu 99 Fagaras 118 80 Vaslui Timisoara Rimnicu Vilcea 111 142 211 Lugoj 97 Pitesti 70 98 146 Hirsova Mehadia 101 85 Urziceni 75 138 86 Bucharest 120 Dobreta 90 Craiova Giurgiu Eforie Straight line distance to Bucharest Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Mehadia 241 Neamt 234 Oradea 380 Pitesti 98 Rimnicu Vilcea 193 Sibiu 253 Timisoara 329 Urziceni 80 Vaslui 199 Zerind 374 CS 580 6 Greedy search Evaluation function h(n) (heuristic) =estimateofcostfromn to goal E.g., h SLD (n) = straight-line distance from n to Bucharest Greedy search expands the node that appears to be closest to goal

CS 580 7 Greedy search example CS 580 8 Zerind Sibiu Timisoara 374 253 329

CS 580 9 Zerind Sibiu Timisoara 374 253 329 Rimnicu Oradea Fagaras Vilcea 380 178 193 CS 580 10 Zerind Sibiu Timisoara 374 253 329 Rimnicu Oradea Fagaras Vilcea 380 178 193 Sibiu Bucharest 253 0

CS 580 11 Properties of greedy search Complete?? Time?? Space?? Optimal?? CS 580 12 Properties of greedy search Complete?? No can get stuck in loops, e.g., Iasi Neamt Iasi Neamt Complete in finite space with repeated-state checking Time?? O(b m ), but a good heuristic can give dramatic improvement Space?? O(b m ) keeps all nodes in memory Optimal?? No

CS 580 13 A search Idea: avoid expanding paths that are already expensive Evaluation function f(n) =g(n)+h(n) g(n) =costsofartoreachn h(n) = estimated cost to goal from n f(n) = estimated total cost of path through n to goal A search uses an admissible heuristic i.e., h(n) h (n) where h (n) is the true cost from n. E.g., h SLD (n) never overestimates the actual road distance Theorem: A search is optimal CS 580 14 A search example

CS 580 15 75 140 118 Zerind Sibiu Timisoara 449 393 447 CS 580 16 75 140 118 Zerind Sibiu Timisoara 449 393 447 140 99 151 80 Rimnicu Oradea Fagaras Vilcea 646 526 417 413

CS 580 17 75 140 118 Zerind Sibiu Timisoara 449 393 447 140 99 151 80 Rimnicu Oradea Fagaras Vilcea 646 526 417 413 146 97 80 Craiova Pitesti Sibiu 526 415 553 CS 580 18 75 140 118 Zerind Sibiu Timisoara 449 393 447 140 99 151 80 Rimnicu Oradea Fagaras Vilcea 646 526 417 413 146 97 80 Craiova Pitesti Sibiu 526 415 553 97 138 101 Rimnicu Vilcea Craiova Bucharest 607 615 418

CS 580 19 75 140 118 Zerind Sibiu Timisoara 449 393 447 140 99 151 80 Rimnicu Oradea Fagaras Vilcea 646 526 417 413 99 211 146 97 80 Sibiu Bucharest Craiova Pitesti Sibiu 591 450 526 415 553 97 138 101 Rimnicu Vilcea Craiova Bucharest 607 615 418 CS 580 20 Optimality of A (standard proof) Suppose some suboptimal goal G 2 has been generated and is in the queue. Let n be an unexpanded node on a shortest path to an optimal goal G 1. Start n G G 2 f(g 2 ) = g(g 2 ) since h(g 2 )=0 > g(g 1 ) since G 2 is suboptimal f(n) since h is admissible Since f(g 2 ) >f(n), A will never select G 2 for expansion

CS 580 21 Optimality of A (more useful) Lemma: A expands nodes in order of increasing f value Gradually adds f-contours of nodes (cf. breadth-first adds layers). Contour i has all nodes with f = f i,wheref i <f i+1 O Z N A T 380 400 S R F I V L P D M C 420 G B U H E CS 580 22 Properties of A Complete?? Yes, unless there are infinitely many nodes with f f(g) Time?? Exponential in [relative error in h length of soln.] Space?? Keeps all nodes in memory Optimal?? Yes cannot expand f i+1 until f i is finished

CS 580 23 Proofoflemma: Pathmax For some admissible heuristics, f may decrease along a path E.g., suppose n is a successor of n n g=5 h=4 f=9 1 n g =6 h =2 f =8 But this throws away information! f(n) =9 true cost of a path through n is 9 Hence true cost of a path through n is 9 also Pathmax modification to A : Instead of f(n )=g(n )+h(n ),use f(n )=max(g(n )+h(n ),f(n)) With pathmax, f is always nondecreasing along any path CS 580 24 Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) 5 4 51 42 3 6 1 8 68 84 7 3 2 7 6 25 Start State Goal State h 1 (S) =?? h 2 (S) =??

CS 580 25 Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) 5 4 51 42 3 6 1 8 68 84 7 3 2 7 6 25 Start State Goal State h 1 (S) =?? 7 h 2 (S) =?? 2+3+3+2+4+2+0+2 = 18 CS 580 26 Dominance If h 2 (n) h 1 (n) for all n (both admissible) then h 2 dominates h 1 and is better for search Typical search costs: d =14 d =14 IDS = 3,473,941 nodes A (h 1 ) = 539 nodes A (h 2 ) = 113 nodes IDS = too many nodes A (h 1 ) = 39,135 nodes A (h 2 ) = 1,641 nodes

CS 580 27 Relaxed problems Admissible heuristics can be derived from the exact solution cost of a relaxed version of the problem If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, thenh 1 (n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h 2 (n) gives the shortest solution For TSP: let path be any structure that connects all cities = minimum spanning tree heuristic CS 580 28 Iterative improvement algorithms In many optimization problems, path is irrelevant; the goal state itself is the solution Then state space = set of complete configurations; find optimal configuration, e.g., TSP or, find configuration satisfying constraints, e.g., n-queens In such cases, can use iterative improvement algorithms; keep a single current state, try to improve it Constant space, suitable for online as well as offline search

CS 580 29 Example: Travelling Salesperson Problem Find the shortest tour that visits each city exactly once CS 580 30 Example: n-queens Put n queens on an n n boardwithnotwoqueensonthesame row, column, or diagonal

CS 580 31 Hill-climbing (or gradient ascent/descent) Like climbing Everest in thick fog with amnesia function Hill-Climbing( problem) returns asolutionstate inputs: problem, aproblem local variables: current, a node next, a node current Make-Node(Initial-State[problem]) loop do next a highest-valued successor of current if Value[next] < Value[current] then return current current next end CS 580 32 Hill-climbing contd. Problem: depending on initial state, can get stuck on local maxima value global maximum local maximum states

CS 580 33 Simulated annealing Idea: escape local maxima by allowing some bad moves but gradually decrease their size and frequency function Simulated-Annealing( problem, schedule) returns a solution state inputs: problem, aproblem schedule, a mapping from time to temperature local variables: current, a node next, a node T, a temperature controlling the probability of downward steps current Make-Node(Initial-State[problem]) for t 1 to do T schedule[t] if T=0 then return current next a randomly selected successor of current E Value[next] Value[current] if E > 0 then current next E /T else current next only with probability e CS 580 34 Properties of simulated annealing At fixed temperature T, state occupation probability reaches Boltzman distribution p(x) =αe E(x) kt T decreased slowly enough = always reach best state Is this necessarily an interesting guarantee?? Devised by Metropolis et al., 1953, for physical process modelling Widely used in VLSI layout, airline scheduling, etc.