Title: More advanced aspects of search
1More advanced aspects of search
- Optimality proof of A
- Further properties of A
- Extensions of A
- Concluding comments
2Optimality of Aa formal proof
- Terminology
- Basic properties of A
- Termination of A
- Finds a path
- Finds the best path
3A algorithm
1. QUEUE lt-- path only containing the root 2.
WHILE QUEUE is not empty
AND first path does not reach goal
remove the first path from the QUEUE
create new paths (to all children)
reject the new paths with loops
add the new paths and sort the entire QUEUE
IF QUEUE contains path P terminating
in I, with cost cost_P, and path Q
containing I, with cost cost_Q AND cost_P ?
cost_Q THEN delete P 3. IF goal reached
THEN success
ELSE failure
(by f cost h)
4Terminology and notation
- Accumulated cost of a path p cost(p)
- End node of a path end(p)
- The best path B S,N,M,,G
- Subpaths see drawing
- p SN is a subpath of B
- assumes that it is an initial part of B
5Property 1
6Property 2
During each WHILE-loop
If a subpath of B is selected and removed - all
its extensions are computed, - at least 1 of
these is a subpath of B and has no loop (B has
no loop), - at least 1 subpath of B is added
7Corollary
For any path p, such that f(p) gt cost(B) p is
never selected during A (and never becomes first
in QUEUE).
Property 1 and Property 2
8Termination of A
Let d be any natural number gt cost(B) / ?
Let p be any path of length d
9A returns a path to a goal
On termination, either goal found
empty QUEUE
A returns the best path
Assume it returns B, with cost(B) gt cost(B)
f(B) cost(B) h(B) ? cost(B)
gt cost(B)
10Other properties of A
- Classification of which nodes are selected.
- Heuristic power.
-
- Finding the best path to each node
- Monotonicity restriction
11Which nodes get selected?
12A better characterization of the selected nodes
First implication corollary
A does not terminate before B becomes the first
in the QUEUE and selects lower f-value paths first
13General picture
- Search tree is partitioned in 3 layers
14The f(p) ? cost(B) layer
- Is the top layer completely selected?
- Can it happen that some path p with f(p) ?
cost(B) never turns up in the QUEUE? - YES !
Termination
15Heuristic power
- To what extend is A improved by better heuristic
functions? - Can we compare them?
16Some underestimating heuristics for 8-puzzle
Note in every state T h3(T) ? h2(T) ? h1(T)
17Heuristic power in 8-puzzle
18Heuristic power of h
19Minimal cost pathsMonotonicity
How to avoid redundant path deletion.
20Minimal-cost paths to nodes.
- A same node may be found multiple times (possibly
with different costs ) - dealt with by redundant path deletion in A
- Do we detect all redundant paths ?? NO !
21Monotonicity
A heuristic function h satisfies the monotonicity
restriction if
22Monotonicity examples
for each arc h(A) ?? h(B) cost(A,B)
23Monotonicity the result
IF h satisfies the monotonicity restriction AND
A( h) selects path p THEN cost(p) is the
lowest cost with which we can ever
reach end(p)
- So
- under monotonicity each node is reached through
the best path first !
24Practical Relevance
IF A( h) later selects a path q with end(q)
end(p) (check via table)
Do NOT extend q, simply remove it from the QUEUE
25Monotonicity further motivation
- It is unreasonable that f decreases along a path
- This throws away information !!
- We already knew that total cost on this path to
the goal is at least 9 (knowledge in node A) - So how can this estimate be lower in node B ?
- Cannot happen under Monotonicity !
26Pathmax
- a variant of A to enforce monotonicity.
- Redefine f
- f (SAB) max( f(SAB) , f (S...A) )
- Is as if we are working with an h that satisfies
monotonicity
h(A) f (S...A) - cost (SA) ? f
(SAB) - cost(SA) f (SAB) -
cost(SAB) cost(A,B) h(B)
cost(A,B)
27Extensions of A
- Iterated deepening A
- Simplified Memory-bounded A
28Iterative-deepening A
29Memory problems with A
- A is similar to breadth-first
- Here 2 extensions of A that improve memory
usage.
30Iterative deepening A
How to establish the f-bounds? - initially
f(S) generate all successors record the minimal
f(succ) gt f(S) Continue with minimal f(succ)
instead of f(S)
31Example
f-limited, f-bound 100
32Example
f-limited, f-bound 120
33Example
f-limited, f-bound 125
34f-limited search
1. QUEUE lt-- path only containing the root
f-bound lt-- ltsome natural numbergt f-new
lt-- ? 2. WHILE QUEUE is not empty AND goal is
not reached DO remove the first path from
the QUEUE create new paths (to all
children) reject the new paths
with loops add the new paths with f(path) ?
f-bound to front of QUEUE
f-new lt-- minimum of current f-new
and of the minimum of new f-values which
are larger than f-bound 3. IF goal
reached THEN success ELSE report f-new
35Iterative deepening A
36Properties of IDA
- Complete and optimal
- under the same conditions as for A
- Memory
- Let ? be the minimal cost of an arc
- O( b (cost(B) /?) )
- Speed
- depends very strongly on the number of
f-contours there are !! - In the worst case f(p) ? f(q) for every 2
paths - 1 2 . N O(N2)
37Why is this optimal,even without monotonicity ??
38Properties practical
- If there are only a reduced number of different
contours
- Else, the gain of the extended f-contour is not
sufficient to compensate recalculating the
previous - In such cases
39Simplified Memory-bounded A
40Simplified Memory-bounded A
- Fairly complex algorithm.
- Optimizes A to work within reduced memory.
- Key idea
(15)
41Generate children 1 by 1
42Too long path give up
43Adjust f-values
better estimate for f(S)
44SMA an example
(15)
13
12
45Example continued
15
(15)
(24)
20
13
15
(?)
13
20
(?)
(?)
24
15
46SMA properties
- Complete If available memory allows to store
the shortest path. - Optimal If available memory allows to store
the best path. - Otherwise returns the best path that fits in
memory. - Memory Uses whatever memory available.
- Speed If enough memory to store entire tree
same as A
47Concluding comments
- More on non-optimal methods
- The optimality Trade-off
48Non-optimal variants
- Sometimes non-admissible heuristics desirable
- Example symmetry
- but cannot be captured with underestimating h
- Use non-admissible A.
49Non-optimal variants (2)
- Reduce the weight of the cost in f
50Approaching the complexity
- Optimal path finding is by nature NP complete !
- in the worst case (depending on the actual search
space !) , behave exponential - in the average case are polynomial
51Complexity continued
- OR, use algorithms that
- ALWAYS produce solutions in polynomial time
- in the worst case (actual search space), the
solution is far form the optimal one - in the average case, it is close to the optimal
one - Examples local search, non-admissible A, ? ? 1 .
52Example traveling salesmanwith minimal cost
- Assume there are N cities
- Worst case
- solution found/ best solution ? log2(N1)/2
- Average case
- solution found 20 longer than best