Professional Documents
Culture Documents
A Search and Min Mix Search
A Search and Min Mix Search
A Search and Min Mix Search
Presented To:
Mr. Asif Aziz
It is a handy algorithm that is often used for map traversal to find the shortest
path to be taken. A* was initially designed as a graph traversal problem, to help
build a robot that can find its own course. It still remains a widely popular
algorithm for graph traversal.
In A* search algorithm, we use search heuristic as well as the cost to reach the
node. Hence we can combine both costs as following, and this sum is called as
a fitness number.
Algorithm of A* search:
Step1: Place the starting node in the OPEN list.
Step 2: Check if the OPEN list is empty or not, if the list is empty then return
failure and stops.
Step 3: Select the node from the OPEN list which has the smallest value of
evaluation function (g+h), if node n is goal node then return success and stop,
otherwise
Step 4: Expand node n and generate all of its successors, and put n into the closed
list. For each successor n', check whether n' is already in the OPEN or CLOSED
list, if not then compute evaluation function for n' and place into Open list.
Step 5: Else if node n' is already in OPEN and CLOSED, then it should be
attached to the back pointer which reflects the lowest g(n') value.
Problem-01:
Find the most cost-effective path to reach the final state from initial state using A*
Algorithm.
Consider g(n) = Depth of node and h(n) = Number of misplaced tiles.
Solution-
2 8 2 8 2 8
6 4 h=5 4 h=3
1+ 1+ 1+
2 8 2 8
4 h=3
2+4
7 6 6 5
2 8
4 h=4
3+ 3-«4 3+4
7 6
8 4 h=1
5+0
7 6
Final State
Problem-02:
The numbers written on edges represent the distance between the nodes.
The numbers written on nodes represent the heuristic value.
Find the most cost-effective path to reach from start state A to final state J using A*
Algorithm.
Solution-
Step-01:
We start with node A.
Node B and Node F can be reached from node A.
Path- A → F
Step-02:
Node G and Node H can be reached from node F.
Path- A → F → G
Step-03:
Node I can be reached from node G.
Path- A → F → G → I
Step-04:
Node E, Node H and Node J can be reached from node I.
Path- A → F → G → I → J
This is the required shortest path from node A to node J.
Advantages:
Best first search can switch between BFS and DFS by gaining the
advantages of both the algorithms.
This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
It can behave as an unguided depth-first search in the worst case scenario.
It can get stuck in a loop as DFS.
This algorithm is not optimal.
WHAT IS THE MINIMAX ALGORITHM?
The Minimax Algorithm is a recursive or backtracking algorithm
typically used in turn-based, two-player games.
Min-Max algorithm is mostly used for game playing in AI. Such as Chess,
Checkers, tic-tac-toe, go, and various tow-players game. This Algorithm
computes the minimax decision for the current state.
In this algorithm two players play the game, one is called MAX and other is
called MIN.
Both the players fight it as the opponent player gets the minimum benefit
while they get the maximum benefit.
Both Players of the game are opponent of each other, where MAX will
select the maximized value and MIN will select the minimized value.
The minimax algorithm performs a depth-first search algorithm for the
exploration of the complete game tree.
In the above figure, the two players MAX and MIN are there. MAX starts the
game by choosing one path and propagating all the nodes of that path. Now, MAX will
backtrack to the initial node and choose the best path where his utility value will be the
maximum. After this, its MIN chance. MIN will also propagate through a path and again
will backtrack, but MIN will choose the path which could minimize MAX winning
chances or the utility value.