You are on page 1of 17

Solving Problems

Syed Ali Raza


Lecturer
Department of Computer Science
GC University Lahore
Start state

Goal state
• Initial state Initial
state
• Actions
• Transition model
• Goal state
• Path cost
• Optimal solution

Goal
state
• On vacation in Romania; currently in A
• On vacation in Romania; currently in A
• Initial state
• A
• Actions
• Go from one city to another
• Transition model
• If you go from city A to
city B, you end up in city B
• Goal state
• B
• Path cost
• Sum of edge costs
• Initial state
• No queens on the board
• Actions
• Go from one cell to another
• Transition model
• any arrangement of n<=8 queens
• or arrangements of n<=8 queens in leftmost n columns, 1 per column, such that no queen
attacks any other.

• Goal state
• 8 queens on the board, none attacked
• Path cost
• 1 per move
• States
• Agent location and dirt location
• How many possible states?
• What if there are n possible locations?
• Actions
• Left, right, suck
• Transition model
• Uninformed search strategies
• Also known as “blind search,” uninformed search strategies use no information
about the likely “direction” of the goal node(s)

• Informed search strategies


• Also known as “heuristic search,” informed search strategies use information
about the domain to (try to) (usually) head in the general direction of the goal
node(s)
• UnInformed
• Breadth First Search
• Depth First Search
• Bidirectional Search
• Uniform Cost Search
• Informed
• Best First Search
• Greedy Best First Search
• A* Search
S

3 8
1

A B C
3 15
7 20
5
D E G
Expanded node Nodes list
{ S0 }
S0 { A3 B1 C8 }
S A3 { D6 E10 G18 B1 C8 }
3 1 8 D6 { E10 G18 B1 C8 }
E10 { G18 B1 C8 }
A B C G 18 { B 1 C8 }

3 15
7 20 5 Solution path found is S A G, cost 18
Number of nodes expanded (including goal
D E G node) = 5
Expanded node Nodes list
{ S0 }
S0 { A3 B1 C8 }
S A3 { B1 C8 D6 E10 G18 }
B1 { C8 D6 E10 G18 G21 }
3 1 8 C8 { D6 E10 G18 G21 G13 }
D6 { E10 G18 G21 G13 }
A B C E10 { G18 G21 G13 }
3 15 G18 { G21 G13 }
7 20 5 Solution path found is S A G , cost 18
D E Number of nodes expanded (including goal
G node) = 7
Expanded node Nodes list
{ S0 }
S0 { B1 A3 C8 }
S B1 { A3 C8 G21 }
A3 { D6 C8 E10 G18 G21 }
3 1 8 D6 { C8 E10 G18 G21 }
C8 { E10 G13 G18 G21 }
A B C E10 { G13 G18 G21 }
3 15 G13 { G18 G21 }
7 20 5
Solution path found is S B G, cost 13.
D E G Number of nodes expanded (including goal
node) = 7
• Depth-First Search:
• Expanded nodes: S A D E G
• Solution found: S A G (cost 18)
• Breadth-First Search:
• Expanded nodes: S A B C D E G
• Solution found: S A G (cost 18)
• Uniform-Cost Search:
• Expanded nodes: S A D B C E G
• Solution found: S B G (cost 13)
This is the only uninformed search that worries about costs.
A
10 22

12
T Z
5
3
S O

9 16
L
11
1 R F
M
12 13
14
D

17
15 23
C P B

You might also like