Informed Search New
Informed Search New
Informed Search New
Outline
Informed = use problem-specific knowledge Which search strategies?
Best-first search and its variants How to invent them Hill climbing, simulated annealing, local beam search,
Heuristic functions?
Search Algorithms
Blind search BFS, DFS, uniform cost
no notion concept of the right direction can only recognize goal once its achieved
Heuristic search we have rough idea of how good various states are, and use this knowledge to guide our search
Best-first search
General approach of informed search:
Best-first search: node is selected for expansion based on an evaluation function f(n)
Informed Search
Add domain-specific information to select the best path along which to continue searching Define a heuristic function, h(n), that estimates the goodness of a node n. Specifically, h(n) = estimated cost (or distance) of minimal cost path from n to a goal state. If n= goal node then h(n)=0. The heuristic function is an estimate, based on domain-specific information that is computable from the current state description, of how close we are to a goal
(i) if it has not been generated before, evaluate it, add it to OPEN and (ii) if it has been generated before, change the parent if this new path is better than the previous one . In that case update the cost of getting to this node and to any successors that this node may already have.
Example
A* search
A* search combines Uniform-cost and Greedy Best-first Search Evaluation function: f(N) = g(N) + h(N) where:
0 < c(N,N) (no negative cost steps). Order the nodes in the fringe in increasing values of f(N)
g(N) is the cost of the best path found so far to N h(N) is an admissible heuristic f(N) is the estimated cost of cheapest solution through N
A* search example
19
A* search example
20
A* search example
21
A* search example
22
A* search example
23
A* search example
24
Admissible heuristic
Let h*(N) be the true cost of the optimal path from N to a goal node Heuristic h(N) is admissible if: 0 h(N) h*(N) An admissible heuristic is always optimistic If h(n) is admissible, A*using TREE-SEARCH is optimal
Suppose suboptimal goal G2 in the queue. Let n be an unexpanded node on a shortest to optimal goal G.
f(G2 ) = g(G2 ) since h(G2 )=0 =g(G2)>C* C* is cost of optimal solution For node n that is optimal solution we know f(n)=g(n) +h(n) <=C* f(n) <=C*<f(g2) So G2 will never be expanded and A* must return an optimal solution
Previous proof breaks down Add extra bookkeeping i.e. remove more expensive of two paths. Ensure that optimal path to any repeated state is always first followed.
Extra requirement on h(n): consistency
Solution:
(monotonicity)
Consistency
h ,, ' +n ( c a) h) n ( n ( ) n '
if h(n) is consistent then the values of f(n) along any path are nondecreasing. Proof:
If n is successor of n then g(n)=g(n) + c(n,a,n) for some a f(n) = g(n)+h(n) =g(n)+c(n,a,n)+h(n) >=g(n) + h(n) >=f(n)
F-contours are gradually Added: 1) nodes with f(n)<C* 2) Some nodes on the goal Contour (f(n)=C*).
A* search, evaluation
Completeness: YES
Since bands of increasing f are added Unless there are infinitely many nodes with f<f(G)
A* search, evaluation
Completeness: YES Time complexity:
A* search, evaluation
Completeness: YES Time complexity: (exponential with path length) Space complexity:
It keeps all generated nodes in memory Hence space is the major problem not time
A* search, evaluation
Completeness: YES Time complexity: (exponential with path length) Space complexity:(all nodes are stored) Optimality: YES
Cannot expand fi+1 until fi is finished. A* expands all nodes with f(n)< C* A* expands some nodes with f(n)=C* A* expands no nodes with f(n)>C*
Iterative-deepening A* (IDA*)
Here cutoff information is the f-cost (g+h) instead of
depth
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.
Path until Rumnicu Vilcea is already expanded Above node; f-limit for every recursive call is shown on top. Below node: f(n) The path is followed until Pitesti which has a f-value worse than the f-limit.
Unwind recursion and store best f-value for current best leaf Pitesti
result, f [best] RBFS(problem, best, min(f_limit, alternative))
Unwind recursion and store best f-value for current best leaf Fagaras
result, f [best] RBFS(problem, best, min(f_limit, alternative))
best is now Rimnicu Viclea (again). Call RBFS for new best
RBFS evaluation
RBFS is a bit more efficient than IDA*
IDA* retains only one single number (the current f-cost limit) Depends on accuracy if h(n) and how often best path changes.
(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
Same node could be selected for expansion and deletion. SMA* solves this by expanding newest best leaf and deleting oldest worst leaf.
Heuristic functions
Avg. solution cost is about 22 steps (branching factor +/- 3) Exhaustive search to depth 22: 3.1 x 1010 states. The corresponding states for 15 puzzle problem is 1013 A good heuristic function can reduce the search process.
Heuristic Function
Function h(N) that estimates the cost of the cheapest path from node N to goal node. Example: 8-puzzle
5 8 4 2 1 7 3 6 N 1 2 3 4 5 6 7 8 goal h1(N) = number of misplaced tiles =6
Heuristic Function
Function h(N) that estimate the cost of the cheapest path from node N to goal node. Example: 8-puzzle
5 8 4 2 1 7 3 6 N 1 2 3 4 5 6 7 8 goal h2(N) = sum of the distances of every tile to its goal position =2+3+0+1+3+0+3+1 = 13
8-Puzzle
5
3 3 4
2 4 3 3 4 5 4 2 1 0
8-Puzzle
4+1 5+0
8-Puzzle
6
2 5 4 3 4 6 5 2 1 0
8-Puzzle
0+4
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 = b () ++) + 1 *b . ( d 1++ 2 . b * *
The optimal solution cost of a relaxed problem is no greater than the optimal solution cost of the real problem.
systematic search doesnt work however, can start with a suboptimal solution and improve it
Local Search algorithms operate using a single current state and generally move only to the neighbor of that state.
Use very little memory Find often reasonable solutions in large or infinite state spaces. The goal is to find best state according to some objective function.
Hill-climbing search
is a loop that continuously moves in the direction of increasing value
Hill climbing does not look ahead of the immediate neighbors of the current state. Hill-climbing chooses randomly among the set of best successors, if there is more than one. Hill-climbing a.k.a. greedy local search Some problem spaces are great for hill climbing and others are terrible.
Hill-climbing search
function HILL-CLIMBING(problem) return a state that is a local maximum input: problem, a problem local variables: current, a node. neighbor, a node.
current MAKE-NODE(INITIAL-STATE[problem]) loop do neighbor a highest valued successor of current if VALUE [neighbor] VALUE[current] then return STATE[current] current neighbor
h=17 A B AC BC DE DF DG EF EG FG FH
GH AE BF CG BD CE BH
With h=1
A B C D E F G H
h = -3
start 1 2 5 7 4 8 6 3 -3
1 2 5 7 4 -4 8 6 3 1 2 5 7 4 -4 8 6 3
61
Introduce randomness
Hill-climbing variations
Stochastic hill-climbing
Random selection among the uphill moves. The selection probability can vary with the steepness of the uphill move. Stochastic hill climbing by generating successors randomly until a better one is found. Tries to avoid getting stuck in local maxima. If at first you dont succeed, try, try again
First-choice hill-climbing
Random-restart hill-climbing
Simulated annealing
Escape local maxima by allowing bad moves.
If T decreases slowly enough, best state is reached. Applied for VLSI layout, airline scheduling, etc.
Simulated annealing
function SIMULATED-ANNEALING( problem, schedule) return a solution state input: problem, a problem schedule, a mapping from time to temperature local variables: current, a node. next, a node. T, a temperature controlling the probability of downward steps
current MAKE-NODE(INITIAL-STATE[problem]) for t 1 to do T schedule[t] if T = 0 then return current next a randomly selected successor of current E VALUE[next] - VALUE[current] if E > 0 then current next else current next only with probability eE /T
Simulated Annealing
applet Successful application: circuit routing, traveling sales person (TSP)
If any of successors is goal finished Else select k best from successors and repeat.
Major difference with random-restart search Information is shared among k search threads. Can suffer from lack of diversity.
Genetic algorithm
Successor states are generated by combining two parent states. GAs begin with a set of k randomly generated states population Each state is rated by the evaluation function or the fitness function. Various techniques may be used for the production of next generation of states:
There is no other available techniques, or It is not worth the effort to develop a more efficient technique There is no other available techniques, and There exist good heuristics
Greedy Search A*
Admissible heuristics