COSC 4350 and 5350 Artificial Intelligence - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

COSC 4350 and 5350 Artificial Intelligence

Description:

There is a pump that can be used to fill the jugs with water. How can you get exactly 2 gallons of water into the 3-gallon jug? ... – PowerPoint PPT presentation

Number of Views:241
Avg rating:3.0/5.0
Slides: 28
Provided by: informa67
Category:

less

Transcript and Presenter's Notes

Title: COSC 4350 and 5350 Artificial Intelligence


1
COSC 4350 and 5350Artificial Intelligence
  • Problem solving using uninformed search
  • Dr. Lappoon R. Tang

2
Overview
  • Define what is problem solving by searching
  • See how we can formalize a problem as a search
    problem
  • Examples of search problems
  • Explain a number of search algorithms
  • Depth first search
  • Breadth first search
  • Depth bounded search
  • Iterative deepening search
  • Bidirectional search

3
Whats Problem Solving by Searching?
4
Whats Problem Solving by Searching? (Contd)
  • Try to imagine you are working out a route from
    Brownsville, TX to Strasbourg in France
  • Whatd be the first problem in your mind that you
    need to solve?
  • Whatd be the next problem in your mind after the
    first was solved?
  • When will you stop solving the problem?

5
Whats Problem Solving by Searching? (Contd)
  • Lets try to make our thinking a bit more
  • formal

6
Whats Problem Solving by Searching? (Contd)
  • Initial state where you are at the beginning
    before you even attempted to solve the problem
    (i.e. in Brownsville)
  • Current state where you are at the moment (e.g.
    Chicago)
  • Next state where you WILL be after you make a
    move from the current state (e.g. Paris)
  • Final state (or Goal state) where you WANT to
    be at the end
  • Action how to go from one state to another
    (e.g. taking a plane from Brownsville to Houston)

7
Whats Problem Solving by Searching? (Contd)
  • Solving problem by searching means the following
  • Finding a sequence of actions that will bring you
    from the initial state to the goal state in the
    most cost effective way
  • It is a fun problem that we solve many many times
    each day not knowing that we are doing it! ?

8
Formalizing a problem as a state space search
  • To formalize a problem as a search problem, one
    needs to specify
  • a set of states
  • a start state
  • a set of goal states
  • a set of operators (a successor function)
  • i.e. the actions
  • Optional path costs

9
Uninformed Search
  • A.k.a. brute force search
  • Exhaustive searching of the search space until a
    solution is found keep looking for the next
    state until the goal state is finally reached
  • Mechanical and unintelligent
  • Domain knowledge is not utilized even if
    available (we dont use knowledge to guide our
    choice of which action to take)
  • Termination might not be guaranteed for some of
    the search methods
  • It could happen if the search space is not
    bounded (hold on, you will find out more about it)

10
Example A Water Jug Problem
  • You are given two jugs, a 4-gallon one and a
    3-gallon one. Neither has any measuring markers
    on it. There is a pump that can be used to fill
    the jugs with water. How can you get exactly 2
    gallons of water into the 3-gallon jug?
  • States (x, y) where x is content of 4-gallon
    jug, y 3-gallon jug
  • Start state (0, 0)
  • Goal state (n, 2)
  • Operators
  • 1) Fill x from pump, 2) Fill y from pump
  • 3) Pour x to y, 4) Pour y to x
  • 5) Drain x (pour water to the drain), 6) drain y

11
Example A Water Jug Problem (Contd)
You are given two jugs, a 4-gallon one and a
3-gallon one. Neither has any measuring markers
on it. There is a pump that can be used to fill
the jugs with water. How can you get exactly 2
gallons of water into the 4-gallon jug? (4, 0) /
Fill x from pump / (Start state of the
world) (1, 3) / Pour x to y / (1, 0) / Drain y
/ (0, 1) / Pour x to y / (4, 1) / Fill x from
pump / (2, 3) / Pour x to y / (2, 0) / Drain
y / (0, 2) / Pour x to y / (Goal state final
state of the world) Is there a better solution? ?
12
State Space Representation
  • State space is usually a tree or a graph

(4, 0)
(1, 3)
(4, 3)
(0, 0)

(1, 0)


(0, 1)
In this case, it is a tree

13
Example Moving blocks in a block world
There are a number of blocks on a table. The
task is to rearrange them so that they line up in
a certain order.
A
A
B
C
B
C
  • States on(x,y) block x is on top of block y
  • Start state on(a,c) and on(c,b)
  • Goal state on(a,b) and on(b,c)
  • Operators
  • put(x,y) place block x on top of y if top of
    both blocks are clear
  • put(x,table) move block x to the table if top
    of x is clear

14
Example Moving blocks in a block world
There are a number of blocks on a table. The
task is to rearrange them so that they line up in
a certain order.
A
A
B
C
B
C
  • What would be the sequence of actions that take
    us from the initial
  • state to the goal state?

15
Example Moving blocks in a block world
There are a number of blocks on a table. The
task is to rearrange them so that they line up in
a certain order.
A
A
B
C
B
C
  • put(A, table)
  • put(C, table)
  • put(B, C)
  • put(A, B)

16
Searching for a solution
  • Two key decisions involved
  • Use a tree or a graph (state space
    representation)?
  • How to choose which node to expand next (search
    strategy)?
  • Example

17
Problem solving performance
  • Completeness
  • Is the search guaranteed to find a solution if
    one exists?
  • Optimality
  • Does it find the solution with the best path
    cost?
  • Is it the shortest path from the start state to
    the goal state?
  • Time complexity
  • How long does it take to find a solution (or of
    nodes generated by search operators)?
  • Space complexity
  • How much space are needed to stores the nodes to
    find a solution?

18
The Outline of a Basic Tree Search(informal
version)
  • If the current state is already the goal state,
    then we quit and return the solution path that
    connects the initial state to the goal state
  • Otherwise, we apply all the possible actions to
    the current state and expand the current state
    into all possible next states
  • Select the next state according to the search
    strategy from all the states that have not been
    explored (i.e. not yet expanded)
  • Make next state the current state
  • Go back to step 1

19
The Outline of a Basic Tree Search(formal
version)
  • Given an initial state x, a goal state y, a set
    of operators O, a search strategy
  • current-state x, Q current-state
  • If current-state y, return the solution path
    and quit
  • Expand node current-state into a set of children
    nodes C by applying the operators in O on the
    node current-state
  • Q C U (Q current-state)
  • Select the node next-state from Q according to
    the search strategy
  • current-state next-state
  • Goto step 2

20
Breadth-First Search
Goal State
  • Generate children nodes for the current node
  • If the current node goal state, you stop
  • Otherwise, current node the next sibling node
  • Is this a good idea?

21
Depth-First Search
22
Bounded Depth-First Search
  • It is simply DFS with a depth bound
  • Searching is not permitted beyond the depth bound
  • Pros Termination is guaranteed
  • Cons If the solution is beneath the depth bound,
    the search cannot find the goal (hence this
    search algorithm is incomplete).

23
Iterative Deepening
24
Is Iterative Deepening a Win?
Suppose the solution is at depth d of the tree
the last node on that level (i.e. worst case
scenario)
N(BFS) b b2 bd (bd1-b) O(bd1)
N(IDS) (d)b (d-1)b2 (1)bd O(bd)
Example Let b 10 and d 5 N(IDS) 50
400 3,000 20,000 100,000 123,450 N(BFS)
10 100 1,000 10,000 100,000 999,990
1,111,100 IDS is actually faster!
25
Bi-directional Search
Idea Expand the start state AND the goal state
until a common middle point is reached. Note Not
always applicable depending on if one can
expand the goal state Complexity O(bd/2) both
time and space
26
Comparing uninformed search strategies
  • Only depth first search and depth limited search
    are not complete nor optimal
  • Only depth first search, depth limited search,
    and IDS have linear space complexity
  • All uninformed searches have an exponential time
    complexity hopeless as a viable problem solving
    mechanism (unless you have a quantum computer!)

27
Avoiding repeating states
  • If the state space is organized as a tree, there
    are no repeated states.
  • Some problem state spaces can be more readily
    represented as a graph instead of a tree and
    repeated states can be produced IF the problem
    state space was organized as a tree
  • Example the number grid problem
  • Solution Remember search nodes expanded before
  • Maintain a CLOSED list that contains all nodes
    expanded before and an OPEN list containing nodes
    yet to be expanded
  • If the current node is in CLOSED, discard it
    because it is a repeated state
Write a Comment
User Comments (0)
About PowerShow.com