Simulated Annealing is a probabilistic technique for approximating the global optimum of a given function in a large search space. It is particularly effective for combinatorial optimization problems with many local minima, such as the Traveling Salesman Problem (TSP) or Job Shop Scheduling, where deterministic gradient-based methods would get trapped.
Glossary
Simulated Annealing

What is Simulated Annealing?
A metaheuristic optimization algorithm inspired by the metallurgical process of annealing, where a material is heated and then slowly cooled to increase the size of its crystals and reduce defects.
The algorithm works by iteratively proposing random moves from the current solution. A move that improves the objective function is always accepted. Crucially, a worse move may also be accepted with a probability governed by a temperature parameter and the Metropolis criterion, allowing the search to escape local optima early on. As the temperature cools according to a defined cooling schedule, the algorithm becomes greedier, eventually settling into a low-energy, near-optimal state.
Key Characteristics of Simulated Annealing
Simulated annealing is a probabilistic metaheuristic that escapes local optima by accepting worse solutions with a probability that decreases over time, mimicking the metallurgical annealing process.
The Metropolis Acceptance Criterion
The core decision rule that determines whether a new candidate solution is accepted. If the new solution is better, it is always accepted. If it is worse, acceptance probability is calculated as:
P(accept) = exp(-ΔE / T)
- ΔE: The difference in objective function value (new_cost - current_cost)
- T: The current temperature parameter
At high temperatures, the algorithm accepts significantly worse solutions, enabling broad exploration. As T approaches zero, the probability of accepting an uphill move vanishes, and the search becomes a greedy descent.
Cooling Schedule
The cooling schedule dictates how the temperature parameter T is reduced over time and is the most critical hyperparameter for convergence.
Common schedules include:
- Exponential decay: T_k = α * T_{k-1} where α is typically 0.85 to 0.99
- Logarithmic decay: T_k = T_0 / log(1 + k), proven to guarantee convergence to the global optimum given infinite time
- Linear decay: T_k = T_0 - η * k
A schedule that cools too quickly causes premature convergence to a local optimum (quenching). Cooling too slowly wastes computational resources.
Neighborhood Generation Function
The mechanism that generates a new candidate solution by perturbing the current state. The design of this function is problem-specific and must ensure the search space is connected.
For the Traveling Salesman Problem (TSP):
- 2-opt swap: Reverse a subsequence of the tour
- Node swap: Exchange the positions of two cities
- Insertion: Remove a city and reinsert it at a different position
The perturbation magnitude should be calibrated so that the expected change in objective value is comparable to the current temperature, maintaining a reasonable acceptance rate.
Global Convergence Properties
Simulated annealing is theoretically guaranteed to converge to the global optimum under specific conditions, proven via Markov chain analysis.
Required conditions for convergence:
- The neighborhood structure must be strongly connected (any state reachable from any other)
- The cooling schedule must satisfy T_k ≥ T_0 / log(1 + k) for sufficiently large T_0
- An infinite number of iterations at each temperature level
In practice, these conditions are relaxed, and the algorithm provides a high-quality approximate solution in finite time. The Boltzmann distribution governs the probability of occupying each state at thermal equilibrium.
Comparison with Hill Climbing
Simulated annealing fundamentally differs from greedy local search by its ability to escape local optima.
Hill Climbing (Greedy Descent):
- Only accepts moves that improve the objective
- Traps at the first local optimum encountered
- Deterministic given a fixed starting point
Simulated Annealing:
- Accepts worsening moves probabilistically
- Can traverse valleys to reach better peaks
- Stochastic; multiple runs yield different paths
This makes simulated annealing suitable for rugged, non-convex fitness landscapes with many deceptive local optima, such as VLSI circuit placement and protein folding.
Parameter Tuning and Restarts
Effective deployment requires careful tuning of three interdependent parameters.
Key parameters:
- Initial temperature (T_0): Set high enough that approximately 80% of proposed moves are initially accepted. A common heuristic is to run a short pilot phase and set T_0 based on the observed distribution of ΔE values.
- Markov chain length: The number of iterations at each temperature step before cooling. Should be proportional to the neighborhood size.
- Termination criterion: Stop when the system appears frozen—typically when the acceptance ratio drops below a threshold or the objective value has not improved for several temperature steps.
Adaptive schedules dynamically adjust the cooling rate based on acceptance statistics, reducing the need for manual tuning.
Simulated Annealing vs. Other Optimization Methods
A comparative analysis of simulated annealing against alternative prescriptive analytics and combinatorial optimization methods used in autonomous supply chain intelligence.
| Feature | Simulated Annealing | Genetic Algorithm | Mixed-Integer Linear Programming | Gradient-Based Optimization |
|---|---|---|---|---|
Problem Class | Discrete & continuous combinatorial optimization | Discrete & continuous combinatorial optimization | Linear problems with integer constraints | Continuous, differentiable functions |
Global Optimum Guarantee | ||||
Handles Non-Differentiable Objectives | ||||
Escapes Local Minima | ||||
Solution Time for Large Search Spaces | Minutes to hours | Minutes to hours | Hours to days (NP-Hard) | Seconds to minutes |
Requires Derivative Information | ||||
Stochastic Search Process | ||||
Typical Supply Chain Application | Vehicle routing, facility location | Multi-echelon inventory, scheduling | Network flow, production planning | Demand forecasting parameter tuning |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the simulated annealing optimization algorithm, its mechanisms, and its practical application in solving complex combinatorial problems.
Simulated annealing is a probabilistic metaheuristic optimization algorithm that locates an approximate global optimum in a large, discrete search space by mimicking the thermodynamic process of heating and controlled cooling of a material. The algorithm works by iteratively proposing random moves from a current solution. A move that improves the objective function is always accepted. Crucially, a move that degrades the solution is accepted with a probability defined by the Metropolis criterion: P = exp(-ΔE / T), where ΔE is the increase in cost and T is the current temperature parameter. The temperature starts high, allowing the algorithm to freely explore the solution landscape and escape local minima. As the temperature gradually decreases according to a cooling schedule, the algorithm becomes increasingly greedy, settling into a low-energy (optimal) state. This controlled acceptance of uphill moves is the core mechanism that prevents premature convergence on a suboptimal local minimum.
Related Terms
Simulated annealing belongs to a family of metaheuristic and exact optimization techniques. Understanding its neighbors clarifies when to use this probabilistic method versus deterministic or evolutionary alternatives.
Genetic Algorithm
A population-based metaheuristic inspired by natural selection. Unlike simulated annealing's single-solution trajectory, genetic algorithms maintain a population of candidate solutions, applying crossover (recombination) and mutation operators to evolve toward optima.
- Key Difference: Explores multiple regions of the search space simultaneously via parallel populations
- Strength: Naturally handles multi-objective optimization and discrete/continuous hybrid spaces
- Weakness: Requires careful tuning of selection pressure, crossover rate, and population size
- Example: Evolving optimal warehouse layouts where the fitness function evaluates throughput and storage density
Stochastic Optimization
The broader class to which simulated annealing belongs. Stochastic optimization methods deliberately inject randomness into the search process to escape local optima or handle objective functions corrupted by statistical noise.
- Random Restarts: Periodically resetting the search from new random starting points
- Stochastic Gradient Descent (SGD): Uses noisy gradient estimates from data batches
- Simulated Annealing: Uses thermal noise controlled by a cooling schedule
- Application: Optimizing supply chain parameters when demand forecasts have quantified uncertainty distributions
Branch and Bound
An exact algorithm for discrete and combinatorial optimization that systematically partitions the search space and computes upper and lower bounds on the objective. Unlike simulated annealing, it guarantees global optimality but may require exponential time.
- Bounding: Prunes entire subregions whose lower bound exceeds the current best-known solution
- Branching: Recursively divides the feasible region into smaller subproblems
- Contrast with SA: Exact but intractable for large instances; SA is approximate but scalable
- Example: Solving small to medium Vehicle Routing Problems to proven optimality for benchmarking heuristic methods
Bayesian Optimization
A sequential model-based approach for optimizing expensive black-box functions. It builds a probabilistic surrogate model (typically a Gaussian Process) of the objective and uses an acquisition function to decide where to sample next, balancing exploration and exploitation.
- Surrogate Model: Approximates the true objective and quantifies prediction uncertainty
- Acquisition Functions: Expected Improvement (EI), Upper Confidence Bound (UCB), Probability of Improvement (PI)
- Contrast with SA: Sample-efficient for costly evaluations; SA requires many cheap evaluations
- Application: Tuning hyperparameters of a deep demand forecasting model where each training run costs hours of GPU time
Gradient-Based Optimization
Algorithms that require first-order derivative information (gradients) of the objective function to iteratively move toward a local minimum. Includes Gradient Descent, Adam, and L-BFGS. Simulated annealing is derivative-free, making it applicable when gradients are unavailable, unreliable, or non-existent.
- Requirement: Objective must be differentiable and gradients computable
- Convergence: Fast local convergence to the nearest stationary point
- Limitation: Trapped by local minima in non-convex landscapes
- Hybrid Approach: Use gradient methods for fine-tuning after SA identifies a promising basin of attraction
Constraint Programming
A declarative paradigm where relations between variables are expressed as constraints, and a solver finds feasible solutions using propagation and search. Unlike simulated annealing's numerical objective landscape, CP excels at highly constrained combinatorial problems with logical relationships.
- Constraint Propagation: Deduces variable domain reductions from partial assignments
- Global Constraints: Specialized algorithms for common patterns like
all_differentorcumulative - Complementary Use: CP finds feasible schedules; SA optimizes an objective over those schedules
- Example: Assigning delivery time windows while respecting driver hours-of-service regulations, then using SA to minimize total mileage

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us