SlideShare ist ein Scribd-Unternehmen logo
1 von 43
3
Best-first search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Idea: use an evaluation function f(n) to select the node for
expansion
– estimate of "desirability"
Expand most desirable unexpanded node
• Implementation:
Order the nodes in fringe in decreasing order of desirability
• A key component in best-first algorithms is a heuristic
function, h(n), which is the estimated cost of the cheapest path
from n to a goal node
5
Romania with step costs in km
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
e.g. For Romania, cost of the cheapest path from Arad to
Bucharest can be estimated via the straight line distance
6
Greedy best-first search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Greedy best-first search expands the node that
appears to be closest to goal
• Evaluation function f(n) = h(n) (heuristic)
• = estimate of cost from n to goal
• e.g., hSLD(n) = straight-line distance from n to
Bucharest
• Note that, hSLD cannot be computed from the problem
description itself. It takes a certain amount of
experience to know that it is correlated with actual
road distances, and therefore it is a useful heuristic
7
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
8
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
9
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
10
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
11
Greedy best-first search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
Problems:
Path through Faragas is not the optimal
In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
19
Properties of greedy best-first
search
• Complete? No – can get stuck in loops,
– e.g., Iasi  Neamt  Iasi  Neamt 
• Time? O(bm), but a good heuristic can give dramatic
Improvement
• Space? O(bm) -- keeps all nodes in memory
• Optimal? No
20
A* search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Idea: avoid expanding paths that are already
expensive
• Evaluation function f(n) = g(n) + h(n)
• g(n) = cost so far to reach n
• h(n) = estimated cost from n to goal
• f(n) = estimated total cost of path through n to goal
21
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
22
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
23
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
24
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
25
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
26
A* search example
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
33
Straight line estimate
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
Uniform-cost orders by path cost, or backward
cost g(n)
Greedy orders by goal proximity, or forward
cost h(n)
A* Search orders by the sum: f(n) = g(n) + h(n)
Initialize : set open={s} , closed={ }
g(s)=0 , f(s)= h(s)
Fail: if open= { } , terminate and fail
Select: select minimum cost state n from open{ } .save in closed{ }
Terminate: if n belongs to G ,terminate with success , return f(n)
Expand: for each successor m of n
if m Є [open U Closed]
set g(m)=g(n)+c(n,m)
set f(m)=g(m)+h(m)
insert m in open { }
if m Є [open U Closed]
set g(m)=min { g(m), g(n)+c(n,m)}
set f(m)=g(m)+h(m)
If f(m) has decreased and m Є closed
Move m to open { }
A* Algorithm
37
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
• A heuristic h(n) is admissible if for every node n,
h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n.
An admissible heuristic never overestimates the cost to reach the goal,
i.e., it is optimistic – thinks that the cost of solving the problem is less
than it actually is
Consequence: f(n) never over estimates the the true cost of a solution
through n since g(n) is the exact cost to reach n
• Example: hSLD(n) (never overestimates the actual road distance) since
the shortest path between any two points is a straight line
38
Optimality of A* (proof)
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Theorem: If h(n) is admissible, A* using TREE-SEARCH is
optimal
•
• Suppose some suboptimal goal G2 has been generated and is in the fringe.
Let the cost of the optimal solution to goal G is C*
f = g + h
• f(G2) = g(G2)
• g(G2) > C*
• f(G) = g(G)
• f(G2) > f(G)
since h(G2) = 0
since G2 is suboptimal
since h(G) = 0
from above
39
Optimality of A* (proof)
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Let n be an unexpanded node in the fringe such that n is on a shortest path
to an optimal goal G (e.g. Pitesti).
If h(n) does not overestimate the cost of completing the solution path, then
f(n) = g(n) + h(n) ≤ C*
f(n) ≤ f(G)
•
•
•
• f(G2) > f(G) from above
• Hence f(G2) > f(G) >= f(n) , and A* will never select G2 for expansion
41
Optimality of A*
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
•
A* expands nodes in order of increasing f value
Gradually adds "f-contours" of nodes
Contour i has all nodes with f=fi, where fi < fi+1
42
Properties of A*
• nodes with f ≤ f(G) )
• Time? Exponential
• Space? Keeps all nodes in memory
• Optimal? Yes
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Complete? Yes (unless there are infinitely many
S
c
D
E
F
B
G
5
4
10
3
7
2
5
16
12
S=14
S-B=4+12=16 **
S-C=3+11=14
S-C-D=3+7+6=16
S-C-E=3+10+4=17
S-B-E=4+12+4=20
S-B-F=4+5+11=20
S-C-D-E=3+7+2+4=16
S-C-D-E-G=3+7+2+5=17
Open list Closed list
S(14) S(14)
C(14) B(16) C(14)
B(16)E(17)D(16) D(16)
E(16) E(16)
G(17) G(17)
Open list Closed list
S(14) S(14)
C(14) B(16) C(14)
B(16)E(17)D(16) B(16)
E(17)D(16)F(20) D(16)
E(16) E(16)
G(17) G(17)
43
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
E.g., for the 8-puzzle:
•
•
h1(n) = number of misplaced tiles
h2(n) = total Manhattan distance – the sum of the distances of the tiles from
their goal positions
• h1(S) = ?
• h2(S) = ?
44
Admissible heuristics
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
E.g., for the 8-puzzle:
• h1(n) = number of misplaced tiles
• h2(n) = total Manhattan distance
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18
45
Dominance
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• If h2(n) ≥ h1(n) for all n (both admissible)
• then h2 dominates h1
• h2 is better for search
• It is always better to use a heuristic function with higher
values, provided it does not overestimate and that the
computation time for the heuristic is not too large
• Typical search costs (average number of nodes expanded):
• d=12 IDS = 3,644,035 nodes
A*(h1) = 227 nodes
A*(h2) = 73 nodes
• d=24 IDS = too many nodes
A*(h1) = 39,135 nodes
A*(h2) = 1,641 nodes
46
Relaxed problems
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• A problem with fewer restrictions on the actions is
called a relaxed problem
• The cost of an optimal solution to a relaxed problem
is an admissible heuristic for the original problem
• The heuristic is admissible because the optimal
solution in the original problem is also a solution in
the relaxed problem and therefore must be at least as
expensive as the optimal solution in the relaxed
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
47
Inventing admissible heuristic functions
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• If a problem definition is written down in a formal language, it is
possible to construct relaxed problems automatically (ABSOLVER)
– If 8-puzzle is described as
• A tile can move from square A to square B if
• A is horizontally or vertically adjacent to B and B is blank
– A relaxed problem can be generated by removing one or both of
the conditions
• (a) A tile can move from square A to square B if A is adjacent to B
• (b) A tile can move from square A to square B if B is blank
• (c) A tile can move from square A to square B
– h2 can be derived from (a) – h2 is the proper score if we move
each tile into its destination
– h1 can be derived from (c) – it is the proper score if tiles could
move to their intended destination in one step
• Admissible heuristics can also be derived from the solution cost of a
subproblem of a given problem
48
Local search algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• In many optimization problems, the path to the goal is
irrelevant; the goal state itself is the solution
• State space = set of "complete" configurations
• Find configuration satisfying constraints, e.g., n-
queens
• In such cases, we can use local search algorithms
• keep a single "current" state, try to improve it
49
Example: n-queens
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Put n queens on an n × n board with no two queens
on the same row, column, or diagonal
50
Hill-climbing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• "Like climbing Everest in thick fog with amnesia"
51
Hill-climbing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Problem: depending on initial state, can get stuck in
local maxima
52
Hill-climbing search: 8-queens problem
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• h = number of pairs of queens that are attacking each other, either directly or
indirectly
h = 17 for the above state
•
53
Hill-climbing search: 8-queens problem
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• A local minimum with h = 1
54
Simulated annealing search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Idea: escape local maxima by allowing some "bad"
moves but gradually decrease their frequency
56
Local beam search
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• Keep track of k states rather than just one
• Start with k randomly generated states
• At each iteration, all the successors of all k states are
generated
• If any one is a goal state, stop; else select the k best
successors from the complete list and repeat.
57
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
• A successor state is generated by combining two parent states
• Start with k randomly generated states (population)
• A state is represented as a string over a finite alphabet (often a
string of 0s and 1s)
• Evaluation function (fitness function). Higher values for better
states.
• Produce the next generation of states by selection, crossover,
and mutation
58
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
•
•
•
Fitness function: number of non-attacking pairs of queens (min
= 0, max = 8 × 7/2 = 28)
24/(24+23+20+11) = 31%
23/(24+23+20+11) = 29% etc
59
Genetic algorithms
Spring2008 CS461 Artificial Intelligence © Pinar Duygulu

Weitere ähnliche Inhalte

Ähnlich wie AI 22-23 Chpt3 informed.pptx

Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECUnit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECsundarKanagaraj1
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)Nazir Ahmed
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)Nazir Ahmed
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search Mustafa Jarrar
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdfDrBashirMSaad
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data sciencedevvpillpersonal
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.pptMIT,Imphal
 
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONSCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONaftab alam
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxSwagat Praharaj
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programminghodcsencet
 
Module_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemModule_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemNareshKireedula
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1man003
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchPalGov
 

Ähnlich wie AI 22-23 Chpt3 informed.pptx (20)

Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VECUnit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
Unit II Problem Solving Methods in AI K.sundar,AP/CSE,VEC
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
Artificial intelligence(06)
Artificial intelligence(06)Artificial intelligence(06)
Artificial intelligence(06)
 
Jarrar: Informed Search
Jarrar: Informed Search  Jarrar: Informed Search
Jarrar: Informed Search
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
m4-heuristics.ppt
m4-heuristics.pptm4-heuristics.ppt
m4-heuristics.ppt
 
M4 Heuristics
M4 HeuristicsM4 Heuristics
M4 Heuristics
 
Searching Informed Search.pdf
Searching Informed Search.pdfSearching Informed Search.pdf
Searching Informed Search.pdf
 
Lecture24
Lecture24Lecture24
Lecture24
 
Informed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data scienceInformed-search TECHNIQUES IN ai ml data science
Informed-search TECHNIQUES IN ai ml data science
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATIONSCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
SCALABLE PATTERN MATCHING OVER COMPRESSED GRAPHS VIA DE-DENSIFICATION
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
Aaex3 group2
Aaex3 group2Aaex3 group2
Aaex3 group2
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
3.informed search
3.informed search3.informed search
3.informed search
 
Module_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert SystemModule_2_rks in Artificial intelligence in Expert System
Module_2_rks in Artificial intelligence in Expert System
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
 
Searching
SearchingSearching
Searching
 
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearchJarrar.lecture notes.aai.2011s.ch4.informedsearch
Jarrar.lecture notes.aai.2011s.ch4.informedsearch
 

Kürzlich hochgeladen

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 

Kürzlich hochgeladen (20)

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

AI 22-23 Chpt3 informed.pptx

  • 1. 3 Best-first search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Idea: use an evaluation function f(n) to select the node for expansion – estimate of "desirability" Expand most desirable unexpanded node • Implementation: Order the nodes in fringe in decreasing order of desirability • A key component in best-first algorithms is a heuristic function, h(n), which is the estimated cost of the cheapest path from n to a goal node
  • 2. 5 Romania with step costs in km Spring2008 CS461 Artificial Intelligence © Pinar Duygulu e.g. For Romania, cost of the cheapest path from Arad to Bucharest can be estimated via the straight line distance
  • 3. 6 Greedy best-first search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Greedy best-first search expands the node that appears to be closest to goal • Evaluation function f(n) = h(n) (heuristic) • = estimate of cost from n to goal • e.g., hSLD(n) = straight-line distance from n to Bucharest • Note that, hSLD cannot be computed from the problem description itself. It takes a certain amount of experience to know that it is correlated with actual road distances, and therefore it is a useful heuristic
  • 4. 7 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 5. 8 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 6. 9 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 7. 10 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 8. 11 Greedy best-first search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu Problems: Path through Faragas is not the optimal In getting Iasi to Faragas, it will expand Neamt first but it is a dead end
  • 9. 19 Properties of greedy best-first search • Complete? No – can get stuck in loops, – e.g., Iasi  Neamt  Iasi  Neamt  • Time? O(bm), but a good heuristic can give dramatic Improvement • Space? O(bm) -- keeps all nodes in memory • Optimal? No
  • 10. 20 A* search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Idea: avoid expanding paths that are already expensive • Evaluation function f(n) = g(n) + h(n) • g(n) = cost so far to reach n • h(n) = estimated cost from n to goal • f(n) = estimated total cost of path through n to goal
  • 11. 21 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 12. 22 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 13. 23 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 14. 24 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 15. 25 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 16. 26 A* search example Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 17. 33 Straight line estimate Spring2008 CS461 Artificial Intelligence © Pinar Duygulu
  • 18. Uniform-cost orders by path cost, or backward cost g(n) Greedy orders by goal proximity, or forward cost h(n) A* Search orders by the sum: f(n) = g(n) + h(n)
  • 19. Initialize : set open={s} , closed={ } g(s)=0 , f(s)= h(s) Fail: if open= { } , terminate and fail Select: select minimum cost state n from open{ } .save in closed{ } Terminate: if n belongs to G ,terminate with success , return f(n) Expand: for each successor m of n if m Є [open U Closed] set g(m)=g(n)+c(n,m) set f(m)=g(m)+h(m) insert m in open { } if m Є [open U Closed] set g(m)=min { g(m), g(n)+c(n,m)} set f(m)=g(m)+h(m) If f(m) has decreased and m Є closed Move m to open { } A* Algorithm
  • 20.
  • 21. 37 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic – thinks that the cost of solving the problem is less than it actually is Consequence: f(n) never over estimates the the true cost of a solution through n since g(n) is the exact cost to reach n • Example: hSLD(n) (never overestimates the actual road distance) since the shortest path between any two points is a straight line
  • 22. 38 Optimality of A* (proof) Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal • • Suppose some suboptimal goal G2 has been generated and is in the fringe. Let the cost of the optimal solution to goal G is C* f = g + h • f(G2) = g(G2) • g(G2) > C* • f(G) = g(G) • f(G2) > f(G) since h(G2) = 0 since G2 is suboptimal since h(G) = 0 from above
  • 23. 39 Optimality of A* (proof) Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G (e.g. Pitesti). If h(n) does not overestimate the cost of completing the solution path, then f(n) = g(n) + h(n) ≤ C* f(n) ≤ f(G) • • • • f(G2) > f(G) from above • Hence f(G2) > f(G) >= f(n) , and A* will never select G2 for expansion
  • 24. 41 Optimality of A* Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • A* expands nodes in order of increasing f value Gradually adds "f-contours" of nodes Contour i has all nodes with f=fi, where fi < fi+1
  • 25. 42 Properties of A* • nodes with f ≤ f(G) ) • Time? Exponential • Space? Keeps all nodes in memory • Optimal? Yes Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Complete? Yes (unless there are infinitely many
  • 26. S c D E F B G 5 4 10 3 7 2 5 16 12 S=14 S-B=4+12=16 ** S-C=3+11=14 S-C-D=3+7+6=16 S-C-E=3+10+4=17 S-B-E=4+12+4=20 S-B-F=4+5+11=20 S-C-D-E=3+7+2+4=16 S-C-D-E-G=3+7+2+5=17 Open list Closed list S(14) S(14) C(14) B(16) C(14) B(16)E(17)D(16) D(16) E(16) E(16) G(17) G(17) Open list Closed list S(14) S(14) C(14) B(16) C(14) B(16)E(17)D(16) B(16) E(17)D(16)F(20) D(16) E(16) E(16) G(17) G(17)
  • 27.
  • 28. 43 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu E.g., for the 8-puzzle: • • h1(n) = number of misplaced tiles h2(n) = total Manhattan distance – the sum of the distances of the tiles from their goal positions • h1(S) = ? • h2(S) = ?
  • 29. 44 Admissible heuristics Spring2008 CS461 Artificial Intelligence © Pinar Duygulu E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance • h1(S) = ? 8 • h2(S) = ? 3+1+2+2+2+3+3+2 = 18
  • 30. 45 Dominance Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • If h2(n) ≥ h1(n) for all n (both admissible) • then h2 dominates h1 • h2 is better for search • It is always better to use a heuristic function with higher values, provided it does not overestimate and that the computation time for the heuristic is not too large • Typical search costs (average number of nodes expanded): • d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes • d=24 IDS = too many nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes
  • 31. 46 Relaxed problems Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • A problem with fewer restrictions on the actions is called a relaxed problem • The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem • The heuristic is admissible because the optimal solution in the original problem is also a solution in the relaxed problem and therefore must be at least as expensive as the optimal solution in the relaxed 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
  • 32. 47 Inventing admissible heuristic functions Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • If a problem definition is written down in a formal language, it is possible to construct relaxed problems automatically (ABSOLVER) – If 8-puzzle is described as • A tile can move from square A to square B if • A is horizontally or vertically adjacent to B and B is blank – A relaxed problem can be generated by removing one or both of the conditions • (a) A tile can move from square A to square B if A is adjacent to B • (b) A tile can move from square A to square B if B is blank • (c) A tile can move from square A to square B – h2 can be derived from (a) – h2 is the proper score if we move each tile into its destination – h1 can be derived from (c) – it is the proper score if tiles could move to their intended destination in one step • Admissible heuristics can also be derived from the solution cost of a subproblem of a given problem
  • 33. 48 Local search algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution • State space = set of "complete" configurations • Find configuration satisfying constraints, e.g., n- queens • In such cases, we can use local search algorithms • keep a single "current" state, try to improve it
  • 34. 49 Example: n-queens Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Put n queens on an n × n board with no two queens on the same row, column, or diagonal
  • 35. 50 Hill-climbing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • "Like climbing Everest in thick fog with amnesia"
  • 36. 51 Hill-climbing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Problem: depending on initial state, can get stuck in local maxima
  • 37. 52 Hill-climbing search: 8-queens problem Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • h = number of pairs of queens that are attacking each other, either directly or indirectly h = 17 for the above state •
  • 38. 53 Hill-climbing search: 8-queens problem Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • A local minimum with h = 1
  • 39. 54 Simulated annealing search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Idea: escape local maxima by allowing some "bad" moves but gradually decrease their frequency
  • 40. 56 Local beam search Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • Keep track of k states rather than just one • Start with k randomly generated states • At each iteration, all the successors of all k states are generated • If any one is a goal state, stop; else select the k best successors from the complete list and repeat.
  • 41. 57 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • A successor state is generated by combining two parent states • Start with k randomly generated states (population) • A state is represented as a string over a finite alphabet (often a string of 0s and 1s) • Evaluation function (fitness function). Higher values for better states. • Produce the next generation of states by selection, crossover, and mutation
  • 42. 58 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu • • • Fitness function: number of non-attacking pairs of queens (min = 0, max = 8 × 7/2 = 28) 24/(24+23+20+11) = 31% 23/(24+23+20+11) = 29% etc
  • 43. 59 Genetic algorithms Spring2008 CS461 Artificial Intelligence © Pinar Duygulu