Artificial Intelligence lecture notes. AI summarized notes for heuristically informed searches and types of searches in ai ( ai search algorithms ) and machine learning as well, just for reading and may be for self-learning, I think.
2. Heuristically Informed
• Heuristic Example
• Here you see the distances between each city and the goal
• If you wish to reach the goal, it is usually better to be in a city that is close, but
not necessarily; city
• Suppose our goal is to reach city G starting from S.
C is closer than, but city C is not a good place to be
3. Straight-line distance as Heuristic
• Heuristics do help us reduce the search space
• It is not at all guaranteed that we’ll always find a solution.
• Heuristic function takes as input the heuristic and gives us output a
number corresponding to that heuristic
4. Hill Climbing
.
• Problems
Hill Climbing is DFS with a heuristic measurement that
orders choices.
Foothill Problem
Plateau Problem Ridge Problem
5. Hill Climbing
The numbers beside the nodes are straight-line
distances from the path- terminating city to the
goal city.
S
BA
E FDC
G H I J
K L M N
9 11
9 9
7
6
4 4
8.57.3
6
5
02
6. Beam Search
S
BA
E FDC
G H I J
K L M N
9 11
7.1 9
7
5.3
4 2
8.57.3
6
5
02.5
Degree (k) = 2
At every level use only 2
best nodes
Out of n possible choices at any level, beam search follows only the best k of them.
7. Best First Search
Best first search considers all the open nodes so far and selects the best
amongst them.
best first search is a greedy approach which looks for the best
amongst the available options
8. Optimal Searches
• Both uninformed and informed searches
• whenever they find a solution they immediately stop.
• the solution that they have ignored might be the optimal one.
• They are not optimal
• Methods to find optimal solutions
• brute force method: exploring the entire search space
• Branch and Bound
• A* Procedure
9. Branch and Bound
Basic Observation
The length of complete path
from S to G, S-D-E-F-G is 9
Similarly the length of the partial path S D-A-B also
is 9 and any additional
movement along a branch will make it longer than 9
S
D
A E
B F
G
9
9
10. Branch and Bound
Start state : S
Goal state: G
Proceed in Best first search manner
Start at S, A is the best option
11. Branch and Bound
From S the options to travel are B and D, the children of A and D
the child of S. Among these, D the child of S is the best option. So
we explore D.
16. Branch and Bound
we explore E we find out that if we follow this path further, our path length will increase
beyond 9 which is the distance of S to G. we block all the further sub-trees along this paths.
17. Branch and Bound
Then move to F as that is the best option at this point with a value 7.
19. Branch and Bound
C is a leaf node so we bind C too as in diagram we move to B on the right hand side of
the tree and bind the sub trees ahead of B as they also exceed the path length 9.
20. Branch and Bound
We go on proceeding in this fashion, binding the paths that exceed 9 and hence we are saved
from traversing a considerable portion of the tree. The subsequent diagrams complete the
search until it has found all the optimal solution, that is along the right hand branch of the tree
21. Branch and Bound
The basic idea was to reduce the search space by binding the paths
that exceed the path length from S to G.
The two most famous ways to improve it.
1. Estimates
2. Dynamic Programming
23. A* Procedure
S
A D
B D A E
C E
D F
G
E
B F
C G
B
C E
F
G
B F
A C G
7+1=8
9+0 = 9
0+8 = 8
2+2 = 4
5+3 = 8 6+6 = 12
8+5 = 13 9+5 = 14
3+6 = 9
7+2 = 9
4+5 = 9
10+3 = 13 8+3 = 11
S
G
FE
CB
D
A
3 3
1 3
2
8
6
2
5
3
5
1
0
24. Adversarial Search
• multiple agents or persons searching for solutions in
the same solution space.
• game playing where two opponents also called adversaries are
searching for a goal.
• Their goals are usually contrary to each other.
25. Search and Game Playing
• We will focus on Board Games
• We will represent the game as a tree
Original Board
Situation
New Board
Situation
New Board
Situation
• The node is a
game tree
represent board
configuration,
and the branches
indicate how
moves can
connect them.
A
B C
D E F G
26. The Minimax Procedure
3 6 2 7
Maximizing Level
Minimizing Level
Maximizing LevelG
3 2
3
A
B C
D E F
27. Alpha Beta Pruning
3 6 2
Maximizing Level
Minimizing Level
Maximizing Level
=3
=3
>=3
=<2
A
B C
29. Example: Tic-tac-toe
• The heuristic takes a state to be measure, counts all winning lines open to MAX and then
subtracts the total number of winning lines open to MIN.
• The search attempts to maximize this difference
• If a state is a forced win for MAX, it is evaluated as +͚ ; a forced win for MIN as –
Infinity