SlideShare a Scribd company logo
1 of 23
UNIT – 2
Heuristic Techniques
Heuristic Search Techniques
1. Generate & Test
2. Hill Climbing
 Simple Hill Climbing
 Steepest Ascent Hill Climbing
3. Best First Search & A*
4. Problem Reduction & AO*
5. Constraint Satisfaction
6. Means – Ends Analysis
 A best-first search depends on the use of a heuristic
to select the most promising path to a goal node.
 Best first search selects the next node based on the
best estimate out of all the estimates of the heuristic
function calculated so far – this is where Best-First
Search differs from Hill Climbing.
 Greedy best-first search tries to expand the node that
is closest to the goal, that this is likely to lead to a
solution quickly.
 Use Priority queue for implementation
 Thus, it evaluates nodes by using just the heuristic
function; that is, f (n) = h(n)
Step 1: Place the starting node into the OPEN list.
Step 2: If the OPEN list is empty, Stop and return failure.
Step 3: Remove the node n, from the OPEN list which has the lowest
value of h(n), and places it in the CLOSED list.
Step 4: Expand the node n, and generate the successors of node n.
Step 5: Check each successor of node n, and find whether any node is
a goal node or not. If any successor node is goal node, then return
success and terminate the search, else proceed to Step 6.
Step 6: For each successor node, algorithm checks for evaluation
function f(n), and then check if the node has been in either OPEN or
CLOSED list. If the node has not been in both list, then add it to the
OPEN list.
Step 7: Return to Step 2.
S is initial state
G is goal state
H(N) heuristic function is the total cost from
current state to goal state
Expand the nodes of S
 Initialization: Open= [S], Closed= [ ]
 Open= [A, B], Closed= [S]
 Open=[A], Closed=[S, B]
 Open=[E, F,A],Closed= [S, B]
 Open=[E, A], Closed=[S, B, F]
 Open=[I, G, E, A], Closed=[S, B, F]
 Open=[I, E, A], Closed=[S, B, F, G]
 Hence the final solution path will be:
 S----> B----->F----> G
 A specialization of Best-First Search
 The procedure followed by A* Search is:
Along a path to the goal, at each node, the A*
algorithm generates all the child nodes,
For each child node, A* computes the estimate of
the distance (cost) from the start node to a goal
node through each of the children,
A* selects the child node which has the minimum
cost and expands it. The process than repeats for
this selected node until the goal is found or the
search ends in failure.
 The total cost function f(n) used by A*, for the
current node n during the search process is given
by
 OPEN LIST stores the nodes which have been
generated but not expanded and are available (are
“open”) for expansion, that is, their child nodes are
yet to be identified.
 CLOSED LIST stores the nodes that have been
expanded and are not available (are “closed”) for
further expansion.
1. Initialize: Set OPEN={s}, CLOSED={ },
g(s)=0 and f(s)=h(s).
2. Fail: if OPEN={ }; terminate and fail.
3. Select: Select the minimum cost state, n
from OPEN. Save n in CLOSED.
4. Terminate: If n  G, where G is the set of
goal states, terminate with success and
return f(n).
5. Expand: For each child, m, of n
6. IF m  G, where G is the set of goal states, terminate
with success and return f(n).
if m  [OPEN  CLOSED], CALCULATE F(M)
Set f(m) = g(m) + h(m)
Insert m in OPEN.
7. Return: Return to Step 2.
 A* Algorithm calculates f(B) and f(F).
 f(B) = 6 + 8 = 14
 f(F) = 3 + 6 = 9
 Since f(F) < f(B), so it decides to go to node F.
 A* Algorithm calculates f(G) and f(H).
 f(G) = (3+1) + 5 = 9
 f(H) = (3+7) + 3 = 13
 Since f(G) < f(H), so it decides to go to node G.
 Path- A → F → G
 A* Algorithm calculates f(I).
 f(I) = (3+1+3) + 1 = 8
 It decides to go to node I.
 Path- A → F → G → I
 A* Algorithm calculates f(E), f(H) and f(J).
 f(E) = (3+1+3+5) + 3 = 15
 f(H) = (3+1+3+2) + 3 = 12
 f(J) = (3+1+3+3) + 0 = 10
 Since f(J) is least, so it decides to go to node
J.
 Path- A → F → G → I → J
A-5
B-4 C-23
D-2
E-3
F-0
2
3
4 3
1
20
C(n,m)
h(n)
OPEN
A(5)
CLOSED
A(5)
Initial state of OPEN and CLOSED. g(A)=0, f(A)=h(A)=5.
Minimum cost state in OPEN is A. Put A in CLOSED. A does not belong to G.
OPEN
A(5)
B(7) C(25)
CLOSED
A(5)
A(5) B(7)
Expand A to obtain B and C. B does not belong to [OPEN union CLOSED].
Therefore, set g(B)=g(A) + C(A, B) = 0 + 3 = 3.
And, set f(B) = g(B) + h(B) = 3 + 4 = 7. Place B on OPEN.
Similarly, g(C)=0 + 2 = 2 and f(C)=0+23=25. Place C in OPEN. Return to step 2.
Minimum cost state in OPEN is B. Put B in CLOSED. B does not belong to G.
OPEN
A(5)
B(7) C(25)
C(25) D(9)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
Expand B to obtain D. D does not belong to [OPEN union CLOSED].
Therefore, set g(D)=g(B) + C(B, D) = 3 + 4 = 7.
And, set f(D) = g(D) + h(D) = 7 + 2 = 9. Place D in OPEN. Return to step 2.
Minimum cost state in OPEN is D. Put D in CLOSED. D does not belong to G.
OPEN
A(5)
B(7) C(25)
C(25) D(9)
C(25) E(11)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
A(5) B(7) D(9) E(11)
Expand D to obtain E. E does not belong to [OPEN union CLOSED].
Therefore, set g(E)=g(D) + C(D, E) = 7 + 1 = 8.
And, set f(E) = g(E) + h(E) = 8 + 3 = 11. Place E in OPEN. Return to step 2.
Minimum cost state in OPEN is E. Put E in CLOSED. E does not belong to G.
OPEN
A(5)
B(7) C(25)
C(25) D(9)
C(25) E(11)
C(25) F(28)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
A(5) B(7) D(9) E(11)
A(5) B(7) D(9) E(11) C(25)
Expand E to obtain F. F does not belong to [OPEN union CLOSED].
Therefore, set g(F)=g(E) + C(E, F) = 8 + 20 = 28.
And, set f(F) = g(F) + h(F) = 28 + 0 = 28. Place F in OPEN. Return to step 2.
Minimum cost state in OPEN is C. Put C in CLOSED. C does not belong to G.
OPEN
A(5)
B(7) C(25)
C(25) D(9)
C(25) E(11)
C(25) F(28)
F(28) D(7)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
A(5) B(7) D(9) E(11)
A(5) B(7) E(11 C(25)
A(5) B(7) D(9) E(11) C(25)
Expand C to obtain D. D belongs to [OPEN union CLOSED] as it is in CLOSED.
Therefore, set g(D)=min{g(D), g(C) + C(C, D)} = min{7, 2 + 3} = 5.
And, set f(D) = g(D) + h(D) = 5 + 2 = 7. As f(D) has decreased from 9 to 7, and D
belongs to CLOSED, therefore move D from CLOSED to OPEN. Return to step 2.
OPEN
A(5)
B(7) C(25)
C(25) D(9)
C(25) E(11)
C(25) F(28)
F(28) D(7)
F(28) E(9)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
A(5) B(7) D(9) E(11)
A(5) B(7) E(11 C(25)
A(5) B(7) E(11 C(25) D(7)
A(5) B(7) C(25 D(7)
Minimum cost state in OPEN is D. Put D in CLOSED. D does not belong to G.
Expand D to obtain E. E belongs to [OPEN union CLOSED] as it is in CLOSED.
Therefore, set g(E)=min{g(E), g(D) + C(D, E)} = min{8, 5 + 1} = 6.
And, set f(E) = g(E) + h(E) = 6 + 3 = 9. As f(E) has decreased from 11 to 9, and E
belongs to CLOSED, therefore move E from CLOSED to OPEN. Return to step 2.
F(28)
OPEN
A(5)
B(7) C(25)
C(25) D(9)
C(25) E(11)
C(25) F(28)
F(28) D(7)
F(28) E(9)
F(28)
CLOSED
A(5)
A(5) B(7) D(9)
A(5) B(7)
A(5) B(7) D(9) E(11)
A(5) B(7) E(11 C(25)
A(5) B(7) C(25) D(7)
A(5) B(7) C(25) D(7) E(9)
Minimum cost state in OPEN is E. Put E in CLOSED. E does not belong to G.
F(26)
Expand E to obtain F. F belongs to [OPEN union CLOSED] as it is in OPEN.
Therefore, set g(F)=min{g(F), g(E) + C(E, F)} = min{28, 6 + 20} = 26.
And, set f(F) = g(F) + h(F) = 26 + 0 = 26. As f(F) has decreased from 28 to 26, but
F does not belong to CLOSED, it is already in OPEN. Replace it. Return to step 2.
Minimum cost state in OPEN is F with the cost 26. F belongs to G. Therefore,
return f(F)=26. This is the minimum cost of reaching the goal node F.
 When will a node have to be moved from
CLOSED to OPEN?
This is required only in the case when the data
structure being used for the search is a graph
rather than a tree.
In the case of a graph, the moving of a node from
CLOSED to OPEN indicates a backtracking and
that the path followed till the node being moved
is not the best path and there are other
alternative paths which may be better.

More Related Content

Similar to heuristic - best search and a*

A Short Study of Galois Field
A Short Study of Galois FieldA Short Study of Galois Field
A Short Study of Galois FieldHazratali Naim
 
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdf
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdfnewmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdf
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdfBiswajitPalei2
 
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
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AIAmey Kerkar
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search StrategiesAmey Kerkar
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptxDrYogeshDeshmukh1
 
Digital electronics k map comparators and their function
Digital electronics k map comparators and their functionDigital electronics k map comparators and their function
Digital electronics k map comparators and their functionkumarankit06875
 
College Algebra MATH 107Record your answers and work on th.docx
College Algebra MATH 107Record your answers and work on th.docxCollege Algebra MATH 107Record your answers and work on th.docx
College Algebra MATH 107Record your answers and work on th.docxclarebernice
 
HEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptxHEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptxrakeshkumar12020604
 
Module For Mathematics
Module For Mathematics Module For Mathematics
Module For Mathematics jrbt2014
 
Complex analysis notes
Complex analysis notesComplex analysis notes
Complex analysis notesPrakash Dabhi
 
Impllicity Differentiation
Impllicity Differentiation Impllicity Differentiation
Impllicity Differentiation EmaduddinAksir
 

Similar to heuristic - best search and a* (16)

A Short Study of Galois Field
A Short Study of Galois FieldA Short Study of Galois Field
A Short Study of Galois Field
 
Chap4
Chap4Chap4
Chap4
 
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdf
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdfnewmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdf
newmicrosoftofficepowerpointpresentation-150826055944-lva1-app6891.pdf
 
Functions 2
Functions 2Functions 2
Functions 2
 
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
 
Finite fields
Finite fieldsFinite fields
Finite fields
 
Control Strategies in AI
Control Strategies in AIControl Strategies in AI
Control Strategies in AI
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptx
 
Digital electronics k map comparators and their function
Digital electronics k map comparators and their functionDigital electronics k map comparators and their function
Digital electronics k map comparators and their function
 
College Algebra MATH 107Record your answers and work on th.docx
College Algebra MATH 107Record your answers and work on th.docxCollege Algebra MATH 107Record your answers and work on th.docx
College Algebra MATH 107Record your answers and work on th.docx
 
HEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptxHEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptx
 
Module For Mathematics
Module For Mathematics Module For Mathematics
Module For Mathematics
 
Complex analysis notes
Complex analysis notesComplex analysis notes
Complex analysis notes
 
Unit ii-ppt
Unit ii-pptUnit ii-ppt
Unit ii-ppt
 
Impllicity Differentiation
Impllicity Differentiation Impllicity Differentiation
Impllicity Differentiation
 

More from swatihans

components of computer
components of computercomponents of computer
components of computerswatihans
 
Digital signature
Digital signatureDigital signature
Digital signatureswatihans
 
telnet ftp email
telnet ftp emailtelnet ftp email
telnet ftp emailswatihans
 
cryptography
cryptographycryptography
cryptographyswatihans
 
Computer Graphics transformations
Computer Graphics transformationsComputer Graphics transformations
Computer Graphics transformationsswatihans
 
Digital signature
Digital signatureDigital signature
Digital signatureswatihans
 

More from swatihans (6)

components of computer
components of computercomponents of computer
components of computer
 
Digital signature
Digital signatureDigital signature
Digital signature
 
telnet ftp email
telnet ftp emailtelnet ftp email
telnet ftp email
 
cryptography
cryptographycryptography
cryptography
 
Computer Graphics transformations
Computer Graphics transformationsComputer Graphics transformations
Computer Graphics transformations
 
Digital signature
Digital signatureDigital signature
Digital signature
 

Recently uploaded

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 

Recently uploaded (20)

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 

heuristic - best search and a*

  • 1. UNIT – 2 Heuristic Techniques
  • 2. Heuristic Search Techniques 1. Generate & Test 2. Hill Climbing  Simple Hill Climbing  Steepest Ascent Hill Climbing 3. Best First Search & A* 4. Problem Reduction & AO* 5. Constraint Satisfaction 6. Means – Ends Analysis
  • 3.  A best-first search depends on the use of a heuristic to select the most promising path to a goal node.  Best first search selects the next node based on the best estimate out of all the estimates of the heuristic function calculated so far – this is where Best-First Search differs from Hill Climbing.  Greedy best-first search tries to expand the node that is closest to the goal, that this is likely to lead to a solution quickly.  Use Priority queue for implementation  Thus, it evaluates nodes by using just the heuristic function; that is, f (n) = h(n)
  • 4. Step 1: Place the starting node into the OPEN list. Step 2: If the OPEN list is empty, Stop and return failure. Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in the CLOSED list. Step 4: Expand the node n, and generate the successors of node n. Step 5: Check each successor of node n, and find whether any node is a goal node or not. If any successor node is goal node, then return success and terminate the search, else proceed to Step 6. Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if the node has been in either OPEN or CLOSED list. If the node has not been in both list, then add it to the OPEN list. Step 7: Return to Step 2.
  • 5. S is initial state G is goal state H(N) heuristic function is the total cost from current state to goal state
  • 6. Expand the nodes of S  Initialization: Open= [S], Closed= [ ]  Open= [A, B], Closed= [S]  Open=[A], Closed=[S, B]  Open=[E, F,A],Closed= [S, B]  Open=[E, A], Closed=[S, B, F]  Open=[I, G, E, A], Closed=[S, B, F]  Open=[I, E, A], Closed=[S, B, F, G]  Hence the final solution path will be:  S----> B----->F----> G
  • 7.  A specialization of Best-First Search  The procedure followed by A* Search is: Along a path to the goal, at each node, the A* algorithm generates all the child nodes, For each child node, A* computes the estimate of the distance (cost) from the start node to a goal node through each of the children, A* selects the child node which has the minimum cost and expands it. The process than repeats for this selected node until the goal is found or the search ends in failure.
  • 8.  The total cost function f(n) used by A*, for the current node n during the search process is given by  OPEN LIST stores the nodes which have been generated but not expanded and are available (are “open”) for expansion, that is, their child nodes are yet to be identified.  CLOSED LIST stores the nodes that have been expanded and are not available (are “closed”) for further expansion.
  • 9. 1. Initialize: Set OPEN={s}, CLOSED={ }, g(s)=0 and f(s)=h(s). 2. Fail: if OPEN={ }; terminate and fail. 3. Select: Select the minimum cost state, n from OPEN. Save n in CLOSED. 4. Terminate: If n  G, where G is the set of goal states, terminate with success and return f(n).
  • 10. 5. Expand: For each child, m, of n 6. IF m  G, where G is the set of goal states, terminate with success and return f(n). if m  [OPEN  CLOSED], CALCULATE F(M) Set f(m) = g(m) + h(m) Insert m in OPEN. 7. Return: Return to Step 2.
  • 11.
  • 12.  A* Algorithm calculates f(B) and f(F).  f(B) = 6 + 8 = 14  f(F) = 3 + 6 = 9  Since f(F) < f(B), so it decides to go to node F.  A* Algorithm calculates f(G) and f(H).  f(G) = (3+1) + 5 = 9  f(H) = (3+7) + 3 = 13  Since f(G) < f(H), so it decides to go to node G.  Path- A → F → G
  • 13.  A* Algorithm calculates f(I).  f(I) = (3+1+3) + 1 = 8  It decides to go to node I.  Path- A → F → G → I  A* Algorithm calculates f(E), f(H) and f(J).  f(E) = (3+1+3+5) + 3 = 15  f(H) = (3+1+3+2) + 3 = 12  f(J) = (3+1+3+3) + 0 = 10  Since f(J) is least, so it decides to go to node J.  Path- A → F → G → I → J
  • 15. OPEN A(5) CLOSED A(5) Initial state of OPEN and CLOSED. g(A)=0, f(A)=h(A)=5. Minimum cost state in OPEN is A. Put A in CLOSED. A does not belong to G.
  • 16. OPEN A(5) B(7) C(25) CLOSED A(5) A(5) B(7) Expand A to obtain B and C. B does not belong to [OPEN union CLOSED]. Therefore, set g(B)=g(A) + C(A, B) = 0 + 3 = 3. And, set f(B) = g(B) + h(B) = 3 + 4 = 7. Place B on OPEN. Similarly, g(C)=0 + 2 = 2 and f(C)=0+23=25. Place C in OPEN. Return to step 2. Minimum cost state in OPEN is B. Put B in CLOSED. B does not belong to G.
  • 17. OPEN A(5) B(7) C(25) C(25) D(9) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) Expand B to obtain D. D does not belong to [OPEN union CLOSED]. Therefore, set g(D)=g(B) + C(B, D) = 3 + 4 = 7. And, set f(D) = g(D) + h(D) = 7 + 2 = 9. Place D in OPEN. Return to step 2. Minimum cost state in OPEN is D. Put D in CLOSED. D does not belong to G.
  • 18. OPEN A(5) B(7) C(25) C(25) D(9) C(25) E(11) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) A(5) B(7) D(9) E(11) Expand D to obtain E. E does not belong to [OPEN union CLOSED]. Therefore, set g(E)=g(D) + C(D, E) = 7 + 1 = 8. And, set f(E) = g(E) + h(E) = 8 + 3 = 11. Place E in OPEN. Return to step 2. Minimum cost state in OPEN is E. Put E in CLOSED. E does not belong to G.
  • 19. OPEN A(5) B(7) C(25) C(25) D(9) C(25) E(11) C(25) F(28) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) A(5) B(7) D(9) E(11) A(5) B(7) D(9) E(11) C(25) Expand E to obtain F. F does not belong to [OPEN union CLOSED]. Therefore, set g(F)=g(E) + C(E, F) = 8 + 20 = 28. And, set f(F) = g(F) + h(F) = 28 + 0 = 28. Place F in OPEN. Return to step 2. Minimum cost state in OPEN is C. Put C in CLOSED. C does not belong to G.
  • 20. OPEN A(5) B(7) C(25) C(25) D(9) C(25) E(11) C(25) F(28) F(28) D(7) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) A(5) B(7) D(9) E(11) A(5) B(7) E(11 C(25) A(5) B(7) D(9) E(11) C(25) Expand C to obtain D. D belongs to [OPEN union CLOSED] as it is in CLOSED. Therefore, set g(D)=min{g(D), g(C) + C(C, D)} = min{7, 2 + 3} = 5. And, set f(D) = g(D) + h(D) = 5 + 2 = 7. As f(D) has decreased from 9 to 7, and D belongs to CLOSED, therefore move D from CLOSED to OPEN. Return to step 2.
  • 21. OPEN A(5) B(7) C(25) C(25) D(9) C(25) E(11) C(25) F(28) F(28) D(7) F(28) E(9) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) A(5) B(7) D(9) E(11) A(5) B(7) E(11 C(25) A(5) B(7) E(11 C(25) D(7) A(5) B(7) C(25 D(7) Minimum cost state in OPEN is D. Put D in CLOSED. D does not belong to G. Expand D to obtain E. E belongs to [OPEN union CLOSED] as it is in CLOSED. Therefore, set g(E)=min{g(E), g(D) + C(D, E)} = min{8, 5 + 1} = 6. And, set f(E) = g(E) + h(E) = 6 + 3 = 9. As f(E) has decreased from 11 to 9, and E belongs to CLOSED, therefore move E from CLOSED to OPEN. Return to step 2. F(28)
  • 22. OPEN A(5) B(7) C(25) C(25) D(9) C(25) E(11) C(25) F(28) F(28) D(7) F(28) E(9) F(28) CLOSED A(5) A(5) B(7) D(9) A(5) B(7) A(5) B(7) D(9) E(11) A(5) B(7) E(11 C(25) A(5) B(7) C(25) D(7) A(5) B(7) C(25) D(7) E(9) Minimum cost state in OPEN is E. Put E in CLOSED. E does not belong to G. F(26) Expand E to obtain F. F belongs to [OPEN union CLOSED] as it is in OPEN. Therefore, set g(F)=min{g(F), g(E) + C(E, F)} = min{28, 6 + 20} = 26. And, set f(F) = g(F) + h(F) = 26 + 0 = 26. As f(F) has decreased from 28 to 26, but F does not belong to CLOSED, it is already in OPEN. Replace it. Return to step 2. Minimum cost state in OPEN is F with the cost 26. F belongs to G. Therefore, return f(F)=26. This is the minimum cost of reaching the goal node F.
  • 23.  When will a node have to be moved from CLOSED to OPEN? This is required only in the case when the data structure being used for the search is a graph rather than a tree. In the case of a graph, the moving of a node from CLOSED to OPEN indicates a backtracking and that the path followed till the node being moved is not the best path and there are other alternative paths which may be better.