






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This document delves into the concept of adversarial search, a search strategy employed in scenarios where multiple agents with conflicting goals compete for optimal outcomes. It focuses on two key algorithms: min-max search and alpha-beta pruning. Min-max search is a recursive backtracking algorithm that provides an optimal move for a player assuming the opponent plays optimally. Alpha-beta pruning is an optimization technique that eliminates unnecessary branches in the search tree, improving efficiency. The working principles of both algorithms through detailed examples and highlights their properties, including completeness, optimality, and time and space complexity.
Typology: Summaries
1 / 11
This page cannot be seen from the preview
Don't miss anything!







2a) Adversarial search is a search in which two or more agents with conflicting goals are trying to search the same search space for a solution with an aim to optimise their outcomes while considering the actions of their adversaries. It comes in handy in the following situations: Playing board games like chess, checkers, Go, Connect Four, Backgammon. Here it can be used to visualize optimal strategies to win against a human or computer opponent with the different search algorithms. Puzzle solving. Using adversarial search algorithms comes up with the best sequence of moves or actions which can achieve a desired outcome and solve puzzles. b) Min-Max Search This is a recursive backtracking search algorithm used to for decision making. It provides an optimal move for the player assuming that the opponent is also playing optimally. It is used to play in two or more player games in which one player's loss or gain results entirely in another player's gain or loss. Otherwise known as zero sum games. In this algorithm, there are two players, the Maximizer (Max) and the Minimizer (Min) The algorithm generates the search tree for all possible scenarios of the game and performs a depth-first search algorithm for the exploration of the game tree. It proceeds from the start node to the terminal node of the tree. Working of Min-Max Algorithm: o The working of the minimax algorithm can be easily described using an example. Below we have taken an example of game-tree which is representing the two-player game. o In this example, there are two players one is called Maximizer and other is called Minimizer. o Maximizer will try to get the Maximum possible score, and Minimizer will try to get the minimum possible score.
o This algorithm applies DFS, so in this game-tree, we must go all the way through the leaves to reach the terminal nodes. o At the terminal node, the terminal values are given so we will compare those value and backtrack the tree until the initial state occurs. Following are the main steps involved in solving the two-player game tree: Step-1: In the first step, the algorithm generates the entire game-tree and apply the utility function to get the utility values for the terminal states. In the below tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes first turn which has worst-case initial value =- infinity, and minimizer will take next turn which has worst-case initial value = +infinity. Step 2: Now, first we find the utilities value for the Maximizer, its initial value is - ∞ , so we will compare each value in terminal state with initial value of Maximizer and determines the higher nodes values. It will find the maximum among all. o For node D max(-1,- - ∞) => max(-1,4)= 4 o For Node E max(2, - ∞) => max(2, 6)= 6
Step 4: Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and find the maximum value for the root node. In this game tree, there are only 4 layers, hence we reach immediately to the root node, but in real games, there will be more than 4 layers. o For node A max(4, -3)= 4
That was the complete workflow of the minimax two player game. Properties of Mini-Max algorithm: o Complete- Min-Max algorithm is Complete. It will find a solution (if it exists), in the finite search tree. o Optimal- Min-Max algorithm is optimal if both opponents are playing optimally. o Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-Max algorithm is O(bm) , where b is branching factor of the game-tree, and m is the maximum depth of the tree. o Space Complexity- Space complexity of Mini-max algorithm is also like DFS which is O(bm). c) α – β Pruning
Step 2: At Node D, the value of α will be calculated as its turn for Max. The value of α is compared with firstly 2 and then 3, and the max (2, 3) = 3 will be the value of α at node D and node value will also 3. Step 3: Now algorithm backtrack to node B, where the value of β will change as this is a turn of Min, Now β= + ∞, will compare with the available subsequent nodes value, i.e. min ( ∞, 3) = 3, hence at node B now α= - ∞, and β= 3. In the next step, algorithm traverse the next successor of Node B which is node E, and the values of α= - ∞, and β= 3 will also be passed. Step 4: At node E, Max will take its turn, and the value of alpha will change. The current value of alpha will be compared with 5, so max (- ∞, 5) = 5, hence at node
E α= 5 and β= 3, where α>=β, so the right successor of E will be pruned, and algorithm will not traverse it, and the value at node E will be 5. Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At node A, the value of alpha will be changed the maximum available value is 3 as max (- ∞, 3)= 3, and β= + ∞, these two values now passes to right successor of A which is Node C. At node C, α=3 and β= + ∞, and the same values will be passed on to node F. Step 6: At node F, again the value of α will be compared with left child which is 0, and max(3,0)= 3, and then compared with right child which is 1, and max(3,1)= 3 still α remains 3, but the node value of F will become 1.
Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) =