problem solving by searching copyright, 1996 © dale carnegie & associates, inc. chapter 3...

23
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004

Post on 19-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Problem Solving by Searching

Copyright, 1996 © Dale Carnegie & Associates, Inc.

Chapter 3

Spring 2004

CS 471/598 by H. Liu 2

Problem-Solving AgentsThis is a kind of goal-based agents that decide what to do by finding sequences of actions that lead to desirable states.

Formulating problemsExample problemsSearching for solutions

CS 471/598 by H. Liu 3

A simple problem-solving agent

Goal formulation - limiting the objectives A goal is a set of world states in which

the goal is satisfied.

Problem formulation - deciding what actions and states to considerSearch - looking for the best sequence of actions

CS 471/598 by H. Liu 4

A simple agentSolutions - the results of search, so they are sequences of actions that lead to the goal Execution - acting upon the world

Formulate -> Search -> ExecuteAn algorithm in Fig 3.1

CS 471/598 by H. Liu 5

Well-defined problems and solutions

A problem is defined by four components Initial state is where an agent starts Possible actions, successor function

<action,successor> Goal test determines if a state is a goal state Path cost function, step cost

A solution is a path from the initial state to a goal state Path - connecting sets of states

CS 471/598 by H. Liu 6

Problems and Solutions

States and actions are the basic elements of a problemA world of states: initial state I, operator O (or successor)State space - the set of all states reachable from I by any sequences of OExample: a simplified Romania road map (Fig 3.2)

CS 471/598 by H. Liu 7

Formulating ProblemsChoosing states and actions

The real art of problem solving is in what goes into the description of the states and operators and what does notAbstraction - removing detail from a representation

CS 471/598 by H. Liu 8

Measuring problem-solving performance

Performance measures Completeness Optimality Time complexity Space complexity

Reach the goalSearch costTotal cost = path cost + search cost

CS 471/598 by H. Liu 9

Example ProblemsToy problems: concise and exact, used to illustrate or exercise various problem-solving methods - ideal casesReal-world problems: more difficult and we want solutions, but there might be many different descriptions

CS 471/598 by H. Liu 10

Toy problem (1)Vacuum world (Fig 3.3) States: 8 Initial states: any Successor function: Left, Right, Suck Goal test: Clean or not Path cost: Each step costs 1

Comparing with the real world case

CS 471/598 by H. Liu 11

Toy problem (2)The 8-puzzle States:O(9!) Initial state: Start state (Fig 3.4) Successor function: Left, Right, Up,

Down Goal test: Goal state (Fig 3.4) Path cost: Each step costs 1

CS 471/598 by H. Liu 12

Toy problem (3)The 8-queens (Fig 3.5) States: 64*63*…*57 Initial states: Empty board Successor function: Add a queen to

any empty square Goal test: 8 queens on the board,

none attacked Path cost: N/A

CS 471/598 by H. Liu 13

Real-world problemsRoute findingTouring and traveling salesperson problemVLSI layoutRobot navigationAssembly sequencingProtein designInternet searching

CS 471/598 by H. Liu 14

SearchGenerating action sequences Expanding the current state by ... Generating a new set of statesLet’s look at a situation we come to BY

… PHX -> ASU -> BY

A state map

CS 471/598 by H. Liu 15

What is search?The essence of search is to consider one choice at a time. Search tree – generated by the initial state and successor, defines the state space (two examples - Figs 3.6 and 3.8) root, nodes, fringe (leaf nodes)

A general search algorithm (Fig 3.9) Initial state, test, expand, test, expand, … How to expand is determined by a search

strategy How to implement the fringe - a queue

CS 471/598 by H. Liu 16

Search EvaluationEvaluating search strategies (Criteria) Completeness – guaranteed to find a

solution if there is one Time complexity – big O Space complexity – big O Optimality – the solution is optimal

Two types of search Blind search (uninformed) Heuristic search (informed)

CS 471/598 by H. Liu 17

Uninformed Search Strategies

Breadth-first search (a binary tree example) Expanding the shallowest node Complete? Optimal? What if cost is non-

decreasing How to implement it branching factor - a killing cost (Fig 3.11)

The main concerns the memory requirements exponential complexity

Uniform cost search – expands the node with the lowest path cost When is it identical to BFS?

CS 471/598 by H. Liu 18

Search Strategies (2)Depth-first search A binary tree example (Fig 3.12) Complete? Optimal? How to implement it

The main concerns Wrong branch Deep branch

The cures Depth-limited search (Fig 3.13)

Determining depth limit based on the problem (how many cities in the map of Romania?)

Iterative deepening search (Fig 3.15)

CS 471/598 by H. Liu 19

Search Strategies (3)Bidirectional search The two directions: Start, Goal (Fig

3.16) What’s the saving?

The main concerns How to search backwards Multiple goal states Efficient checking to avoid redundant

search in the other tree

CS 471/598 by H. Liu 20

Search Strategies (4)Which one to use when We need to know the strategies in

terms of the four criteria Comparing uninformed search strategies

(Fig 3.17) We need to know the problem to be

solved

CS 471/598 by H. Liu 21

Avoiding Repeated StatesIt’s wasting time to expand states that have already been encountered and expanded before.How to avoid Systematic search Remembering what have been visited

(open list vs. closed list) Graph-Search (Fig 3.19)

CS 471/598 by H. Liu 22

Searching with partial information

Sensorless problems Reason about sets of states instead of a

single state (Fig 3.21)

Contingency problems Environment is partially observable, actions

are uncertain [Suck, Right, if [R,Dirty] then Suck] with

position and local dirt sensors

Exploration problems Both the states and actions of E are unknown Can be viewed as an extreme case of

contingency problems

CS 471/598 by H. Liu 23

SummaryProblem solving is goal-basedA problem is of 4 parts initial state, operator, goal test, path

costA single general search algorithm can solve any problem, but …Four criteria: completeness, optimality, time complexity, space complexityVarious search strategies