Download presentation

Presentation is loading. Please wait.

Published byJewel Mathews Modified about 1 year ago

1
Search Strategies

2
Tries – for word searchers, spell checking, spelling corrections Digital Search Trees – for searching for frequent keys (in text, databases, applications) Min-max search – for optimal move search in games Alpha-beta pruning – improvement of min- max search Branch-and-bound – algorithmic technique to limit the search

3
In chess, both players know where the pieces are, they alternate moves, and they are free to make any legal move. The object of the game is to checkmate the other player, to avoid being checkmated, or to achieve a draw if that's the best thing given the circumstances. A chess program selects moves via use of a search function. A search function is a function that is passed information about the game, and tries to find the best move for side that the program is playing.

4
Min-max search is used on a B-tree like structure representing the space of all possible moves. Initial state of every game is a large B-tree, then a tree-search finds the move that would be selected if both sides were to play the best possible moves.

5
Let's say that at the root position (the position on the board now), it's White's turn to move. The Max function is called, and all of White's legal moves are generated. In each resulting position, the "Min" function is called. The "Min" function scores the position and returns a value. Since it is White to move, and White wants a more positive score if possible, the move with the largest score is selected as best, and the value of this move is returned. The "Min" function works in reverse. The "Min" function is called when it's Black's turn to move, and black wants a more negative score, so the move with the most negative score is selected. These functions are dual recursive, meaning that they call each other until the desired search depth is reached. When the functions "bottom out", they return the result of the "Evaluate" function.

6
Alpha - Beta Pruning ◦ a technique that improves upon the minimax algorithm by ignoring branches on the game tree that do not contribute further to the outcome.

7
◦ The basic idea behind this modification to the minimax search algorithm is the following. During the process of searching for the next move, not every move (i.e. every node in the search tree) needs to considered in order to reach a correct decision. ◦ In other words, if the move being considered results in a worse outcome than our current best possible choice, then the first move that the opposition could make which is less then our best move will be the last move that we need to look at.

8

9
function Max-Value(state, game, œ, ß) returns the mimimax value of state inputs: state, current state in the game game, game description œ, the best score for MAX along the path to state ß, the best score for MIN along the path to state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do œ = ß then return ß end return œ function Min-Value(state, game, œ, ß) returns the mimimax value of state if CUTOFF-TEST(state) then return EVAL(state) for each s in SUCCESSORS(state) do ß <-- MIN(ß,MAX-VALUE(s,game,œ,ß)) if ß <= œ then return œ end return ß

10
With the previously listed assumptions taken into account the following gains\improvements can be calculated. With Alpha-Beta Pruning the number of nodes on average that need to be examined is O(bd/2) as opposed to the Minimax algorithm which must examine 0(bd) nodes to find the best move. In the worst case Alpha-Beta will have to examine all nodes just as the original Minimax algorithm does. But assuming a best case result this means that the effective branching factor is b(1/2) instead of b. For a chess game, which normally has a branching factor of 35, the branching factor will be reduced to 6! It means that a chess program running Alpha - Beta could look ahead twice as far in the same amount of time, improving the skill level of our chess program from a novice to an expert level player.

11
Definition: An algorithmic technique to find the optimal solution by keeping the best solution found so far. If a partial solution cannot improve on the best, it is abandoned.

12
For instance, suppose we want to find the shortest route from Zarahemla to Manti, and at some time the shortest route found until that time is 387 kilometers. Suppose we are to next consider routes through Cumeni. If the shortest distance from Zarahemla to Cumeni is 350 km and Cumeni is 46 km from Manti in a straight line, there is no reason to explore possible roads from Cumeni: they will be at least 396 km ( ), which is worse than the shortest known route. So we need not explore paths from Cumeni.

13
The method can be implemented as a backtracking algorithm, which is a modified depth-first search, or using a priority queue ordering partial solutions by lower bounds. backtracking depth-first searchpriority queue

14
Chess Checkers Tic-tac-toe Other games

15

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google