0% found this document useful (0 votes)
25 views15 pages

21FE27 Artificial Intelligence - : III Year/V Semester IT

Uploaded by

dhurgadevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views15 pages

21FE27 Artificial Intelligence - : III Year/V Semester IT

Uploaded by

dhurgadevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

21FE27

ARTIFICIAL INTELLIGENCE

III YEAR/V SEMESTER - IT


Module-2 Outline
2.1 Problem solving by searching
2.1.1. Problem solving agents and Example problems
2.1.2. Searching for Solutions
2.1.3. Uninformed search strategies
2.1.4. Informed (heuristics search strategies
2.1.5. Heuristics functions
2.2.Beyond classical search
2.2.1. Local search algorithms and optimization problems
2.2.2. Searching with partial observations
2.2.3. online search agents and unknown environments
2.3 Adversial search
2.3.1. Games
2.3.2. optimal decisions in games
2.3.3. Alpha-beta pruning
2.4. Constraint satisfaction problems
2.4.1. Backtracking search
2.4.2. Local search for constraint satisfaction problems .
Heuristic Functions
• The 8-puzzle was one of the earliest heuristic search problems.
• The average solution cost for a randomly generated 8-puzzle
instance is about 22 steps.
• The branching factor is about 3.
• in the middle 🡺four moves
• in a corner 🡺 two moves
• along an edge 🡺 three moves
• A search algorithm may look at 170,000 states to solve a random 8-
puzzle instance, because
9!/2=181,400 distinct states are reachable.
• A search algorithm may look at 1013 s.tates to solve a random 15-
puzzle instance
🡺 We need a good heuristic function.
🡺 If we want to find the shortest solutions by using A∗,
we need a heuristic function that never overestimates the number of
Heuristic Functions
• A typical instance of the 8-puzzle. The solution is 26 steps long.
Heuristic Functions
Two admissible heuristics for 8-puzzle.
h1(n) = number of misplaced tiles
•h1 is an admissible heuristic because any tile that is out of place must be moved at
least once.
h2(n) = total Manhattan distance (the sum of the distances of the tiles
from their goal positions)
•Because tiles cannot move along diagonals, the distance is the sum of the horizontal
and vertical distances.
•h2 is also admissible because all any move can do is move one tile one step closer to
the goal.

h1(start) = 8

h2(start) = 3+1+2+2+2+3+3+2 = 18
summation Manhattan Distances of tiles 1 to 8
The effect of heuristic accuracy
on performance
• The quality of a heuristic can be measured by its effective branching
factor b∗.
• If the total number of nodes generated by A∗ for a particular problem is N
and the solution depth is d, then b∗ is the branching factor that a uniform
tree of depth d would have to have in order to contain N + 1 nodes.

• If A∗ finds a solution at depth 5 using 52 nodes, then the effective


branching factor is 1.92.
• Experimental measurements of b∗ on a small set of problems can
provide a good guide to the
heuristic’s overall usefulness.
• A well-designed heuristic would have a value of b∗ close to 1.
The effect of heuristic accuracy
on performance
• To test the heuristic functions h1 and h2, 1200 random problems are
generated with solution lengths from 2 to 24 (100 for each even number)
and solved with iterative deepening search and with A∗ tree search using
both h1 and h2.
• The results suggest that h2 is better than h1, and it is far better than using
iterative deepening search.
Dominance
• If h2(n) ≥ h1(n) for all n (both h1 and h2 are admissible) then h2
dominates h1 and h2 is better than h1 for search.
• Domination translates directly into efficiency.
• A∗ using h2 will never expand more nodes than A∗ using h1.
• It is generally better to use a heuristic function with higher
values, provided it is consistent.
• Given any admissible heuristics h , h ,
a b

• h(n) = max(h (n), h (n))


a b

• is also admissible and h(n) dominates both h and h


a b
Generating Admissible Heuristics from
Relaxed Problems
• h1 (misplaced tiles) and h2 (Manhattan distance) are fairly good heuristics
for the 8-puzzle and that h2 is better.
• A problem with fewer restrictions on the actions is called a relaxed
problem.
• Admissible heuristics can be derived from the exact solution cost of a
relaxed version of the problem.
• If the rules of the 8-puzzle are relaxed so that a tile can move anywhere,
then h1(n) gives the shortest solution.
• If the rules are relaxed so that a tile can move to any adjacent square, then
h2(n) gives the shortest
solution.
• Key point: the optimal solution cost of a relaxed problem is no greater
than the optimal solution cost
of the real problem
Generating Admissible Heuristics from
Sub Problems
Admissible heuristics can also be derived from solution to subproblems:
Each state is mapped into a partial specification,
e.g. in 15-puzzle only position of specific tiles matters.

Here are goals for two sub- problems (called Corner and Fringe) of 15puzzle.
If you want to know how they came up with these subproblems? Here is the
paper.
Note that the goal state here for15- puzzle is different than what we have
defined in Assignment1).

•By searching backwards from these goal states, we can compute the
distance of any configuration of these tiles to their goal locations. We are
ignoring the identity of the other tiles.
•For any state n, the number of moves required to get these tiles into place
form a lower bound on the cost of getting to the goal from n.
Learning Heuristics from
Experience
• Inductive learning methods work best
when supplied with features of a state that
are relevant to predicting the states value.
• H(n)=C1x1 (n)+c2x2(n)
• C1 and C2 are constants adjusted to give
bet fit to the actual data on solution costs.
Summary
• Heuristic functions estimate costs of shortest paths
• Good heuristics can dramatically reduce search cost
• Greedy best-first search expands lowest h
• incomplete and not always optimal
• A* search expands lowest g + h
• complete and optimal
• also optimally efficient
• Admissible heuristics can be derived from exact solution
of relaxed problems
Test your Knowledge
• A ………. is a shortcut to solving a
problem when there are no exact
solutions.
Answer
• A heuristic function (algorithm) or simply a
heuristic is a shortcut to solving a
problem when there are no exact
solutions
Next Session…
2.2.Beyond classical search

You might also like