1 / 41

The Shape of a Game Tree Fragment

The Shape of a Game Tree Fragment. Standard - is an algorithm which performs the same computation as minimax for a given tree - avoiding generating useless parts of that tree.

Download Presentation

The Shape of a Game Tree Fragment

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. The Shape of a Game Tree Fragment • Standard - is an algorithm which performs the same computation as minimax for a given tree - avoiding generating useless parts of that tree. • Quiescence Search can be seen as a method for defining the shape of a tree by means other than truncating it at a fixed depth. • Quiescence Search can be used as an evaluation function at the leaves of an - search (or any other for that matter, even itself: Second Order Quiescence). • It allows further search to be used as if it were a static evaluation function. • Null-Move Quiescence Search generates at least a fringe of null-moves one ply beyond the normal fixed depth of the tree (though null moves are very cheap) COMP4031 Artificial Intelligence for Games and Puzzles

  2. Null Move Quiescence as an Evaluation Function NMQuiesce (real lower, real upper) /* initially -, + */ {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  3. Animation of Null-Move Quiescence Search • Nodes in search tree generally have six attributes: • After consideration of a node is complete, collapse it to: • Integers, not reals, will be used for simplicity. COMP4031 Artificial Intelligence for Games and Puzzles

  4. What is the value of the position? NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  5. Generate null move  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  6. Generate null move and evaluate it  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  7. Use that evaluation  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  8. Since 0 < +, generate 1st real move  K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  9. Start with null move  K-h3  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  10. Statically evaluate  K-h3  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  11. Use that evaluation  K-h3  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  12. Since “best 0” <= “upper 0”,  K-h3  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  13. Since “best 0” <= “upper 0”, immediately return 0   NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  14. 0 = 0, and 0 < +, so generate next move available  NxP  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  15. Obtain null-move evaluation  NxP   NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  16. Since “upper 0” > “best -1”, try 1st move  NxP   K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} COMP4031 Artificial Intelligence for Games and Puzzles

  17. Obtain null-move evaluation  NxP   K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}  COMP4031 Artificial Intelligence for Games and Puzzles

  18. Now “best +1” >= “upper +1”,  NxP   K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}  COMP4031 Artificial Intelligence for Games and Puzzles

  19. Now “best +1” >= “upper +1”, so return value +1  NxP   K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}  COMP4031 Artificial Intelligence for Games and Puzzles

  20. Try another move  NxP   BxN  COMP4031 Artificial Intelligence for Games and Puzzles

  21. Null move evaluation  NxP   BxN   COMP4031 Artificial Intelligence for Games and Puzzles

  22. “best -2” < “upper +1”, so off again …  NxP   BxN   COMP4031 Artificial Intelligence for Games and Puzzles

  23. Try a move  NxP   BxN   K-h3 COMP4031 Artificial Intelligence for Games and Puzzles

  24. Use null move evaluation, test, return  NxP   BxN   K-h3 COMP4031 Artificial Intelligence for Games and Puzzles

  25. Try another move  NxP   BxN   P-f4 COMP4031 Artificial Intelligence for Games and Puzzles

  26. Try all moves in turn  NxP   BxN K-g1   COMP4031 Artificial Intelligence for Games and Puzzles

  27. Eventually settling on a value  NxP   BxN K-g1   COMP4031 Artificial Intelligence for Games and Puzzles

  28. .. Which is returned  NxP   BxN K-g1   COMP4031 Artificial Intelligence for Games and Puzzles

  29. .. Which is returned, compared  NxP   BxN K-g1   COMP4031 Artificial Intelligence for Games and Puzzles

  30. .. Which is returned, compared, found to be better  NxP   BxN K-g1   COMP4031 Artificial Intelligence for Games and Puzzles

  31. All other black moves are considered, (null not shown)  NxP   B-a3   COMP4031 Artificial Intelligence for Games and Puzzles

  32. Eventually determining a value  NxP   B-a3   COMP4031 Artificial Intelligence for Games and Puzzles

  33. Demonstrating that that capture is not good      COMP4031 Artificial Intelligence for Games and Puzzles

  34. Other moves are considered (null again not shown)  N-c3     COMP4031 Artificial Intelligence for Games and Puzzles

  35. Eventually determining a value for the initial position  N-c3     COMP4031 Artificial Intelligence for Games and Puzzles

  36. Null-Move values as bounds • The value determined for every node arises originally as the result of an evaluation of a null move. • These evaluations - assuming the position is not zugzwang - are properly thought of as providing (lower) bounds on the value of a position. (Not to be confused with alpha and beta - achievable and hope - which are bounds on the range of values one is interested in exploring.) • “The value of this position is at least N” is more reliable than • “The value of this position is N” The value of the topmost node arises not from one evaluation providing one bound, but from two or more opposing evaluations providing touching bounds. COMP4031 Artificial Intelligence for Games and Puzzles

  37. Touching bounds • The smallest possible tree for null-move quiescence: +4 -4 -4 +4 COMP4031 Artificial Intelligence for Games and Puzzles

  38. Quiescence as Evaluation • The sort of evaluation performed by QUIESCE is to be performed at every leaf node of a MINIMAX (or AlphaBeta) search. COMP4031 Artificial Intelligence for Games and Puzzles

  39. Second Order Quiescence • Since Quiescence Search can be regarded as an evaluation function, it can be used as such within another quiescence search: wherever the main quiescence search generates and evaluates a null move, that evaluation is performed using quiescence search with the real evaluation function. COMP4031 Artificial Intelligence for Games and Puzzles

  40. Evaluations that produce bounds on values • Null moves may be regarded as producing a lower bound on a position’s value. • A quiescence search that is terminated early - for example, by being restricted in terms of the depth of tree it may build or the number of nodes it may generate - may produce a “fat value” - a combination of • A reliable lower bound (assuming no zugzwang) • A reliable upper bound (assuming no zugzwang) • Possibly, an unreliable value in between • Fat values may also be produced by other means, for instance a pairing of a pessimistic evaluation function and an optimistic one. • Some search algorithms, eg Berliner’s B* algorithm, work with value ranges rather than point values. More on B* another day … COMP4031 Artificial Intelligence for Games and Puzzles

  41. Bounds on values of interest to a search • The AlphaBeta tree search algorithm uses its parameters  (achievable) and  (hope) to cut off search of parts of the game tree which cannot affect the minimaxed value ultimately found at the root. Once it is determined that a subtree’s value falls outside certain bounds, it can be abandoned. • Conventionally, AlphaBeta is started off (at a root node) in an agnostic manner: =- and =+ corresponds to having no idea what the value of the position is. • Some interesting algorithms use an AlphaBeta search with different  and : using a narrower search window in the expectation of getting more cutoffs. • Aspiration Search • NegaScout & PVS (Principal Variation Search) • Scout • MTD(f) COMP4031 Artificial Intelligence for Games and Puzzles

More Related