Given a search space, apply search and find the solution quickly and make sure that solution is optimal. i.e, both look up cost and execution cost must be minimum.
Brute force procedure
BritishMuseum (){
- Explore the entire search space;
- return the optimal solution;
}
Branch&Bound(){
- open <- {(start, NIL, Cost(start))}
- closed <- {}
- while TRUE
- do if Empty(open)
- then return FAILURE;
- pick the cheapest node n from open
- if GoalTest(Head(n))
- then return ReconstructPath(n)
- else children <- MoveGen(Head(n))
- for each m ∈ children{
- do Cost(m) <- Cost(n) + K(m, n)
- Add (m, Head(n), Cost(m) ) to open }
}
GeneralisedBranch&Bound(){
- start with all possible solutions
- repeat
- Refine the least ( Estimated cost ) solution further
- until the cheapest solution is fully refined
- return s
}
Dijkstra’s Alg(){
- Color all nodes white
- cost(start) <- 0
- parent(start) <- NIL
- for all other nodes n
- do cost(n) <- ∞
- repeat
- select lowest cost white node n
- color n black
- for all white neighbors m of n
- do if (const(n) + k(n, m)) < cost(m)
- then cost(m) = const(n) + k(n, m)
- parent(m) <- n
- until all nodes are colored black
}
A*(){
// heuristic fun f(n) = g(n) + h(n)
//g(n) =known cost of path found from S to n
//h(n) = Estimated cost of path from n to G
- open <- List(start)
- f(start) <- h(start)
- parent(start) <- NIL
- closed <- {}
- while open is not EMPTY
- do
- Remove node n from open such that f(n) has the lowest value
- Add n to closed
- if GoalTest(n) == TRUE
- then return Reconstructpath(n)
- neighbors <- MoveGen(n)
- for each m ∈ neighbors
- do switch
- case m ∉ open and m ∉ closed : /* new node */
- Add m to open
- parent(m) <- n
- g(m) <- g(n) + k(n, m)
- f(m) <- g(m) + h(m)
- case m ∈ open :
- if (g(n) + k(n, m) ) < g(m)
- then parent(m) <- n
- g(m) <- g(n) + k(n, m )
- f(m) <- g(m) + h(m)
- case m ∈ closed :
- if (g(n) + k(n, m) ) < g(m)
- then parent(m) <- n
- g(m) <- g(n) + k(n, m )
- f(m) <- g(m) + h(m)
- propagateImprovement(m)
- return FAILURE
}
PropagateImprovement(m){
- neighbours <- MoveGen(m)
- for each s ∈ neighbours
- do newGvalue <- g(m) + k(m, s)
- if newGvalue < g(s)
- then parent(s) <- m
- g(s) <- newGvalue
- if s ∈ closed
- then PropagateImprovement(s)
}
Admissibility of A*
Assumptions:
- The branching factor is finite