Review: Search problem formulation

Slides:



Advertisements
Similar presentations
Artificial Intelligent
Advertisements

Informed search algorithms
Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Lights Out Issues Questions? Comment from me.
Informed search algorithms
Informed Search Algorithms
Notes Dijstra’s Algorithm Corrected syllabus.
Uninformed search strategies
Informed search strategies
Informed search algorithms
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Solving Problem by Searching
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Blind Search1 Solving problems by searching Chapter 3.
Search Strategies Reading: Russell’s Chapter 3 1.
May 12, 2013Problem Solving - Search Symbolic AI: Problem Solving E. Trentin, DIISM.
1 Lecture 3 Uninformed Search. 2 Uninformed search strategies Uninformed: While searching you have no clue whether one non-goal state is better than any.
Touring problems Start from Arad, visit each city at least once. What is the state-space formulation? Start from Arad, visit each city exactly once. What.
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.
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics Memory Bounded A* Search.
Informed search algorithms
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
1 Shanghai Jiao Tong University Informed Search and Exploration.
Search Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore, Svetlana Lazebnik,
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.
Search (cont) & CSP Intro Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
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.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
Uninformed search strategies A search strategy is defined by picking the order of node expansion Uninformed search strategies use only the information.
Problem Solving as Search. Problem Types Deterministic, fully observable  single-state problem Non-observable  conformant problem Nondeterministic and/or.
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:
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
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.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Lecture 3 Problem Solving through search Uninformed Search
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Last time: Problem-Solving
Heuristic Search Introduction to Artificial Intelligence
Uninformed Search Chapter 3.4.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
Solving problems by searching
CS 4100 Artificial Intelligence
Informed search algorithms
Informed search algorithms
Artificial Intelligence
Artificial Intelligence
Solving Problems by Searching
Informed Search.
Presentation transcript:

Review: Search problem formulation Initial state Actions Transition model Goal state Path cost What is the optimal solution? What is the state space?

Review: Tree search Initialize the fringe using the starting state While the fringe is not empty Choose a fringe node to expand according to search strategy If the node contains the goal state, return solution Else expand the node and add its children to the fringe

Search strategies A search strategy is defined by picking the order of node expansion Strategies are evaluated along the following dimensions: Completeness: does it always find a solution if one exists? Optimality: does it always find a least-cost solution? Time complexity: number of nodes generated Space complexity: maximum number of nodes in memory Time and space complexity are measured in terms of b: maximum branching factor of the search tree d: depth of the optimal solution m: maximum length of any path in the state space (may be infinite)

Uninformed search strategies Uninformed search strategies use only the information available in the problem definition Breadth-first search Uniform-cost search Depth-first search Iterative deepening search

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end A D F B C E G

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end A D F B C E G

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end A D F B C E G

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end A D F B C E G

Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end A D F B C E G

Properties of breadth-first search Complete? Yes (if branching factor b is finite) Optimal? Yes – if cost = 1 per step Time? Number of nodes in a b-ary tree of depth d: O(bd) (d is the depth of the optimal solution) Space? O(bd) Space is the bigger problem (more than time)

Uniform-cost search Expand least-cost unexpanded node Implementation: fringe is a queue ordered by path cost (priority queue) Equivalent to breadth-first if step costs all equal Complete? Yes, if step cost is greater than some positive constant ε Optimal? Yes – nodes expanded in increasing order of path cost Time? Number of nodes with path cost ≤ cost of optimal solution (C*), O(bC*/ ε) This can be greater than O(bd): the search can explore long paths consisting of small steps before exploring shorter paths consisting of larger steps Space? O(bC*/ ε)

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Depth-first search Expand deepest unexpanded node Implementation: fringe = LIFO queue, i.e., put successors at front A D F B C E G

Properties of depth-first search Complete? Fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path  complete in finite spaces Optimal? No – returns the first solution it finds Time? Could be the time to reach a solution at maximum depth m: O(bm) Terrible if m is much larger than d But if there are lots of solutions, may be much faster than BFS Space? O(bm), i.e., linear space!

Iterative deepening search Use DFS as a subroutine Check the root Do a DFS searching for a path of length 1 If there is no path of length 1, do a DFS searching for a path of length 2 If there is no path of length 2, do a DFS searching for a path of length 3…

Iterative deepening search

Iterative deepening search

Iterative deepening search

Iterative deepening search

Properties of iterative deepening search Complete? Yes Optimal? Yes, if step cost = 1 Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd) Space? O(bd)

Informed search Idea: give the algorithm “hints” about the desirability of different states Use an evaluation function to rank nodes and select the most promising one for expansion Greedy best-first search A* search

Heuristic function Heuristic function h(n) estimates the cost of reaching goal from node n Example: Start state Goal state

Heuristic for the Romania problem

Greedy best-first search Expand the node that has the lowest value of the heuristic function h(n)

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Properties of greedy best-first search Complete? No – can get stuck in loops start goal

Properties of greedy best-first search Complete? No – can get stuck in loops Optimal? No

Properties of greedy best-first search Complete? No – can get stuck in loops Optimal? No Time? Worst case: O(bm) Best case: O(bd) – If h(n) is 100% accurate Space?

How can we fix the greedy problem?

A* search Idea: avoid expanding paths that are already expensive The evaluation function f(n) is the estimated total cost of the path through node n to the goal: f(n) = g(n) + h(n) g(n): cost so far to reach n (path cost) h(n): estimated cost from n to goal (heuristic)

A* search example

A* search example

A* search example

A* search example

A* search example

A* search example

Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic Example: straight line distance never overestimates the actual road distance Theorem: If h(n) is admissible, A* is optimal

Optimality of A* Proof by contradiction Let n* be an optimal goal state, i.e., f(n*) = C* Suppose a solution node n with f(n) > C* is about to be expanded Let n' be a node in the fringe that is on the path to n* We have f(n') = g(n') + h(n') ≤ C* But then, n' should be expanded before n – a contradiction

Optimality of A* In other words: f(n*) = C* n* n f(n) > C* g(n')  f(n) > C* n' In other words: Suppose A* terminates its search at n* It has found a path whose actual cost f(n*) = g(n*) is lower than the estimated cost f(n) of any path going through any fringe node Since f(n) is an optimistic estimate, there is no way n can have a successor goal state n’ with g(n’) < C*

Optimality of A* A* is optimally efficient – no other tree-based algorithm that uses the same heuristic can expand fewer nodes and still be guaranteed to find the optimal solution Any algorithm that does not expand all nodes with f(n) < C* risks missing the optimal solution

Properties of A* Complete? Yes – unless there are infinitely many nodes with f(n) ≤ C* Optimal? Yes Time? Number of nodes for which f(n) ≤ C* (exponential) Space? Exponential

Designing heuristic functions Heuristics for the 8-puzzle h1(n) = number of misplaced tiles h2(n) = total Manhattan distance (number of squares from desired location of each tile) h1(start) = 8 h2(start) = 3+1+2+2+2+3+3+2 = 18 Are h1 and h2 admissible?

Heuristics from relaxed problems A problem with fewer restrictions on the actions is called a relaxed problem The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution

Dominance If h1 and h2 are both admissible heuristics and h2(n) ≥ h1(n) for all n, (both admissible) then h2 dominates h1 Which one is better for search? A* search expands every node with f(n) < C* or h(n) < C* – g(n) Therefore, A* search with h1 will expand more nodes

Dominance Typical search costs for the 8-puzzle (average number of nodes expanded for different solution depths): d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes d=24 IDS ≈ 54,000,000,000 nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes

Heuristics from subproblems Let h3(n) be the cost of getting a subset of tiles (say, 1,2,3,4) into their correct positions Can precompute and save the exact solution cost for every possible subproblem instance – pattern database

h(n) = max{h1(n), h2(n), …, hm(n)} Combining heuristics Suppose we have a collection of admissible heuristics h1(n), h2(n), …, hm(n), but none of them dominates the others How can we combine them? h(n) = max{h1(n), h2(n), …, hm(n)}

Memory-bounded search The memory usage of A* can still be exorbitant How to make A* more memory-efficient while maintaining completeness and optimality? Iterative deepening A* search Recursive best-first search, SMA* Forget some subtrees but remember the best f-value in these subtrees and regenerate them later if necessary Problems: memory-bounded strategies can be complicated to implement, suffer from “thrashing”

Comparison of search strategies Algorithm Complete? Optimal? Time complexity Space complexity BFS UCS DFS IDS Greedy A* If all step costs are equal Yes O(bd) O(bd) Yes Yes Number of nodes with g(n) ≤ C* No No O(bm) O(bm) If all step costs are equal Yes O(bd) O(bd) Worst case: O(bm) No No Best case: O(bd) Yes Yes Number of nodes with g(n)+h(n) ≤ C*