170 likes | 279 Vues
Dive into strategies for improving Minimax algorithm with depth-limited DFS, alpha-beta pruning, and optimized evaluation functions to enhance game search efficiency. Learn from examples and overcome common pitfalls in game search algorithms.
E N D
administrivia • Exam format – take home, open book • Suicide rule for King’s court Illegal moves cannot move last piece from court OK D Goforth - COSC 4117, fall 2003
Focusing Game Search improvements on Minimax
Minimax in large state space maximization minimization heuristic evaluation from viewpoint of Max see p.166, Fig. 6.3 D Goforth - COSC 4117, fall 2003
Minimax depth-limited DFS (1) maximization >-∞,<=3 minimization 3 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Minimax depth-limited DFS (2) >=-1,<∞ maximization -1 minimization 3 2 -1 4 0 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Minimax depth-limited DFS (3) >=-1,<∞ maximization -2 -1 -2 3 2 -1 4 0 0 3 2 1 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Minimax depth-limited DFS (4) 1 -2 -1 1 minimization -2 1 3 2 -1 4 0 0 3 2 1 1 4 5 1 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Alpha-beta pruning (3’a) >=-1,<∞ maximization >-∞,<=0 -1 minimization 3 2 -1 4 0 0 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Alpha-beta pruning (3’b) >=-1,<∞ maximization -1 >-∞,<=-2 minimization -2 3 2 -1 4 0 0 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Alpha-beta pruning (4’) 1 >-∞,<=-2 -1 1 -2 1 3 2 -1 4 0 0 1 4 5 1 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Alpha beta pruning • alpha, beta are limits on evaluation of non-terminal node • eliminates some search at no risk • optimized alpha-beta can reduce branching factor n n1/2 double depth of search with same cost D Goforth - COSC 4117, fall 2003
1 1 1 1 4 5 Factor: order of traversal 1 <=-1 <=-2 0 -1 0 2 3 4 -2 1 2 3 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
1 1 1 1 4 5 How to improve order 1 expand in order of heuristic evaluation 0 -1 3 <=-1 <=-2 0 -1 0 2 3 4 -2 1 2 3 heuristic evaluation from viewpoint of Max: bigger better for Max D Goforth - COSC 4117, fall 2003
Problems with Minimax • searching to edge of disaster - lack of ‘quiescence’ – values don’t change a lot from ply to ply • horizon effect – search finds a path that delays but doesn’t avoid bad move • partial solution: singular extension – mini-search beyond chosen path D Goforth - COSC 4117, fall 2003
Pruning with risk • alpha beta pruning is proven to find best solution • other methods risk missing best solution • forward pruning: eliminate branches based on preliminary evaluation • absolute: below certain value • competitive: limit branching factor • extended rules: ignore entirely some expansions D Goforth - COSC 4117, fall 2003
Evaluation functions • properties • optimistic, well ordered (if possible) • efficient, fast • features correlated to win/loss • functions of state (incremental maintenance) • combine in weighted evaluation function • best model for ‘tuning’ D Goforth - COSC 4117, fall 2003
Evaluation function: example e.g. King’s Court: • f1: difference in number of pieces in Court • f2: number of pieces vulnerable to jumping by opponent evaluation = w1f1 + w2f2 where w’s weigh relative importance of functions D Goforth - COSC 4117, fall 2003