Artificial Intelligence Chapter 3: Problem Solving and Searching
-
Upload
zeeshan-bhatti -
Category
Documents
-
view
226 -
download
0
Transcript of Artificial Intelligence Chapter 3: Problem Solving and Searching
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
1/94
Artificial IntelligenceProblem Solving and SearchingDr. Zeeshan Bhatti
BSSW-PIVChapter 3
Institute of Information and Communication TechnologyUniversity of Sindh, Jamshoro By: Dr. Zeeshan Bhat ti 11BY: DR. ZEESHAN BHATTI
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
2/94
Last time: Summary
•Definition of AI?•Turing Test?• Intelligent Agents:
•Anything that can be viewed as perceiving its environment throughsensors and acting upon that environment through its effectors tomaximize progress towards its goals .•PAGE (Percepts, Actions, Goals, Environment)•Described as a Perception (sequence) to Action Mapping: f : P * A •Using look-up-table, closed form, etc.
• Agent Types: Reflex, state-based, goal-based, utility-based
•Rational Action: The action that maximizes the expected value of
the performance measure given the percept sequence to date
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
3/94
Outline: Problem solving and search
• Introduction to Problem Solving
•Complexity
•Uninformed search•Problem formulation•Search strategies: depth-first, breadth-first
• Informed search•Search strategies: best-first, A*•Heuristic functions
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
4/94
Example: Measuring problem!
Problem: Using these three buckets,measure 7 liters of water.
3 l 5 l 9 l
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
5/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
6/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
7/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
8/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
9/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
10/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
11/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
12/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
13/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
14/94
Example: Measuring problem!
• (one possible) Solution:
a b c0 0 0
start3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
15/94
Example: Measuring problem!
• Another Solution:
a b c0 0 0
start0 5 00 0 3
3 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
16/94
Example: Measuring problem!
• Another Solution:
a b c0 0 0
start0 5 03 2 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
17/94
Example: Measuring problem!
• Another Solution:
a b c0 0 0
start0 5 03 2 03 0 23 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
18/94
Example: Measuring problem!
• Another Solution:
a b c0 0 0
start0 5 03 2 03 0 23 5 20 0 63 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
19/94
Example: Measuring problem!
• Another Solution:
a b c0 0 0
start0 5 03 2 03 0 23 5 23 0 7
goal3 0 60 3 63 3 61 5 60 5 7
goal
3 l 5 l 9 l
a b c
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
20/94
Which solution do we prefer?
•Solution 1:a b c
0 0 0start
3 0 00 0 33 0 30 0 63 0 60 3 63 3 61 5 60 5 7
goal
•Solution 2:
a b c
0 0 0start
0 5 03 2 03 0 23 5 23 0 7
goal
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
21/94
Problem Solving Agents
• Intelligent agents are supposed to maximizetheir performance measure.
• Achieving this is sometimes simplified if theagent can adopt a goal and aim at satisfying it.
Goal formulation , based on the current situationand the agent’s performance measure, is the first
step in problem solving.
DZB1
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
22/94
Slide 21
DZB1 Dr. Zeeshan Bhatti, 14/3/2016
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
23/94
Example: Romania
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
24/94
Example: Romania
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
25/94
Problem-Solving Agent
Note: This is offline problem-solving. Online problem-solving involvesacting w/o complete knowledge of the problem and environment
action
// From LA to San Diego (given curr. state)// e.g., Gas usage
// What is the current state?
// If fails to reach goal, update
Restricted form of general agent:
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
26/94
Example: Buckets
Measure 7 liters of water using a 3-liter, a 5-liter, and a 9-liter buckets.
•Formulate goal: Have 7 liters of waterin 9-liter bucket
•Formulate problem:•States: amount of water in the buckets•Operators: Fill bucket from source, empty bucket
•Find solution: sequence of operators that bring you
from current state to the goalstate
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
27/94
Problem types
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
28/94
Problem types
•Single-state problem: deterministic, accessible Agent knows everything about world, thus can calculate optimal action sequence to reach goal state.
•Multiple-state problem: deterministic, inaccessible Agent must reason about sequences of actions and states assumed while working towards goal state.
•Contingency problem: nondeterministic, inaccessible•Must use sensors during execution •Solution is a tree or policy •Often interleave search and execution
•Exploration problem: unknown state spaceDiscover and learn about environment while taking actions.
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
29/94
Problem types
•Single-state problem: deterministic, accessible
•Agent knows everything about world (the exact state),
•Can calculate optimal action sequence to reach goal state.
•E.g., playing chess. Any action will result in an exact state
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
30/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
31/94
Problem types
•Contingency problem: nondeterministic, inaccessible
•Must use sensors during execution•Solution is a tree or policy•Often interleave search and execution
•E.g., a new skater in an arena•Sliding problem.•Many skaters around
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
32/94
Problem types
•Exploration problem: unknown state space
Discover and learn about environment whiletaking actions.
•E.g., Maze
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
33/94
Example: Vacuum world
Simplified world: 2 locations, each may or not contain dirt,each may or not contain vacuuming agent.
Goal of agent: clean up the dirt.
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
34/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
35/94
34
Example: vacuum world
• Single-state , start in #5.Solution?
•
By: Dr. Zeeshan Bhatti
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
36/94
35
Example: vacuum world
• Single-state , start in #5.Solution? [Right, Suck]
•
• Multiple State or Sensorless,start in { 1,2,3,4,5,6,7,8 } e.g.,Right goes to { 2,4,6,8 }Solution?
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
37/94
36
Example: vacuum world
• Sensorless, start in{1,2,3,4,5,6,7,8 } e.g.,Right goes to { 2,4,6,8 }Solution?[Right,Suck,Left,Suck]
•
• Contingency• Nondeterministic: Suck may
dirty a clean carpet
• Partially observable: location, dirt at current location.• Percept: [L, Clean], i.e., start in #5 or #7
Solution?
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
38/94
37
Example: vacuum world
• Sensorless, start in{1,2,3,4,5,6,7,8 } e.g.,Right goes to { 2,4,6,8 }Solution?[Right,Suck,Left,Suck]
•• Contingency
• Nondeterministic: Suck maydirty a clean carpet
• Partially observable: location, dirt at current location.• Percept: [L, Clean], i.e., start in #5 or #7
Solution? [Right, if dirt then Suck]
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
39/94
38
Single-state problem formulation
A problem is defined by four items:
1. initial state e.g., "at Arad"2. actions or successor function S(x) = set of action–state pairs
• e.g., S(Arad) = {, … }
3. goal test , can be• explicit , e.g., x = "at Bucharest"• implicit , e.g., Checkmate(x)
4. path cost (additive)• e.g., sum of distances, number of actions executed, etc.• c(x,a,y) is the step cost , assumed to be ≥ 0
• A solution is a sequence of actions leading from the initial state to agoal state
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
40/94
39
Selecting a state space• Real world is absurdly complex
state space must be abstracted for problem solving
• (Abstract) state = set of real states
• (Abstract) action = complex combination of real actions• e.g., "Arad Zerind" represents a complex set of possible routes, detours,
rest stops, etc.• For guaranteed realizability, any real state "in Arad“ must get to some
real state "in Zerind"
• (Abstract) solution =• set of real paths that are solutions in the real world
• Each abstract action should be "easier" than the original problem
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
41/94
40
Vacuum world state space graph
• states?• actions?
• goal test?• path cost?•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
42/94
41
Vacuum world state space graph
• states? integer dirt and robot location
• actions? Left , Right , Suck • goal test? no dirt at all locations• path cost? 1 per action
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
43/94
42
Example: The 8-puzzle
• states?• actions?• goal test?• path cost?
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
44/94
43
Example: The 8-puzzle
• states? locations of tiles• actions? move blank left, right, up, down• goal test? = goal state (given)
• path cost? 1 per move•
[Note: optimal solution of n-Puzzle family is NP-hard]
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
45/94
44
Example: robotic assembly
• states? : real-valued coordinates of robot joint angles parts ofthe object to be assembled
• actions? : continuous motions of robot joints
• goal test? : complete assembly
• path cost? : time to execute
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
46/94
45
Tree search algorithms
• Basic idea:• offline, simulated exploration of state space by generating
successors of already-explored states (a.k.a.~ expandingstates)
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
47/94
Example: Romania
•In Romania, on vacation. Currently in Arad.•Flight leaves tomorrow from Bucharest.
•Formulate goal:be in Bucharest
•Formulate problem:states: various citiesoperators: drive between cities
•Find solution:
sequence of cities, such that total driving distance isminimized.
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
48/94
Example: Traveling from Arad To Bucharest
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
49/94
48
Tree search example
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
50/94
49
Tree search example
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
51/94
50
Tree search example
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
52/94
51
Implementation: general tree search
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
53/94
By: Dr. Zeeshan Bhatti 52
Implementation: states vs. nodes
• A state is a (representation of) a physical configuration• A node is a data structure constituting part of a search tree
includes state , parent node , action , path cost g(x) , depth
• The Expand function creates new nodes, filling in thevarious fields and using the SuccessorFn of the problem tocreate the corresponding states.
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
54/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
55/94
Binary Tree Example
root
N1 N2
N3 N4 N5 N6
Number of nodes: n = 2 max depthNumber of levels (max depth) = log(n) (could be n)
Depth = 0
Depth = 1
Depth = 2
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
56/94
By: Dr. Zeeshan Bhatti 55
Uninformed search strategies
• Uninformed search strategies use only theinformation available in the problem definition
•• Breadth-first search•• Uniform-cost search•• Depth-first search•• Depth-limited search•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
57/94
By: Dr. Zeeshan Bhatti 56
Breadth-first search
• Expand shallowest unexpanded node•• Implementation :
• fringe is a FIFO queue, i.e., new successors go at end•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
58/94
By: Dr. Zeeshan Bhatti 57
Breadth-first search
• Expand shallowest unexpanded node•• Implementation :
• fringe is a FIFO queue, i.e., new successors go at end•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
59/94
By: Dr. Zeeshan Bhatti 58
Breadth-first search
• Expand shallowest unexpanded node•• Implementation :
• fringe is a FIFO queue, i.e., new successors go at end•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
60/94
By: Dr. Zeeshan Bhatti 59
Breadth-first search
• Expand shallowest unexpanded node•• Implementation :
• fringe is a FIFO queue, i.e., new successors go at end
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
61/94
By: Dr. Zeeshan Bhatti 60
Properties of breadth-first search
• Complete? Yes (if b is finite)•• Time? 1+b+b 2 +b 3+… + bd + b(b d -1 ) = O(b d+1 )•• Space? O(b d+1 ) (keeps every node in memory)•• Optimal? Yes (if cost = 1 per step)
•
• Space is the bigger problem (more than time)
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
62/94
By: Dr. Zeeshan Bhatti 61
Uniform-cost search
• Expand least-cost unexpanded node•• Implementation :
• fringe = queue ordered by path cost•
• Equivalent to breadth-first if step costs all equal•• Complete? Yes, if step cost ≥ ε•• Time? # of nodes with g ≤ cost of optimal solution,
O(b ceiling(C*/ ε) ) where C * is the cost of the optimal solution• Space? # of nodes with g ≤ cost of optimal solution,
O(b ceiling(C*/ ε) )
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
63/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
64/94
By: Dr. Zeeshan Bhatti 63
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
65/94
By: Dr. Zeeshan Bhatti 64
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
66/94
By: Dr. Zeeshan Bhatti 65
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
67/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
68/94
By: Dr. Zeeshan Bhatti 67
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
69/94
By: Dr. Zeeshan Bhatti 68
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
70/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
71/94
By: Dr. Zeeshan Bhatti 70
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
72/94
By: Dr. Zeeshan Bhatti 71
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
73/94
By: Dr. Zeeshan Bhatti 72
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
74/94
By: Dr. Zeeshan Bhatti 73
Depth-first search
• Expand deepest unexpanded node•• Implementation :
• fringe = LIFO queue, i.e., put successors at front
•
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
75/94
By: Dr. Zeeshan Bhatti 74
Properties of depth-first search
• Complete? No: fails in infinite-depth spaces, spaceswith loops
• Modify to avoid repeated states along path•
complete in finite spaces
• Time? O(b m ): terrible if m is much larger than d • but if solutions are dense, may be much faster than
breadth-first•
• Space? O(bm), i.e., linear space!•• O timal? No
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
76/94
By: Dr. Zeeshan Bhatti 75
Depth-limited search
= depth-first search with depth limit l ,i.e., nodes at depth l have no successors
• Recursive implementation :
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
77/94
By: Dr. Zeeshan Bhatti 76
Iterative deepening search
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
78/94
By: Dr. Zeeshan Bhatti 77
Iterative deepening search l =0
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
79/94
By: Dr. Zeeshan Bhatti 78
Iterative deepening search l =1
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
80/94
By: Dr. Zeeshan Bhatti 79
Iterative deepening search l =2
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
81/94
By: Dr. Zeeshan Bhatti 80
Iterative deepening search l =3
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
82/94
By: Dr. Zeeshan Bhatti 81
Iterative deepening search
• Number of nodes generated in a depth-limited search todepth d with branching factor b:N DLS = b 0 + b 1 + b 2 + … + b d-2 + b d-1 + b d
• Number of nodes generated in an iterative deepening search
to depth d with branching factor b:NIDS = (d+1)b 0 + d b^ 1 + (d-1)b^ 2 + … + 3b d-2 +2b d-1 + 1b d
• For b = 10 , d = 5 ,•
• NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111•• N IDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456•
d h
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
83/94
By: Dr. Zeeshan Bhatti 82
deepening search
• Complete? Yes•• Time? (d+1)b 0 + d b 1 + (d-1)b 2 + … + b d = O(b d )•• Space? O(bd)•• Optimal? Yes, if step cost = 1
f l h
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
84/94
By: Dr. Zeeshan Bhatti 83
Summary of algorithms
R d
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
85/94
By: Dr. Zeeshan Bhatti 84
Repeated states
• Failure to detect repeated states can turn a linearproblem into an exponential one!
•
G h h
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
86/94
By: Dr. Zeeshan Bhatti 85
Graph search
S
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
87/94
By: Dr. Zeeshan Bhatti 86
Summary
• Problem formulation usually requires abstracting away real-world details to define a state space that can feasibly beexplored
• Variety of uninformed search strategies
• Iterative deepening search uses only linear space and notmuch more time than other uninformed algorithms
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
88/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
89/94
Complexity
•Why worry about complexity of algorithms?
because a problem may be solvable in principle but maytake too long to solve in practice
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
90/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
91/94
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
92/94
Complexity example: Traveling Salesman Problem
This is a hard problem: the only known algorithms (so far)to solve it have exponential complexity, that is, the numberof operations required to solve it grows as exp(n) for n cities.
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
93/94
Why is exponential complexity “hard”?
It means that the number of operations necessary tocompute the exact solution of the problem growsexponentially with the size of the problem (here, thenumber of cities).
•exp(1) = 2.72
•exp(10) = 2.20 10 4 (daily salesman trip)•exp(100) = 2.69 10 43 (monthly salesman planning)•exp(500) = 1.40 10 217 (music band worldwide tour)•exp(250,000) = 10 108,573 (fedex, postal services)•Fastest
computer = 10 12 operations/second
-
8/18/2019 Artificial Intelligence Chapter 3: Problem Solving and Searching
94/94
So…
In general, exponential-complexity problems cannot besolved for any but the smallest instances!