Problem Solving and Search in AI Heuristic Search

Slides:



Advertisements
Similar presentations
Lights Out Issues Questions? Comment from me.
Advertisements

Review: Search problem formulation
Notes Dijstra’s Algorithm Corrected syllabus.
Informed search algorithms
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 4 Jim Martin.
Solving Problem by Searching
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Problem Solving by Searching
Informed search.
Review: Search problem formulation
Introduction to Artificial Intelligence A* Search Ruth Bergman Fall 2002.
A* Search Introduction to AI. What is an A* Search? A greedy search method minimizes the cost to the goal by using an heuristic function, h(n). It works.
Artificial Intelligence
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
CSC344: AI for Games Lecture 4: Informed search
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA 2 nd ed Chapter 3, AIMA 3 rd ed.
Rutgers CS440, Fall 2003 Heuristic search Reading: AIMA 2 nd ed., Ch
Artificial Intelligence Problem solving by searching CSC 361 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
1 CS 2710, ISSP 2610 Chapter 4, Part 1 Heuristic Search.
Informed search algorithms
2013/10/17 Informed search A* algorithm. Outline 2 Informed = use problem-specific knowledge Which search strategies? Best-first search and its variants.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
1 Shanghai Jiao Tong University Informed Search and Exploration.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed Search Methods. Informed Search  Uninformed searches  easy  but very inefficient in most cases of huge search tree  Informed searches  uses.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
CSC3203: AI for Games Informed search (1) Patrick Olivier
Informed Search I (Beginning of AIMA Chapter 4.1)
Artificial Intelligence Problem solving by searching.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Pengantar Kecerdasan Buatan 4 - Informed Search and Exploration AIMA Ch. 3.5 – 3.6.
Heuristic Search Foundations of Artificial Intelligence.
Heuristic Functions. A Heuristic is a function that, when applied to a state, returns a number that is an estimate of the merit of the state, with respect.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Search Methodologies Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
For Monday Read chapter 4 exercise 1 No homework.
Romania. Romania Problem Initial state: Arad Goal state: Bucharest Operators: From any node, you can visit any connected node. Operator cost, the.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Review: Tree search Initialize the frontier using the starting state
Heuristic Functions.
Artificial Intelligence (CS 370D)
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
COMP 8620 Advanced Topics in AI
Informed search algorithms
Informed search algorithms
Artificial Intelligence
HW 1: Warmup Missionaries and Cannibals
HW 1: Warmup Missionaries and Cannibals
Artificial Intelligence
Solving Problems by Searching
Informed Search.
Presentation transcript:

Problem Solving and Search in AI Heuristic Search

Heuristic Search Problem with uniform cost search Solution: We are only considering the cost so far, not the expected cost of getting to the goal node But, we don’t know before hand the cost of getting to the goal from a previous state Solution: Need to estimate for each state the cost of getting from there to a goal state Use “heuristic” information to guess which nodes to expand next the heuristic is in the form of an evaluation function based on domain-specific information related to the problem. the evaluation function gives us a way to evaluate a node “locally” based on an estimate of the cost to get from the node to a goal node (the idea is to find the least cost path to a goal node).

Evaluation Functions h(n) is the heuristic function g(n): cost of the best path found so far between the initial node and n f(n) = h(n)  greedy best-first search f(n) = g(n) + h(n)  A* search

Best-First Search Basic Idea: always expand the node that minimizes (or maximizes) the evaluation function f(n) Greedy strategy: f(n) = h(n), where h(n) estimates the cost of getting from the node n to the goal if we keep nodes in memory (on the queue) for backtracking, then this is called (Greedy) Best-First search; if no queue and we stop as soon as f(n) is worse for the children than the parent, then this is called Hill-Climbing. What happens if always try at each step to move closer to the goal node? The BFS algorithm in this case will find the longer solution path, since it will begin by moving forward and then be committed to this choice. What about hill-climbing?

Best-First Search The evaluation function f maps each search node n to positive real number f(n) Traditionally, the smaller f(n), the more promising n Best-first search sorts the search queue at each step in increasing order of f random order is assumed among nodes with equal values of f

Best-First Search The evaluation function f maps each search node n to positive real number f(n) Traditionally, the smaller f(n), the more promising n Best-first search sorts the search queue at each step in increasing order of f random order is assumed among nodes with equal values of f “Best” only refers to the value of f, not to the quality of the actual path. Best-first search does not generate optimal paths in general

Best-First Search Example (Romania) Suppose we don’t know the actual distances beforehand, but can figure out the straight line distances from a map

Best-First Search Example (Romania) Suppose we don’t know the actual distances beforehand, but can figure out the straight line distances from a map Heuristic evaluation function: h(n) = straight-line distance between n and Bucharest h(n) is a heuristic because it is an estimate of the actual cost of getting from n to the goal Note that h(goal) = 0 always

Greedy Best-First Search Arad h(n) = 366 <== Arad <==

Greedy Best-First Search Arad h(n) = 366 h(n) = 253 Sibiu h(n) = 329 Timisoara h(n) = 374 Zerind <== Sibiu, Timisoara, Zerind <==

Greedy Best-First Search Arad h(n) = 366 h(n) = 253 Sibiu h(n) = 329 Timisoara h(n) = 374 Zerind 366 178 193 380 Arad Fagaras Oradea Rimnicu <== Fagaras, Rimnicu, Timisoara, Zerind, Oradea <==

Greedy Best-First Search Arad h(n) = 366 h(n) = 253 Sibiu h(n) = 329 Timisoara h(n) = 374 Zerind 178 193 380 Fagaras Oradea Rimnicu 253 h(n) = 0 Sibiu Bucharest <== Bucharest, Rimnicu, Timisoara, Zerind, Oradea <==

Greedy Best-First Search Arad h(n) = 366 h(n) = 253 Sibiu h(n) = 329 Timisoara h(n) = 374 Zerind 178 193 380 Fagaras Oradea Rimnicu h(n) = 0 Actual cost of the solution: Arad => Sibiu => Fagaras => Bucharest is 140 + 99 + 211 = 450 But, consider the path: Arad => Sibiu => Rimnicu => Pitesti => Bucharest with the cost 418 – So we got a suboptimal solution 253 Sibiu Bucharest

Heuristics for 8-Puzzle Problem In total, there are a possible of 9! or 362,880 possible states. However, with a good heuristic function, it is possible to reduce this state to less than 50. Some possible heuristics for 8-Puzzle: h1(n) = no. of misplaced tiles may have many plateaus (indistinguishable states) doesn’t captures the number of moves to get to the right place h2(n) = sum of Manhattan distances (i.e., no. of squares from desired location of each tile) doesn’t capture the importance of sequencing tiles (putting them in the right order)

Heuristics for 8-Puzzle Problem 5 4 1 2 3 6 1 8 8 4 7 3 2 7 6 5 s = start state g = goal state h1(s) = 7 h2(s) = 4 + 2 + 2 + 3 + 3 + 0 + 2 + 2 = 18

18 19 17 16 15 14 13 Part of the search tree generated by Best-First search using h2 = sum of Manhattan distances.

Heuristics Search in 8-Puzzle 18 19 17 16 15 14 13 12 11 Part of the search tree generated by Best-First search using h2 = sum of Manhattan distances. What will happen with hill-climbing? Initial Node Goal Node

A* Search (most popular algorithm in AI) Basic Idea: avoid expanding paths that are already expensive Evaluation function: f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost to goal from n f(n) = estimated total cost of path through n to reach the goal Admissible heuristics i.e., h(n) £ h*(n), for all n, where h*(n) is the true cost from n Ex: straight-line distance never overestimates the actual road distance Ex: h1 and h2 is 8-puzzle never overestimate the actual no. of moves A* search is optimal (finds lowest cost solution) if h(n) is admissible however, the number of nodes expanded depends on how good the heuristic is best case: h(n) = h*(n) for all n  A* will find the best solution with no search if h(n) > h*(n) for some n, then A* might still work, but might not find any solution at all

A* Search Arad f(n) = 366 140 75 118 h(n) = 253 f(n) = 393 h(n) = 329 Sibiu Timisoara Zerind 140 99 151 80 Arad Fagaras Oradea Rimnicu f(n) = 413 f(n) = 646 f(n) = 417 f(n) = 661 146 97 80 Craiova Pitesti Sibiu f(n) = 526 f(n) = 415 f(n) = 553

A* Search ... h(n) = 253 f(n) = 393 Sibiu 140 99 151 80 Arad Fagaras Oradea Rimnicu f(n) = 413 f(n) = 646 f(n) = 417 f(n) = 661 146 97 80 Craiova f(n) = 415 Pitesti Sibiu f(n) = 526 f(n) = 553 138 97 101 Rimnicu Craiova Bucharest f(n) = 607 f(n) = 615 f(n) = 418

A* Search ... h(n) = 253 f(n) = 393 Sibiu 140 99 80 151 Arad Fagaras Oradea Rimnicu f(n) = 413 f(n) = 646 f(n) = 526 99 211 146 97 80 Sibiu Bucharest Craiova f(n) = 415 Pitesti Sibiu f(n) = 591 f(n) = 450 f(n) = 526 f(n) = 553 138 97 101 Rimnicu Craiova Bucharest f(n) = 607 f(n) = 615 f(n) = 418

A* Search ... h(n) = 253 f(n) = 393 Sibiu 140 99 80 151 Arad Fagaras Oradea Rimnicu f(n) = 413 f(n) = 646 f(n) = 526 99 211 146 97 80 Sibiu Bucharest Craiova f(n) = 415 Pitesti Sibiu f(n) = 591 f(n) = 450 f(n) = 526 f(n) = 553 138 97 101 Rimnicu Craiova Bucharest f(n) = 607 f(n) = 615 f(n) = 418

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

Order of expansion f(n) = g(n) + h(n) A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. Order of expansion f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n)

A* search for an instance of 8-puzzle with h1 (sum of misplaced tiles). g(n) assumes each move has a cost of 1. Here we assume repeated state checking. f(n) = g(n) + h(n) Note: at level 2 there are two nodes listed with f(n) = 5. Depending on which node is we put in front of the queue, the algorithm will either expand 6 or 7 nodes. Here we have assumed the worse case, and thus the tree shows that 6 nodes were expanded 7

Efficiency of A* Comparison of search costs and effective branching factors for the Iterative Deepening search and A* algorithms with h1 and h2 for 8-puzzle. d is the average depth of the search tree. Data are averaged over 100 instances of the problem, for various solution lengths.

When to Use Search Techniques? The search space is small, and No other technique is available, or Developing a more efficient technique is not worth the effort The search space is large, and No other available technique is available, and There exist “good” heuristics

Heuristics in Tic-Tac-Toe? (you are X) Which is a better move? Why? ? ? Is there a heuristic we can use to evaluate these configurations? ?

Heuristics in Tic-Tac-Toe? (you are X) Which is a better move? Why? ? ?

Exercise Consider the problem of solving a cross-word puzzle initial state is an empty board with some possible blocked cells a goal state is board configuration filled in with legal English words: How can this problem be viewed as a search problem? What are the operators? How can we measure path costs? Etc. Assuming we have dictionary of 100,000 words, what would be a good (uninformed) search strategy to use? Why? What might be some good heuristics to use for this problem? How effective might hill-climbing strategies work in solving this problem? How can we handle the local minima problem? Propose a solution and discuss its effectiveness.