search in combinatorial spaces: fun with puzzles and games bart massey (physics '87) asst....
TRANSCRIPT
![Page 1: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/1.jpg)
Search In Combinatorial Spaces:Fun with puzzles and games
Bart Massey (Physics '87)Asst. Prof. Computer Science
Portland State [email protected]
![Page 2: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/2.jpg)
● Vernor Vinge: Usenix 2005 Keynote Talk: Possible Futures of Software– exponential collapse– indefinite exponential growth (!)– exponential saturation
● Key point – two kinds of computation– boring polytime– NP-hard and worse
● Puzzles and games “don't scale”– given P≠NP, strong polytime thesis
Why puzzles and games?
![Page 3: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/3.jpg)
Topics
● About the problem● Search spaces induced by puzzles & games● Single-agent search
– complete– local
● Adversary search● Some p&g I've been playing with
– a word puzzle– optimal Boggle boards– optimal 2-player Yahtzee
![Page 4: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/4.jpg)
P vs NP
● Instance vs Problem vs Class● Decision problems and instance size● Completeness for class: reductions● P: Class of problems solvable in time
(bounded by) polynomial in size of instance● NP: Class of problems with a cert
checkable in P – “guess and check”● P=NP? NP=co-NP? NP-complete?● PSPACE, EXPTIME
![Page 5: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/5.jpg)
Why Search
● Idea: Examine only tractable instances of hard problems!– everything is constant time/space :-)– these instances matter most anyhow
● But how?– clever mathematics (too hard for me)– brute force (too slow)– brute force and trickery
![Page 6: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/6.jpg)
Example: Magnetic Letters
● Found on the side of a file cabinet: L = wretch sprightly plumb divvy smudge off knock jazz wjxxbqqn
● Question: Can all the letters be used simultaneously to make words?
● Consider the various large spaces– 2**|D| sets of words (omitting dupes!):
find a largest collection covered by L– huge number of ordered partitions of L:
find one best covered by D● Brute force won't work: no time or space
![Page 7: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/7.jpg)
A search space
● Consider graph with– node = words + unmatched letters– edge = “small” change to node state
words
![Page 8: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/8.jpg)
State space search
● Traverse the graph from initial condition– deterministically– stochastically
● Use algorithmic tricks that are– general search tricks: e.g. local search– problem specific tricks: e.g. dictionary ordering– instance specific tricks: e.g. vowel valuation
● May not terminate expeditiously: anytime
![Page 9: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/9.jpg)
An answer
● Here's a better letter puzzle soln
rhythms crypts blindfold knock fuzz bump wigwag vex vex jjqq
![Page 10: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/10.jpg)
Complete Search
{}
pizza
sets of words
![Page 11: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/11.jpg)
Speeding up complete search
● Search control– iterative deepening/broadening– limited discrepancy search
● Heuristic search● Pruning
– branch-and-bound– A*
![Page 12: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/12.jpg)
Local Search
+pizza
sets of words
![Page 13: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/13.jpg)
Speeding up local search
● Heuristic functions● Evading local minima
– restarts– simulated annealing– noise moves
![Page 14: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/14.jpg)
Optimal Boggle
● Lead: Micah Sheller (PSU undergrad)– easy search: score Boggle board fast– harder search: find high-scoring board– hardest search: find high-scoring dice
● Monte-Carlo local search
![Page 15: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/15.jpg)
Puzzle vs. Game
● “Adversary is nature” vs“Adversary is intelligent”
● Basic game-theory trick: minimax– usually negamax– two-player alternating deterministic zero-sum
games with no hidden information or likelihood● produces best outcome vs. best opp. play
– vs expectimax– given complete search
![Page 16: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/16.jpg)
Backing up game tree values
terminal posns
3 -2
-3 2
2
-2
4
-4
![Page 17: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/17.jpg)
pruning
terminal posns
3 -2
-3 2
2
-2
4
-4
4
-4
![Page 18: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/18.jpg)
Speeding up game tree search
● Transposition tables● Move ordering● Zero-window search
![Page 19: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/19.jpg)
Optimal 1-player Yahtzee
● Single-agent puzzle● Probability means large branching factor● Can use a set of tricks to speed up● Folks do this from time to time
![Page 20: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/20.jpg)
Optimal 2-Player Yahtzee
● Probabilistic “race game”: c.f. backgammon● Not the same as 1-player!● Classic adversary search, except
– forward search requires hidden-info analysis– this would mean solving many LP problems– instead, retrograde analysis
● Work in progress (for Yacht)
![Page 21: Search In Combinatorial Spaces: Fun with puzzles and games Bart Massey (Physics '87) Asst. Prof. Computer Science Portland State University bart@cs.pdx.edu](https://reader030.vdocuments.net/reader030/viewer/2022032703/56649d205503460f949f4b3f/html5/thumbnails/21.jpg)
Comments
● Computers are dumb + fast, souse emergent behavior
● Outstanding challenges: puzzles– search based theorem proving– search based GP planning
● Outstanding challenges: games– Go– Bridge– 3+ player games– nonzero-sum “games”