SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Simulated Annealing
Classical Search 
• Observable 
• Deterministic 
• Known Environment 
• Solution of sequence of actions
Local Search 
• All that matters is the solution state 
• Don't care about solution path
Advantages of Local Search 
• Very little memory — usually constant amount 
• Can often find reasonable solutions in infinite (continuous) 
state spaces
Steepest Ascent Hill 
Climbing 
(a.k.a. greedy local search)
Hill Climbing 
1. Pick a random point. 
2. Look at your neighbors. 
3. Keep going up until you find the 
local maximum.
Hill Climbing & 8-Queens 
• Gets stuck 86% of the time 
• avg 3 steps when it gets stuck 
• avg 4 steps to solve optimally
Hill Climbing with Sidesteps 
• Gets stuck only 6% of the time on 8-queens 
• avg 64 steps when it gets stuck 
• avg 21 steps to solve optimally
Random-restart hill climbing 
• expected restarts = 1/p, p is the probability of success 
• expected steps = 1 successful iteration + cost of (1-p)/p cost 
of failure, roughly 22 steps 
• even for 3 Million-Queens finds a solution in under 1 minute
Simulated Annealing
Metallurgy 
Annealing is the process used to temper or harden metals 
and glass by heating them to a high temperature and then 
gradually cooling them, thus allowing the material to reach a 
low-energy crystalline state.
Simulated Annealing 
1. Choose a random initial state, high initial temperature, and 
cooling rate 
2. Choose random neighbor of current state 
3. If it's better than the current state, pick it 
4. If not, randomly decide to take it anyway based on 
temperature 
5. Reduce temperature 
6. Repeat steps 2-5 until cooled
// Loop until system has cooled 
while (temp > 1) { 
Tour newSolution = randomNeighbor(currentSolution); 
// Get energy of solutions 
int currentEnergy = currentSolution.getDistance(); 
int neighbourEnergy = newSolution.getDistance(); 
// Decide if we should accept the neighbour 
if (acceptanceProbability(currentEnergy, neighbourEnergy, temp) > Math.random()) { 
currentSolution = new Tour(newSolution.getTour()); 
} 
// Keep track of the best solution found 
if (currentSolution.getDistance() < best.getDistance()) { 
best = new Tour(currentSolution.getTour()); 
} 
// Cool system 
temp *= 1-coolingRate; 
}
Choosing Cooling Rate 
• No silver bullet. 
• Picking a high temperature and low cooling rate is generally 
best.
Advantages of Simulated 
Annealing 
• can deal with arbitrary systems and cost functions 
• is relatively easy to code, even for complex problems 
• generally gives a "good" solution
Complete? 
NO
Optimal? 
With loose enough 
cooling schedule
Time Complexity 
O(1)
Space Complexity 
O(1)

Contenu connexe

Tendances

Simulated annealing-global optimization algorithm
Simulated annealing-global optimization algorithmSimulated annealing-global optimization algorithm
Simulated annealing-global optimization algorithm
Akhil Prabhakar
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
Nilu Desai
 

Tendances (20)

Simulated annealing
Simulated annealingSimulated annealing
Simulated annealing
 
Simulated annealing
Simulated annealingSimulated annealing
Simulated annealing
 
Simulated annealing-global optimization algorithm
Simulated annealing-global optimization algorithmSimulated annealing-global optimization algorithm
Simulated annealing-global optimization algorithm
 
Simulated Annealing
Simulated AnnealingSimulated Annealing
Simulated Annealing
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
 
Lecture 25 hill climbing
Lecture 25 hill climbingLecture 25 hill climbing
Lecture 25 hill climbing
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Tabu search
Tabu searchTabu search
Tabu search
 
Lecture 15 monkey banana problem
Lecture 15 monkey banana problemLecture 15 monkey banana problem
Lecture 15 monkey banana problem
 
Informed search (heuristics)
Informed search (heuristics)Informed search (heuristics)
Informed search (heuristics)
 
TabuSearch FINAL
TabuSearch  FINALTabuSearch  FINAL
TabuSearch FINAL
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 
Hill climbing algorithm
Hill climbing algorithmHill climbing algorithm
Hill climbing algorithm
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
Heuristc Search Techniques
Heuristc Search TechniquesHeuristc Search Techniques
Heuristc Search Techniques
 
Decision trees in Machine Learning
Decision trees in Machine Learning Decision trees in Machine Learning
Decision trees in Machine Learning
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Classical Planning
Classical PlanningClassical Planning
Classical Planning
 
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
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}
 

En vedette

Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
Federico Cerutti
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
Bise Mond
 
Wireless mesh network (2)
Wireless mesh network (2)Wireless mesh network (2)
Wireless mesh network (2)
Jyoti Yadav
 

En vedette (18)

Simulated annealing
Simulated annealing Simulated annealing
Simulated annealing
 
Metaheurística Simulated Annealing
Metaheurística Simulated AnnealingMetaheurística Simulated Annealing
Metaheurística Simulated Annealing
 
Artificial intel
Artificial intelArtificial intel
Artificial intel
 
Stochastic Approximation and Simulated Annealing
Stochastic Approximation and Simulated AnnealingStochastic Approximation and Simulated Annealing
Stochastic Approximation and Simulated Annealing
 
Practical Non-Monotonic Reasoning
Practical Non-Monotonic ReasoningPractical Non-Monotonic Reasoning
Practical Non-Monotonic Reasoning
 
Comparative study of graph partitioning algorithms
Comparative study of graph partitioning algorithmsComparative study of graph partitioning algorithms
Comparative study of graph partitioning algorithms
 
Instrumentation Engineering : Signals & systems, THE GATE ACADEMY
Instrumentation Engineering : Signals & systems, THE GATE ACADEMYInstrumentation Engineering : Signals & systems, THE GATE ACADEMY
Instrumentation Engineering : Signals & systems, THE GATE ACADEMY
 
Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
Cerutti--Introduction to Argumentation (seminar @ University of Aberdeen)
 
Guest lecture Programme in the Methods of Health Economics (Abteilung für Ges...
Guest lecture Programme in the Methods of Health Economics (Abteilung für Ges...Guest lecture Programme in the Methods of Health Economics (Abteilung für Ges...
Guest lecture Programme in the Methods of Health Economics (Abteilung für Ges...
 
Lecture 27 simulated annealing
Lecture 27 simulated annealingLecture 27 simulated annealing
Lecture 27 simulated annealing
 
spsann - optimization of sample patterns using spatial simulated annealing
spsann - optimization of sample patterns using  spatial simulated annealingspsann - optimization of sample patterns using  spatial simulated annealing
spsann - optimization of sample patterns using spatial simulated annealing
 
L1 theory behind research methods
L1 theory behind research methodsL1 theory behind research methods
L1 theory behind research methods
 
Artificial intelligence - TSP
Artificial intelligence - TSP Artificial intelligence - TSP
Artificial intelligence - TSP
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Chapter 2 (final)
Chapter 2 (final)Chapter 2 (final)
Chapter 2 (final)
 
Fuzzy Genetic Algorithm
Fuzzy Genetic AlgorithmFuzzy Genetic Algorithm
Fuzzy Genetic Algorithm
 
Wireless mesh network (2)
Wireless mesh network (2)Wireless mesh network (2)
Wireless mesh network (2)
 
Clustering:k-means, expect-maximization and gaussian mixture model
Clustering:k-means, expect-maximization and gaussian mixture modelClustering:k-means, expect-maximization and gaussian mixture model
Clustering:k-means, expect-maximization and gaussian mixture model
 

Similaire à Simulated Annealing (11)

Simulated_Annealing.pptx
Simulated_Annealing.pptxSimulated_Annealing.pptx
Simulated_Annealing.pptx
 
BeyondClassicalSearch.ppt
BeyondClassicalSearch.pptBeyondClassicalSearch.ppt
BeyondClassicalSearch.ppt
 
BeyondClassicalSearch.ppt
BeyondClassicalSearch.pptBeyondClassicalSearch.ppt
BeyondClassicalSearch.ppt
 
Chap 4 local_search
Chap 4 local_search Chap 4 local_search
Chap 4 local_search
 
cs-171-05-LocalSearch.pptx
cs-171-05-LocalSearch.pptxcs-171-05-LocalSearch.pptx
cs-171-05-LocalSearch.pptx
 
Heuristic approach optimization
Heuristic  approach optimizationHeuristic  approach optimization
Heuristic approach optimization
 
Lec 6 bsc csit
Lec 6 bsc csitLec 6 bsc csit
Lec 6 bsc csit
 
Simulated annealing presentation
Simulated annealing presentation Simulated annealing presentation
Simulated annealing presentation
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
SimulatedAnnealing.ppt
SimulatedAnnealing.pptSimulatedAnnealing.ppt
SimulatedAnnealing.ppt
 
Optimization
OptimizationOptimization
Optimization
 

Plus de Jason Larsen (6)

Unidirectional Data Flow with Reactor
Unidirectional Data Flow with ReactorUnidirectional Data Flow with Reactor
Unidirectional Data Flow with Reactor
 
Unidirectional Data Flow in Swift
Unidirectional Data Flow in SwiftUnidirectional Data Flow in Swift
Unidirectional Data Flow in Swift
 
Protocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in SwiftProtocol Oriented JSON Parsing in Swift
Protocol Oriented JSON Parsing in Swift
 
Data Pipelines in Swift
Data Pipelines in SwiftData Pipelines in Swift
Data Pipelines in Swift
 
7 Habits For a More Functional Swift
7 Habits For a More Functional Swift7 Habits For a More Functional Swift
7 Habits For a More Functional Swift
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great Good
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Simulated Annealing

  • 2. Classical Search • Observable • Deterministic • Known Environment • Solution of sequence of actions
  • 3. Local Search • All that matters is the solution state • Don't care about solution path
  • 4. Advantages of Local Search • Very little memory — usually constant amount • Can often find reasonable solutions in infinite (continuous) state spaces
  • 5. Steepest Ascent Hill Climbing (a.k.a. greedy local search)
  • 6. Hill Climbing 1. Pick a random point. 2. Look at your neighbors. 3. Keep going up until you find the local maximum.
  • 7. Hill Climbing & 8-Queens • Gets stuck 86% of the time • avg 3 steps when it gets stuck • avg 4 steps to solve optimally
  • 8. Hill Climbing with Sidesteps • Gets stuck only 6% of the time on 8-queens • avg 64 steps when it gets stuck • avg 21 steps to solve optimally
  • 9. Random-restart hill climbing • expected restarts = 1/p, p is the probability of success • expected steps = 1 successful iteration + cost of (1-p)/p cost of failure, roughly 22 steps • even for 3 Million-Queens finds a solution in under 1 minute
  • 11. Metallurgy Annealing is the process used to temper or harden metals and glass by heating them to a high temperature and then gradually cooling them, thus allowing the material to reach a low-energy crystalline state.
  • 12. Simulated Annealing 1. Choose a random initial state, high initial temperature, and cooling rate 2. Choose random neighbor of current state 3. If it's better than the current state, pick it 4. If not, randomly decide to take it anyway based on temperature 5. Reduce temperature 6. Repeat steps 2-5 until cooled
  • 13.
  • 14. // Loop until system has cooled while (temp > 1) { Tour newSolution = randomNeighbor(currentSolution); // Get energy of solutions int currentEnergy = currentSolution.getDistance(); int neighbourEnergy = newSolution.getDistance(); // Decide if we should accept the neighbour if (acceptanceProbability(currentEnergy, neighbourEnergy, temp) > Math.random()) { currentSolution = new Tour(newSolution.getTour()); } // Keep track of the best solution found if (currentSolution.getDistance() < best.getDistance()) { best = new Tour(currentSolution.getTour()); } // Cool system temp *= 1-coolingRate; }
  • 15. Choosing Cooling Rate • No silver bullet. • Picking a high temperature and low cooling rate is generally best.
  • 16. Advantages of Simulated Annealing • can deal with arbitrary systems and cost functions • is relatively easy to code, even for complex problems • generally gives a "good" solution
  • 18. Optimal? With loose enough cooling schedule