goal-based problem solving goal formation based upon the current situation and performance measures....
TRANSCRIPT
Goal-based Problem Solving Goal formation Based upon the current situation and
performance measures. Result is moving into a desirable state (goal
state).
Problem formation Determining actions and states to consider
given the goal.
Objective: Select the best sequence of actions and states to attain goal.
Goal-based Problem SolvingExample: The 8 Puzzle
Initial State Goal State
Goal: Find sequence of actions that lead to the final configuration
Actions: move tiles up, down, left, or right when possible.
Process of finding sequence of actions: search.
Problem Types Deterministic, fully observable: single-state problemDeterministic, partially observable: multiple-state problemStochastic, partially observable: contingency problem Have to use sensors during execution Agent acts before it has found a guaranteed
plan Interleaving of search and execution
Unknown state space: exploration problemReview the four problem examples types in book: Section 3.2
Defining the problem space State space approach – Problem described as a set of states Initial state, si, that the agent knows itself to be
in at the start.
Actions: Possible actions available to agent Application of operator ai moves agent from current
state sj to state sk in the state space.
Goal Test: Is the current state is the goal state, sg?
A path in a state space is a set of actions that transition from one state to another. Path cost: a function that assigns cost to a path Solution: A path from si to sg.
8-Puzzle
Initial State Goal State
State Space Definition for 8 Puzzle
State description:
Operators:
Goal Test:
Path cost: each move is assigned a cost of 1.
position of each of the 8 tiles in one of 9 squares (or 3x3 board).
blank position moves up, down, left, or right
current state matches goal configuration illustrated on slide 3.
Example ProblemsToy Problems 8 Puzzle Missionaries and Cannibals 8 Queens
Real World Problems Route Finding Traveling Salesperson problem VLSI Layout Robot Navigation
Task: Determine the state space representation for the above problems
Search Process: Generating Solutions
Represented as a treeWhat is a characteristic of
this problem regardingtree size?
Evaluate StrategiesCompleteness Is the strategy guaranteed to find a solution if
one exists?
Time Complexity How long does the algorithm take to find a
solution?
Space Complexity How much memory does it take to perform the
search?
Optimality Does the method find the best (highest quality)
solution when there is more than one solution?
Uninformed Search Strategies
Breadth First SearchUniform Cost SearchDepth First SearchIterative Deepening Depth First Search
Search Algorithm: ImplementationApplied to State Space Representation
Function GENERAL-SEARCH (problem, QUEUING-FN) returns a solution or failure
nodes MAKE-QUEUE(
MAKE-NODE(INITIALSTATE[problem]))
:initialize search tree
loop do
if nodes is empty then return failure :no candidates to expand
node REMOVE-FRONT (nodes) :remove first node to expand
if GOAL-TEST[problem] applied to STATE(node) succeeds
then return node :if goal test is satisfied return node as the solution
nodes QUEUING-FN(node,
EXPAND(node,OPERATORS[problem]))
:otherwise find node’s successors and insert in to queue
end
Definitions Branching Factor (b)
The maximum number of successors to any node.
Depth (d) The depth of the shallowest goal node
Max Path Length (m) The maximum length of any path in the state space.
Time Number of nodes generated during the search.
Space The maximum number of nodes stored in memory.
Breadth-first Search (BFS)
All nodes at a given depth are expanded before any nodes at a lower level are expanded.
A
B
E
C
D
I J K
F
Start node
Level 1
Level 2
L
Level 3
G H
1
2 3
4 65
7 8 9
Queuing: FIFOQueue : AQueue : B,CQueue : C, DQueue : D, E, FQueue : E, F, G, HQueue : F, G, H, I, JQueue : G, H, I, J, K, L
A
Queue : I, J, K, LQueue : J, K, LQueue : K, L
A
Queue :
B
Queue : C
B
D
Queue : D
CC
Queue : E, F
D
Queue : F, G, H
EE
Queue : G, H, I, J
F
Queue : H, I, J, K, L
F
GG HH II J
Added queue
Removed queue
Expanded
Breadth-first SearchWill always find solution but may not be the most efficient solution.
Is it complete?What is the time complexity?What is the space complexity?Is it optimal?
Uniform-cost SearchExpand node with least path cost first Means must insert nodes into queue by
increasing path cost (PC).
A
B
E
C
D
I J
F
G H
1
23
4 5
J
Queue : AQueue : C, BQueue : B, E, FQueue : D, E, FQueue : E, G, F, HQueue : J, G, F, I, H
10 5
1 7PC: 10 + 1 = 11
PC: 5 + 7 = 12 10PC: 5 + 10 = 15
3PC: 11 + 3 = 14
NOTE: Node F is never expanded, therefore, nodes K & L from our BFS tree are never seen in this tree.
9PC: 11 + 9 = 20
4PC: 12 + 4 = 16
1PC: 12 + 1 = 13
Queue : G, F, I, H
Added queue
Removed queue
Expanded
A
Queue : Queue : B
A
CC
Queue : E, F
BB
D
Queue : E, F
D
Queue : G, F, H
EE
Uniform-cost SearchOnly concerned about the total path cost.
Can it get into an infinite loop?Is it complete?How does the worst case time and space complexity compare to breadth-first search?Is it optimal?
Depth-first Search (DFS)
Follows each path to the greatest depth before moving to the next path.
A
B
E
C
D
I J
F
Start node
Level 1
Level 2
Level 3
G H
1
2
3
4
6
5
7
8 J
Queuing: LIFOQueue : AQueue : B,CQueue : D, CQueue : G, H, CQueue : CQueue : E, FQueue : I, J, FQueue : J, FQueue : F
11
Added queue
Removed queue
Expanded
Queue :
AA
Queue : C
BB
Queue : C
DD
Queue : H, C
GG H
Queue :
H
C
Queue : F
C
EE
II
Depth-first SearchWhat is a problem with this method?What are the space requirements? What is the worst case?
What about the processing requirements? What is the worst case?
Depth-Limited Search Depth-first search with depth limit l i.e., cut off search at preset depth l
Start node
Level 1
Level 2
Level 3
Is this result the same as DFS?
Let l = 3
What changes if l = 2?
Added queue
Removed queue
Expanded
A
B
E
C
D
I J
F
G H
1
2
3
4
5
J
Queue : AQueue : B,CQueue : D, CQueue : G, H, CQueue : CQueue : E, FQueue : I, J, FQueue : J, FQueue : FQueue :
AA
Queue : C
BB
Queue : C
DD
Queue : H, C
G H
Queue :
C
Queue : F
C
EE
I
Depth-limited SearchDoes this algorithm solve the infinite path problem?
What happens if the goal is at a node below the depth limit? What does this mean for completeness?
What happens if l is larger than d, the depth of the goal node?
What is the diameter? How does it affect the depth limit?
Iterative deepening searchDepth-first search that gradually increases the depth limit until the goal is found. Again combines DFS and BFS.
A
B
E
C
D
I J
F
G H J
Limit = 0Limit = 1
Queue : AQueue : B, CQueue : C
Limit = 2
Queue : D, CQueue : E, FQueue : F
Limit = 3
Queue : G, H, CQueue : H, CQueue : I, J, FQueue : J, F
Added queue
Removed queue
Expanded
Queue :
A
B C
D E F
G IH
A
B
D E
C
1 2
3 4
5
6
7
8
9
Iterative Deepening Search
Combines the best of breadth-first and depth-first searches. What is this factor for breadth-first
search? For depth-first search?
What is the time complexity?Is iterative deepening faster than breadth-first?When is it best to apply this algorithm?
Some Conceptual Questions
What is common between BFS and Uniform cost search? Not much; Uniform cost search is more like DFS. True or False
• What is a definite advantage of DFS over BFS? (choose 1)
• DFS is always faster than BFS.• DFS will always find the optimal solution.• DFS requires much less memory than BFS.• None of the above
Some Conceptual Questions• IDS is truly wasteful, because you keep generating the same nodes again and again.
• True – at the kth iteration, the root node will already have been
generated k times.• False: it does not have a significant effect on complexity of the
search.
Uninformed SearchEach of the algorithms discussed are considered uninformed search algorithms. Why? Is it possible to improve the search
process if it was more intelligent?