8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 1/48
Introduction to
Artificial Intelligence
Problem Solving and Strategies
Solving problems by searchingSearch Strategies
Blind searchInformed search
Game play searchP roblem reduction paradigm
Search graph AND/OR graph
No. 3
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 2/48
Introduction to
Artificial IntelligenceProblem as a State Space Search
To build a system to solve a particular problem, we need to:D efine the problem : must include precise specifications ~initial solution & final solution.A nalyze the problem : select the most important features thatcan have an immense impact.Isolate and represent : convert these important features intoknowledge representation.Identify problem solving technique(s) : choose the besttechnique and apply it to particular problem.
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 3/48
Introduction to
Artificial IntelligenceThe Quest
Typical questions that need to be answered:Is the problem solver guaranteed to find a solution?W ill the system always terminate or caught in a infinite loop?If the solution is found, it is optimal ?W hat is the complexity of searching process?H ow the system be able to reduce searching complexity?H ow it can effectively utilize the representation paradigm?
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 4/48
Introduction to
Artificial IntelligenceImportant Terms
Search space possible conditions and solutions.Initial state state where the searching processstarted.Goal state the ultimate aim of searching process.Problem space ³ what to solve´Searching strategy strategy for controlling thesearch.Search tree tree representation of search space,showing possible solutions from initial state.
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 5/48
Introduction to
Artificial IntelligenceExample: Travelling Salesperson Problem
B
C
D
E
75
50
100
100125
125125
75
50
A
Suppose a salesperson has five cities to visit and theymust return home. Goal find the shortest path to travel.
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 6/48
Introduction to
Artificial Intelligence
A
A A A
C
C
C
C
D
D
D
D
The possible search space for TS P .
Example: Traveling Salesperson Problem (cont)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 7/48
Introduction to
Artificial Intelligence
The 8 P uzzle Games contains eight tiles that can bemoved around in nine spaces.
A im : to arrange the tiles sequence using defined legalmovement (Eg: move the blank board).
1 2 3
4 6
7 8
5
Example: Eight Puzzle Games
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 8/48
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 9/48
Introduction to
Artificial IntelligenceSearching for Solution
Search through state space (explicitly using searching tree).
Node expansion :- generating new node related to previous nodes.
Concepts:
State :- conditions in which the node corresponds.P arent node :- the superior node
P ath cost :- the cost, from initial to goal state.
Depth:- number of steps along the path from initial state
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 10/48
Introduction to
Artificial IntelligenceNode expansion
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 11/48
Introduction to
Artificial IntelligenceNode expansion (initial)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 12/48
Introduction to
Artificial IntelligenceNode expansion (expanding A rad)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 13/48
Introduction to
Artificial IntelligenceNode expansion (expanding Sibiu)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 14/48
Introduction to
Artificial IntelligenceMeasuring Searching Performance
The output from problem-solving (searching) algorithm is either FAILURE or SOLUTION.
Four ways:
Completeness : is guaranteed to find a solution?Optimality : does it find optimal solution ?
Time complexity : how long?
Space complexity : how much memory?
Complexity : branching factor ( b ), depth ( d ), and max.depth ( m )
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 15/48
Introduction to
Artificial IntelligenceSearching Strategies
Heuristic search searchprocess takes place bytraversing search space withapplied rules (information).
Techniques : Greedy Best FirstSearch, A* A lgorithm
There is no guarantee thatsolution is found.
Blind search traversing thesearch space until the goalnodes is found (might be doingexhaustive search).
T echniques : Breadth FirstUniform Cost , D epth first,Interactive D eepeningsearch .
Guarantees solution.
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 16/48
Introduction to
Artificial IntelligenceBlind Search : Breadth First Search (BFS)
Strategy ~ search all the nodes expanded at given depthbefore any node at next level.
Concept : First In First Out (FIFO) queue.Complete ?: Yes with finite b (branch).
Space : similar to complexity ± keep nodes in everymemory
Optimal ? = Yes (if cost =1)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 17/48
Introduction to
Artificial IntelligenceBlind Search : Breadth First Search
1 2
43
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 18/48
Introduction to
Artificial IntelligenceBlind Search : Uniform-Cost Search (UCS)
Strategy ~ search all the nodes expanded with the lowestpath cost.
If all path cost equals identical to BFS.Complete ?: Yes (if finite depth and total cost is small)
Optimality ? : Yes (proportion to cost function)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 19/48
Introduction to
Artificial IntelligenceBlind Search : Depth First Search (DFS)
Strategy ~ search all the nodes expanded in deepest path.
Last In First Out concept.
Complete ?: No
Optimality ? : No
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 20/48
Introduction to
Artificial IntelligenceBlind Search : D epth First Search ( D FS)
1 2 3
4 5
««.
N+1
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 21/48
Introduction to
Artificial IntelligenceHeuristic Search :
Important aspect: formationof heuristic function ( h(n)).
Heuristic functionadditional knowledge to
guide searching strategy(short cut).
Distance: heuristic functioncan be straight linedistance (SLD)
A*
B C*
D
E
h(n)=0
h(n)= 34
h(n)=2 4
h(n)=67
h(n)=12h(n)=9
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 22/48
Introduction to
Artificial IntelligenceHeuristic Search : Heuristic Function
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 23/48
Introduction to
Artificial Intelligence
Heuristic Search :Greedy-Best Search
Tries to expand the node that is closest to the goal.
Evaluates using only heuristic function : f (n) = h(n)
P ossibly lead to the solution very fast.
P roblem ? ~ can end up in sub-optimal solutions(doesn¶t take notice of the distance it travels).
Complexity and time:Complete & optimal ? : No (stuck in infinite loop)
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 24/48
Introduction to
Artificial Intelligence
Heuristic Search :Greedy-Best Search
1
2
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 25/48
Introduction to
Artificial Intelligence
Searching comparison (D
FS, BFS, GBFS)
A :5
CB
FED
H
G
J
:4:5
:4 :2 :6 :4
:0 :3
D iscussion:
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 26/48
Introduction to
Artificial IntelligenceH euristic Search :Greedy-Best Search
3
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 27/48
Introduction to
Artificial IntelligenceH euristic Search : A* Algorithm
W idely known algorithm ± (pronounced as ³ A star´search).
Evaluates nodes by combining g(n)³cost to reachthe node´ and h(n) ³ cost to get to the goal´
f (n) = g(n) + h(n), f (n) estimated cost of thecheapest solution.
Complete and optimal ~ since evaluates all paths.Time ? ~ a bit time consuming
Space ? ~ lot of it!
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 28/48
Introduction to
Artificial Intelligence
Heuristic Search :A*
A
lgorithm
S
GE
DA
G¶ H
:10
:8 :9
:0:4 :0 :3
2 3
25 13
Path cost for S- D -G
f (S) = g(S) + h(S)
= 0 + 10 10 f (D) = (0+3) + 9 12
f (G) = (0+3+3) + 0 6
Total path cost = f (S)+ f (D)+ f (G) 28
Path cost for S- A -G¶
f (S) = 0 + 10 10 f (A) = (0+2) + 8 10 f (G¶) = (0+2+2) + 0 4
Total path cost = f (S)+ f (A)+ f (G¶) 24
* P ath S-A-G is chosen= Lowest cost
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 29/48
Introduction to
Artificial IntelligenceHeuristic Search : A* A lgorithm
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 30/48
Introduction to
Artificial IntelligenceHeuristic Search : A* A lgorithm
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 31/48
Introduction to
Artificial IntelligenceHeuristic Search : A* A lgorithm
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 32/48
Introduction to
Artificial IntelligenceHeuristic Search : A* A lgorithm
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 33/48
Introduction to
Artificial IntelligenceHeuristic Search : A* A lgorithm
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 34/48
Introduction to
Artificial Intelligence
Issues in Heuristic SearchSearching using heuristic function does not solely ondirected solution but the best algorithm to findshortest path towards goal.
Admissible attempt to find possible shortest pathto a goal whenever it exists.
Informedness question in what sense theheuristic function is better than another.
Monotonicity question if the best state isdiscovered by heuristic search, is there anyguarantee that the same state won¶t be found later at lowest searching cost?
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 35/48
Introduction to
Artificial Intelligence
Games andA
I ?
Game playing is a good problem for AI research: All the information is available (human and computer have equal information.Non-trivial (requires decision making + need todisplay ³ intelligence´).Can be played in a controlled environmentCan compare humans and computers ability directly(percentage of wins/losses).For fun ?
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 36/48
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 37/48
Introduction to
Artificial IntelligenceGames ..
Backgammon Checkers Reversi
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 38/48
Introduction to
Artificial IntelligenceSo what ?
³ Deep Blue´ (IBM)parallel processor, 32 nodeseach chip can search 200 million configurations/secondmemorizes starts, end-gamespower based on speed and memory: no common sense
Kasparov vs. Deep Blue, May 19976 game full-regulation chess match (sponsored by ACM)
Kasparov lost the match (2.5 to 3.5)a historic achievement for computer chess: the first time acomputer is the best chess-player on the planet
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 39/48
Introduction to
Artificial IntelligenceSo what ?
Checkers/ D raughtscurrent world champion is Chinook,can beat any human + uses alpha-beta search
Othello (Reversi)computers can easily beat the world experts
Backgammon
system which learns is ranked in the top 3 in the worlduses neural networks to learn from playing manymany games against itself
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 40/48
Introduction to
Artificial Intelligence
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 41/48
Introduction to
Artificial Intelligence
8 8 P P u u z z
z z l l ee
Initial State
Goal State
Solution:
a p c p f p j p l p m
Search Space
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 42/48
Introduction to
Artificial Intelligence8 8- -puzzle : puzzle : RulesRules
Start
Goal
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 43/48
Introduction to
Artificial Intelligence
H euristic I:Number of tiles out of place
Current State Goal State
8 8- -puzzle : puzzle : HeuristicsHeuristics
Number of tiles out place: 5 @ h( n) = 5
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 44/48
Introduction to
Artificial Intelligence
Depth-First SearchBreath-First SearchBest-First Search
A* Algorithm
8 8- -puzzle : puzzle : StrategiesStrategies
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 45/48
Introduction to
Artificial Intelligence
H euristic II:Sum of distances out of place
Current State Goal State
8 8- -puzzle : puzzle : HeuristicsHeuristics
Tile D istances out of place
2 1
8 2
1 1
Sum of distances out of place: 4@
h(n)=
4
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 46/48
Introduction to
Artificial Intelligence
Goal State
H euristic
8 8- -puzzle : puzzle : HeuristicsHeuristics
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 47/48
Introduction to
Artificial Intelligence
Exercise:
2 8 3
7 51 6 4
1 2 3
8 47 6 5Goal StateInitial State
H euristic: sum of distances out of place
Consider the following 8-p uzzle problem:
Construct a state space for the above problem usingGreedy Best-First strategy
8/7/2019 Chapt 3 Problem Solving
http://slidepdf.com/reader/full/chapt-3-problem-solving 48/48
Introduction to
Artificial Intelligence
References
Cawsey, A. (1998). The Essence of ArtificialIntelligence, P rentice H all.Russell, S. and Norvig, P . (2003). Artificial
Intelligence: A Modern Approach, P rentice- H all2nd Edition.