goal-based problem solving goal formation based upon the current situation and performance measures....

25
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.

Upload: allen-lynch

Post on 18-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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.

Page 2: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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.

Page 3: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 4: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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.

Page 5: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

8-Puzzle

Initial State Goal State

Page 6: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable 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.

Page 7: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 8: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

Search Process: Generating Solutions

Represented as a treeWhat is a characteristic of

this problem regardingtree size?

Page 9: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 10: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

Uninformed Search Strategies

Breadth First SearchUniform Cost SearchDepth First SearchIterative Deepening Depth First Search

Page 11: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 12: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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.

Page 13: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 14: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 15: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 16: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 17: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 18: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 19: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 20: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 21: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 22: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?

Page 23: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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

Page 24: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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.

Page 25: Goal-based Problem Solving Goal formation Based upon the current situation and performance measures. Result is moving into a desirable state (goal state)

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?