Professional Documents
Culture Documents
Informed Search
Uninformed Search
• = Blind Search = Naive search
• They are given no information other than its definition
• A class of general purpose search algorithm that operate in a brute-
force way
• Some algorithms:
1. Generate and Test 5. Non-Deterministic Search
2. Random search 6. Depth-Limited Search (DLS)
3. Depth first search (DFS) 7. Iterative Deepening Search (IDS)
4. Breadth first search (BFS) 8. Bidirectional Search (BIDI)
2
Informed Search
• Heuristic Search
➡ Methods that use a heuristic function to provide specific
knowledge about the problem that helps narrow or focus the
search process
➡ Using problem-specific knowledge
➡ Widely used in optimization problem
• Heuristic (Greek)
– To discover
– A rule of thumbs, hint, or trick that may help solve a given problem
– It takes problem knowledge into consideration to help guide the
search within the domain
Heuristic Function
• Heuristic function:
– f : state T à number x
– f(T) : expresses the quality of state T
– f(T) = x
• (+) : for good heuristic function, the search may expand much
less nodes
• (-) : the cost of computing such functions may be high
4
Example of Heuristic Function
A B C
• Problem:
finding a route S
on a road map G
D E F
• f1(T) = the_distance_between_two_nodes
A
4 B
4 C
3 • SABEFG = 19
S
5 5 • SADEFG = 17
G • SDEFG = 13
2 3
4 D E
4 F
D E F
• f2(T) = the_straight_line_distance_from_T_to_G
A 10.4 B 6.7 C
11 4 The
S
G estimation
8.9
3 can be wrong!
D E 6.9 F
6
Example of Heuristic Function (3)
A B C
• Problem:
finding a route S
on a road map G
D E F
• f1(T) = the_distance_between_two_nodes
• f2(T) = the_straight_line_distance_from_T_to_G
4 4 10.4
A B C A B 6.7 C
3
4
5 5 S 11
G G
3 8.9
2 4 3
4 D E F D E 6.9 F
8
Examples of Heuristic Search
1. Generate and Test
2. Simple Hill Climbing
3. Steepest Ascent Hill Climbing
4. Best First Search
5. A* & SMA* (Simplified Memory Bounded A*)
6. Minimax
7. Alpha Beta Prunning
8. Simulated Annealing
9. Genetic Algorithm
10. Ant Algorithm
• Algorithm:
1. Generate all alternative solutions
2. Compare all alternative solutions
3. Choose the optimal solution
10
Generate and Test (2)
• Example: Traveling Salesman Problem (TSP)
➡ Given a list of cities and the distances between each pair of cities,
what is the shortest possible route that visits each city exactly once
and returns to the origin city?
• f(T) = the_distance_between_two_nodes
8
A B
3 4
7 5
D C
6
11
Hill Climbing
• Depth first search + heuristic
• Backtracking is not allowed
• Idea:
- start with an alternative of solution
➡ start at the base of a hill
- repeatedly improve the solution
➡ walk up the hill
- until some condition is maximized
➡ until the top of the hill is reached
12
Hill Climbing: Global & Local Max
13
14
Hill Climbing: Global & Local Max (2)
15
16
Hill Climbing: Types
• Types:
1. Simple Hill Climbing
2. Steepest Ascent Hill Climbing
• Example:
• Traveling Salesman Problem (TSP) à 4 cities
8
A B
3 4
7 5
D C
6
17
• Operator:
– To switch the position of solution composition
– Number of operator:
– Operators:
1.Switch 1,2 4.Switch 4,1
Combination:
2.Switch 2,3 5.Switch 2,4
6.Switch 1,3 Order does NOT matter
3.Switch 3,4
18
Simple Hill Climbing
• Procedure:
1. Generate all nodes based on the operator
2. Omit the node that has generated before
3. Chose the node that is better than the previous one
8 Operators:
A B
1.Switch 1,2
3 4 2.Switch 2,3
3.Switch 3,4
7 5 4.Switch 4,1
5.Switch 2,4
6.Switch 1,3
D C
6
19
8 Operators:
A B
1.Switch 1,2
3 4 2.Switch 2,3
3.Switch 3,4
7 5 4.Switch 4,1
5.Switch 2,4
6.Switch 1,3
D C
6
20
Steepest Ascent Hill Climbing
• Procedure:
1. Generate all nodes based on the operator
2. Omit the node that has generated before
3. Chose the best node
8 Operators:
A B
1.Switch 1,2
3 4 2.Switch 2,3
3.Switch 3,4
7 5 4.Switch 4,1
5.Switch 2,4
6.Switch 1,3
D C
6
21
• At each step, select the best node with the best value
heuristically, then expand it
• Backtracking is allowed
22
Best First Search (2)
23
S 5 5
3 G
4 2 4
D E F
24
f1(x) = distance cost Example 1
S
Route: SDEFG
3 4
A D
4 5 5 2
B D A E
4 5 4 4
2 5
C E E B B F
2 4 5 4 4 5 4 4 3
D F B F C E A C G
3 4 3 4 Goal
(End)
G C G F
25
A D
7 8 9 6
B D A E
11 10 13 10
12 11
C E E B B F
14 15 14 17 18 15 15 13
16
D F B F C E A C G
19 19 17 Goal
22 (End)
G C G F
25
G
26
26
Best First Search (4)
• Route = SDEFG (13)
4 4
3 A B C
S 5 5
3 G
4 2 4
D E F
27