Download Informed Search.pps

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Embodied cognitive science wikipedia , lookup

Artificial intelligence in video games wikipedia , lookup

AI winter wikipedia , lookup

Technological singularity wikipedia , lookup

Philosophy of artificial intelligence wikipedia , lookup

History of artificial intelligence wikipedia , lookup

Ethics of artificial intelligence wikipedia , lookup

Intelligence explosion wikipedia , lookup

Existential risk from artificial general intelligence wikipedia , lookup

Transcript
Informed Search
S.P.Vimal
BITS-Pilani
EA C461 Artificial Intelligence
To discuss…
• Search Strategies
•
•
•
•
Best First Search
Greedy Best First Search
A* Search
Memory Bounded Heuristic Search
• Heuristic Functions
• Heuristic Accuracy
• Finding appropriate heuristics
EA C461 Artificial Intelligence
Introduction
• Search
– Heuristic / Informed
• Uses additional information about nodes (heuristics)
that have not yet been explored to decide which nodes
to examine next
– Blind / Uninformed
• Assumes no additional information about the problem
• Heuristic function h (n) used in search provides an
estimate of the distance from any given node to a goal
node
EA C461 Artificial Intelligence
Best First Search
• A node is selected for expansion based on an evaluation
function f(n)
– Choose the node which appears to be best while expanding
• Best First Search algorithms differs in the evaluation function
– Evaluation function incorporate the problem specific knowledge
in the form of h(n)
– h(n)  heuristic function , a component of f(n)
 Estimated cost of cheapest path to the goal node
• h(n) = 0, if n is the goal node
• Greedy Best First Search, A* Search
EA C461 Artificial Intelligence
Greedy best-first search
• Expands the node that is closest to the goal
• Consider route finding problem in Romania
– Use of hSLD, Straight Line Distance Heuristic
– Evaluation function f(n) = h(n) (heuristic), estimate of
cost from n to goal
• For the problem of finding route from Arad to
Burcharest…
EA C461 Artificial Intelligence
Optimal Distance 140+80+97+101 = 418
EA C461 Artificial Intelligence
Greedy best-first search
EA C461 Artificial Intelligence
Greedy best-first search
EA C461 Artificial Intelligence
Greedy best-first search
EA C461 Artificial Intelligence
Greedy best-first search
EA C461 Artificial Intelligence
Optimal Distance 140+80+97+101 = 418
EA C461 Artificial Intelligence
Critics
•
•
•
•
•
Minimizing f(n) is susceptible to false start
Same issues with DFS
Not optimal, Incomplete (may search an infinite path)
Performance depends problem and heuristic
O(bm)  Worst case space needed
EA C461 Artificial Intelligence
A* Search
• A better form of best-first search
• f(n)=g(n) + h(n)
– g(n) the cost to reach the node
– h(n) the estimated cost of the cheapest path from n
to the goal
– f(n)  the estimated cost of the cheapest solution
through the node n
• h(n)  Admissible Heuristic / Consistent (in case of
graph search)
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* search
EA C461 Artificial Intelligence
A* Search : 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: hSLD(n) (never overestimates the actual road
distance)
• Theorem: If h(n) is admissible, A* using TREESEARCH is optimal
EA C461 Artificial Intelligence
A* Search : Optimality of A* (proof)
• Suppose some suboptimal goal G2 has been generated and is in
the fringe. Let n be an unexpanded node in the fringe such that
n is on a shortest path to an optimal goal G.
f(G2) = g(G2),
g(G2) > g(G),
f(G) = g(G),
f(G2) > f(G),
since h(G2) = 0
since G2 is suboptimal
since h(G) = 0
from above
Hence f(G2) > f(n), and A* will never select G2 for expansion
EA C461 Artificial Intelligence
A* Search: Repeated states
• Sub optimal solutions can be returned, if we discard
the optimal path to a repeated node
– Can be handled by keeping all nodes expanded in
memory, and when repeated make a decision based on
their costs
– Make Sure, repeated nodes are costlier
• Requires the heuristic to be consistent
EA C461 Artificial Intelligence
A* Search : Consistent heuristics
• A heuristic is consistent if for every node n, every successor n'
of n generated by any action a,
h(n) ≤ c(n,a,n') + h(n')
• If h is consistent, we have
f(n') = g(n') + h(n')
= g(n) + c(n,a,n') + h(n')
≥ g(n) + h(n)
= f(n)
i.e., f(n) is non-decreasing along any path.
• Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is
optimal
EA C461 Artificial Intelligence
A* Characteristics
• A* expands no nodes with f(n)>C*
– These nodes are said to be pruned
– This pruning still guarantees optimality
• Expands nodes in the increasing order of costs
• A* is optimally efficient
– For a given heuristic, A* finds optimal solution with the fewest
number of nodes expansion
– Any algorithm that doesn’t expand nodes with f(n)<C* has the
risk of missing an optimal solution
• For most problems the number of nodes with costs lesser than
C* is exponential
EA C461 Artificial Intelligence
Memory Bounded Heuristic Search
• Iterative-deepening A* (IDA*)
– uses f-value (g + h) as the cutoff
– Keep increase the cutoff for each iteration by the smallest
amount, in excess of the current cutoff
EA C461 Artificial Intelligence
Recursive best-first search
• Keeps track of the f-value of the best-alternative path
available.
– If current f-values exceeds this alternative f-value than backtrack
to alternative path.
– Upon backtracking change f-value to best f-value of its children.
– Re-expansion of this result is thus still possible.
EA C461 Artificial Intelligence
Recursive best-first search, ex.
EA C461 Artificial Intelligence
Recursive best-first search, ex.
EA C461 Artificial Intelligence
Recursive best-first search, ex.
EA C461 Artificial Intelligence
RBFS evaluation
• RBFS is a bit more efficient than IDA*
– Still excessive node generation (mind changes)
• Like A*, optimal if h(n) is admissible
• Space complexity is O(bd).
– IDA* retains only one single number (the current f-cost
limit)
• Time complexity difficult to characterize
– Depends on accuracy if h(n) and how often best path
changes.
• IDA* en RBFS suffer from too little memory.
EA C461 Artificial Intelligence
(simplified) memory-bounded A*
• Use all available memory.
– I.e. expand best leafs until available memory is full
– When full, SMA* drops worst leaf node (highest f-value)
– Like RFBS backup forgotten node to its parent
• What if all leafs have the same f-value?
– Same node could be selected for expansion and deletion.
– SMA* solves this by expanding newest best leaf and deleting oldest
worst leaf.
• SMA* is complete if solution is reachable, optimal if optimal solution is
reachable.
EA C461 Artificial Intelligence
Heuristic functions
• E.g for the 8-puzzle
– Avg. solution cost is about 22 steps (branching factor +/- 3)
– Exhaustive search to depth 22: 3.1 x 1010 states.
– A good heuristic function can reduce the search process.
EA C461 Artificial Intelligence
Heuristic functions
• E.g for the 8-puzzle knows two commonly used heuristics
• h1 = the number of misplaced tiles
– h1(s)=8
• h2 = the sum of the distances of the tiles from their goal positions
(manhattan distance).
– h2(s)=3+1+2+2+2+3+3+2=18
EA C461 Artificial Intelligence
Heuristic quality
• Effective branching factor b*
– Is the branching factor that a uniform tree of depth
d would have in order to contain N+1 nodes.
N 11 b * (b*)2  ... (b*)d
– Measure is fairly constant for sufficiently hard
problems.
 • Can thus provide a good guide to the heuristic’s overall
usefulness.
• A good value of b* is 1.
EA C461 Artificial Intelligence
Heuristic quality and dominance
• 1200 random problems with solution lengths from 2 to 24.
• If h2(n) >= h1(n) for all n (both admissible)
then h2 dominates h1 and is better for search
EA C461 Artificial Intelligence
Inventing admissible heuristics
• Admissible heuristics can be derived from the exact solution
cost of a relaxed version of the problem:
– Relaxed 8-puzzle for h1 : a tile can move anywhere
As a result, h1(n) gives the shortest solution
– Relaxed 8-puzzle for h2 : a tile can move to any adjacent
square.
As a result, h2(n) gives the shortest solution.
The optimal solution cost of a relaxed problem is no greater than
the optimal solution cost of the real problem.
ABSolver found a usefull heuristic for the rubic cube.
EA C461 Artificial Intelligence
Inventing admissible heuristics
• Admissible heuristics can also be derived from the solution
cost of a subproblem of a given problem.
• This cost is a lower bound on the cost of the real problem.
• Pattern databases store the exact solution to for every possible
subproblem instance.
– The complete heuristic is constructed using the patterns in
the DB
EA C461 Artificial Intelligence
Inventing admissible heuristics
• Another way to find an admissible heuristic is
through learning from experience:
– Experience = solving lots of 8-puzzles
– An inductive learning algorithm can be used to
predict costs for other states that arise during
search.
EA C461 Artificial Intelligence
Reference :
Chapter 4.1, 4.2
EA C461 Artificial Intelligence