410 likes | 557 Views
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.
E N D
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Try another move NxP BxN COMP4031 Artificial Intelligence for Games and Puzzles
Null move evaluation NxP BxN COMP4031 Artificial Intelligence for Games and Puzzles
“best -2” < “upper +1”, so off again … NxP BxN COMP4031 Artificial Intelligence for Games and Puzzles
Try a move NxP BxN K-h3 COMP4031 Artificial Intelligence for Games and Puzzles
Use null move evaluation, test, return NxP BxN K-h3 COMP4031 Artificial Intelligence for Games and Puzzles
Try another move NxP BxN P-f4 COMP4031 Artificial Intelligence for Games and Puzzles
Try all moves in turn NxP BxN K-g1 COMP4031 Artificial Intelligence for Games and Puzzles
Eventually settling on a value NxP BxN K-g1 COMP4031 Artificial Intelligence for Games and Puzzles
.. Which is returned NxP BxN K-g1 COMP4031 Artificial Intelligence for Games and Puzzles
.. Which is returned, compared NxP BxN K-g1 COMP4031 Artificial Intelligence for Games and Puzzles
.. Which is returned, compared, found to be better NxP BxN K-g1 COMP4031 Artificial Intelligence for Games and Puzzles
All other black moves are considered, (null not shown) NxP B-a3 COMP4031 Artificial Intelligence for Games and Puzzles
Eventually determining a value NxP B-a3 COMP4031 Artificial Intelligence for Games and Puzzles
Demonstrating that that capture is not good COMP4031 Artificial Intelligence for Games and Puzzles
Other moves are considered (null again not shown) N-c3 COMP4031 Artificial Intelligence for Games and Puzzles
Eventually determining a value for the initial position N-c3 COMP4031 Artificial Intelligence for Games and Puzzles
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
Touching bounds • The smallest possible tree for null-move quiescence: +4 -4 -4 +4 COMP4031 Artificial Intelligence for Games and Puzzles
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
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
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
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