12.07.2015 Views

COMP9414: Artificial Intelligence Adversarial Search - AI Study

COMP9414: Artificial Intelligence Adversarial Search - AI Study

COMP9414: Artificial Intelligence Adversarial Search - AI Study

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 2<strong>COMP9414</strong>: <strong>Artificial</strong> <strong>Intelligence</strong><strong>Adversarial</strong> <strong>Search</strong><strong>Adversarial</strong> <strong>Search</strong> In many problems — especially game playing — you’re are pittedagainst an opponent This means that certain operators are beyond your controlWayne WobckeRoom J17-433wobcke@cse.unsw.edu.auBased on slides by Maurice Pagnucco That is, you cannot control your opponent’s moves You cannot search the entire space from the outset looking for asolution since your opponent may make a move which makes anypath you find obsolete What you need is a strategy that leads to a winning position regardlessof how your opponent plays<strong>COMP9414</strong> c○UNSW, 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 1<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 3<strong>Adversarial</strong> <strong>Search</strong> Shall investigate two uses of search where we can apply otherstrategies to search the state space In particular we shall investigate adversarial search in which wesearch through a space where not all operators (choices) are under ourcontrol We shall also briefly discuss constraint satisfaction problemsOverview Minimax Alpha-Beta Pruning Constraint Satisfaction as <strong>Search</strong> Conclusion Reference:◮ Ivan Bratko, Prolog Programming for <strong>Artificial</strong> <strong>Intelligence</strong>,Addison-Wesley, 2001. (Chapter 22)◮ Stuart J. Russell and Peter Norvig, <strong>Artificial</strong> <strong>Intelligence</strong>: AModern Approach, Second Edition, Pearson Education, 2003.(Chapter 6)<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004


<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 8Minimax Algorithm<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 10Alpha-Beta Pruningfunction MinimaxValue(state, game) returns utility valueif TerminalTest[game](state)then return Utility[game](state)else if Max is to move in statethen return highest MinimaxValue of successors(state)else return lowest MinimaxValue of successors(state) Idea: Consider node n in search tree such that certain player has achoice of moving to that node If the player has a better choice m either at the parent node of n, orat any choice point further up, then n will never be reached in actualplay Once we have ascertained enough information about n by looking atsome of its successors to reach this decision, we can prune it<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 9Alpha-Beta Pruning<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 11Alpha-Beta Pruning In most games it will be impossible to try and calculate minimax asdescribed — the game tree will be just too big There is however a way of pruning the amount of work to be doneand still make the correct minimax decision Pruning — elimination of branches from the search withoutexamination Alpha-beta pruning returns a pruned minimax treemn<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004


<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 12Alpha-Beta Pruning<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 14Alpha-Beta Pruning Algorithm Minimax is depth-first At any point we only have to consider the nodes on a single path inthe search tree Suppose α is the value of the best choice for Max on the path and βthe value of the best choice for Min on the path Alpha-beta updates the values of α and β and prunes any subtree assoon as it can determine whether it is worse than the current α or βfunction MaxValue(state, game, α, β) returns minimax value of stateif CutoffTest(state) then return Eval(state)for each s in Successors(state) doα ← Max(α,MinValue(s, game, α,β))if α ≥ β then return βreturn αfunction MinValue(state, game, α, β) returns minimax value of stateif CutoffTest(state) then return Eval(state)for each s in Successors(state) doβ ← Min(β,MaxValue(s, game, α,β))if β ≤ α then return αreturn β<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 13Alpha-Beta Pruning Example<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 15Games of ChanceMax5Min 5


<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 16Constraint Satisfaction Problems<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 18Conclusion Constraint Satisfaction Problems (CSPs) are problems in which statesare defined by the values taken by a set of variables and the goal testspecifies a set of constraints the values must satisfy Problems that can be expressed as CSPs: N-queens, VLSI layout,scheduling, cryptarithmetic Can use search to look for an assignment of values to variables suchthat the constraints are satisfied CSP has become a powerful and commonly used technique in <strong>AI</strong>with its own algorithms for determining variable assignments (e.g.arc consistency, hill climbing, simulated annealing, etc.) <strong>Search</strong> is a common technique in problem solving especially whenour knowledge of the problem or domain is limited It is important to spend some time thinking about the problem inorder to decide how the problem states will be represented and whichsearch strategy to apply We have only investigated a small number of search techniques We have examined some uninformed (blind) and informed (heuristic)strategies plus some techniques for adversarial search and constraintsatisfaction problems<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004<strong>COMP9414</strong>, Wednesday 24 March, 2004 <strong>Adversarial</strong> <strong>Search</strong> 17Constraint Satisfaction ProblemsS E N DM O R E+MO N E Y<strong>COMP9414</strong> c○UNSW, 2004 Generated: 31 March 2004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!