outline for 3/28 introduction & logistics textbook: chapters 3, 4 and 5. notion of a problem...

45
Outline for 3/28 • Introduction & Logistics • Textbook: chapters 3, 4 and 5. • Notion of a Problem Space • Search Techniques • Constraint Satisfaction Techniques • Game Search; Video: Kasparov vs. Deep Blue

Upload: branden-fields

Post on 21-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Outline for 3/28

• Introduction & Logistics

• Textbook: chapters 3, 4 and 5.

• Notion of a Problem Space

• Search Techniques

• Constraint Satisfaction Techniques

• Game Search; Video: Kasparov vs. Deep Blue

Page 2: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Logistics:• John Q. Yang [email protected]• Mathrew Cary [email protected]• www.cs.washington.edu/education/courses/cse592/00sp

• Reading– Required: Textbook by Russell & Norvig and Tom Mitchell– Recommended: various papers

• Grading: – Problem Set 25%– AI Tool Demonstration in Class 25%– Final Project (Group) 50%

Page 3: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Defining Intelligence?

Page 4: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

4

Artificial Intelligence• Planning (To get a good job I should get an MS/CSE…)

• Diagnosis (My car won’t start, but I know it has gas…)

• Design (Space Shuttle, Boeing 777, Pentium)

• Communicate (Language + Social reasoning)

• Theorem Proving (Fermat’s Last Theorem)

• Perceive/Act (Vision, Manipulation)

• Game Playing (Kasparov vs. Deep Blue)

• Create Art (MacBeth, Mona Lisa, Taj Mahal)• Learn to ...

Page 5: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

AI as Science• Origin & Laws of the Physical Universe

• Origin & Laws of Biological Life

• Nature of Intelligent Thought

AI as Engineering• Softbots & Intelligent User Interfaces

• Mobile Robots … Immobots

• Machine Learning Algorithms; Data Mining

• Medical Expert Systems...

Page 6: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

AI Theory

• For example, Machine Learning– Given tree structured instance space with n attributes,

you need• 4 log(2/) + 16n log(13/ examples

AI Practice

• Game Playing • Pattern Classification: Character Recognition, …• Machine Learning: Data Mining, Web Agents• Perception – Vision, Speech

Page 7: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Course Topics by Week• Search (1 and 2-person) & Constraint Satisfaction• KR&R 1: Logic representation & Theorem Proving• KR&R 2: Planning and Diagnosis• Machine Learning 1: Supervised Learning• Machine Learning 2: Unsupervised Learning• Natural Language Processing• AI-Tools demo• Application Sampler I• Application Sampler II• Final Project

Page 8: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Search (one solution)• Brute force

– DFS, BFS, iterative deepening, iterative broadening

• Heuristic– Best first, beam, hill climbing, simulated annealing, limited discrepancy

• Optimizing– Branch & bound, A*, IDA*, SMA*

• Adversary Search– Minimax, alpha-beta, conspiracy search

• Constraint Satisfaction– As search, preprocessing, backjumping, forward checking, dynamic variable ordering

Page 9: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Search (Internet and Databases)

• Look for all solutions• Must be efficient• Often uses indexing• Also uses heuristics (e.g., Google )• More than search itself

– NLP can be important– Scale up to thousands of users– Caching is often used

Page 10: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Outline• Defining a Search Space• Types of Search

– Blind– Heuristic– Optimization– Adversary Search– Constraint Satisfaction

• Analysis– Completeness– Time & Space Complexity

Page 11: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

11

Specifying a search problem?

• What are states (nodes in graph)?

• What are the operators (arcs between nodes)?

• Initial state?

• Goal test?

• [Cost?, Heuristics?, Constraints?]

E.g., Eight Puzzle

1 2 3

7 8

4 5 67 2 3

8 5

4 1 6

Page 12: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

12

Towers of Hanoi

• What are states (nodes in graph)?

• What are the operators (arcs between nodes)?

• Initial state?

• Goal test?

a b c

Page 13: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

13

Planning

• What is Search Space?– What are states?– What are arcs?

• What is Initial State?

• What is Goal?

• Path Cost?

• Heuristic?

ac

b

cba

PickUp(Block)PutDown(Block)

Page 14: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

14

Missionaries and Cannibals

m m m

c c c

• What are states (nodes in graph)?• What are the operators (arcs between nodes)?• Initial state?• Goal test?• 2 Representations

Page 15: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

15

Search Strategies

• Blind Search– Depth first search– Breadth first search– Iterative deepening search– Iterative broadening search

• Heuristic Search• Optimizing Search• Constraint Satisfaction

Page 16: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Depth First Search

a

b

d e

c

f g h

• Maintain stack of nodes to visit• Evaluation

– Complete?

– Time Complexity?

– Space Complexity?Not for infinite spaces

O(b^d)

O(d)

Page 17: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Breadth First Search

a

b c

d e f g h

• Maintain queue of nodes to visit• Evaluation

– Complete?

– Time Complexity?

– Space Complexity?Yes

O(b^d)

O(b^d)

Page 18: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Iterative Deepening Search

• DFS with limit; incrementally grow limit

a

b c

Page 19: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Iterative Deepening Search

• DFS with limit; incrementally grow limit• Evaluation

– Complete?

– Time Complexity?

– Space Complexity?Yes

O(b^d)

O(d) b

d e

c

f g h

a

Page 20: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Heuristic Search

• A heuristic is:– Function from a state to a real number

• Low number means state is close to goal• High number means state is far from the goal

Designing a good heuristic is very important!

(And hard)

More on this in a bit...

Page 21: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

A* Search

• Idea– Best first search with admissible heuristic– Plus keep checking until all possibilities look worse

• Evaluation– Finds optimal solution?

– Time Complexity?

– Space Complexity?

Yes

O(b^d)

O(b^d)

Underestimates cost ofany solution which can reached from node

Page 22: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Admissable Heuristics

• f(x) = g(x) + h(x)

• g: cost so far

• h: underestimate of remaining costs

a

b

c

d

e

f12

8

15

10

8

14 20

7 2 3

8 5

4 1 6

For transportation planning?

For eight puzzle?

Page 23: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Hill Climbing

• Idea– Always choose best child; no backtracking

• Evaluation– Complete?

– Time Complexity?

– Space Complexity?

No - suffers from plateau, local maxima, ridges

O(b^d) but only in pathological cases

O(b)

Page 24: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Simulated Annealing

• Objective: avoid local minima

• Technique:– For the most part use hill climbing– Occasionally take non-optimal step– Reduce probability(non-optimal) over time

• Comparison to Hill Climbing– Completeness?– Speed?– Space Complexity?

temp

Page 25: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Importance of Heuristics

D IDS A*(h1) A*(h2) 2 10 6 6 4 112 13 12 6 680 20 18 8 6384 39 2510 47127 93 3912 364404 227 7314 3473941 539 11318 3056 36324 39135 1641

• h1 = number of tiles in the wrong place

• h2 = sum of distances of tiles from correct loc

7 2 3

8 5

4 1 6

Page 26: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Constraint Satisfaction

• Chronological Backtracking (BT)

• Backjumping (BJ)

• Conflict-Directed Backjumping (CBJ)

• Forward checking (FC)

• Dynamic variable ordering heuristics

• Preprocessing Strategies

Page 27: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Chinese Constraint Network

Soup

Total Cost< $30

ChickenDish

Vegetable

RiceSeafood

Pork Dish

Appetizer

Must beHot&Sour

No Peanuts

No Peanuts

NotChow Mein

Not BothSpicy

Page 28: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

CSPs in the real world

• Scheduling Space Shuttle Repair

• Transportation Planning

• Computer Configuration

• Diagnosis

Page 29: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Recognizing Trihedral Objects

• Trihedral objects: all vertices are intersections of three planes.• Labeling: with +, - and ->• Enumerating all labels:

• Using constraint satisfaction to find correct labels– NP hard in general– CSP gives good solutions

Page 30: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Binary Constraint Network• Set of n variables: x1 … xn

• Value domains for each variable: D1 … Dn

• Set of binary constraints (also known as relations)– Rij Di Dj

– Specifies which values of xi are consistent w/ those of xj

• Partial assignment of values with a tuple of pairs– {...(x,a)…} means variable x gets value a...– Consistent if all constraints satisfied on all vars in tuple– Tuple = full solution if consistent & all vars included

• Tuple {(xi, ai) … (xj, aj)} consistent w/ a set of vars {xm … xn} iff am … an such that this tuple is consistent: {(xi, ai) … (xj, aj), (xm, am) … (xn, an)} }

Page 31: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

N Queens• Variables = board columns

• Domain values = rows

• Rij = {(ai, aj) : (ai aj) (|i-j| |ai-aj|)– e.g. R12 = {(1,3), (1,4), (2,4), (3,1), (4,1), (4,2)}

Q

Q

Q

• {(x1, 2), (x2, 4), (x3, 1)} consistent with (x4)• Shorthand: “{2, 4, 1} consistent with x4”

Page 32: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

32

CSP as a search problem?

• What are states (nodes in graph)?

• What are the operators (arcs between nodes)?

• Initial state?

• Goal test?

Q

Q

Q

Page 33: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Chronological Backtracking (BT)(e.g., depth first search)

Q

Q

Q

Q

Q

Q

Q

Q

Q

Q

Q

1

2

34

5

6

Consistency check performed in the order in which vars were instantiated

If c-check fails, try next value of current varIf no more values, backtrack to most recent var

Page 34: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Backjumping (BJ)• Similar to BT, but more efficient when no consistent

instantiation can be found for the current var• Instead of backtracking to most recent var…• BJ reverts to deepest var which was checked against

the current var

Q

Q

Q

QBJ Discovers (2, 5, 3, 6) inconsistent with x6

No sense trying other values of x5

Q

Page 35: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

BT vs. BJ

{

Page 36: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Preprocessing Strategies

• Even FC-CBJ is O(b^d) time worst case• Sometimes useful to spend polynomial time preprocessing

to achieve local consistency before doing exponential search• Arc consistency

– Consider all pairs of vars

– Can any values be eliminated from a domain ala FC

– Propagate

– O(d^2) time where d= number of vars

Page 37: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Forward Checking (FC)

• Perform Consistency Check Forward

• Whenever assign var a value– Prune inconsistent values from – As-yet unvisited variables– Backtrack if domain of any var ever collapses

Q

Q

Q

Q

Q

FC only visits consistent nodes but not all such nodes skips (2, 5, 3, 4) which CBJ visitsBut FC can’t detect that (2, 5, 3) inconsistent with {x5, x6 }

Page 38: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Dynamic variable ordering

• In the N-queens examples we assumed– First x1 then x2 then ...

• But this order not required– Any order ok with respect to completeness– A good order leads to huge speedup

• A good heuristic:– Choose variable w/ minimum remaining values

• This is easy if one is doing FC

Page 39: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Number of Nodes Explored

BT=BM

BJ=BMJ=BMJ2

CBJ=BM-CBJ=BM-CBJ2

FC-CBJ

FC

More

Fewer

Page 40: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Number of Consistency Checks

BMJ2

BT

BJ

BMJ

BM-CBJ

CBJFC-CBJ

BM

BM-CBJ2

FC

Page 41: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Combinatorial Optimization

• Nonlinear Programs• Convex Programs

– Local optimality global optimality– Kuhn Tucker conditions for optimality

• Linear Programs– Simplex Algorithm

• Flow and Matching• Integer Programming

Page 42: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Game Tree Search (java applet)

• Two person games: min (adversary) and max (me!)• Max wants to win by expanding all possible moves of min, and looks for

the ‘best’ branch • There is a utility function e(n) attached to each terminal node • Values of utility function propagates upward

– Max: chooses the max value of all children– Min: chooses the min value of all children

• Tic-Tac-Toe– MAX = “X”, MIN = “O”– e (leaf node) = Total-Open-Paths(MAX) – Total-Open-Paths(MIN)– e (leaf node) = +/- infinity for winning nodes– e (MAX node) = MAX {e(succ nodes)}; e(MIN node) = MIN {}

Page 43: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Search TreeStart node

-2

1

X X X X XO

O O OO

6-5=1 5-5=0 ?

MIN

X

XX

?

MAX

Page 44: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Tricks

• Alpha value: for MAX nodes, is a current lower bound on its evaluation function (it never goes down for MAX)

• Beta value: for MIN nodes, is a current upper bound on its evaluation function (it never goes up for MIN)

• Rule 1: – if MAX is parent, MIN is a child and– (alpha(MAX) > = beta(MIN),– then terminate search on MIN

• Rule 2: – if MIN is parent, MAX is a child, and – (alpha(MAX) > = beta(MIN),– Then terminate search on MAX

Page 45: Outline for 3/28 Introduction & Logistics Textbook: chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques

Watch Video