Artificial Intelligence & Expert Systems
description
Transcript of Artificial Intelligence & Expert Systems
![Page 1: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/1.jpg)
Artificial Intelligence &
Expert Systems
Heuristic Search
![Page 2: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/2.jpg)
Heuristics
Heuristic means “rule of thumb”. To quote Judea Pearl,
“Heuristics are criteria, methods or principles for deciding which among several alternative courses of action promises to be the most effective in order to achieve some goal”.
In heuristic search or informed search, heuristics are used to identify the most promising search path.
![Page 3: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/3.jpg)
Heuristics . . .
“The study of the methods and rules of discovery and invention” defined by George Polya
Greek root word is euisco which means “I discover” Archimedes emerged and shouted “Eureka”
meaning “I have found it” In state space search, heuristics are formalized as
rules for choosing those branches in a state space that are most likely to lead to an acceptable solution
![Page 4: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/4.jpg)
AI problem solvers employ heuristics in two basic situation
(1) A problem may not have an exact solution because of inherent ambiguities in the problem statement or available data.
A given set of symptoms may have several possible causes; doctors use heuristics to choose the most likely diagnosis and formulate a plan of treatment
![Page 5: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/5.jpg)
(2) A problem may have an exact solution, but the computational cost of finding it may be prohibitive. In many problems (such as chess),state space growth is combinatorially explosive, with the number of possible states increasing exponentially or factorially with the depth of the search. In these cases, exhausive, bruce-force search techniques such as depth-first or breadth-first search may fail to find a solution within any practical length of time. Heuristics attack this complexity by guiding the search along the most “promising” path through the space. By eliminating unpromising states and their descendants from consideration, a heuristics algorithm can defeat this combinatorial explosion and find an acceptable solution.
![Page 6: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/6.jpg)
Inherent limitation of heuristic search
Heuristic is only an informed guess of the next step to be taken in solving a problem.
Because heuristics use limited information, they are seldom able to predict the exact behavior of the state space farther along in the search.
a heuristic can lead a search algorithm to a sub-optimal solution or fail to find any solution at all.
![Page 7: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/7.jpg)
Importance of heuristics
But heuristics and the design of algorithms to implement heuristic search have long been a core concern of artificial intelligence research
It is not feasible to examine every inference that can be made in a mathematics domain
heuristic search is often the only practical answer more recently, expert systems research has
affirmed the importance of heuristics as an essential component of problem solving
![Page 8: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/8.jpg)
Algorithms for Heuristic Search
Heuristic Search
Hill Climbing Best first search A* Algo
![Page 9: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/9.jpg)
Hill Climbing To implementation of heuristic search is through a
procedure called hill climbing Hill climbing strategies expand the current state in
the search and evaluate its children the best child is selected for further expansion;
neither its siblings nor its parent are retained search halts when it reaches a state that is better
than any of its children go uphill along the steepest possible path until it can
go no farther because it keeps no history, the algorithm cannot
recover from failures of its strategy
![Page 10: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/10.jpg)
Hill Climbing . . .
• If the Node is better, only then you proceed to that Node.Algorithm:1. Start with current-state (cs) = initial state2. Until cs = goal-state or there is no change in the cs do:
(a) Get the successor of cs and use the EVALUATION FUNCTION to assign a score to each successor
(b) If one of the successor has a better score than cs then set the new state to be the successor with the
best score.
![Page 11: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/11.jpg)
Example-1: Tic-Tac-Toe
In tic-tac-toe problem,
the combinatorics for exhaustive search are high but not insurmountable
total number of states that need to be considered in an exhaustive search at 9x8x7x….or 9!
Symmetry reduction decrease the search space Symmetry reductions on the second level further
reduce the number of paths through the space to 12x7!
![Page 12: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/12.jpg)
First three levels of the tic-tac-toe state space reduced by symmetry.
![Page 13: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/13.jpg)
The “most wins” heuristic applied to the first children in tic-tac-toe.
![Page 14: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/14.jpg)
Which one to choose???
Heuristic: calculate winning lines and move to state with
most winning lines.
![Page 15: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/15.jpg)
Heuristically reduced state space for tic-tac-toe.
![Page 16: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/16.jpg)
Example-2:
![Page 17: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/17.jpg)
Devise any heuristic to reach goal: Start : Library Goal : University
![Page 18: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/18.jpg)
Evaluation Function: Distance between two place Adopt the one with minimum distance from goal
Probable route will be:
Library Hospital Newsagent
University
![Page 19: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/19.jpg)
Suppose S2 < S1
Then what will happen?
The algorithm will always go to park from hospital instead of going to newsagent. The algorithm will get stuck here.
![Page 20: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/20.jpg)
Drawback of Hill Climbing
![Page 21: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/21.jpg)
Ridge = sequence of local maxima difficult for hill climbing to navigate
Plateaux = an area of the state space where the evaluation function is flat.
GETS STUCK 86% OF THE TIME.
![Page 22: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/22.jpg)
Simulated Annealing
A method to get rid of the local minima/maxima problem.
It is an optimization method that employ certain techniques to take small steps in the direction indicated by the gradient, but occasionally large steps in the gradient direction / same other directional taken.
![Page 23: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/23.jpg)
Best-First Search
A major problem of hill climbing strategies is their tendency to become stuck at local maxima
if they reach a state that has a better evaluation than any of its children, the algorithm halts
hill climbing can be used effectively if the evaluation function is sufficiently informative to avoid local maxima and infinite paths
heuristic search requires a more flexible algorithm: this is provided by best-first search, where, with a priority queue, recovery from local maxima is possible
![Page 24: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/24.jpg)
![Page 25: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/25.jpg)
Heuristic search of a hypothetical state space
![Page 26: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/26.jpg)
A trace of the execution of best-first search
![Page 27: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/27.jpg)
Heuristic search of a hypothetical state space with open and closed highlighted
![Page 28: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/28.jpg)
The best-first search algorithm always select the most promising state on open for further expansion
as it is using a heuristic that may prove erroneous, it does not abandon all the other states but maintains then on open
In the event a heuristic leads the search down a path that proves incorrect, the algorithm will eventually retrieve some previously generated, “next best” state from open and shift its focus to another part of the space
In best-first search, as in depth-first and breadth-first search algorithms, the open list allows backtracking from paths that fail to produce a goal
![Page 29: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/29.jpg)
Evaluation Function
1. Count the no. of tiles out of place in each state when compared with the goal.
Out of place tiles
2, 8, 1, 6
In place tiles
3, 4, 5, 7
2 8 3
1 6 4
7 5
1 2 3
8 4
7 6 5
Initial state
Goal
![Page 30: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/30.jpg)
![Page 31: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/31.jpg)
Heuristic Function f(n) = h(n)
Drawback:
The heuristic defined does not take into account the distance each tile has to be moved to bring it to the correct place.
![Page 32: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/32.jpg)
Sum the no. of boxes the tile has to be moved to reach the goal
for example:
41
1
Total places to be moved = ‘2’
21
1
1
No. of places to be moved = ‘3’
![Page 33: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/33.jpg)
2 8 3
1 6 4
7 5
Total tiles out of place = 5
Sum of distances out of place = 6
Tiles Distance
1 1
2 1
8 2
6 1
7 1 total: 6
![Page 34: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/34.jpg)
Another ScenarioThe first picture shows the current state n, and the second picture the goal state. h(n) = 5 because the tiles 2, 8, 1, 6 and 7 are out of place.
![Page 35: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/35.jpg)
Manhattan Distance Heuristic: Another heuristic for 8-puzzle is the Manhattan distance heuristic.
This heuristic sums the distance that the tiles are out of place.
The distance of a tile is measured by the sum of the differences in the x-positions and the y-positions.
For the above example, using the Manhattan distance heuristic,
h(n) = 1 + 1 + 0 + 0 + 0 + 1 + 1 + 2 = 6
![Page 36: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/36.jpg)
3 5 6
1 4
2 8 7
Total tiles out of place = 7
Sum of distances
Tiles Distance
3 2
1 1
2 2
8 2
7 2
6 3
5 3 total: 15
![Page 37: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/37.jpg)
![Page 38: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/38.jpg)
Complete Heuristic function (sum of two functions)
f(n) = g(n) + h(n)
where h(n) = Sum of the distances
g(n) = tiles out of places
Anther Heuristic Could be:
g(n) = level of search
h(n) = number of tiles out of place
![Page 39: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/39.jpg)
![Page 40: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/40.jpg)
![Page 41: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/41.jpg)
In general,
Best-first search is a general algorithm for heuristically search any state space graph (as were in the breadth-and depth-first algorithms)
It is equally appropriate data-and goal-driven searches and supports a variety of heuristic evaluation functions
Because of its generality, best-first search can be used with a variety of heuristics, ranging from subjective estimates of state’s “goodness” to sophisticated measure based on the probability of a state leading to a goal
![Page 42: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/42.jpg)
Drawbacks with BFS
Problems with Best First Search It reduces the costs to the goal but
It is not optimal nor complete Uniform cost
![Page 43: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/43.jpg)
Algorithm A
Consider the evaluation function
f(n) = g(n) + h(n)
wheren is any state encountered during the searchg(n) is the cost of n from the start stateh(n) is the heuristic estimate of the distance n to the goal
If this evaluation algorithm is used with the best_first_search algorithm, the result is called algorithm A.
![Page 44: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/44.jpg)
Algorithm A*
If the heuristic function used with algorithm A is admissible, the result is called algorithm A* (pronounced A-star).
A heuristic is admissible if it never overestimates the cost to the goal.
The A* algorithm always finds the optimal solution path whenever a path from the start to a goal state exists.
![Page 45: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/45.jpg)
Monotonicity
A heuristic function h is monotone if
1. For all states ni and nJ, where nJ is a descendant of ni,
h(ni) - h(nJ) cost (ni, nJ),
where cost (ni, nJ) is the actual cost (in number of moves) of going from state ni to nJ.
2. The heuristic evaluation of the goal state is zero, or h(Goal) = 0.
![Page 46: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/46.jpg)
Informedness
For two A* heuristics h1 and h2, if
h1 (n) h2 (n), for all states n in the search space,
heuristic h2 is said to be more informed than h1.
![Page 47: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/47.jpg)
Condition for Admissible Search
h(n) <= h*(n)
Estimated Heuristic Cost
Actual Heuristic Cost
This Condition Ensures Shortest Path
![Page 48: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/48.jpg)
A* Search
Evaluation function:
f(n) = g(n) +h(n)
Path cost to node n + heuristic cost at n
Constraints:
h(n) <= h*(n) (Admissible)
g(n) >= g*(n) (Coverage)
![Page 49: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/49.jpg)
Coverage: g(n) >= g*(n)
g(n)
g*(n)
Goal will never be reached
![Page 50: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/50.jpg)
Example of A*
Path: (P1): Best First/Hill Climbing
ABDEF: Cost P1 = 14 (not optimal)
For A* algorithm
F(A)=0+10=10,
F(B)=2+8=10, f(C) = 2+9=11, Expand B
F(D)=(2+5)+6=13, f(C)=11, Expand C
F(G)=(2+3)+3=8, f(D)=13, Expand G
F(f)=(2+3+2)+0=7, GOAL achieved
Path ACGF: Cost P2=7 (Optimal)
Path Admissibility
Cost P2 < Cost P1 hence P2 is admissible Path
A:10
2 2
B:8 C:9
5 3
D:6 G:3
3
E:4 2
4
F:0
![Page 51: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/51.jpg)
ExplanationFor A* algorithm Path (P2)
Now lets start from A, should we
move from A to B or A to C.
Lets check the path cost SAME,
So lets see the total cost
(fb=hb+gb=8+2=10)
(fc=hc+gb=9+2=11), hence moving through
B is better
Next move to D, total path cost to D is 2+5 = 7, and heuristic cost is 6, total is 7+6=13.
On the other side If you move through C to G, then the path cost is 2+3=5, and heuristic cost is 3, total = 3+5=8, which is much better than moving through state D. So now we choose to change path and move through G
A:10
2 2
B:8 C:9
5 3
D:6 G:3
3
E:4 2
4
F:0
![Page 52: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/52.jpg)
Explanation
Now from G we move to the Goal node F
Total Path cost via G is 2+3+2=7
And Total Path cost via D is 2+5+3+4=14
Hence moving through G is much better will give the optimal path.
A:10
2 2
B:8 C:9
5 3
D:6 G:3
3
E:4 2
4
F:0
![Page 53: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/53.jpg)
For A*never throw away For A*never throw away unexpanded nodes:unexpanded nodes:
Always compare paths through Always compare paths through expanded and unexpanded nodesexpanded and unexpanded nodes
Avoid expanding paths that are already expensive
![Page 54: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/54.jpg)
A* search
Best-known form of best-first search. Idea: avoid expanding paths that are already
expensive. Evaluation function f(n)=g(n) + h(n)
g(n) the cost (so far) to reach the node. h(n) estimated cost to get from the node to the goal. f(n) estimated total cost of path through n to goal.
![Page 55: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/55.jpg)
A* search
A* search uses an admissible heuristic A heuristic is admissible if it never overestimates
the cost to reach the goal Are optimistic
Formally:
1. h(n) <= h*(n) where h*(n) is the true cost from n
2. h(n) >= 0 so h(G)=0 for any goal G.
e.g. hSLD(n) never overestimates the actual road distance
![Page 56: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/56.jpg)
Romania example
![Page 57: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/57.jpg)
A* search example
Starting at Arad f(Arad) = g(Arad,Arad)+h(Arad)=0+366=366
![Page 58: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/58.jpg)
A* search example
Expand Arad and determine f(n) for each node f(Sibiu)= g(Arad,Sibiu)+h(Sibiu)=140+253=393 f(Timisoara)=g(Arad,Timisoara)+h(Timisoara)=118+329=447 f(Zerind)=g(Arad,Zerind)+h(Zerind)=75+374=449
Best choice is Sibiu
![Page 59: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/59.jpg)
A* search example
Expand Sibiu and determine f(n) for each node f(Arad)= g(Sibiu,Arad)+h(Arad)=280+366= 646 f(Fagaras)=g(Sibiu,Fagaras)+h(Fagaras)=239+179= 415 f(Oradea)=g(Sibiu,Oradea)+h(Oradea)=291+380= 671 f(Rimnicu Vilcea)=g(Sibiu,Rimnicu Vilcea)+
h(Rimnicu Vilcea)=220+192= 413 Best choice is Rimnicu Vilcea
Previous Pathsf(Timisoara)=c(Arad,Timisoara)+h(Timisoara)=118+329=
447f(Zerind)=c(Arad,Zerind)+h(Zerind)=75+374=449
![Page 60: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/60.jpg)
A* search example
f(Timisoara)=g(Arad,Timisoara)+h(Timisoara)=118+329= 447 f(Zerind)=g(Arad,Zerind)+h(Zerind)=75+374= 449 f(Arad)=g(Sibiu,Arad)+h(Arad)=280+366= 646 f(Fagaras)=g(Sibiu,Fagaras)+h(Fagaras)=239+179= 415 f(Oradea)=g(Sibiu,Oradea)+h(Oradea)=291+380= 671
Expand Rimnicu Vilcea and determine f(n) for each node f(Craiova)=g(Rimnicu Vilcea, Craiova)+h(Craiova)=360+160= 526 f(Pitesti)=g(Rimnicu Vilcea, Pitesti)+h(Pitesti)=317+100= 417 f(Sibiu)=g(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253= 553
Best choice is Fagaras
![Page 61: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/61.jpg)
A* search example
f(Timisoara)=g(Arad,Timisoara)+h(Timisoara)=118+329= 447
f(Zerind)=g(Arad,Zerind)+h(Zerind)=75+374= 449 f(Arad)=g(Sibiu,Arad)+h(Arad)=280+366= 646 f(Fagaras)=g(Sibiu,Fagaras)+h(Fagaras)=239+179= 415 f(Oradea)=g(Sibiu,Oradea)+h(Oradea)=291+380= 671
Expand Rimnicu Vilcea and determine f(n) for each node f(Craiova)=g(Rimnicu Vilcea, Craiova)+h(Craiova)=360+160= 526 f(Pitesti)=g(Rimnicu Vilcea, Pitesti)+h(Pitesti)=317+100= 417417 f(Sibiu)=g(Rimnicu Vilcea,Sibiu)+h(Sibiu)=300+253= 553
Expand Fagaras and determine f(n) for each node f(Sibiu)=g(Fagaras, Sibiu)+h(Sibiu)=338+253= 591 f(Bucharest)=g(Fagaras,Bucharest)+h(Bucharest)=450+0= 450
Best choice is Pitesti !!!
![Page 62: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/62.jpg)
A* search example
Expand Pitesti and determine f(n) for each node f(Bucharest)=g(Pitesti,Bucharest)+h(Bucharest)=418+0=418
Best choice is Bucharest !!! Optimal solution (only if h(n) is admissable)
Note values along optimal path !!
![Page 63: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/63.jpg)
A* search, evaluation
Completeness: YES Since bands of increasing f are added Unless there are infinitely many nodes with f<f(G)
![Page 64: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/64.jpg)
A* search, evaluation
Completeness: YES Time complexity:
Number of nodes expanded is still exponential in the length of the solution.
![Page 65: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/65.jpg)
A* search, evaluation
Completeness: YES Time complexity: (exponential with path
length) Space complexity:
It keeps all generated nodes in memory Hence space is the major problem not time
![Page 66: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/66.jpg)
Heuristic Search & Expert Systems
Expert Systems:
Human Extract Heuristic Develop Rules
Expert Knowledge
No certainties
are involved Knowledge Base
Manipulates the
knowledge to run
the system
![Page 67: Artificial Intelligence & Expert Systems](https://reader036.fdocuments.in/reader036/viewer/2022062301/568150ba550346895dbed459/html5/thumbnails/67.jpg)
Using Heuristics in Games Games have always been an important application area for
heuristic algorithms Two-person games are more complicated than simple puzzles
because of the existence of a “hostile” and essentially unpredictable opponent
consider games whose state space is small enough to be exhaustively searched; here the problem is systematically searching the space of possible moves and countermoves by the opponent
look at games in which it is either impossible or undesirable to exhaustively search the game graph
Because only a portion of the state space can be generated and searched, the game player must use heuristics to guide play along a path to a winning state