Search Problems Russell and Norvig Chapter 3 Sections
Search Problems Russell and Norvig: Chapter 3, Sections 3. 1 – 3. 3 CS 121 – Winter 2003 Search Problems
Problem-Solving Agent sensors ? environment agent actuators Search Problems 2
Problem-Solving Agent sensors ? environment agent actuators • Actions • Initial state • Goal test Search Problems 3
State Space and Successor Function state space successor function • Actions • Initial state • Goal test Search Problems 4
Initial State space successor function • Actions • Initial state • Goal test Search Problems 5
Goal Test state space successor function • Actions • Initial state • Goal test Search Problems 6
Example: 8 -puzzle 8 2 3 4 5 1 1 2 3 7 4 5 6 6 7 8 Initial state Goal state Search Problems 7
Example: 8 -puzzle 8 2 3 4 7 5 1 6 8 2 3 4 5 1 8 7 6 2 8 2 3 4 7 5 1 6 Search Problems 8
Example: 8 -puzzle Size of the state space = 9!/2 = 181, 440 15 -puzzle . 65 x 1012 0. 18 sec 6 days 24 -puzzle . 5 x 1025 12 billion years 10 millions states/sec Search Problems 9
Search Problem State space Initial state Successor function Goal test Path cost Search Problems 10
Search Problem State space n n each state is an abstract representation of the environment the state space is discrete Initial state Successor function Goal test Path cost Search Problems 11
Search Problem State space Initial state: n n usually the current state sometimes one or several hypothetical states (“what if …”) Successor function Goal test Path cost Search Problems 12
Search Problem State space Initial state Successor function: n n [state subset of states] an abstract representation of the possible actions Goal test Path cost Search Problems 13
Search Problem State space Initial state Successor function Goal test: n n usually a condition sometimes the description of a state Path cost Search Problems 14
Search Problem State space Initial state Successor function Goal test Path cost: n n n [path positive number] usually, path cost = sum of step costs e. g. , number of moves of the empty tile Search Problems 15
Search of State Space Search Problems 16
Search of State Space Search Problems 17
Search State Space Search Problems 18
Search of State Space Search Problems 19
Search of State Space Search Problems 20
Search of State Space search tree Search Problems 21
Simple Agent Algorithm Problem-Solving-Agent 1. initial-state sense/read state 2. goal select/read goal 3. successor select/read action models 4. problem (initial-state, goal, successor) 5. solution search(problem) 6. perform(solution) Search Problems 22
Example: 8 -queens Place 8 queens in a chessboard so that no two queens are in the same row, column, or diagonal. A solution Not a solution Search Problems 23
Example: 8 -queens Formulation #1: • States: any arrangement of 0 to 8 queens on the board • Initial state: 0 queens on the board • Successor function: add a queen in any square • Goal test: 8 queens on the board, none attacked 648 states with 8 queens Search Problems 24
Example: 8 -queens 2, 067 states Formulation #2: • States: any arrangement of k = 0 to 8 queens in the k leftmost columns with none attacked • Initial state: 0 queens on the board • Successor function: add a queen to any square in the leftmost empty column such that it is not attacked by any other queen • Goal test: 8 queens on the Search Problems board 25
Example: Robot navigation What is the state space? Search Problems 27
Example: Robot navigation Cost of one horizontal/vertical step = 1 Cost of one diagonal step = 2 Search Problems 28
Example: Robot navigation Search Problems 29
Example: Robot navigation Search Problems 30
Example: Robot navigation Cost of one step = ? ? ? Search Problems 31
Example: Robot navigation Search Problems 32
Example: Robot navigation Search Problems 33
Example: Robot navigation Cost of one step: length of segment Search Problems 34
Example: Robot navigation Search Problems 35
Example: Assembly Planning Initial state Complex function: it must find if a collision-free merging motion exists Goal state Successor function: • Merge two subassemblies Search Problems 36
Example: Assembly Planning Search Problems 37
Example: Assembly Planning Search Problems 38
Assumptions in Basic Search The The environment is static environment is discretizable environment is observable actions are deterministic open-loop solution Search Problems 39
Search Problem Formulation Real-world environment Abstraction Search Problems 40
Search Problem Formulation Real-world environment Abstraction n Validity: w Can the solution be executed? Search Problems 41
Search Problem Formulation Real-world environment Abstraction n Validity: w Can the solution be executed? w Does the state space contain the solution? Search Problems 42
Search Problems 43
Search Problems 44
Search Problems 45
Search Problems 46
Search Problem Formulation Real-world environment Abstraction n Validity: w Can the solution be executed? w Does the state space contain the solution? n Usefulness w Is the abstract problem easier than the realworld problem? Search Problems 47
Search Problem Formulation Real-world environment Abstraction n Validity: w Can the solution be executed? w Does the state space contain the solution? n Usefulness w Is the abstract problem easier than the realworld problem? Without abstraction an agent would be swamped by the real world Search Problems 48
Search Problem Variants One or several initial states One or several goal states The solution is the path or a goal node n n In the 8 -puzzle problem, it is the path to a goal node In the 8 -queen problem, it is a goal node Search Problems 49
Problem Variants One or several initial states One or several goal states The solution is the path or a goal node Any, or the best, or all solutions Search Problems 50
Important Parameters Number of states in state space 8 -puzzle 181, 440 15 -puzzle . 65 x 1012 24 -puzzle . 5 x 1025 8 -queens 2, 057 100 -queens 1052 There exist techniques to solve N-queens problems efficiently! Stating a problem as a search problem is not always a good idea! Search Problems 51
Important Parameters Number of states in state space Size of memory needed to store a state Search Problems 52
Important Parameters Number of states in state space Size of memory needed to store a state Running time of the successor function Search Problems 53
Applications Route finding: airline travel, telephone/computer networks Pipe routing, VLSI routing Pharmaceutical drug design Robot motion planning Video games Search Problems 54
Task Environment Observable Static Discrete Agents Crossword puzzle Fully Static Discrete Single Chess with a clock Fully Strategic Sequential Semi Discrete Multi Partially Strategic Sequential Static Discrete Multi Backgammon Fully Stochastic Sequential Static Discrete Multi Taxi driving Partially Stochastic Sequential Dynamic Continuous Multi Medical diagnosis Partially Stochastic Sequential Dynamic Continuous Single Fully Deterministic Episodic Semi Continuous Single Part-picking robot Partially Stochastic Episodic Dynamic Continuous Single Refinery controller Partially Stochastic Sequential Dynamic Continuous Single Interactive English tutor Partially Stochastic Sequential Dynamic Discrete Multi Poker Image-analysis Figure 2. 6 Deterministic Episodic Deterministic Sequential Examples of task environments and their characteristics. Search Problems 55
Summary Problem-solving agent State space, successor function, search Examples: 8 -puzzle, 8 -queens, route finding, robot navigation, assembly planning Assumptions of basic search Important parameters Search Problems 56
Future Classes Search strategies n n Blind strategies Heuristic strategies Extensions n n n Uncertainty in state sensing Uncertainty action model On-line problem solving Search Problems 57
- Slides: 57