Upcoming SlideShare
×

# Minimax

22,075 views

Published on

Minimax in artificial intelligence

38 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No

Are you sure you want to  Yes  No

Are you sure you want to  Yes  No
Views
Total views
22,075
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
0
2
Likes
38
Embeds 0
No embeds

No notes for slide

### Minimax

1. 1. “The capacity to learn and solve problems “ in particular The ability to solve novel problems The ability to act rationally The ability to act like humans Intelligence exhibited by an artificial entity. BASICALLY : Putting human intelligence into a machine.
2. 2. Human Intelligence is not fully understood. There is no method of determining when a machine is actually intelligent
3. 3. Simulates human thoughts and actions Matches or exceeds human intelligence Example : Robots in movie Matrix, Terminator Upcoming : Endiran
4. 4. To understand human intelligence better To create useful “smart” programs
5. 5. Minimax is a procedure used for minimizing the possible loss while maximizing the potential gain Originally formulated for two player game To be simpler Considering for two player games, the players are referred to as MAX (the player) and MIN( the opponent). MAX is the player trying to maximize its score and MIN is the opponent trying to minimize MAX’s score.
6. 6. Let me have two players MAX and MIN BASIS : Assume opponent best move TASK : To find a “best” move for MAX ASSUME : MAX moves first & then MIN moves thus alternatively TYPE : Win , lose or draw
7. 7. Say each configuration has an evaluation number High number favor the player So we want to choose moves which maximize evaluation Low number favors the opponent So they will choose moves which minimize evaluation
8. 8. You (Computer) assume that the opponent will choose the minimizing move next(After your move) So you now choose the best move under assumption i.e maximum (highest value) option considering both your move and the Opponent’s optimal move
9. 9. TIC TAC TOE TYPE : DRAW
10. 10. TYPE : WIN
11. 11. AN OPTIMAL PROCEDURE  Designed to find the optimal strategy for Max and find best move: 1. Generate the whole game tree to leaves 2. Apply evaluation function to leaves 3. Back-up values from leaves toward the root:  a Max node computes the max of its child values  a Min node computes the Min of its child values 4. When value reaches the root: choose max value and the corresponding move.  However: It is impossible to develop the whole search tree, instead develop part of the tree and evaluate static evaluation function.
12. 12. Static (Heuristic) Evaluation Functions An Evaluation Function ◦ estimates how good the current board configuration is for a player. ◦ Typically, one figures how good it is for the player, and how good it is for the opponent, subtracts the opponents score from the players E(n) = M(n)- O(n)  Values ranges from -infinity (loss) to +infinity (win) or [-1, +1].  If the board evaluation is X for a player, it’s -X for the opponent Example: ◦ Evaluating chess boards, ◦ Checkers ◦ Tic-tac-toe
13. 13. Calculating Evaluation Function for tic-tac-toe  The static evaluation function
14. 14. miniMAX Algorithm Algorithm MINIMAX(Position, Depth, Player) 1. If DEEP-ENOUGH( Position, Depth), then return the structure VALUE = EVA-Fn( Position, Player); PATH = nil This indicates that there is no path from this node and that its value is that found by evaluation function. 2. Otherwise, generate one more search of the tree by calling the function MOVE-GEN( Position, Player) and setting SUCCESSORS to the list it returns. 3. If SUCCESSORS is empty, then there are no moves to be made, so return the same structure as DEEP-ENOUGH 4. If SUCCESSORS is not empty, then examine each element in turn and keep track of the best one. The best move for the player is selected upon the maximum returning value of the tree node
15. 15. Example- Tic Tac Toe
16. 16. TYPE: WIN
17. 17. Properties of minMAX Complete? - Yes(if tree is finite) Optimal? - Yes(against an optimal opponent) Time Complexity? O(bm ) Space Complexity? O(bm) (depth first exploration)
18. 18. minMAX Overview • MINMAX the heart of almost every computer board game • Applies to games where • Players take turns • Underlying assumption • Have perfect information • But can work form games without perfect information or chance E.g: Poker,Monopoles,Dice • Can work in real time(i.e. not turn based) with timer
19. 19. Summarizing • Basic concepts of AI • MiniMAX procedure • MiniMAX principle • Optimal procedure • Minimax algorithm & an example • Properties & Overview
20. 20. Chess is a game played by two people on a chessboard, with 32 pieces (16 for each player) of six types. Each type of piece moves in a distinct way. The goal of the game is to checkmate, i.e. to threaten the opponent's king with inevitable capture. Games do not necessarily end with checkmate – players often resign if they believe they will lose. In addition, there are several ways that a game can end in a draw.
21. 21. HOW MINIMAX Player MAX starts with white coins and makes the move Player MIN moves with black coins after the MAX makes the move The MAX keeps up the move assuming the MIN next move i.e The MAX makes the best move assuming the opponent MIN move The MIN also tries to defeat MAX by making good moves
22. 22. What is functional network ? A group of variables, which have measurable values, and interact in some way such that the value of one variable affects the value of another. In the image to the left, the variables are represented by circles, and the functional interactions by arrows. Idea is to minimize the maximum absolute error between predicted and observed values.
23. 23. Cards are shuffled and distrubuted The player with the highest rank showing, is the first to speak and to bet. He can either bet or check. By saying 'Check', he passes the decision to bet to the next player who can also check. If all players check, then it is the end of the round. Everyone opens his cards and the highest hand wins. HOW MINIMAX The player with highest ranking is consider as MAX and he makes the best move to win The other player tries to minimize the opponent by not passing the essential card The player MAX plays so efficiently assuming the opponents move
24. 24. The first player rolls the dice and mark off the number rolled starting on the "1" spot on the board. All players take turns rolling the dice and moving their markers. If the marker reaches the number which has bottom of the ladder he climbs the ladder and go to the top of the ladder and continue from there, and If the marker reaches the number which has the face of the snake then he needs to go down to the box where it has its tail and continue from there. HOW MINIMAX First the player MAX makes the move when he get “1” on the dice. Now the opponenet MIN chance is less than MAX since MAX started to move When MIN tries to make a move after it enters it moves in such a way that it minimize that is cut off the coins of MAX in the board Knowing the move of MIN the MAX always tries to make best move to safe itself from min and also to win