CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH)...
Transcript of CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH)...
![Page 1: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/1.jpg)
CS 730/730W/830: Intro AI
CSPs
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 1 / 22
1 handout: slides730W blog entries were due
You think you know when you can learn, are more
sure when you can write, even more when you can
teach, but certain when you can program.
![Page 2: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/2.jpg)
EOLQs
CSPs
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 2 / 22
![Page 3: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/3.jpg)
Constraint Satisfaction Problems
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 3 / 22
![Page 4: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/4.jpg)
Types of Search Problems
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 4 / 22
■ Shortest-path (vacuum, tile puzzle, M&C)
◆ given operators and their costs◆ want least-cost path to a goal◆ goal depth/cost unknown
■ Constraint satisfaction (map coloring, n-queens)
◆ any goal is fine◆ fixed depth◆ explicit constraints on partial solutions
![Page 5: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/5.jpg)
Heuristics for CSPs
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 5 / 22
Variable choice: choose most constrained variable (smallestdomain)
■ want to keep tree small, failing quickly
Value choice: try least constraining value first (fewestremovals)
■ might as well succeed sooner if possible
![Page 6: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/6.jpg)
Example Results
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 6 / 22
BT FC FC+MCV
USA > 1M 2K 60n-Queens > 40M > 40M 820KZebra 3.9M 35K 500Random 1 420K 26K 2KRandom 2 940K 77K 15K
![Page 7: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/7.jpg)
Maintaining Arc Consistency
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 7 / 22
Ensure every value for x has a legal value in all neighbors y. Ifone doesn’t, remove it and ensure consistency of all y.
![Page 8: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/8.jpg)
Maintaining Arc Consistency
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 7 / 22
Ensure every value for x has a legal value in all neighbors y. Ifone doesn’t, remove it and ensure consistency of all y.
while Q is not empty(x, y)← pop Q
if revised(x, y) thenif x’s domain is now empty, return failurefor every other neighbor z of x
push (z, x) on Q
revise(x, y)revised← falseforeach v in x’s domain
if no value in domain of y is compatible with v
remove v from x’s domainrevised← true
return revised
![Page 9: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/9.jpg)
Other Algorithms for CSPs
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 8 / 22
■ (Conflict-directed) Backjumping■ Dynamic backtracking■ Randomized restarting
Course projects!
![Page 10: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/10.jpg)
Break
CSPs
■ Other Problems
■ Types of Problems
■ ‘Heuristics’
■ Example Results
■ MAC
■ Other Algorithms
■ Break
CombinatorialOptimization
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 9 / 22
■ what is a course project?■ asst 1 going out on Wed
![Page 11: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/11.jpg)
Combinatorial Optimization
CSPs
CombinatorialOptimization
■ Types of Problems
■ Hill-Climbing
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 10 / 22
![Page 12: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/12.jpg)
Types of Search Problems
CSPs
CombinatorialOptimization
■ Types of Problems
■ Hill-Climbing
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 11 / 22
■ Shortest-path (M&C, vacuum, tile puzzle)
◆ want least-cost path to a goal◆ goal depth unknown◆ given operators and their costs
■ Constraint satisfaction (map coloring, n-queens)
◆ any goal is fine◆ maximum depth = number of variables◆ given explicit constraints on variables
■ Combinatorial optimization (TSP, max-CSP)
◆ want least-cost goal◆ maximum depth = number of variables◆ every leaf is a solution
![Page 13: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/13.jpg)
Hill-Climbing
CSPs
CombinatorialOptimization
■ Types of Problems
■ Hill-Climbing
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 12 / 22
Sol ← some random solution (probably poor quality).Do limit times
New ← random neighbor of Sol.If New better than Sol,
then Sol ← New.
![Page 14: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/14.jpg)
Hill-Climbing
CSPs
CombinatorialOptimization
■ Types of Problems
■ Hill-Climbing
Adversarial Search
Wheeler Ruml (UNH) Lecture 4, CS 730 – 12 / 22
Sol ← some random solution (probably poor quality).Do limit times
New ← random neighbor of Sol.If New better than Sol,
then Sol ← New.
Elaborations: best neighbor (aka gradient-descent)restartssimulated annealingpopulation (GAs, ‘go with the winners’)
![Page 15: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/15.jpg)
Adversarial Search
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 13 / 22
![Page 16: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/16.jpg)
Another Twist on Search
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 14 / 22
■ Shortest-path (M&C, vacuum, tile puzzle)
◆ want least-cost path to goal at unkown depth
■ Constraint satisfaction (map coloring, n-queens)
◆ any goal that satisfies constraints (fixed depth)
■ Combinatorial optimization (TSP, max-CSP)
◆ want least-cost goal (fixed depth)
■ Decisions with an adversary (chess, tic-tac-toe)
◆ adversary might prevent path to best goal◆ want best assured outcome
![Page 17: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/17.jpg)
Adversarial Search: Minimax
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 15 / 22
Each ply corresponds to half a move.Terminal states are labeled with value.Can also bound depth and use a static evaluation function onnon-terminal states.
![Page 18: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/18.jpg)
Evaluation for Tic-tac-toe
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 16 / 22
A 3-length is a complete row, column, or diagonal.value of position = ∞ if win for me,
or = −∞ if a win for you,otherwise = # 3-lengths open for me −
# 3-lengths open for you
![Page 19: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/19.jpg)
Tic-tac-toe: two-ply search
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 17 / 22
![Page 20: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/20.jpg)
Tic-tac-toe: second move
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 18 / 22
![Page 21: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/21.jpg)
Tic-tac-toe: third move
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 19 / 22
![Page 22: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/22.jpg)
Improving the Search
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 20 / 22
■ partial expansion, SEF■ symmetry (‘transposition tables’)■ search more ply as we have time (De Groot figure)■ avoid unnecessary evaluations
![Page 23: CS730/730W/830: IntroAIruml/cs730/slides/lecture-5-co.pdf · 2012. 2. 13. · WheelerRuml(UNH) Lecture4,CS730–7/22 Ensure every value for xhas a legal value in all neighbors y.](https://reader035.fdocuments.us/reader035/viewer/2022071013/5fcb71e6dbc08b0ca5110fe9/html5/thumbnails/23.jpg)
EOLQs
CSPs
CombinatorialOptimization
Adversarial Search
■ Another Type
■ Minimax
■ Tic-tac-toe
■ Improvements
■ EOLQs
Wheeler Ruml (UNH) Lecture 4, CS 730 – 21 / 22
Please write down the most pressing question you have aboutthe course material covered so far and put it in the box on yourway out.
Thanks!