1 / 33

EA C461 Artificial Intelligence Adversarial Search

VimalEA C461- Artificial Intelligence. To discuss. Game PlayingOptimal Decisions in GamesMinimax AlgorithmMultiplayer GamesAlpha-Beta Pruning. VimalEA C461- Artificial Intelligence. Game playing. One of the very first tasks AI undertookChess, with average branching factor 35, with each

sileas
Download Presentation

EA C461 Artificial Intelligence Adversarial Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. S.P.Vimal http://discovery.bits-pilani.ac.in/~vimalsp/1910AI/ EA C461 Artificial Intelligence Adversarial Search

    2. Vimal EA C461- Artificial Intelligence To discuss Game Playing Optimal Decisions in Games Minimax Algorithm Multiplayer Games Alpha-Beta Pruning

    3. Vimal EA C461- Artificial Intelligence Game playing One of the very first tasks AI undertook Chess, with average branching factor 35, with each player taking 50 steps, the number of nodes generated is 35100. Make decisions, apparently no optimal choice Inefficiencies penalized severely "Unpredictable" opponent ? specifying a move for every possible opponent reply Time limits ? unlikely to find goal, must approximate

    4. Vimal EA C461- Artificial Intelligence Problems Two players MAX, MIN Components of the problem Initial State Successor function Terminal Test Test of states where the game ends Utility function +1, 0, -1

    5. Vimal EA C461- Artificial Intelligence Game tree (2-player, deterministic, turns)

    6. Vimal EA C461- Artificial Intelligence Game strategy An optimal strategy leads to an outcome which is at least as good as playing against an infallible opponent

    7. Vimal EA C461- Artificial Intelligence Minimax Value Minimax-Value (n) = Utility(n) , if n is a terminal node MaxseSuccessors(n) Minimax-Value(s) , if n is a Max Node MinseSuccessors(n) Minimax-Value(s) , if n is a Min Node

    8. Vimal EA C461- Artificial Intelligence Minimax algorithm

    9. Vimal EA C461- Artificial Intelligence Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(bm) Space complexity? O(bm) (depth-first exploration) For chess, b 35, m 100 for "reasonable" games ? exact solution completely infeasible

    10. Vimal EA C461- Artificial Intelligence

    11. Vimal EA C461- Artificial Intelligence a- Pruning Prune away those nodes which cannot possibly influence the final outcome

    12. Vimal EA C461- Artificial Intelligence a- pruning example

    13. Vimal EA C461- Artificial Intelligence a- pruning example

    14. Vimal EA C461- Artificial Intelligence a- pruning example

    15. Vimal EA C461- Artificial Intelligence a- pruning example

    16. Vimal EA C461- Artificial Intelligence a- pruning example

    17. Vimal EA C461- Artificial Intelligence a- Pruning Minimax (root) = max( min(3,12,8), min(2,x,y), min(14,5,2) ) = max( 3, min(2,x,y), 2 ) = max( 3, z, 2 ) , z = 2 = 3

    18. Vimal EA C461- Artificial Intelligence Properties of a- Pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(bm/2) ? doubles depth of search A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

    19. Vimal EA C461- Artificial Intelligence Why is it called a-? a is the value of the best (i.e., highest-value) choice found so far at any choice point along the path for max If v is worse than a, max will avoid it ? prune that branch Define similarly for min

    20. Vimal EA C461- Artificial Intelligence Implementation The game tree is traversed in depth-first order. Each non-leaf node will have a beta value and an alpha value stored. For each max node, the minimum beta value for all its min node ancestors is stored as beta. For each min node, the maximum alpha value for all its max node ancestors is stored as alpha. Initially, the root node is assigned an alpha value of negative infinity and a beta value of infinity.

    21. Vimal EA C461- Artificial Intelligence Implementation The variable children is used to represent all of the children of the current node The following call means

    22. Vimal EA C461- Artificial Intelligence

    23. Vimal EA C461- Artificial Intelligence

    24. Vimal EA C461- Artificial Intelligence Trace alpha-beta

    25. Vimal EA C461- Artificial Intelligence Resource limits Replace utility function with heuristic function Gives an estimate of utility Replace terminal test by cur-off test

    26. Vimal EA C461- Artificial Intelligence Evaluation functions Evaluation function should Order the terminal state by its true utility Not take long time Correlate strongly with the actual chances of winning, for every non terminal states Works by calculating features of the state No of pawns possessed by each players, etc Groups features to make classes/categories of the state. Mostly evaluation function identifies the category in which the current state falls, and give an ordering of its successor with its expected utility.

    27. Vimal EA C461- Artificial Intelligence Evaluation functions Categorizing may be difficult Material value of each piece can be taken into account Pawn ?1 Knight/bishop ?3 Rook ?5 Queen ?9 Specific features like Good pawn structure King safty For chess, typically linear weighted sum of features Eval(s) = w1 f1(s) + w2 f2(s) + + wn fn(s)

    28. Vimal EA C461- Artificial Intelligence Evaluation functions Weighted linear combination of features may be poor considering the fact Bishops are more powerful in the endgame Pair of bishops slightly more worthies than a single bishop Importantly, the features are not the part of the rules of the game ? They come out of experience Experience suggests that, secured material advantage has more chance of winning, when all other things being equal A 3 point advantage near the end of the game is sufficient to ensure victory Bishop is indeed worth 3 pawns

    29. Vimal EA C461- Artificial Intelligence Cutting off search Replace terminal test with the cutoff function If CUTOFF-TEST (state, depth) then return EVAL (state) Apply evaluation functions only to quiescent positions, positions unlikely to exhibit a wild swing Generate around million nodes/second in latest PC Given 3 mins to make a move approximately 200 million nodes can be generated With b=35, this implies 5 levels of look ahead (minimax) With alpha-beta we get around 10 ply look ahead

    30. Vimal EA C461- Artificial Intelligence Cutting off search Minimax Selects optimal move, given the leave evaluations are exactly correct. Evaluations at leave are mostly estimations Evaluation functions can be probability distribution over a set of possible values

    31. Vimal EA C461- Artificial Intelligence Chess in Gaming Literature 1957 Herbert Simon 10 years computer will beat human world champion 1997 Deep Blue defeated Gary Kasparov Six-Game Exhibition Match Deep Blue Running as parallel computer, 30 IBM RS/6000 running software search, 480 custom VLSI chess processors generates moves and orders them Hardware search for last few levels of the tree 126 million nodes/second average with the peak speed of 300 million nodes/sec

    32. Vimal EA C461- Artificial Intelligence Chess in Gaming Literature Used standard iterative deepening alpha-beta search with transposition tables Max depth approx 40 plies Evaluation function with 8000 features About 4000 opening positions, consensus recommendations from the database of 700,000 grandmaster games Large solved end game database (all positions with 5 pieces, as many as 6 pieces) 2002 FRITZ (on ordinary PC) Vladimir Kramnik drawn

    33. Vimal EA C461- Artificial Intelligence Summary Games are fun to work on! They illustrate several important points about AI perfection is unattainable ? must approximate good idea to think about what to think about

More Related