Game Search & Constrained Search CMSC 25000 Artificial Intelligence January 18, 2005.

Slides:



Advertisements
Similar presentations
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Advertisements

Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Constraint Satisfaction Problems
Searching for Solutions Artificial Intelligence CSPP January 14, 2004.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Chapter 5 Outline Formal definition of CSP CSP Examples
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Minimax with Alpha Beta Pruning The minimax algorithm is a way of finding an optimal move in a two player game. Alpha-beta pruning is a way of finding.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
GAME PLAYING 1. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: 1.They provide a structured task.
Chapter 5 Constraint Satisfaction Problems
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Constraint Propagation Artificial Intelligence CMSC January 22, 2002.
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
CS-424 Gregory Dudek Lecture 10 Annealing (final comments) Adversary Search Genetic Algorithms (genetic search)
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Constraint Propagation CS121 – Winter Constraint Propagation2 Constraint Propagation … … is the process of determining how the possible values of.
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Announcements Homework 1 Full assignment posted..
Last time: search strategies
PENGANTAR INTELIJENSIA BUATAN (64A614)
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
CSCI 5582 Artificial Intelligence
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Games & Adversarial Search
Games & Adversarial Search
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Artificial Intelligence
Constraint Propagation
Artificial Intelligence Chapter 12 Adversarial Search
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Games & Adversarial Search
Games & Adversarial Search
Game Search & Constrained Search
Kevin Mason Michael Suggs
Artificial Intelligence
The Alpha-Beta Procedure
Minimax strategies, alpha beta pruning
Constraint satisfaction problems
Game Playing Fifth Lecture 2019/4/11.
Mini-Max search Alpha-Beta pruning General concerns on games
Search.
Search.
Games & Adversarial Search
Games & Adversarial Search
Minimax strategies, alpha beta pruning
Constraint satisfaction problems
Games & Adversarial Search
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Game Search & Constrained Search CMSC Artificial Intelligence January 18, 2005

Roadmap I Searching for the right move –Review adversial search, minimax –Alpha-beta pruning, optimality –State-of-the-art: Specialized techniques –Dealing with chance

Games as Search Nodes = Board Positions Each ply (depth + 1) = Move Special feature: –Two players, adversial Static evaluation function –Instantaneous assessment of board configuration –NOT perfect (maybe not even very good)

Minimax Lookahead Modeling adversarial players: –Maximizer = positive values –Minimizer = negative values Decisions depend on choices of other player Look forward to some limit –Static evaluate at limit –Propagate up via minimax

Minimax Procedure If at limit of search, compute static value Relative to player If minimizing level, do minimax –Report minimum If maximizing level, do minimax –Report maximum

Minimax Search

Minimax Analysis Complete: –Yes, if finite tree Optimal: –Yes, if optimal opponent Time: –b^m Space: –bm (progressive deepening DFS) Practically: Chess: b~35, m~100 –Complete solution is impossible ~2.5*10^154

Minimax Example MAX MIN

Alpha-Beta Pruning Alpha-beta principle: If you know it’s bad, don’t waste time finding out HOW bad May eliminate some static evaluations May eliminate some node expansions

Simple Alpha-Beta Example MAX MIN 27 2 >=2 1 <=1 2

Alpha-Beta Pruning

Alpha-Beta Procedure If level=TOP_LEVEL, alpha = NEGMAX; beta= POSMAX If (reached Search-limit), compute & return static value of current If level is minimizing level, While more children to explore AND alpha < beta ab = alpha-beta(child) if (ab < beta), then beta = ab Report beta If level is maximizing level, While more children to explore AND alpha < beta ab = alpha-beta(child) if (ab > alpha), then alpha = ab Report alpha

Alpha-Beta Pruning Analysis Worst case: –Bad ordering: Alpha-beta prunes NO nodes Best case: –Assume cooperative oracle orders nodes Best value on left “If an opponent has some response that makes move bad no matter what the moving player does, then the move is bad.” Implies: check move where opposing player has choice, check all own moves

Optimal Alpha-Beta Ordering

Optimal Ordering Alpha-Beta Significant reduction of work: –11 of 27 static evaluations Lower bound on # of static evaluations: –if d is even, s = 2*b^d/2-1 –if d is odd, s = b^(d+1)/2+b^(d-1)/2-1 Upper bound on # of static evaluations: –b^d Reality: somewhere between the two –Typically closer to best than worst

Heuristic Game Search Handling time pressure –Focus search –Be reasonably sure “best” option found is likely to be a good option. Progressive deepening –Always having a good move ready Singular extensions –Follow out stand-out moves

Progressive Deepening Problem: Timed turns –Limited depth If too conservative, too shallow If too generous, won’t finish Solution: –Always have a (reasonably good) move ready –Search at progressively greater depths: 1,2,3,4,5…..

Progressive Deepening Question: Aren’t we wasting a lot of work? –E.g. cost of intermediate depths Answer: (surprisingly) No! –Assume cost of static evaluations dominates –Last ply (depth d): Cost = b^d –Preceding plies: b^0 + b^1+…b^(d-1) (b^d - 1)/(b -1) –Ratio of last ply cost/all preceding ~ b - 1 –For large branching factors, prior work small relative to final ply

Singular Extensions Problem: Explore to some depth, but things change a lot in next ply –False sense of security –aka “horizon effect” Solution: “Singular extensions” –If static value stands out, follow it out –Typically, “forced” moves: E.g. follow out captures

Additional Pruning Heuristics Tapered search: –Keep more branches for higher ranked children Rank nodes cheaply Rule out moves that look bad Problem: –Heuristic: May be misleading Could miss good moves

Due to Russell and Norvig Deterministic Games

Games with Chance Many games mix chance and strategy –E.g. Backgammon –Combine dice rolls + opponent moves Modeling chance in game tree –For each ply, add another ply of “chance nodes” –Represent alternative rolls of dice One branch per roll Associate probability of roll with branch

Expectiminimax:Minimax+Chance Adding chance to minimax –For each roll, compute max/min as before Computing values at chance nodes –Calculate EXPECTED value –Sum of branches Weight by probability of branch

Expecti… Tree

Summary Game search: –Key features: Alternating, adversarial moves Minimax search: Models adversarial game Alpha-beta pruning: –If a branch is bad, don’t need to see how bad! –Exclude branch once know can’t change value –Can significantly reduce number of evaluations Heuristics: Search under pressure –Progressive deepening; Singular extensions

Constraint Propagation Artificial Intelligence CMSC January 18, 2005

Agenda Constraint Propagation: Motivation Constraint Propagation Example –Waltz line labeling Constraint Propagation Mechanisms –Arc consistency –CSP as search Forward-checking Back-jumping Summary

Leveraging Representation General search problems encode task- specific knowledge –Successor states, goal tests, state structure –“black box” wrt to search algorithm Constraint satisfaction fixes representation –Variables, values, constraints –Allows more efficient, structure-specific search

Constraint Satisfaction Problems Very general: Model wide range of tasks Key components: –Variables: Take on a value –Domains: Values that can be assigned to vars –Constraints: Restrictions on assignments Constraints are HARD –Not preferences: Must be observed E.g. Can’t schedule two classes: same room, same time

Constraint Satisfaction Problem Graph/Map Coloring: Label a graph such that no two adjacent vertexes same color –Variables: Vertexes –Domain: Colors –Constraints: If E(a,b), then C(a) != C(b)

Constraint Satisfaction Problems Resource Allocation: –Scheduling: N classes over M terms, 4 classes/term –Aircraft at airport gates Satisfiability: e.g. 3-SAT –Assignments of truth values to variables such that 1) consistent and 2) clauses true

Constraint Satisfaction Problem “N-Queens”: –Place N queens on an NxN chessboard such that none attacks another –Variables: Queens (1/column) –Domain: Rows –Constraints: Not same row, column, or diagonal

N-queens Q1 Q2 Q3 Q4

Constraint Satisfaction Problem Range of tasks: –Coloring, Resource Allocation, Satisfiability –Varying complexity: E.g. 3-SAT NP-complete Complexity: Property of problem NOT CSP Basic Structure: –Variables: Graph nodes, Classes, Boolean vars –Domains: Colors, Time slots, Truth values –Constraints: No two adjacent nodes with same color, No two classes in same time, consistent, satisfying ass’t

Problem Characteristics Values: –Finite? Infinite? Real? Discrete vs Continuous Constraints –Unary? Binary? N-ary? Note: all higher order constraints can be reduced to binary

Representational Advantages Simple goal test: –Complete, consistent assignment Complete: All variables have a value Consistent: No constraints violates Maximum depth? –Number of variables Search order? –Commutative, reduces branching –Strategy: Assign value to one variable at a time