Presentation is loading. Please wait.

Presentation is loading. Please wait.

Outline Introduction & Logistics Textbook: Russell and Norvig chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction.

Similar presentations


Presentation on theme: "Outline Introduction & Logistics Textbook: Russell and Norvig chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction."— Presentation transcript:

1 Outline Introduction & Logistics Textbook: Russell and Norvig chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction Techniques Game Search; Video: Kasparov vs. Deep Blue

2 Logistics: Q. Yang qyang@cs.sfu.ca TA: Janet Hsiao hsiao@cs.sfu.ca Readings –Required: Textbook by Russell & Norvig and Witten and Eibe –Recommended: various papers Grading: –Problem Set10% –Exams60% –Final Project (Group)30%

3 Defining Intelligence?

4 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...

5 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...

6 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

7 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 Applications Final Project Demo Sept 11, 2000

8 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

9 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

10 Outline Defining a Search Space Types of Search –Blind –Heuristic –Optimization –Adversary Search –Constraint Satisfaction Analysis –Completeness –Time & Space Complexity

11 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 6 7 2 3 8 5 4 1 6

12 12 Towers of Hanoi What are states (nodes in graph)? What are the operators (arcs between nodes)? Initial state? Goal test? a bc

13 Water Jug You are given two jugs, a 4-gallon one and a 3-gallon one. Neither has nay measure markers on it. There is a pump that can be used to fill the jugs with water. How can you get exactly 2 gallons of water into the 4- gallon jug?

14 14 Planning What is Search Space? –What are states? –What are arcs? What is Initial State? What is Goal? Path Cost? Heuristic? a c b c b a PickUp(Block) PutDown(Block)

15 15 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

16 16 Search Strategies Blind Search –Depth first search –Breadth first search –Iterative deepening search –Iterative broadening search Heuristic Search Optimizing Search Constraint Satisfaction

17 General-Search(problem, Queuing-FN) returns a solution, or failure Page 73 of Russell and Norvig Nodes <- Make-Queue(Make-Node(Initial- State(problem))); Loop do –If nodes is empty then return failure; –Node <- Remove-Front (nodes); –If Goal-Test(problem) applied to State(node) succeeds then return node; –Nodes = Queuing-Fn(nodes, Expand(node, Operators(problem))); End Loop

18 Heuristic Search A heuristic function 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 –Every node has a function f(node)! Designing a good heuristic is very important! (And hard) More on this in a bit...

19 Depth First Search a b de c f gh Maintain stack of nodes to visit ( f(node)= –Nodes = Queuing-Fn(nodes, Expand(node, Operators(problem))); Evaluation –Complete? –Time Complexity? –Space Complexity? Not for infinite spaces O(b^d) O(d)

20 Breadth First Search a b c def gh Maintain queue of nodes to visit ( f(node)= –Nodes = Queuing-Fn(nodes, Expand(node, Operators(problem))); Evaluation –Complete? –Time Complexity? –Space Complexity? Yes O(b^d)

21 Iterative Deepening Search DFS with limit; incrementally grow limit (page79) a b c

22 Iterative Deepening Search DFS with limit; incrementally grow limit Evaluation –Complete? –Time Complexity? –Space Complexity? Yes O(b^d) O(d) b de c f gh a

23 A* Search Idea –Best first search with admissible heuristic ( f(node)= –Plus keep checking until all possibilities look worse Evaluation –Finds optimal solution? –Time Complexity? –Space Complexity? Yes O(b^d) Underestimates cost of any solution which can reached from node

24 Admissable Heuristics f(x) = g(x) + h(x) g: cost so far h: underestimate of remaining costs a b c d e f 12 8 15 10 8 14 20 7 2 3 8 5 4 1 6 For transportation planning? For eight puzzle?

25 A* Optimality If A* finds a node, then it is a optimal goal node Proof by contradiction…

26 Importance of Heuristics D IDS A*(h1)A*(h2) 2 10 6 6 4 11213 12 6 68020 18 8 638439 25 10 4712793 39 12 364404 227 73 143473941 539 113 18 3056 363 24 391351641 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

27 Constraint Satisfaction Chronological Backtracking (BT) Backjumping (BJ) Conflict-Directed Backjumping (CBJ) Forward checking (FC) Dynamic variable ordering heuristics Preprocessing Strategies

28 Chinese Constraint Network Soup Total Cost < $30 Chicken Dish Vegetable RiceSeafood Pork Dish Appetizer Must be Hot&Sour No Peanuts No Peanuts Not Chow Mein Not Both Spicy

29 CSPs in the real world Scheduling Space Shuttle Repair Transportation Planning Computer Configuration Diagnosis

30 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

31 Binary Constraint Network Set of n variables: x 1 … x n Value domains for each variable: D 1 … D n Set of binary constraints (also known as relations) –R ij  D i  D j –Specifies which values of x i are consistent w/ those of x j 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 {(x i, a i ) … (x j, a j )} consistent w/ a set of vars {x m … x n } iff  a m … a n such that this tuple is consistent: {(x i, a i ) … (x j, a j ), (x m, a m ) … (x n, a n )} }

32 N Queens Variables = board columns Domain values = rows R ij = {(a i, a j ) : (a i  a j )  (|i-j|  |a i -a j |) –e.g. R 12 = {(1,3), (1,4), (2,4), (3,1), (4,1), (4,2)} Q Q Q {(x 1, 2), (x 2, 4), (x 3, 1)} consistent with (x 4 ) Shorthand: “{2, 4, 1} consistent with x 4 ”

33 33 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

34 Chronological Backtracking (BT) (e.g., depth first search) Q Q Q Q Q Q Q Q Q Q Q 1 2 3 4 5 6 Consistency check performed in the order in which vars were instantiated If c-check fails, try next value of current var If no more values, backtrack to most recent var

35 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

36 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 visits But FC can’t detect that (2, 5, 3) inconsistent with {x 5, x 6 }

37 Dynamic variable ordering In the N-queens examples we assumed –First x 1 then x 2 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

38 Hill Climbing (p112) Current <- Make-Node(Initial-State(problem)); Loop Next  successor of Current with highest f-value If f(Next) < f(Current), then return Current; Current  Next; End loop

39 Simulated Annealing Current  Make-Node(Initial-State(problem)); For t =1 to infinity, do –T  schedule(t); –If T=0 then return Current; –Next  random-selected successor of Current; –E  f(Next) - f(Current); –If E>0 then Current  Next –Else Current  Next only with probability Note: T decreases with time t; E is the energy function Note: more random moves at beginning, fewer later…

40 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 {}

41 Search Tree Start node -2 1 XX X XX O O OO O 6-5=15-5=0 ? MIN X X X ? MAX 1 0

42 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

43 Watch Video


Download ppt "Outline Introduction & Logistics Textbook: Russell and Norvig chapters 3, 4 and 5. Notion of a Problem Space Search Techniques Constraint Satisfaction."

Similar presentations


Ads by Google