Contents Foundations of Artificial Intelligence Problem-Solving Agents 1 3. Solving Problems by Searching Formulating Problems 2 Problem-Solving Agents, Formulating Problems, Search Strategies Problem Types 3 Wolfram Burgard, Bernhard Nebel, and Martin Riedmiller Example Problems 4 Albert-Ludwigs-Universit¨ at Freiburg Search Strategies 5 May 6, 2011 (University of Freiburg) Foundations of AI May 6, 2011 2 / 47 Problem-Solving Agents A Simple Problem-Solving Agent function S IMPLE -P ROBLEM -S OLVING -A GENT ( percept ) returns an action persistent : seq , an action sequence, initially empty → Goal-based agents state , some description of the current world state goal , a goal, initially null Formulation: problem as a state-space and goal as a particular condition problem , a problem formulation on states state ← U PDATE -S TATE ( state , percept ) Given: initial state if seq is empty then goal ← F ORMULATE -G OAL ( state ) Goal: To reach the specified goal (a state) through the execution problem ← F ORMULATE -P ROBLEM ( state , goal ) of appropriate actions seq ← S EARCH ( problem ) if seq = failure then return a null action → Search for a suitable action sequence and execute the actions action ← F IRST ( seq ) seq ← R EST ( seq ) return action (University of Freiburg) Foundations of AI May 6, 2011 3 / 47 (University of Freiburg) Foundations of AI May 6, 2011 4 / 47
Properties of this Agent Problem Formulation Goal formulation World states with certain properties Definition of the state space Stationary environment (important: only the relevant aspects → abstraction) Definition of the actions that can change the world state Observable environment Definition of the problem type, which depends on the knowledge of the Discrete states world states and actions → states in the search space Deterministic environment Specification of the search costs (search costs, offline costs) and the execution costs (path costs, online costs) Note: The type of problem formulation can have a serious influence on the difficulty of finding a solution. (University of Freiburg) Foundations of AI May 6, 2011 5 / 47 (University of Freiburg) Foundations of AI May 6, 2011 6 / 47 Example Problem Formulation Alternative Problem Formulation Given an n × n board from which two diagonally opposite corners have been removed (here 8 × 8 ): Question: Can a chess board consisting of n 2 / 2 black and n 2 / 2 − 2 white squares be Goal: Cover the board completely with dominoes, each of which covers completely covered with dominoes such that each domino covers one black two neighbouring squares. and one white square? → Goal, state space, actions, search, . . . . . . clearly not. (University of Freiburg) Foundations of AI May 6, 2011 7 / 47 (University of Freiburg) Foundations of AI May 6, 2011 8 / 47
Problem Formulation for the Vacuum Cleaner World Problem Types: Knowledge of States and Actions State is completely observable Complete world state knowledge Complete action knowledge World state space: → The agent always knows its world state 2 positions, dirt or no dirt 1 2 → 8 world states State is partially observable Incomplete world state knowledge Actions: 3 4 Incomplete action knowledge Left ( L ), Right ( R ), or Suck ( S ) → The agent only knows which group of world states it is in Goal: 5 6 Contingency problem no dirt in the rooms It is impossible to define a complete sequence of actions that constitute 7 8 Path costs: a solution in advance because information about the intermediary states one unit per action is unknown. Exploration problem State space and effects of actions unknown. Difficult! (University of Freiburg) Foundations of AI May 6, 2011 9 / 47 (University of Freiburg) Foundations of AI May 6, 2011 10 / 47 The Vacuum Cleaner Problem The Vacuum Cleaner World as a Partially Observable State Problem If the environment is completely observable, the vacuum cleaner always knows where it is and where the dirt is. The solution then is reduced to searching for a path from the initial state to the goal state. If the vacuum cleaner has L no sensors, it doesn’t R R know where it or the dirt L R is. L R L S S In spite of this, it can still S R R solve the problem. Here, L R L R S S states are knowledge L L S S states. L R S S L R S S States for the search: The L R R L power set of the world R L L R L states 1-8. S S S S R States for the search: The world states 1-8. (University of Freiburg) Foundations of AI May 6, 2011 11 / 47 (University of Freiburg) Foundations of AI May 6, 2011 12 / 47
Concepts (1) L R L R Initial State: The state from which the agent infers that it is at the beginning S State Space: Set of all possible states Actions: Description of possible actions. Available actions might S S be a function of the state. L R Transition Model: Description of the outcome of an action L (successor function) S S R Goal Test: Tests whether the state description matches a goal state R L L R L S S R (University of Freiburg) Foundations of AI May 6, 2011 14 / 47 Concepts (2) Example: The 8-Puzzle 7 2 4 1 2 5 6 3 4 5 Path: A sequence of actions leading from one state to another 8 3 1 6 7 8 Path Costs: Cost function g over paths. Usually the sum of the costs of Start State Goal State the actions along the path States: Description of the location of each of the eight tiles and (for Solution: Path from an initial to a goal state efficiency) the blank square. Search Costs: Time and storage requirements to find a solution Initial State: Initial configuration of the puzzle. Actions (transition model defined accordingly): Moving the blank left, Total Costs: Search costs + path costs right, up, or down. Goal Test: Does the state match the configuration on the right (or any other configuration)? Path Costs: Each step costs 1 unit (path costs corresponds to its length). (University of Freiburg) Foundations of AI May 6, 2011 15 / 47 (University of Freiburg) Foundations of AI May 6, 2011 16 / 47
Example: 8-Queens Problem Example: 8-Queens Problem Almost a solution: A solution: States: States: Any arrangement of 0 to 8 queens on the board. Any arrangement of 0 to 8 queens on the board. Initial state: Initial state: No queen on the board. No queen on the board. Successor function: Successor function: Add a queen to an empty field on the board. Add a queen to an empty field on the board. Goal test: Goal test: 8 queens on the board such that no queen attacks another. 8 queens on the board such that no queen attacks another. Path costs: Path costs: 0 (we are only interested in the solution). 0 (we are only interested in the solution). (University of Freiburg) Foundations of AI May 6, 2011 17 / 47 (University of Freiburg) Foundations of AI May 6, 2011 18 / 47 Alternative Formulations Example: Missionaries and Cannibals Informal problem description: Na¨ ıve formulation States: any arrangement of 0 – 8 queens Three missionaries and three cannibals are on one side of a river that Problem: 64 × 63 × · · · × 57 ≈ 10 14 possible states they wish to cross. Better formulation A boat is available that can hold at most two people. States: any arrangement of n queens ( 0 ≤ n ≤ 8 ) one per column in the leftmost n columns such that no queen attacks another. You must never leave a group of missionaries outnumbered by cannibals Successor function: add a queen to any square in the leftmost empty on the same bank. column such that it is not attacked by any other queen. Problem: 2 , 057 states → Find an action sequence that brings everyone safely to the opposite Sometimes no admissible states can be found. bank. (University of Freiburg) Foundations of AI May 6, 2011 19 / 47 (University of Freiburg) Foundations of AI May 6, 2011 20 / 47
Recommend
More recommend