18
Heuristic Search-A* Algorithm Lecture-14 Hema Kashyap 1

Lecture 14 Heuristic Search-A star algorithm

Embed Size (px)

Citation preview

Page 1: Lecture 14 Heuristic Search-A star algorithm

Heuristic Search-A* AlgorithmLecture-14

Hema Kashyap

1

Page 2: Lecture 14 Heuristic Search-A star algorithm

A* Search• A* is a cornerstone name of many AI systems and has been used since it was

developed in 1968 by Peter Hart; Nils Nilsson and Bertram Raphael. It is thecombination of Dijkstra’s algorithm and Best first search. It can be used to solvemany kinds of problems. A* search finds the shortest path through a search spaceto goal state using heuristic function. This technique finds minimal cost solutionsand is directed to a goal state called A* search. In A*, the * is written for optimalitypurpose. The A* algorithm also finds the lowest cost path between the start andgoal state, where changing from one state to another requires some cost. A*requires heuristic function to evaluate the cost of path that passes through theparticular state. This algorithm is complete if the branching factor is finite andevery action has fixed cost. A* requires heuristic function to evaluate the cost ofpath that passes through the particular state. It can be defined by followingformula.

2

Page 3: Lecture 14 Heuristic Search-A star algorithm

A* Algorithm

1. Initialize: set OPEN=[s], CLOSED=[], g(s)=0, f(s)=h(s)

2. Fail: If OPEN=[], then terminate and fail

3. Select: Select a state with minimum cost ,n, from OPEN and save inCLOSED

4. Terminate: If n∈G then terminate with success and return f(s)

5. Expand: For each successors , m of n

For each successor, m, insert m in OPEN only if

if m∈ [OPEN∪CLOSED]

set g(m)= g[n]+C[n,m]

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

if m∈[OPEN∪CLOSED]

set g(m)= min{g[m], g(n)+C[n,m]}

Set f(m)=g(m)+h(m)

If f[m] has decreased and m ∈ CLOSED move m to OPEN

6. Loop: Goto step 2

3

Page 4: Lecture 14 Heuristic Search-A star algorithm

4

Page 5: Lecture 14 Heuristic Search-A star algorithm

5

Page 6: Lecture 14 Heuristic Search-A star algorithm

6

Page 7: Lecture 14 Heuristic Search-A star algorithm

7

Page 8: Lecture 14 Heuristic Search-A star algorithm

8

Page 9: Lecture 14 Heuristic Search-A star algorithm

9

Page 10: Lecture 14 Heuristic Search-A star algorithm

10

Page 11: Lecture 14 Heuristic Search-A star algorithm

11

Page 12: Lecture 14 Heuristic Search-A star algorithm

12

Page 13: Lecture 14 Heuristic Search-A star algorithm

13

Page 14: Lecture 14 Heuristic Search-A star algorithm

14

Page 15: Lecture 14 Heuristic Search-A star algorithm

15

Page 16: Lecture 14 Heuristic Search-A star algorithm

A* Search-Properties

• Admissible: the algorithm A* is admissible . This means that

provided a solution exists, the first solution found by A* is an

optimal solution. A* is admissible under following conditions:

– In the state space graph

• Every node has a finite number of successors

• Every arc in the graph has a cost greater than some ε> 0

– Heuristic function: for every node n, h(n) ≤ h*(n)

• Complete: A* is also complete under the above conditions.

• Optimal: A* is optimally efficient for a given heuristic-of the

optimal search algorithm that expand search paths from the

root node, it can be shown that no other optimal algorithm will

expand fewer nodes and find a solution

16

Page 17: Lecture 14 Heuristic Search-A star algorithm

Advantages

• It is complete and optimal.

• It is the best one from other techniques.

• It is used to solve very complex problems.

• It is optimally efficient, i.e. there is no other optimal algorithm guaranteed to expand fewer nodes than A*.

17

Page 18: Lecture 14 Heuristic Search-A star algorithm

Disadvantages

• This algorithm is complete if the branching factor is finite and every action has fixed cost.

• The speed execution of A* search is highly dependant on the accuracy of the heuristic algorithm that is used to compute h (n).

• It has complexity problems.

18