Bookkeeping Artificial Intelligence Class 3: Search (Ch. 3.1–3.3) • TA Office hours: M 3-4, W 2-3 • General HW 1 questions? • Basic Python • Sets, Tuples, Lists, Dictionaries, … • https://www.tutorialspoint.com/python • http://tiny.cc/concise-python-guide • http://www.w3resource.com/python/python-tutorial.php • https://docs.python.org/3 • Especially Library Reference à Built-in Functions Some material adopted from notes by Charles R. Dyer, University of Wisconsin-Madison Dr. Cynthia Matuszek – CMSC 671 Slides adapted with thanks from: Dr. Marie desJardin 2 Today’s Class Pre-Reading Review • What is search (a.k.a. state-space search )? • Goal-based agents • What are these concepts in search? • Representing states and operators • Initial state • Actions / transition model • Example problems • State space graph • Step cost / path cost • Generic state-space search algorithm • Goal test (cf. goal) • Solution / optimal solution • What is an open-loop system ? Everything in AI comes down to search. • What is the difference between expanding and generating a state? Goal: understand search, and understand why. • What is the frontier (a.k.a. open list )? 3 4 Search: The Core Idea Building Goal-Based Agents • For any problem: • To build a goal-based agent we need to decide: • World is (always) in some state • What is the goal to be achieved? • Agents take actions, which • What are the actions? some other some change the state A 1 A4 A2 action action • What relevant information must be encoded? • To describe the state of the world • We need a sequence of • To describe the available transitions actions that gets the world A3 A5 A6 A7 • To solve the problem into a particular goal state. • To find it, we search the Initial Goal state state space of actions and states. Actions 5 6 1
What is the Goal? What Are Actions? • A situation we want to achieve • Primitive actions or events: • A set of properties that we want to hold • Make changes in the world • In order to achieve a (sub)goal • Must define a “goal test” • What does it mean to achieve it? • Actions are also known as operators or moves • Have we done so? • Examples: • This is a hard question that is rarely tackled in AI! • Often, we assume the system designer or user will specify the goal • Chess: “advance a pawn” • Chess: “get a queen in position” Navigation: “take a step” Navigation: “go home” • • • For people, we stress the importance of establishing clear goals for as the first step towards solving a problem. • Finance: “sell 10% of stock X” • Finance: “sell best-return shares” • What are your goals? • What problem(s) are you trying to solve? 7 8 Actions and Determinism Representing Actions • Actions here are: • In a deterministic world there is no uncertainty in an action’s effects • Discrete events • That occur at an instant of time • Current world state + chosen action fully specifies: A 1 A4 A2 • For example: • Whether that action can be applied to the current world • State: “Mary is in class” • Is it applicable? • Action “Go home” • Is it legal? • New state: “Mary is at home” • What the state of the world is after the action is performed • There is no representation of a state where she is in • No need for “history” information between (i.e., in the state of “going home”). • Everything is encapsulated by state 9 10 Sliding Tile Puzzles Representing Actions • 15-puzzles, 8-puzzles • Number of actions / operators depends on representation used in describing a state • How do we represent states? • How do we represent actions? • 8-puzzle: • Tile-1 moves north • Could specify 4 possible … • Tile-1 moves west moves (actions) for each • Tile-1 moves east of the 8 tiles: • Tile-1 moves south 4*8=32 operators . • Tile-2 moves north • Or, could specify four moves for the “blank” square: • Tile-2 moves west 4 operators! • … • Careful representation can simplify a problem! 12 commons.wikimedia.org/wiki/File:15-puzzle-shuf;led.svg, commons.wikimedia.org/wiki/File:15-puzzle-loyd-bis2.svg 2
Representing States Closed World Assumption • What information about the world sufficiently describes all • We generally use the Closed World Assumption : aspects relevant to solving the goal? “All necessary information about a problem • That is: what knowledge must be in a state description to domain is available in each percept so that each adequately describe the current state of the world? state is a complete description of the world.” • The size of a problem is usually described in terms of the • No incomplete information at any point in time. number of states that are possible • A statement that is true is always known to be true. • Tic-Tac-Toe has about 3 9 states. ∴ If we do not know something is true, it is false. • Checkers has about 10 40 states. • Rubik’s Cube has about 10 19 states. • Chess has about 10 120 states in a typical game. 13 14 en.wikipedia.org/wiki/Closed-world_assumption Some Example Problems 8-Puzzle • Toy problems and micro-worlds Given an initial configuration of 8 numbered tiles on a 3 x 3 board, move the tiles in such a way so as to • 8-Puzzle produce a desired goal configuration of the tiles. • Boat Problems • Cryptarithmetic • Remove 5 Sticks • Water Jug Problem • Real-world problems 15 16 8-Puzzle The 8-Queens Problem • State: 3 x 3 array describing where tiles are Place eight (or • Operators: Move blank square Left, N) queens on a Right, Up or Down chessboard such • This is a more efficient encoding of the that no queen operators! can reach any • Initial State: Starting configuration of other the board • Goal: Some configuration of the board 17 18 3
Boat Problems Remove 5 Sticks 1 sheep, 1 wolf, 1 cabbage, 1 boat • Goal : Move everything across the river. • Given the following configuration of sticks, • Constraints: remove exactly 5 sticks • The boat can hold you plus one thing. in such a way that the • Wolf can never be alone with sheep. remaining • Sheep can never be alone with cabbage. configuration forms • State: location of sheep, wolf, cabbage on shores and boat. exactly 3 squares. • Operators: Move ferry containing some set of occupants across the river (in either direction) to the other side. 19 20 Some Real-World Problems Knowledge Representation Issues • Route finding • What’s in a state? • Is the color of the tiles relevant to solving an 8-puzzle? • Touring (traveling salesman) • Is sunspot activity relevant to predicting the stock market? • Logistics • What to represent is a very hard problem! • VLSI layout • Usually left to the system designer to specify. • What level of abstraction to describe the world? • Robot navigation • Too fine-grained and we “miss the forest for the trees” • Learning • Too coarse-grained and we miss critical information 22 23 Knowledge Representation Issues Formalizing Search in a State Space • Number of states depends on • A state space is a graph (V , E): • Representation • Level of abstraction • V is a set of nodes • E is a set of arcs • In the Remove-5-Sticks problem: • Each arc is directed • If we represent individual sticks, then there are 17- from a node to choose-5 possible ways of removing 5 sticks (6188) another node • If we represent the “squares” defined by 4 sticks, there are • How does that 6 squares initially and we must remove 3 work for 8-puzzle? • So, 6-choose-3 ways of removing 3 squares (20) 24 25 4
Recommend
More recommend