SlideShare a Scribd company logo
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 estimated
straight line distance from node n to goal
Expand the nodes of S
 Initialization: Open= [S], Closed= [ ]
 Open= [B,A], Closed= [S]
 Open=[A], Closed=[S, B]
 Open=[F,E,A],Closed= [S, B]
 Open=[E,A], Closed=[S, B, F]
 Open=[G,E,I,A], Closed=[S, B, F]
 Open=[E,I,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
visited 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
visited 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.
Expand the nodes of A
Step1 :Initialization: Open= [A], Closed= [ ]
Step 2:Remove A and move adjacent of A i.e B & F in open and
calculates f(B) and f(F).
f(B) = 6 + 8 = 14
f(F) = 3 + 6 = 9
So,
 Open= [F,B], Closed= [A]
Step3: Since f(F) < f(B), so it decides to remove node F and move
its adjacent in Open G,H
f(G) = (3+1) + 5 = 9
f(H) = (3+7) + 3 = 13
So,
Open= [G,H,B], Closed= [A,F]
Path- A → F
 Step4: Since f(G) < f(H), so it decides to remove
node G and move its adjacent in Open I and
calculate f(I)
f(I) = (7) + 1 = 8
So,
Open= [I,H,B], Closed= [A,F,G]
Path- A  F G
 Step5: Since node I was only adjacent to node G ,so it
decides to remove node I and move its adjacent in Open E
and J and calculate f(E) and f(J)
f(E) = (12) + 3 = 15
f(J)= (10) +0=10
So,Open= [J,E,H,B], Closed= [A,F,G,I] Path- A → F → G → I
 Step4: Since f(J) < f(E), so it decides to remove
node J as J is goal node also and exit
So,
So,Open= [E,H,B], Closed= [A,F,G,I,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.
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*

Chap4
Chap4Chap4
Chap4
nathanurag
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptx
DrYogeshDeshmukh1
 
HEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptxHEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptx
rakeshkumar12020604
 
Finite fields
Finite fieldsFinite fields
Finite fields
Loeky Haryanto
 
Mathematics 10.pptx
Mathematics 10.pptxMathematics 10.pptx
Mathematics 10.pptx
LEIDELCLAUDETOLENTIN1
 
1.3 Distance and Midpoint Formulas
1.3 Distance and Midpoint Formulas1.3 Distance and Midpoint Formulas
1.3 Distance and Midpoint Formulas
smiller5
 
Obj. 7 Midpoint and Distance Formulas
Obj. 7 Midpoint and Distance FormulasObj. 7 Midpoint and Distance Formulas
Obj. 7 Midpoint and Distance Formulas
smiller5
 
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
clarebernice
 
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
PalGov
 
Module For Mathematics
Module For Mathematics Module For Mathematics
Module For Mathematics
jrbt2014
 

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

Chap4
Chap4Chap4
Chap4
 
Unit 3 Informed Search Strategies.pptx
Unit  3 Informed Search Strategies.pptxUnit  3 Informed Search Strategies.pptx
Unit 3 Informed Search Strategies.pptx
 
HEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptxHEURISTIC SEARCH and other technique.pptx
HEURISTIC SEARCH and other technique.pptx
 
Finite fields
Finite fieldsFinite fields
Finite fields
 
Mathematics 10.pptx
Mathematics 10.pptxMathematics 10.pptx
Mathematics 10.pptx
 
1.3 Distance and Midpoint Formulas
1.3 Distance and Midpoint Formulas1.3 Distance and Midpoint Formulas
1.3 Distance and Midpoint Formulas
 
Obj. 7 Midpoint and Distance Formulas
Obj. 7 Midpoint and Distance FormulasObj. 7 Midpoint and Distance Formulas
Obj. 7 Midpoint and Distance Formulas
 
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
 
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
 
Module For Mathematics
Module For Mathematics Module For Mathematics
Module For Mathematics
 

More from SwatiHans10

routing algo n
routing algo                                nrouting algo                                n
routing algo n
SwatiHans10
 
ethernet nn
ethernet                                         nnethernet                                         nn
ethernet nn
SwatiHans10
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
SwatiHans10
 
search_sort.ppt
search_sort.pptsearch_sort.ppt
search_sort.ppt
SwatiHans10
 
analytics platform
analytics platformanalytics platform
analytics platform
SwatiHans10
 
kpi
kpikpi
data collection.ppt
data collection.pptdata collection.ppt
data collection.ppt
SwatiHans10
 
filler structures.pptx
filler structures.pptxfiller structures.pptx
filler structures.pptx
SwatiHans10
 
filler structures
filler structuresfiller structures
filler structures
SwatiHans10
 
knowledge representation.pptx
knowledge representation.pptxknowledge representation.pptx
knowledge representation.pptx
SwatiHans10
 
Multiplexing.ppt
Multiplexing.pptMultiplexing.ppt
Multiplexing.ppt
SwatiHans10
 
ER.ppt
ER.pptER.ppt
ER.ppt
SwatiHans10
 
Cloud computing
Cloud computingCloud computing
Cloud computing
SwatiHans10
 
3D Transformation
3D Transformation3D Transformation
3D Transformation
SwatiHans10
 

More from SwatiHans10 (14)

routing algo n
routing algo                                nrouting algo                                n
routing algo n
 
ethernet nn
ethernet                                         nnethernet                                         nn
ethernet nn
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
search_sort.ppt
search_sort.pptsearch_sort.ppt
search_sort.ppt
 
analytics platform
analytics platformanalytics platform
analytics platform
 
kpi
kpikpi
kpi
 
data collection.ppt
data collection.pptdata collection.ppt
data collection.ppt
 
filler structures.pptx
filler structures.pptxfiller structures.pptx
filler structures.pptx
 
filler structures
filler structuresfiller structures
filler structures
 
knowledge representation.pptx
knowledge representation.pptxknowledge representation.pptx
knowledge representation.pptx
 
Multiplexing.ppt
Multiplexing.pptMultiplexing.ppt
Multiplexing.ppt
 
ER.ppt
ER.pptER.ppt
ER.ppt
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
3D Transformation
3D Transformation3D Transformation
3D Transformation
 

Recently uploaded

Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 

Recently uploaded (20)

Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 

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 estimated straight line distance from node n to goal
  • 6. Expand the nodes of S  Initialization: Open= [S], Closed= [ ]  Open= [B,A], Closed= [S]  Open=[A], Closed=[S, B]  Open=[F,E,A],Closed= [S, B]  Open=[E,A], Closed=[S, B, F]  Open=[G,E,I,A], Closed=[S, B, F]  Open=[E,I,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 visited 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 visited 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. Expand the nodes of A Step1 :Initialization: Open= [A], Closed= [ ] Step 2:Remove A and move adjacent of A i.e B & F in open and calculates f(B) and f(F). f(B) = 6 + 8 = 14 f(F) = 3 + 6 = 9 So,  Open= [F,B], Closed= [A] Step3: Since f(F) < f(B), so it decides to remove node F and move its adjacent in Open G,H f(G) = (3+1) + 5 = 9 f(H) = (3+7) + 3 = 13 So, Open= [G,H,B], Closed= [A,F] Path- A → F
  • 13.  Step4: Since f(G) < f(H), so it decides to remove node G and move its adjacent in Open I and calculate f(I) f(I) = (7) + 1 = 8 So, Open= [I,H,B], Closed= [A,F,G] Path- A  F G  Step5: Since node I was only adjacent to node G ,so it decides to remove node I and move its adjacent in Open E and J and calculate f(E) and f(J) f(E) = (12) + 3 = 15 f(J)= (10) +0=10 So,Open= [J,E,H,B], Closed= [A,F,G,I] Path- A → F → G → I
  • 14.  Step4: Since f(J) < f(E), so it decides to remove node J as J is goal node also and exit So, So,Open= [E,H,B], Closed= [A,F,G,I,J]  Path- A → F → G → I → J
  • 16. OPEN A(5) CLOSED A(5) Initial state of OPEN and CLOSED. g(A)=0, f(A)=h(A)=5.
  • 17. 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.
  • 18. 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.
  • 19. 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.
  • 20. 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.
  • 21. 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.
  • 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) 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)
  • 23. 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.
  • 24.  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.