KEMBAR78
Min-Max algorithm | PPTX
MINMAX
ALGORITHM
Dr. C.V. Suresh Babu
(CentreforKnowledgeTransfer)
institute
Introduction
◦ Minmax is a kind of backtracking algorithm that is used in decision making and game theory to
find the optimal move for a player, assuming that your opponent also plays optimally.
◦ It is widely used in two player turn-based games such as Tic-Tac-Toe, Backgammon, Mancala,
Chess, etc.
(CentreforKnowledgeTransfer)
institute
Functions of MinMax
◦ In Minimax the two players are called maximizer
and minimizer. The maximizer tries to get the
highest score possible while the minimizer tries to
do the opposite and get the lowest score possible.
◦ Every board state has a value associated with it.
◦ In a given state if the maximizer has upper hand
then, the score of the board will tend to be some
positive value. If the minimizer has the upper hand
in that board state then it will tend to be some
negative value. The values of the board are
calculated by some heuristics
which are unique for every type
of game.
(CentreforKnowledgeTransfer)
institute
Example:
◦ Consider a game which has 4 final states and
paths to reach final state are from root to 4
leaves of a perfect binary tree as shown below.
◦ Assume you are the maximizing player and you
get the first chance to move, i.e., you are at the
root and your opponent at next level.
◦ Which move you would make as a maximizing
player considering that your opponent also
plays optimally?
(CentreforKnowledgeTransfer)
institute
◦ Since this is a backtracking based algorithm, it tries all possible moves, then backtracks and makes a
decision.
◦ Maximizer goes LEFT: It is now the minimizers turn. The minimizer now has a choice between 3 and 5. Being the
minimizer it will definitely choose the least among both, that is 3
◦ Maximizer goes RIGHT: It is now the minimizers turn. The minimizer now has a choice between 2 and 9. He will choose
2 as it is the least among the two values.
• Being the maximizer you would choose the
larger value that is 3. Hence the optimal
move for the maximizer is to go LEFT and
the optimal value is 3.
• Now the game tree looks like :
The above tree shows two possible scores when maximizer makes left and right moves.
Note: Even though there is a value of 9 on the right subtree, the minimizer will never pick that. We
must always assume that our opponent plays optimally.
(CentreforKnowledgeTransfer)
institute
Properties of min max algorithm in AI
◦ The algorithm is complete, meaning in a finite search tree, a solution will be certainly found.
◦ It is optimal if both the players are playing optimally.
◦ Due to Depth-First Search (DFS) for the game tree, the time complexity of the algorithm is
O(bm), where b is the branching factor and m is the maximum depth of the tree.
◦ Like DFS, the space complexity of this algorithm is O(bm).
(CentreforKnowledgeTransfer)
institute
Limitations
◦ A thorough assessment of the search
space is performed.
◦ Decision making in AI is easily possible.
◦ New and smart machines are developed
with this algorithm.
Advantages
• Because of the huge branching factor, the
process of reaching the goal is slower.
• Evaluation and search of all possible
nodes and branches degrades the
performance and efficiency of the engine.
• Both the players have too many choices
to decide from.
• If there is a restriction of time and space,
it is not possible to explore the entire
tree.
But with Alpha-Beta Pruning, the algorithm can be improved.
(CentreforKnowledgeTransfer)
institute
Conclusion
◦ First, an introduction of the theory is provided with examples of where it is used, after which
there is a description of how the algorithm works in a game.
◦ The algorithm is broken down to explain how a decision to make an optimal move is taken
based on moves and counter moves of the players.
◦ The properties of the algorithm are then listed.
◦ Lastly, the advantages and disadvantages of the algorithm are provided.
(CentreforKnowledgeTransfer)
institute

Min-Max algorithm

  • 1.
    MINMAX ALGORITHM Dr. C.V. SureshBabu (CentreforKnowledgeTransfer) institute
  • 2.
    Introduction ◦ Minmax isa kind of backtracking algorithm that is used in decision making and game theory to find the optimal move for a player, assuming that your opponent also plays optimally. ◦ It is widely used in two player turn-based games such as Tic-Tac-Toe, Backgammon, Mancala, Chess, etc. (CentreforKnowledgeTransfer) institute
  • 3.
    Functions of MinMax ◦In Minimax the two players are called maximizer and minimizer. The maximizer tries to get the highest score possible while the minimizer tries to do the opposite and get the lowest score possible. ◦ Every board state has a value associated with it. ◦ In a given state if the maximizer has upper hand then, the score of the board will tend to be some positive value. If the minimizer has the upper hand in that board state then it will tend to be some negative value. The values of the board are calculated by some heuristics which are unique for every type of game. (CentreforKnowledgeTransfer) institute
  • 4.
    Example: ◦ Consider agame which has 4 final states and paths to reach final state are from root to 4 leaves of a perfect binary tree as shown below. ◦ Assume you are the maximizing player and you get the first chance to move, i.e., you are at the root and your opponent at next level. ◦ Which move you would make as a maximizing player considering that your opponent also plays optimally? (CentreforKnowledgeTransfer) institute
  • 5.
    ◦ Since thisis a backtracking based algorithm, it tries all possible moves, then backtracks and makes a decision. ◦ Maximizer goes LEFT: It is now the minimizers turn. The minimizer now has a choice between 3 and 5. Being the minimizer it will definitely choose the least among both, that is 3 ◦ Maximizer goes RIGHT: It is now the minimizers turn. The minimizer now has a choice between 2 and 9. He will choose 2 as it is the least among the two values. • Being the maximizer you would choose the larger value that is 3. Hence the optimal move for the maximizer is to go LEFT and the optimal value is 3. • Now the game tree looks like : The above tree shows two possible scores when maximizer makes left and right moves. Note: Even though there is a value of 9 on the right subtree, the minimizer will never pick that. We must always assume that our opponent plays optimally. (CentreforKnowledgeTransfer) institute
  • 6.
    Properties of minmax algorithm in AI ◦ The algorithm is complete, meaning in a finite search tree, a solution will be certainly found. ◦ It is optimal if both the players are playing optimally. ◦ Due to Depth-First Search (DFS) for the game tree, the time complexity of the algorithm is O(bm), where b is the branching factor and m is the maximum depth of the tree. ◦ Like DFS, the space complexity of this algorithm is O(bm). (CentreforKnowledgeTransfer) institute
  • 7.
    Limitations ◦ A thoroughassessment of the search space is performed. ◦ Decision making in AI is easily possible. ◦ New and smart machines are developed with this algorithm. Advantages • Because of the huge branching factor, the process of reaching the goal is slower. • Evaluation and search of all possible nodes and branches degrades the performance and efficiency of the engine. • Both the players have too many choices to decide from. • If there is a restriction of time and space, it is not possible to explore the entire tree. But with Alpha-Beta Pruning, the algorithm can be improved. (CentreforKnowledgeTransfer) institute
  • 8.
    Conclusion ◦ First, anintroduction of the theory is provided with examples of where it is used, after which there is a description of how the algorithm works in a game. ◦ The algorithm is broken down to explain how a decision to make an optimal move is taken based on moves and counter moves of the players. ◦ The properties of the algorithm are then listed. ◦ Lastly, the advantages and disadvantages of the algorithm are provided. (CentreforKnowledgeTransfer) institute