1 / 52

CS B551: Elements of Artificial Intelligence

CS B551: Elements of Artificial Intelligence. Instructor: Kris Hauser http://cs.indiana.edu/~hauserk. Recap. http://www.cs.indiana.edu/classes/b551 Brief history and philosophy of AI What is intelligence? Can a machine act/think intelligently? Turing machine, Chinese room. Agenda.

Download Presentation

CS B551: Elements of Artificial Intelligence

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser http://cs.indiana.edu/~hauserk

  2. Recap • http://www.cs.indiana.edu/classes/b551 • Brief history and philosophy of AI • What is intelligence? Can a machine act/think intelligently? • Turing machine, Chinese room

  3. Agenda • Problem Solving using Search • Search Algorithms

  4. Example: 8-Puzzle 8 2 1 2 3 3 4 7 4 5 6 5 1 6 7 8 Initial state Goal state State: Any arrangement of 8 numbered tiles and an empty tile on a 3x3 board

  5. Successor Function: 8-Puzzle SUCC(state)  subset of states The successor function is knowledgeabout the 8-puzzle game, but it does not tell us which outcome to use, nor to which state of the board to apply it. 8 2 7 3 4 5 1 6 8 2 8 2 7 8 2 7 3 4 7 3 4 6 3 4 5 1 6 5 1 5 1 6

  6. Across history, puzzles and games requiring the exploration of alternatives have been considered a challenge for human intelligence: • Chessoriginated in Persia and India about 4000 years ago • Checkers appear in 3600-year-old Egyptian paintings • Go originated in China over 3000 years ago So, it’s not surprising that AI uses games to design and test algorithms

  7. Exploring Alternatives • Problems that seem to require intelligence usually require exploring multiple alternatives • Search: a systematic way of exploring alternatives

  8. What is a State? • A state does: • Represent all information meaningful to the problem at a given “instant in time” – usually in the future • Exist in an abstract, mathematical sense • A state DOES NOT: • Necessarily exist in the computer’s memory • Tell the computer how it arrived at the state • Tell the computer how to choose the next action • Need to be a unique representation

  9. 8-Queens Problem • State repr. 1 • Any non-conflicting placement of 0-8 queens • State repr. 2 • Any placement of 8 queens

  10. Defining a Search Problem S • State space S • Successor function: x  S  SUCC(x)  2S • Initial state s0 • Goal test: xS GOAL?(x) =T or F • Arc cost

  11. State Graph • Each state is represented by a distinct node • An arc (or edge) connects a node s to a node s’ if s’ SUCC(s) • The state graph may contain more than one connected component

  12. I Solution to the Search Problem • A solution is a path connecting the initial node to a goal node (any one) • The cost of a path is the sum of the arc costs along this path • An optimal solution is a solution path of minimum cost • There might be no solution ! G

  13. Pathless Problems • Sometimes the path doesn’t matter • A solution is any goal node • Arcs represent potential state transformations • E.g. 8-queens, Simplex for LPs, Map coloring G I

  14. Representation 1 • State: any placement of 0-8 queens • Initial state: 0 queens • Successor function: • Place queen in empty square • Goal test: • Non-conflicting placement of 8 queens • # of states ~ 64x63x…x57 ~ 3x1014

  15. Representation 2 • State: any placement of non-conflicting 0-8 queens in columns starting from left • Initial state: 0 queens • Successor function: • A queen placed in leftmost empty column such that it causes no conflicts • Goal test: • Any state with 8 queens • # of states = 2057

  16. Path Planning What is the state space?

  17. Cost of one horizontal/vertical step = 1 Cost of one diagonal step = 2 Formulation #1

  18. Optimal Solution This path is the shortest in the discretized state space, but not in the original continuous space

  19. Cost of one step: length of segment Formulation #2

  20. Cost of one step: length of segment Formulation #2 Visibility graph

  21. Solution Path The shortest path in this state space is also the shortest in the original continuous space

  22. 5-minute Quiz • Formulate 2x2 Tic-Tac-Toe as a search problem. Assume you choose both X and O’s actions, and O goes first. • Draw entire state graph. For compactness’s sake, eliminate symmetrical states • Indicate initial and goal states on this graph • Suppose one side is allowed to pass. How does the state graph change? Do you need to change anything to the problem definition?

  23. Example: 8-Puzzle 8 2 1 2 3 3 4 7 4 5 6 5 1 6 7 8 Initial state Goal state State: Any arrangement of 8 numbered tiles and an empty tile on a 3x3 board

  24. 15-Puzzle • Introduced (?) in 1878 by Sam Loyd, who dubbed himself “America’s greatest puzzle-expert”

  25. 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 ? 13 13 14 15 15 14 15-Puzzle • Sam Loyd offered $1,000 of his own money to the first person who would solve the following problem:

  26. But no one ever won the prize !!

  27. How big is the state space of the (n2-1)-puzzle? • 8-puzzle  ?? states

  28. How big is the state space of the (n2-1)-puzzle? • 8-puzzle  9! = 362,880 states • 15-puzzle  16! ~ 2.09 x 1013 states • 24-puzzle  25! ~ 1025 states • But only half of these states are reachable from any given state(but you may not know that in advance)

  29. Permutation Inversions • Wlg, let the goal be: • A tile j appears after a tile i if either j appears on the same row as i to the right of i, or on another row below the row of i. • For every i = 1, 2, ..., 15, let ni be the number of tiles j < i that appear after tile i (permutation inversions) • N = n2 + n3 +  + n15 + row number of empty tile 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 n2 = 0 n3 = 0 n4 = 0 n5 = 0 n6 = 0 n7 = 1 n8 = 1 n9 = 1 n10 = 4 n11 = 0 n12 = 0 n13 = 0 n14 = 0 n15 = 0 5 10 7 8  N = 7 + 4 9 6 11 12 13 14 15

  30. 1 2 3 4 1 2 3 4 5 6 7 5 6 11 7 9 10 11 8 9 10 8 s’ = 13 14 15 12 13 14 15 12 • Proposition: (N mod 2) is invariant under any legal move of the empty tile • Proof: • Any horizontal move of the empty tile leaves N unchanged • A vertical move of the empty tile changes N by an even increment ( 1  1  1  1) s = N(s’) = N(s) + 3 + 1

  31. Proposition: (N mod 2) is invariant under any legal move of the empty tile •  For a goal state g to be reachable from a state s, a necessary condition is that N(g) and N(s) have the same parity • It can be shown that this is also a sufficient condition •  The state graph consists of two connected components of equal size

  32. Searching the State Space • It is often not feasible (or too expensive) to build a complete representation of the state graph

  33. 8-, 15-, 24-Puzzles 8-puzzle  362,880 states 15-puzzle  2.09 x1013 states 24-puzzle  1025 states 0.036 sec ~ 55 hours > 109 years 100 millions states/sec

  34. Intractability • Constructing the full state graph is intractable for most interesting problems • n-puzzle: (n+1)! states • k-queens:kk states Tractability of search hinges on the ability to explore only a tiny portion of the state graph!

  35. Searching

  36. Searching the State Space Search tree

  37. Searching the State Space Search tree

  38. Searching the State Space Search tree

  39. Searching the State Space Search tree

  40. Searching the State Space Search tree

  41. Searching the State Space Search tree

  42. 8 8 2 2 8 2 7 3 3 4 4 7 7 3 4 5 5 1 1 6 6 5 1 6 8 2 3 4 7 8 2 8 4 2 3 4 7 3 7 5 1 6 5 1 6 5 1 6 Search Nodes and States If states are allowed to be revisited,the search tree may be infinite even when the state space is finite

  43. 8 2 PARENT-NODE 3 4 7 BOOKKEEPING 5 1 6 STATE CHILDREN Action Right Depth 5 ... Path-Cost 5 yes Expanded Data Structure of a Node Depth of a node N = length of path from root to N (depth of the root = 0)

  44. 8 2 8 8 4 8 2 3 4 7 2 2 3 3 4 7 3 7 4 7 1 5 6 5 1 6 5 1 6 5 1 6 Node expansion • The expansion of a node N of the search tree consists of: • Evaluating the successor function on STATE(N) • Generating a child of N for each state returned by the function • node generation  node expansion N

  45. 8 2 8 2 7 3 4 7 3 4 5 1 6 5 1 6 Fringe of Search Tree • The fringe is the set of all search nodes that haven’t been expanded yet 8 2 3 4 7 5 1 6 8 2 7 3 4 5 1 6 8 2 8 2 3 4 7 3 4 7 5 1 6 5 1 6

  46. Is it identical to the set of leaves?

  47. Search Strategy • The fringe is the set of all search nodes that haven’t been expanded yet • The fringe is implemented as a priority queue FRINGE • INSERT(node,FRINGE) • REMOVE(FRINGE) • The ordering of the nodes in FRINGE defines the search strategy

  48. Search Algorithm #1 SEARCH#1 1. If GOAL?(initial-state) then return initial-state 2. INSERT(initial-node,FRINGE) 3.Repeat: 4. If empty(FRINGE) then return failure 5.N REMOVE(FRINGE) 6.s  STATE(N) 7. For every state s’ in SUCCESSORS(s) 8. Create a new node N’ as a child of N 9. If GOAL?(s’) then return path or goal state 10. INSERT(N’,FRINGE) Expansion of N

  49. Performance Measures • CompletenessA search algorithm is complete if it finds a solution whenever one exists[What about the case when no solution exists?] • OptimalityA search algorithm is optimal if it returns a minimum-cost path whenever a solution exists • ComplexityIt measures the time and amount of memory required by the algorithm

  50. Topics of Next 3-4 Classes • Blind (uninformed) Search • Little or no knowledge about how to search • Heuristic (informed) Search • How to use extra knowledge about the problem • Local Search • With knowledge about goal distribution

More Related