SlideShare una empresa de Scribd logo
1 de 44
ARTIFICIAL INTELLIGENCE
Name : R.Gomathi Jayam
Class : I Msc CS
Semester : II
Topic : Heuristic search
Heuristic Search Techniques
2
• Direct techniques are not always feasible
(they require too much time or space).
• Weak techniques can be effective if applied
correctly on the right kinds of mission.
– generally require domain specific information.
Example: 8 Puzzle
6
1 2 3
7 8 4
5
1 2 3
8 4
3
7 6 5
1 2 3
7 8 4
6 5
Which move is
perfect?
right
1 2 3
7 8 4
6 5
1 2 3
7 4
6 8 5
1 2 3
7 8 4
6 5
1 2 3
8 4
7 6 5
GOAL
4
5
8 Puzzle Heuristics
• Blind search techniques used an random
ordering (priority) of operations.
• Heuristic search techniques make use of
province specific information - a
heuristic.
• What heurisitic(s) can we use to decide
which 8-puzzle move is “perfect”.
6
8 Puzzle Heuristics
• For now - we just want to build some
ordering to the feasible moves (the values
of our heuristic does not matter as long as it
ranks the moves).
• Later - we will worry about the actual
values return by the heuristic function.
7
A Simple 8-puzzle heuristic
• Number of tiles in the correct position.
– The highest number is the better.
– Easy to compute.
– Probably the simplest feasible heuristic.
8
Another approach
• Number of tiles in the not exact position.
– This is also be considered a lower leap on
the number of moves from a solution!
– The “best” move is the one with the lowest
number returned by the heuristic.
– Is this heuristic more than a heuristic (is it
always correct?).
• Given any 2 states, does it always order them
accurately with respect to the minimum number
of moves away from a required solution?
1 2 3
7 8 4
6 5
right
1 2 3
7 8 4
6 5
1 2 3
7 4
6 8 5
1 2 3
7 8 4
6 5
1 2 3
8 4
7 6 5
GOAL
h=2
9
h=4 h=3
10
Another 8-puzzle heuristic
• Count how far away, each tile is from
it’s correct position.
• Sum up this count over all the tiles.
• This is another evaluate on the number of
moves away from a solution.
1 2 3
7 8 4
6 5
right
1 2 3
7 8 4
6 5
1 2 3
7 4
6 8 5
1 2 3
7 8 4
6 5
1 2 3
8 4
7 6 5
GOAL
h=2
11
h=4 h=4
12
Techniques
• There are a variation of search techniques
that rely on the estimate providing by a
heuristic function.
• In all cases - the quality (precise) of the
heuristic is important in real-life application
of the technique!
13
Generate-and-test
• Very simple strategy - just keep guessing.
do while goal not ingenious
generate a feasible solution
test solution to see if it is a goal
• Heuristics may be used to determine the
specific protocol for solution
generation.
14
Example - Traveling Salesman
Problem (TSP)
• Traveler needs to visit n cities.
• Know the far between each pair of
cities.
• Want to know the shortest route that
aspects all the cities once.
• n=80 will take millions of years to solve
completely!
TSP Example
A B
CD 4
6
35
15
1 2
• TSP - generation of
feasible solutions is done
in lexicographical
sequence of cities:
1. A - B - C - D
2. A - B - D - C
3. A - C - B - D
4. A - C - D - B
...
Generate-and-test Example
A B C D
B C D
C D B D C B
D C D B B C
16
17
Hill Climbing
• Variation on generate-and-test:
– generation of next state based on feedback
from the test procedure.
– Test now includes a heuristic function that
provides a guess as to how good each feasible
state is.
• There are a number of method to use the
information returned by the test procedure.
18
Simple Hill Climbing
• Use heuristic search to move only to states
that are better than the current state.
• Always move to better state when feasible.
• The process ends when all operators have
been applying and none of the resulting
states are better than the current state.
19
Simple Hill Climbing
Function intensification
y = f(x)
x
y
20
Potential Problems with
Simple Hill Climbing
• Will achieve when at local optimal.
• The order of application of operators can
make a huge difference.
• Can’t see past a single move in the state
spaces.
21
Simple Hill Climbing Example
• TSP - define state space as the set of all
feasible tours.
• Operators exchange the position of adjacent
cities within the present tour.
• Heuristic function is the length of a tour.
TSP Hill Climb State Space
CABD ABCD ACDB DCBA
Initial State
Swap 1,2 Swap 2,3
Swap 3,4 Swap 4,1
Swap 1,2 Swap 3,4
Swap 2,3 Swap 4,1
ABCD
BACD ACBD ABDC DBCA
22
23
Steepest-Ascent Hill Climbing
• A variation on simple hill climbing.
• Instead of moving to the first state that is
better, move to the best feasible state that is
one move away.
• The sequence of operators does not matter.
• Not just climbing to a better state, climbing
up the elevated slope.
24
Hill Climbing Termination
• Local Optimum: all nearing states are
worse or the same.
• Plateau - all nearing states are the same as
the current state.
• Ridge - local optimal that is caused by
inability to apply 2 operators at once.
25
Heuristic Dependence
• Hill climbing is depends on the value
assigned to states by the heuristic function.
• The heuristic used by a hill climbing
algorithm does not need to be a fixed
function of a single state.
• The heuristic can look ahead many states, or
can use other means to enter at a value for a
state.
26
Best-First Search
• Combines the benefits of Breadth-First
and Depth-First searchs.
– DFS: follows a single path, don’t need to
control all controlling paths.
– BFS: doesn’t get in loops or dead-end- paths.
• Best First Search: analysing the
most assuring path.
27
Best-First Search (cont.)
While goal not reached:
1.Generate all potential beneficiary states
and add to a list of states.
2.choose the best state in the list and go to it.
• Similar to steepest-ascent, but don’t throw
away states that are not picked.
28
Simulated Annealing
• Based on physical process of thicken a
metal to get the best (minimal energy) state.
• Hill climbing with a twist:
– allow some moves downhill
– start out allowing large downhill moves and
gradually allow only small downhill moves.
29
Simulated Annealing (cont.)
• The search initially bounce around a lot,
exploring many regions of the state space.
• The bouncing is gradually decreased and
the search becomes a simple hill climb
(search for local optimum).
Simulated Annealing
1
2 4
3 5
7
6
30
31
A* Algorithm (a sure test topic)
• The A* algorithm uses a modified
estimation function and a Best-First search.
• A* minimizes the total path costs.
• Under the right conditions A* provides the
cheapest costs solution in the optimal
time!
32
A* evaluation function
• The evaluation function f is an evaluate of
the value of a node x given by:
f(x) = g(x) + h’(x)
• g(x) is the effective costs to get from the
start state to state x.
• h’(x) is the evaluate the effective cost to
get from state
x to the goal state.
33
Modified State Evaluation
• Value of each state is a integration of:
– the cost of the path to the state
– evaluated cost of reaching a goal from the state.
• This idea is to use the path to a state to
determine the rank of the state when
compared to other states.
• This doesn’t make senses for DFS or
BFS, but is useful for BFS.
34
Why we need modified
evaluation
• Considering a BFS that generates the same
state more times.
• Which of the paths leads to the state is the
perfect?
• Recall that often the path to a goal is the
solution
35
A* Algorithm
• The general idea is:
– Best First Search with the modified estimation
function.
– h’(x) is an evaluate of the number of steps from
state x to a goal state.
– loops are avoided - we don’t abbreviate the
same state twice
– Information about the path to the goal state
employed.
Example - Maze
START GOAL
36
Example - Maze
START
37
GOAL
38
A* Optimality and Completeness
• If the heuristic function h’ is allowable the
algorithm will find the optimal to the
solution in the minimum number of steps
feasible.
• An admissible heuristic is one that never
overevaluate the cost of getting from a
state to the goal state.
39
Admissible Heuristics
• Given an admissible heuristic h’, path
length to given each state given by g, and
the actual path length from any state to the
goal given by a function h.
• We can proved that the solution found by
A* is the optimal solution.
40
A* Optimality Proof
• Assume A* finds the (suboptimal) goal G2
and the optimal goal is G.
• Since h’ is admissible: h’(G2)=h’(G)=0
• Since G2 is not optimal: f(G2) > f(G).
• At some point during the search, some node
n on the optimal path to G is not expanded.
We know:
f(n) f(G)
G G2
41
n
root (start state)
42
Proof (cont.)
• We also know node n is not
abbreviated before G2, so:
f(G2) f(n)
• Combining these we know:
f(G2) f(G)
• This is a combination of statements !
(G2 can’t be suboptimal).
43
Another view of A* Optimality
(with admissible heuristic)
• Call the optimum length path C*
• A* will:
– expanding all search nodes n such that f(n) <
C*
– Expanding some nodes n such that f(n) = C*
– expanding no nodes n such that f(n) > C*
A* Example
Towers of Hanoi
small Disk Peg 1
Peg 2
44
Peg 3
Big Disk

Más contenido relacionado

La actualidad más candente

Problem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptxProblem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptx
kitsenthilkumarcse
 
Solving problems by searching
Solving problems by searchingSolving problems by searching
Solving problems by searching
Luigi Ceccaroni
 

La actualidad más candente (20)

Heuristc Search Techniques
Heuristc Search TechniquesHeuristc Search Techniques
Heuristc Search Techniques
 
Problem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptxProblem solving in Artificial Intelligence.pptx
Problem solving in Artificial Intelligence.pptx
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 
Production systems
Production systemsProduction systems
Production systems
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
Artificial Intelligence -- Search Algorithms
Artificial Intelligence-- Search Algorithms Artificial Intelligence-- Search Algorithms
Artificial Intelligence -- Search Algorithms
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
 
search strategies in artificial intelligence
search strategies in artificial intelligencesearch strategies in artificial intelligence
search strategies in artificial intelligence
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Uninformed search /Blind search in AI
Uninformed search /Blind search in AIUninformed search /Blind search in AI
Uninformed search /Blind search in AI
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)
 
State Space Search in ai
State Space Search in aiState Space Search in ai
State Space Search in ai
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Informed search
Informed searchInformed search
Informed search
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptx
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Solving problems by searching
Solving problems by searchingSolving problems by searching
Solving problems by searching
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
 

Similar a Heuristic search

Artificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptxArtificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
CCBProduction
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
Swagat Praharaj
 

Similar a Heuristic search (20)

Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Heuristic or informed search
Heuristic or informed searchHeuristic or informed search
Heuristic or informed search
 
Informed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptxInformed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptx
 
AI_Session 9 Hill climbing algorithm.pptx
AI_Session 9 Hill climbing algorithm.pptxAI_Session 9 Hill climbing algorithm.pptx
AI_Session 9 Hill climbing algorithm.pptx
 
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptxArtificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
 
hill climbing algorithm.pptx
hill climbing algorithm.pptxhill climbing algorithm.pptx
hill climbing algorithm.pptx
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
Artificial Intelligence - Hill climbing.
Artificial Intelligence - Hill climbing.Artificial Intelligence - Hill climbing.
Artificial Intelligence - Hill climbing.
 
AI3391 Session 11 Hill climbing algorithm.pptx
AI3391 Session 11 Hill climbing algorithm.pptxAI3391 Session 11 Hill climbing algorithm.pptx
AI3391 Session 11 Hill climbing algorithm.pptx
 
lecture 6 AI - A star.pdf
lecture 6 AI - A star.pdflecture 6 AI - A star.pdf
lecture 6 AI - A star.pdf
 
Heuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptxHeuristic Searching Algorithms Artificial Intelligence.pptx
Heuristic Searching Algorithms Artificial Intelligence.pptx
 
2-Heuristic Search.ppt
2-Heuristic Search.ppt2-Heuristic Search.ppt
2-Heuristic Search.ppt
 
Search-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdfSearch-Beyond-Classical-no-exercise-answers.pdf
Search-Beyond-Classical-no-exercise-answers.pdf
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
Lecture 3 Problem Solving.pptx
Lecture 3 Problem Solving.pptxLecture 3 Problem Solving.pptx
Lecture 3 Problem Solving.pptx
 
Reinforcement learning, Q-Learning
Reinforcement learning, Q-LearningReinforcement learning, Q-Learning
Reinforcement learning, Q-Learning
 
Lecture 11 Informed Search
Lecture 11 Informed SearchLecture 11 Informed Search
Lecture 11 Informed Search
 
CH2_AI_Lecture1.ppt
CH2_AI_Lecture1.pptCH2_AI_Lecture1.ppt
CH2_AI_Lecture1.ppt
 
Lecture 3 problem solving
Lecture 3   problem solvingLecture 3   problem solving
Lecture 3 problem solving
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
 

Último

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Último (20)

Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Heuristic search

  • 1. ARTIFICIAL INTELLIGENCE Name : R.Gomathi Jayam Class : I Msc CS Semester : II Topic : Heuristic search
  • 2. Heuristic Search Techniques 2 • Direct techniques are not always feasible (they require too much time or space). • Weak techniques can be effective if applied correctly on the right kinds of mission. – generally require domain specific information.
  • 3. Example: 8 Puzzle 6 1 2 3 7 8 4 5 1 2 3 8 4 3 7 6 5
  • 4. 1 2 3 7 8 4 6 5 Which move is perfect? right 1 2 3 7 8 4 6 5 1 2 3 7 4 6 8 5 1 2 3 7 8 4 6 5 1 2 3 8 4 7 6 5 GOAL 4
  • 5. 5 8 Puzzle Heuristics • Blind search techniques used an random ordering (priority) of operations. • Heuristic search techniques make use of province specific information - a heuristic. • What heurisitic(s) can we use to decide which 8-puzzle move is “perfect”.
  • 6. 6 8 Puzzle Heuristics • For now - we just want to build some ordering to the feasible moves (the values of our heuristic does not matter as long as it ranks the moves). • Later - we will worry about the actual values return by the heuristic function.
  • 7. 7 A Simple 8-puzzle heuristic • Number of tiles in the correct position. – The highest number is the better. – Easy to compute. – Probably the simplest feasible heuristic.
  • 8. 8 Another approach • Number of tiles in the not exact position. – This is also be considered a lower leap on the number of moves from a solution! – The “best” move is the one with the lowest number returned by the heuristic. – Is this heuristic more than a heuristic (is it always correct?). • Given any 2 states, does it always order them accurately with respect to the minimum number of moves away from a required solution?
  • 9. 1 2 3 7 8 4 6 5 right 1 2 3 7 8 4 6 5 1 2 3 7 4 6 8 5 1 2 3 7 8 4 6 5 1 2 3 8 4 7 6 5 GOAL h=2 9 h=4 h=3
  • 10. 10 Another 8-puzzle heuristic • Count how far away, each tile is from it’s correct position. • Sum up this count over all the tiles. • This is another evaluate on the number of moves away from a solution.
  • 11. 1 2 3 7 8 4 6 5 right 1 2 3 7 8 4 6 5 1 2 3 7 4 6 8 5 1 2 3 7 8 4 6 5 1 2 3 8 4 7 6 5 GOAL h=2 11 h=4 h=4
  • 12. 12 Techniques • There are a variation of search techniques that rely on the estimate providing by a heuristic function. • In all cases - the quality (precise) of the heuristic is important in real-life application of the technique!
  • 13. 13 Generate-and-test • Very simple strategy - just keep guessing. do while goal not ingenious generate a feasible solution test solution to see if it is a goal • Heuristics may be used to determine the specific protocol for solution generation.
  • 14. 14 Example - Traveling Salesman Problem (TSP) • Traveler needs to visit n cities. • Know the far between each pair of cities. • Want to know the shortest route that aspects all the cities once. • n=80 will take millions of years to solve completely!
  • 15. TSP Example A B CD 4 6 35 15 1 2
  • 16. • TSP - generation of feasible solutions is done in lexicographical sequence of cities: 1. A - B - C - D 2. A - B - D - C 3. A - C - B - D 4. A - C - D - B ... Generate-and-test Example A B C D B C D C D B D C B D C D B B C 16
  • 17. 17 Hill Climbing • Variation on generate-and-test: – generation of next state based on feedback from the test procedure. – Test now includes a heuristic function that provides a guess as to how good each feasible state is. • There are a number of method to use the information returned by the test procedure.
  • 18. 18 Simple Hill Climbing • Use heuristic search to move only to states that are better than the current state. • Always move to better state when feasible. • The process ends when all operators have been applying and none of the resulting states are better than the current state.
  • 19. 19 Simple Hill Climbing Function intensification y = f(x) x y
  • 20. 20 Potential Problems with Simple Hill Climbing • Will achieve when at local optimal. • The order of application of operators can make a huge difference. • Can’t see past a single move in the state spaces.
  • 21. 21 Simple Hill Climbing Example • TSP - define state space as the set of all feasible tours. • Operators exchange the position of adjacent cities within the present tour. • Heuristic function is the length of a tour.
  • 22. TSP Hill Climb State Space CABD ABCD ACDB DCBA Initial State Swap 1,2 Swap 2,3 Swap 3,4 Swap 4,1 Swap 1,2 Swap 3,4 Swap 2,3 Swap 4,1 ABCD BACD ACBD ABDC DBCA 22
  • 23. 23 Steepest-Ascent Hill Climbing • A variation on simple hill climbing. • Instead of moving to the first state that is better, move to the best feasible state that is one move away. • The sequence of operators does not matter. • Not just climbing to a better state, climbing up the elevated slope.
  • 24. 24 Hill Climbing Termination • Local Optimum: all nearing states are worse or the same. • Plateau - all nearing states are the same as the current state. • Ridge - local optimal that is caused by inability to apply 2 operators at once.
  • 25. 25 Heuristic Dependence • Hill climbing is depends on the value assigned to states by the heuristic function. • The heuristic used by a hill climbing algorithm does not need to be a fixed function of a single state. • The heuristic can look ahead many states, or can use other means to enter at a value for a state.
  • 26. 26 Best-First Search • Combines the benefits of Breadth-First and Depth-First searchs. – DFS: follows a single path, don’t need to control all controlling paths. – BFS: doesn’t get in loops or dead-end- paths. • Best First Search: analysing the most assuring path.
  • 27. 27 Best-First Search (cont.) While goal not reached: 1.Generate all potential beneficiary states and add to a list of states. 2.choose the best state in the list and go to it. • Similar to steepest-ascent, but don’t throw away states that are not picked.
  • 28. 28 Simulated Annealing • Based on physical process of thicken a metal to get the best (minimal energy) state. • Hill climbing with a twist: – allow some moves downhill – start out allowing large downhill moves and gradually allow only small downhill moves.
  • 29. 29 Simulated Annealing (cont.) • The search initially bounce around a lot, exploring many regions of the state space. • The bouncing is gradually decreased and the search becomes a simple hill climb (search for local optimum).
  • 31. 31 A* Algorithm (a sure test topic) • The A* algorithm uses a modified estimation function and a Best-First search. • A* minimizes the total path costs. • Under the right conditions A* provides the cheapest costs solution in the optimal time!
  • 32. 32 A* evaluation function • The evaluation function f is an evaluate of the value of a node x given by: f(x) = g(x) + h’(x) • g(x) is the effective costs to get from the start state to state x. • h’(x) is the evaluate the effective cost to get from state x to the goal state.
  • 33. 33 Modified State Evaluation • Value of each state is a integration of: – the cost of the path to the state – evaluated cost of reaching a goal from the state. • This idea is to use the path to a state to determine the rank of the state when compared to other states. • This doesn’t make senses for DFS or BFS, but is useful for BFS.
  • 34. 34 Why we need modified evaluation • Considering a BFS that generates the same state more times. • Which of the paths leads to the state is the perfect? • Recall that often the path to a goal is the solution
  • 35. 35 A* Algorithm • The general idea is: – Best First Search with the modified estimation function. – h’(x) is an evaluate of the number of steps from state x to a goal state. – loops are avoided - we don’t abbreviate the same state twice – Information about the path to the goal state employed.
  • 38. 38 A* Optimality and Completeness • If the heuristic function h’ is allowable the algorithm will find the optimal to the solution in the minimum number of steps feasible. • An admissible heuristic is one that never overevaluate the cost of getting from a state to the goal state.
  • 39. 39 Admissible Heuristics • Given an admissible heuristic h’, path length to given each state given by g, and the actual path length from any state to the goal given by a function h. • We can proved that the solution found by A* is the optimal solution.
  • 40. 40 A* Optimality Proof • Assume A* finds the (suboptimal) goal G2 and the optimal goal is G. • Since h’ is admissible: h’(G2)=h’(G)=0 • Since G2 is not optimal: f(G2) > f(G). • At some point during the search, some node n on the optimal path to G is not expanded. We know: f(n) f(G)
  • 42. 42 Proof (cont.) • We also know node n is not abbreviated before G2, so: f(G2) f(n) • Combining these we know: f(G2) f(G) • This is a combination of statements ! (G2 can’t be suboptimal).
  • 43. 43 Another view of A* Optimality (with admissible heuristic) • Call the optimum length path C* • A* will: – expanding all search nodes n such that f(n) < C* – Expanding some nodes n such that f(n) = C* – expanding no nodes n such that f(n) > C*
  • 44. A* Example Towers of Hanoi small Disk Peg 1 Peg 2 44 Peg 3 Big Disk