Chapter Three
Chapter Three
Chapter Three
INTRODUCTION TO PROBLEM
SOLVING
MAN VS MACHINE
When we compare Humans to Machines, it is important to note that a
Machine can be a car, a Smart Phone, a Digital Television, etc.
Generally, machine is better than human in:
Speed and Power
Sensor Detection out side
Human Range
Routine work
Alertness
Computation
Short term Memory
Storage
Simultaneous Activities
Humans are Better than machines in:
Sensory Functions
Perceptual Abilities
Flexiblity/Ability to Improvise
Judgment
Selective Recall
Inductive Reasoning
Problem Definition
A problem can be defined by five main components:
1.Initial state: where we are at the beginning
Initial state, actions, transition models, implicitly define the state space of the
problem
3. Isolate and represent the task knowledge that is necessary to solve the problem
2.Specify one or more states within that space that describe possible
situations from which the problem solving process may start ( initial
state)
Have no information about the number of steps or the path cost from the current
consider
Have knowledge about how far are the various state from the goal
A*-search
Breadth first
Iterative improvement
etc.
Uniform cost
Iterative deepening
etc
Breadth first search
• Expand shallowest unexpanded node,
–i.e. expand all nodes on a given level of the
search tree before moving to the next level
• Implementation: use queue data structure to
store the list:
–Expansion: put successors at the end of
queue
–Pop nodes from the front of the queue
• Properties:
–Takes space: keeps every node in memory
–Optimal and complete: guarantees to find
solution
Exercise
• Apply BFS to find an optimal path from start
node to Goal node.
Uniform cost Search
•The goal of this technique is to find the shortest path to the goal
in terms of cost.
–It modifies the BFS by always expanding least-cost unexpanded
node
•Implementation: nodes in list keep track of total path length
from start to that node
–List kept in priority queue ordered by path cost
A
S S S
1 10 S
5 B 5
S G 0 A B C A B C A B C
1 5 15 5 15 15
G G G
15 5
11 11 10
C
•Properties:
–This strategy finds the cheapest solution provided the cost of a path
must never decrease as we go along the path
g(successor(n)) ≥ g(n), for every node n
Depth-first search
Expand one of the node at the
deepest level of the tree.
–Only when the search hits a non-goal
dead end does the search go back and
expand nodes at shallower levels
Implementation: treat the list as
stack
–Expansion: push successors at the top of
stack
–Pop nodes from the top of the stack
•Properties
–Incomplete and not optimal: fails in
infinite-depth spaces, spaces with loops.
–Takes less space (Linear): Only needs to
remember up to the depth expanded
Iterative Deepening Search (IDS)
• IDS solves the issue of choosing the best depth limit by
trying all possible depth limit:
–Perform depth-first search to a bounded depth d, starting at d = 1
and increasing it by 1 at each iteration.
• This search combines the benefits of DFS and BFS
–DFS is efficient in space, but has no path-length guarantee
–BFS finds min-step path towards the goal, but requires memory space
–IDS performs a sequence of DFS searches with increasing depth-
cutoff until goal is found
Goal
Start
Bidirectional Search
• Advantages:
– Only need to go to half depth
– It can enormously reduce time complexity, but is not
always applicable
• Difficulties
– Do you really know solution? Unique?
– Cannot reverse operators
– Memory requirements may be important: Record all
paths to check they meet
• Memory intensive
S
3 1 8
A B C
3 15
7 20 5
D E G
How they perform
• Breadth-First Search: S
– Expanded nodes: S A B C D E G
3 1 8
– Solution found: S A G (cost 18)
• Depth-First Search:
– Expanded nodes: S A D E G
A B C
– Solution found: S A G (cost 18)
3 15
7 20 5
• Uniform-Cost Search:
– Expanded nodes: S A D B C E G D E G
– Solution found: S C G (cost 13)
This is the only uninformed search that worries about costs.
• Iterative-Deepening Search:
– nodes expanded: S S A B C S A D E G
– Solution found: S A G (cost 18)
Exercise: Uninformed Search Strategies
S
1 5 8
A B C
3 9
7 4 5
D E G
Informed search
Search efficiency would improve greatly if there is
a way to order the choices so that the most
promising nodes are explored first.
This requires domain knowledge of the problem (i.e.