COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

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

COMP219: Artificial Intelligence. Lecture 10: Heuristic Search

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

Introduction to Artificial Intelligence. Informed Search

Artificial Intelligence. Informed search methods

Informed search algorithms

Informed search algorithms

Informed search algorithms. Chapter 4, Sections 1 2 1

COSC343: Artificial Intelligence

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

Artificial Intelligence: Search Part 2: Heuristic search

CS414-Artificial Intelligence

CS:4420 Artificial Intelligence

Introduction to Artificial Intelligence (G51IAI)

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

Informed Search and Exploration

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

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

Solving Problems using Search

Informed Search and Exploration

Planning, Execution & Learning 1. Heuristic Search Planning

Problem solving and search

Informed Search Algorithms. Chapter 4

Informed search algorithms

Artificial Intelligence

Searching and NetLogo

Informed search methods

TDT4136 Logic and Reasoning Systems

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

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

Problem solving and search

Robot Programming with Lisp

Solving Problems by Searching

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

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

COMP219: Artificial Intelligence. Lecture 7: Search Strategies

Informed Search and Exploration

Algorithm. December 7, Shortest path using A Algorithm. Phaneendhar Reddy Vanam. Introduction. History. Components of A.

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,

Foundations of Artificial Intelligence

AGENTS AND ENVIRONMENTS. What is AI in reality?

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

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

4. Solving Problems by Searching

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

Solving Problems by Searching. Artificial Intelligence Santa Clara University 2016

Artificial Intelligence CS 6364

AGENTS AND ENVIRONMENTS. What is AI in reality?

Foundations of Artificial Intelligence

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

Automated Planning & Artificial Intelligence

Problem Solving and Search. Geraint A. Wiggins Professor of Computational Creativity Department of Computer Science Vrije Universiteit Brussel

Artificial Intelligence

Route planning / Search Movement Group behavior Decision making

CS-E4800 Artificial Intelligence

Informed Search and Exploration

Informatics 2D: Tutorial 2 (Solutions)

Artificial Intelligence: Search Part 1: Uninformed graph search

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

Clustering (Un-supervised Learning)

PEAS: Medical diagnosis system

Shortest path using A Algorithm

Informed (heuristic) search (cont). Constraint-satisfaction search.

Summary. Search CSL302 - ARTIFICIAL INTELLIGENCE 1

Problem solving and search

Seminar: Search and Optimization

Solving Problems by Searching

Solving Problems by Searching

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

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

CS 771 Artificial Intelligence. Informed Search

Optimal Control and Dynamic Programming

Informed Search (Ch )

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

Foundations of Artificial Intelligence

Outline. Best-first search

Outline. Best-first search

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

Complete the quizzes in the "Problem Set 1" unit in the Introduction to Artificial Intelligence course from Udacity:

Artificial Intelligence

Artificial Intelligence

Artificial Intelligence

Informed search algorithms

Informed search algorithms

Artificial Intelligence. 2. Informed Search

CSC384: Intro to Artificial Intelligence Search III

CS 5100: Founda.ons of Ar.ficial Intelligence

Solving problems by searching

Problem solving and search

Search. Intelligent agents. Problem-solving. Problem-solving agents. Road map of Romania. The components of a problem. that will take me to the goal!

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

Contents. Foundations of Artificial Intelligence. General Algorithm. Best-First Search

Ar#ficial)Intelligence!!

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

Lecture 4: Informed/Heuristic Search

CS 380: Artificial Intelligence Lecture #4

Chapter 3 Solving Problems by Searching Informed (heuristic) search strategies More on heuristics

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

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

CS:4420 Artificial Intelligence

Transcription:

COMP219: Artificial Intelligence Lecture 10: Heuristic Search 1

Class Tests Class Test 1 (Prolog): Tuesday 8 th November (Week 7) 13:00-14:00 LIFS-LT2 and LIFS-LT3 Class Test 2 (Everything but Prolog) Tuesday 6 th December (Week 11) 13:00-14:00 LIFS-LT2 and LIFS-LT3 2

Overview Last time Depth-limited, iterative deepening and bi-directional search Avoiding repeated states Today Show how applying knowledge of the problem can help Introduce uniform cost search: dependent on the cost of each node Introduce heuristics: rules of thumb Introduce heuristic search Greedy search A* search Learning outcome covered today: Identify, contrast and apply to simple examples the major search techniques that have been developed for problem-solving in AI 3

Real Life Problems Whatever search technique we use, we have exponential time complexity Tweaks to the algorithm will not reduce this to polynomial We need problem specific knowledge to guide the search Simplest form of problem specific knowledge is heuristics Usual implementation in search is via an evaluation function which indicates desirability of expanding a node 4

Path Cost Function Recall: we have a path cost function, which gives the cost of each path. This is comprised of the step costs of each action on the path. 5

Finding The Best Paths Why not expand the cheapest path first? Intuition: cheapest is likely to be best! Performance is like breadth-first search but we use the minimum cost path rather than the shallowest to expand Uniform cost search orders the agenda as a priority queue using the lowest path cost of a node 6

Cheapest First 75 140 118 7

Cheapest First Choose Zerind 75 140 118 8

Cheapest First Choose Zerind 75 146 140 118 9

Cheapest First Choose Zerind Choose Timisoara 75 146 140 118 10

Cheapest First Choose Zerind Choose Timisoara 75 146 140 118 229 11

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu 75 146 140 118 229 12

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu 75 146 140 239 118 229 220 13

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea 75 146 140 239 118 229 220 14

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea 75 146 140 239 118 229 220 15

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea 75 146 140 239 118 229 220 317 366 16

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj 75 146 140 239 118 229 220 317 366 17

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj 75 146 140 239 118 229 299 220 317 366 18

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras 75 146 140 239 118 229 299 220 317 366 19

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras 75 146 140 239 118 229 299 220 317 450 366 20

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras Choose Mehadia 75 146 140 239 118 229 299 220 317 450 366 21

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras Choose Mehadia 75 146 140 239 118 229 299 220 317 450 374 366 22

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras Choose Mehadia 75 146 Choose Pitesti 140 239 118 229 299 220 317 450 374 366 23

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras Choose Mehadia 75 146 Choose Pitesti 140 239 118 229 299 220 317 418 450 374 366 24

Cheapest First Choose Zerind Choose Timisoara Choose Sibiu Choose Oradea Choose Rimnicu Vilcea Choose Lugoj Choose Fagaras Choose Mehadia 75 146 Choose Pitesti 140 239 118 229 299 220 317 418 450 374 366 25

General Algorithm for Uniform Cost Search agenda = [initial state]; while agenda not empty do take node from agenda such that g(node) = min { g(n) n in agenda} if node is goal state then return solution; new nodes = apply operations to node; add new nodes to the agenda; 26

Properties of Uniform Cost Search Uniform cost search guaranteed to find cheapest solution assuming path costs grow monotonically, i.e. the cost of a path never decreases as we move along it In other words, adding another step to the solution makes it more costly, i.e. g(successor(n)) > g(n). If path costs don t grow monotonically, then exhaustive search is required Still requires many nodes to be examined 27

Informed Strategies Use problem-specific knowledge More efficient than blind search The most promising path first! Rather than trying all possible search paths, you try to focus on paths that seem to be getting you nearer your target/goal state 28

Greedy Search Most heuristics estimate cost of cheapest path from node to solution We have a heuristic function, h : Nodes R which estimates the distance from the node to the goal h can be any function but should have h(n) = 0 if n is a goal Example: In route finding, heuristic might be straight line distance from node to destination Greedy search expands the node that appears to be closest to goal 29

Romania Example Straight-line distance to Bucharest Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 176 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 30

Greedy Search Example 366 31

Greedy Search Example 374 366 253 329 32

Greedy Search Example Choose Sibiu 374 366 253 329 33

Greedy Search Example Choose Sibiu 374 380 366 253 176 329 193 34

Greedy Search Example Choose Sibiu Choose Fagaras 374 380 366 253 176 329 193 35

Greedy Search Example Choose Sibiu Choose Fagaras 374 380 366 253 176 329 193 0 36

Greedy Search Example Choose Sibiu 374 380 Choose Fagaras NOT the cheapest path BUT far less effort 366 253 176 329 193 0 37

Search Tree 38

Exercise Suppose that in the Romania example the initial state is Iasi and the goal state is Fagaras. How do you think a greedy search, using the straight line distance as a heuristic, might proceed? 39

General Algorithm for Greedy Search agenda = [initial state]; while agenda not empty do take node from agenda such that h(node) = min { h(n) n in agenda} if node is goal state then return solution; new nodes = apply operations to node; add new nodes to the agenda; 40

Properties of Greedy Search Greedy search finds solutions quickly Doesn t always find the best May not find a solution if there is one (incomplete) Susceptible to false starts Only looking at current node. Ignores past! Short sighted 41

A* Search A* is a very efficient search strategy Basic idea is to combine uniform cost search and greedy search We look at the cost so far and the estimated cost to goal Gives heuristic f: f(n) = g(n) + h(n) where g(n) is path cost of n h(n) is expected cost of cheapest solution from n Aims to minimise overall cost 42

A* Search Example 0+366 43

A* Search Example 75+374 0+366 140+253 118+329 44

A* Search Example Choose Sibiu 75+374 0+366 140+253 118+329 45

A* Search Example Choose Sibiu 75+374 291+380 0+366 140+253 239+176 118+329 220+193 46

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 75+374 291+380 0+366 140+253 239+176 118+329 220+193 47

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 75+374 291+380 0+366 140+253 239+176 118+329 220+193 317+100 455+160 48

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 Choose Fagaras 415 < 417 75+374 291+380 0+366 140+253 239+176 118+329 220+193 317+100 455+160 49

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 Choose Fagaras 415 < 417 75+374 291+380 0+366 140+253 239+176 118+329 220+193 317+100 450+0 455+160 50

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 Choose Fagaras 415 < 417 Choose Pitesti 417 < 450 75+374 291+380 0+366 140+253 239+176 118+329 220+193 317+100 450+0 455+160 51

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 Choose Fagaras 415 < 417 Choose Pitesti 417 < 450 75+374 291+380 0+366 140+253 239+176 118+329 220+193 317+100 450+0 418+0 455+160 52

A* Search Example Choose Sibiu Choose Rimnicu Vilcea 413 < 415 Choose Fagaras 415 < 417 Choose Pitesti 417 < 450 75+374 291+380 Cheapest route found all open nodes > 418 0+366 140+253 239+176 118+329 220+193 317+100 450+0 418+0 455+160 53

Search Tree 54

General Algorithm for A* Search agenda = [initial state]; while agenda not empty do take node from agenda such that f(node) = min { f(n) n in agenda} where f(n) = g(n) + h(n) if node is goal state then return solution; new nodes = apply operations to node; add new nodes to the agenda; 55

Properties of A* Search Complete, provided only finitely many nodes with f < f(g) an admissible heuristic is used Never overestimates the distance i.e., h(n) < true(n) where true(n) is the true cost from n Also require h(n) 0, so h(g) = 0 for any goal G Exponential time Keeps all nodes in memory Optimal 56

Admissible Heuristics Example - 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) Start State Goal State 57

Exercise Calculate h 1 and h 2 for the 8 puzzle on the previous slide. Are these heuristics admissible? 58

Importance of the Heuristic Choice Typical search costs: d = 14 IDS = 3,473,941 nodes A*(h 1 ) = 539 nodes A*(h 2 ) = 113 nodes d = 24 IDS 54,000,000,000 nodes A*(h 1 ) = 39,135 nodes A*(h 2 ) = 1,641 nodes 59

Summary Heuristic functions estimate costs of shortest paths Good heuristics can dramatically reduce search cost Greedy best-first search expands lowest h incomplete and not always optimal A* search expands lowest g + h complete and optimal also optimally efficient Next time Search in complex environments (partial observation) and in game playing 60