web viewinformed search. informed search (heuristic search): the path cost from the current state to...

16
Informed search Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as the next state. Additional information can be added as assumption to solve the problem. E.g. a) Best first search b) Greedy search c) A* search Best first search Best first search is an instance of the general TREE- SEARCH or GRAPH-SEARCH algorithm in which a node is selected for expansion based on an evaluation function f(n), The node with lowest evaluation is selected for expansion, because the evaluation measures the distance to the goal. This can be implemented using a priority-queue, a data structure that will maintain the fringe in ascending order of f-values. A heuristic function or simply a heuristic is a function that ranks alternatives in various search algorithms at each branching step basing on an available information in order to make a decision which branch is to be followed during a search. The key component of Best-first search algorithm is a heuristic function,denoted by h(n): h(n) = extimated cost of the cheapest path from node n to a goal node. For example,in Romania,one might estimate the cost of the cheapest path from Arad to Bucharest via a straight-line distance from Arad to Bucharest

Upload: doancong

Post on 05-Mar-2018

221 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

Informed search

Informed search (Heuristic search):

The path cost from the current state to goal state is calculated, to select the minimum path cost as the next state.

Additional information can be added as assumption to solve the problem.

E.g. a) Best first search

b) Greedy search

c) A* search

Best first search

Best first search is an instance of the general TREE-SEARCH or GRAPH-SEARCH algorithm in which a node is selected for expansion based on an evaluation function f(n), The node with lowest evaluation is selected for expansion, because the evaluation measures the distance to the goal. This can be implemented using a priority-queue, a data structure that will maintain the fringe in ascending order of f-values.

A heuristic function or simply a heuristic is a function that ranks alternatives in various search algorithms at each branching step basing on an available information in order to make a decision which branch is to be followed during a search.

The key component of Best-first search algorithm is a heuristic function,denoted by h(n):

h(n) = extimated cost of the cheapest path from node n to a goal node.

For example,in Romania,one might estimate the cost of the cheapest path from Arad to Bucharest via a straight-line distance from Arad to Bucharest

Heuristic function are the most common form in which additional knowledge is imparted to the search algorithm.

The two types of evaluation functions are:

Expand the node closest to the goal state using estimated cost as the evaluation is called Greedy best-first search.

Expand the node on the least cost solution path using estimated cost and actual cost as the evaluation function is called A* search.

Page 2: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

Greedy best-first search

Use a priority queue, where nodes with best scores are taken off the queue first.

Algorithm

While queue not empty and not found do:

Remove the BEST node N from queue.

If Nis a goal state, then found = TRUE.

Find all the successor nodes of N, assign them a score, and put them on the queue.

Page 3: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

A* Search

Page 4: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

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 TREE-SEARCH is optimal

Page 5: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

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') triangle inequality

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

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), since h(G2) = 0

g(G2) > g(G), since G2 is suboptimal

f(G) = g(G), since h(G) = 0

f(G2) > f(G), from above

Hence f(G2) > f(n), and A* will never select G2 for expansion

Page 6: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

n

n’

A* used With Tree search

Proof A* using tree search is optimal if h(n) is admissible

(i)suboptimal goal node G2 node appear on the fringe

(ii)Cost of optimal solution be C*

(iii)G2 is suboptimal goal node , therefore h(G2)=0

(iv)f(G2)=g(G2)+h(G2)=g(G2)>C*

v) Let us consider one of the fringe node n, an optimal solution path h(n) is admissible heuristic.

f(n)=g(n)+h(n)<=C*

vi)from step no iv and v

f(n)<C*<f(G2), G2 will not expanded and A* must return an optimal solution

A* used with Graph Search

A* with Graph-search may return the suboptimal solution became of the repeated state and which is not the first one generated. To avoid this problem two methods are proposed. They are

i) Extend graph search to discard the expensive cost path, by including the path-cost as one of the argument.

ii) To ensure consistency or monotonicity onh(n).

The behavior of A*search

Let us consider two nodes n and n',where n is the parent of n'.Now suppose, for example, that

f(n)=g(n)+h(n)

=3+4=7

f(n’)=g(n’)+h(n’)

=5+3=8

Monotonicity

Page 7: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

g(n) )= 3and h(n)=4.Thenf(n)=g(n)+h(n)=7

that is, we know that the true cost of a solution path through n is atleast7.Suppose also that

g(n')=4 and h(n')=2,sothat f(n')=6.

This is an example of a nonmonotonic heuristic.Fortunately,from the fact that any path through n' is also a path through n

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

Memory-Bounded Heuristic Search

To reduce the memory requirement for A* - to adapt the idea of iterative deepening to the heuristic search, results in IDA* algorithm. The main difference between IDA* and standard iterative deepening is that the cutoff used is the f-cost(g+h) rather than the depth; at each iteration, the cutoff value is the smallest f-cost of any node that exceeded the cutoff on the previous iteration. The main disadvantage is, it will require more storage

space in complex domains.

Iterative-Deepening A* (IDA*)

Page 8: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

Using f(g+h) as a cut off rather than the depth for the iteration.� Cutoff value is the smallest f-cost of any nodethat exceeded the cutoff on the previous �

iteration; keep these nodes only. Space complexity O(bd)�

Page 9: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as
Page 10: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

Two-memory bounded algorithms:o Recursive best-first search (RBFS)o Memory bounded A* (MA* )

Recursive best-first search (RBFS) 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.

Page 11: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

Recursive best-first search

Page 12: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

function RECURSIVE-BEST-FIRST-SEARCH(problem) return a solution or failurereturn RFBS(problem,MAKE-NODE(INITIAL-STATE[problem]),∞ )

function RFBS( problem, node, f_ limit) return a solution or failure and a new f-cost limitif GOAL-TEST[problem](STATE[node]) then return nodesuccessors EXPAND(node, problem)if successors is empty then return failure, ∞for each s in successors do

f [s] max(g(s) + h(s), f [node])repeat

best the lowest f-value node in successorsif f [best] > f_ limit then return failure, f [best]alternative the second lowest f-value among successorsresult, f [best] RBFS(problem, best, min(f_ limit, alternative))if result failure then return result

Figure 2.4 The algorithm for recursive best-first search

Page 13: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

RBFS and IDA* Comparsion

RBFS is a bit more efficient than IDA*

o Still excessive node generation (mind changes)

Like A*, optimal if h(n) is admissible

Space complexity is O(bd).

o IDA* retains only one single number (the current f-cost limit)

Time complexity difficult to characterize

o Depends on accuracy if h(n) and how often best path changes.

IDA* and RBFS suffer from too little memory.

(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.

Page 14: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as
Page 15: Web viewInformed search. Informed search (Heuristic search): The path cost from the current state to goal state is calculated, to select the minimum path cost as

SMA*: Properties