Simulated Annealing (SA) is a probabilistic technique for approximating the global optimum of a given function, particularly for large-scale NP-hard problems like the Traveling Salesman Problem (TSP) or Vehicle Routing Problem (VRP). The algorithm is a form of local search that, by occasionally accepting worse solutions based on a temperature parameter, can escape local optima and explore a broader solution space, mimicking the physical process of annealing where a material is heated and slowly cooled to reduce defects.
Glossary
Simulated Annealing

What is Simulated Annealing?
Simulated Annealing is a probabilistic metaheuristic optimization algorithm inspired by the annealing process in metallurgy, which allows occasional moves to worse solutions to escape local optima, gradually 'cooling' the acceptance probability to converge on a good solution.
The algorithm's key mechanism is a temperature schedule that controls the probability of accepting inferior moves, defined by the Metropolis criterion. As the virtual temperature decreases according to a cooling schedule, the search becomes more greedy, stabilizing near a high-quality solution. This makes SA highly effective for complex spatial-temporal scheduling tasks where finding a provably optimal solution is computationally intractable, but a robust, near-optimal schedule is required.
Key Features of Simulated Annealing
Simulated Annealing is a probabilistic metaheuristic for global optimization, inspired by the physical annealing process in metallurgy. Its core features enable it to escape local optima and find high-quality solutions for complex, NP-hard scheduling and routing problems.
Probabilistic Acceptance of Worse Moves
The defining mechanism of Simulated Annealing is its ability to accept worse solutions with a certain probability. This probability is governed by the Metropolis criterion: P(accept) = exp(-ΔE / T), where ΔE is the change in the objective function (e.g., increased makespan or route distance) and T is the current temperature. This stochastic acceptance allows the algorithm to escape local minima by 'jumping' over energy barriers, a critical capability for exploring complex solution landscapes in problems like the Vehicle Routing Problem (VRP) or Job Shop Scheduling.
Temperature Schedule (Annealing Schedule)
The algorithm's behavior is controlled by a temperature schedule that systematically reduces the temperature T from a high initial value to near zero. Key components:
- Initial Temperature: Set high enough so that most moves, including bad ones, are accepted, enabling broad exploration.
- Cooling Rate: The rate at which
Tdecreases (e.g.,T_new = α * T_old, whereα = 0.95). A slower cooling rate allows for more thorough exploration but increases computation time. - Equilibrium Condition: The number of iterations or accepted moves at each temperature before cooling.
- Stopping Criterion: Typically when
Treaches a minimum value or the solution ceases to improve. This gradual 'cooling' mimics physical annealing, transitioning the search from exploration to exploitation.
Solution Neighborhood Structure
Simulated Annealing operates by iteratively moving from the current solution to a neighboring solution. The definition of this neighborhood is problem-specific and crucial for performance. Common moves for scheduling and routing include:
- Swap: Exchange the positions of two tasks or cities in a sequence.
- Insertion: Remove a task and insert it at a different position.
- 2-opt (for TSP/VRP): Reverse a segment of a route.
- Resource Reassignment: Reassign a job to a different machine or vehicle. The neighborhood operator generates the candidate solutions that are evaluated and potentially accepted, driving the local search component of the algorithm.
Asymptotic Convergence to Global Optimum
Under a sufficiently slow cooling schedule, Simulated Annealing can be proven to converge asymptotically to the global optimum. This theoretical guarantee, based on the theory of non-homogeneous Markov chains, distinguishes it from simple Local Search heuristics that get trapped in local optima. In practice, the infinite-time requirement is relaxed, but the principle guides parameter tuning: slower cooling increases the probability of finding a near-optimal solution for NP-hard problems like Mixed-Integer Programming (MIP) formulations of scheduling.
Memoryless Search & Minimal State
Simulated Annealing is a memoryless algorithm. It only retains the current solution and the best solution encountered so far. It does not maintain a population (like Genetic Algorithms) or a tabu list. This makes its state management simple and its memory footprint very low. The entire search history is encapsulated in the current temperature and solution state, simplifying implementation and reducing overhead, which is beneficial for large-scale spatial-temporal scheduling problems where evaluating the objective function (e.g., total tardiness) is computationally expensive.
Application to Spatial-Temporal Scheduling
In Heterogeneous Fleet Orchestration, Simulated Annealing optimizes complex objectives under multiple constraints:
- Objective Functions: Minimize makespan, total travel distance, weighted tardiness, or energy consumption.
- Handling Constraints: It navigates precedence constraints, capacity constraints, and time windows by penalizing infeasible solutions in the objective function or using repair operators.
- Dynamic Replanning: Can be used within a Model Predictive Control (MPC) loop for real-time replanning, where the initial solution is the incumbent schedule and the algorithm searches for improvements after a disruption.
- Hybridization: Often combined with other metaheuristics (like Genetic Algorithms for initialization) or Constraint Programming for feasibility checks, creating powerful hybrid solvers for dynamic task allocation and multi-agent path planning.
Simulated Annealing vs. Other Metaheuristics
A feature comparison of Simulated Annealing against other prominent metaheuristic algorithms used for solving complex spatial-temporal scheduling and combinatorial optimization problems, such as the Vehicle Routing Problem (VRP) and Job Shop Scheduling.
| Feature / Mechanism | Simulated Annealing (SA) | Genetic Algorithm (GA) | Tabu Search (TS) | Greedy Algorithm / Local Search |
|---|---|---|---|---|
Core Inspiration | Thermodynamic annealing process in metallurgy | Biological evolution (natural selection) | Human memory and search avoidance | Immediate local improvement |
Solution Representation | Single candidate solution (point in search space) | Population of candidate solutions (chromosomes) | Single candidate solution with memory | Single candidate solution |
Primary Search Mechanism | Probabilistic hill-climbing with controlled 'bad' moves | Crossover (recombination) and mutation on a population | Deterministic local search guided by a tabu list | Deterministic selection of the best immediate neighbor |
Escapes Local Optima? | ||||
Memory of Past Search | Implicit via population gene pool | Via current solution only | ||
Key Control Parameter(s) | Temperature schedule (cooling rate) | Population size, crossover & mutation rates | Tabu list size, aspiration criteria | Neighborhood definition |
Typical Convergence Behavior | Gradual convergence as temperature cools | Generational improvement, can plateau | Intensive local search with strategic diversifications | Converges to the first local optimum encountered |
Handles Constraints | Via penalty functions or modified move operators | Via specialized encoding/repair or penalty functions | Via move operators that preserve feasibility | Often requires feasibility-preserving moves |
Best Suited For | Problems with rugged landscapes, moderate dimensionality | Problems with decomposable structure, parameter tuning | Intensive local search around good solutions | Fast baseline, convex or simple landscapes |
Computational Overhead per Iteration | Low to moderate | High (evaluates entire population) | Moderate (maintains and checks tabu list) | Very low |
Frequently Asked Questions
Common questions about Simulated Annealing, a probabilistic metaheuristic used to solve complex optimization problems in logistics, scheduling, and fleet orchestration.
Simulated Annealing (SA) is a probabilistic metaheuristic optimization algorithm inspired by the physical annealing process in metallurgy, where a material is heated and slowly cooled to reduce defects and minimize its system energy. In optimization, it searches for a near-optimal solution to complex problems (like the Vehicle Routing Problem or Job Shop Scheduling) by iteratively exploring the solution space, occasionally accepting moves to worse solutions to escape local optima, and gradually reducing this acceptance probability as the search progresses.
Its key components are:
- Temperature Parameter (T): Controls the probability of accepting worse moves. High initial temperature allows extensive exploration; it is systematically reduced per a cooling schedule.
- Acceptance Probability: Given by the Metropolis criterion,
P = exp(-ΔE / T), whereΔEis the change in the objective function (e.g., makespan or travel distance). A worse solution (ΔE > 0) is accepted with this probability. - Cooling Schedule: The rule (e.g., geometric:
T_{k+1} = α * T_k) that gradually lowers the temperature, shifting the algorithm's behavior from exploration to exploitation.
SA is particularly valuable for NP-hard combinatorial problems where exact methods like Mixed-Integer Programming (MIP) become intractable at scale, providing a robust framework for finding high-quality solutions in spatial-temporal scheduling and heterogeneous fleet orchestration.
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.
Related Terms
Simulated Annealing is a core metaheuristic within combinatorial optimization. These related concepts define the problem landscape and alternative solution methodologies.
Metaheuristic Algorithm
A metaheuristic is a high-level, general-purpose algorithmic framework designed to guide underlying search heuristics. Unlike problem-specific heuristics, metaheuristics provide abstract strategies for exploring complex solution spaces, often inspired by natural phenomena. Key characteristics include:
- Traversal Strategy: Defines how to move from one candidate solution to another (e.g., local moves, population-based).
- Escaping Local Optima: Incorporates mechanisms (like Simulated Annealing's occasional acceptance of worse solutions) to avoid getting stuck.
- Parameter Tuning: Performance heavily depends on setting control parameters, like the cooling schedule in Simulated Annealing. Examples include Genetic Algorithms, Tabu Search, and Ant Colony Optimization. They are the primary tools for tackling NP-Hard scheduling and routing problems where exact solutions are computationally infeasible.
Local Search
Local Search is a fundamental heuristic optimization technique that forms the core iterative process of Simulated Annealing. It operates by starting with an initial feasible solution and iteratively moving to a 'neighbor' solution—a slightly modified version of the current one. The algorithm evaluates the objective function (e.g., total travel distance, makespan) for each neighbor.
In its basic form, a hill-climbing variant only accepts moves that improve the objective, inevitably converging to a local optimum. Simulated Annealing enhances this by using a probabilistic acceptance criterion, allowing moves to worse solutions with a probability that decreases over time. This 'temperature'-controlled randomness enables the search to escape local optima and explore more of the solution space before settling.
NP-Hard Problem
An NP-Hard problem is a class of computational problems for which no known algorithm can find an exact solution in polynomial time as the problem size grows. Most real-world spatial-temporal scheduling challenges—like the Vehicle Routing Problem (VRP), Traveling Salesman Problem (TSP), and Job Shop Scheduling—are proven to be NP-Hard.
This computational intractability is the primary reason techniques like Simulated Annealing are essential. Since calculating the guaranteed optimal solution for large-scale problems (e.g., routing hundreds of robots) is often impossible within operational timeframes, metaheuristics provide a practical alternative by finding high-quality feasible solutions within reasonable computation time, trading guaranteed optimality for tractability.
Genetic Algorithm (GA)
A Genetic Algorithm (GA) is another population-based metaheuristic inspired by biological evolution, often compared and contrasted with Simulated Annealing. While Simulated Annealing iteratively improves a single solution, a GA maintains a population of candidate solutions.
It uses biologically inspired operators over successive generations:
- Selection: Fitter solutions (based on the objective function) are chosen to 'reproduce'.
- Crossover (Recombination): Pairs of selected solutions combine parts of their structure to create offspring.
- Mutation: Random alterations are introduced to maintain genetic diversity. This approach allows broad exploration of the solution space. The choice between GA and Simulated Annealing often depends on the problem structure; GAs can be more effective for problems where good solutions can be built by combining parts of other solutions.
Objective Function
The Objective Function (or cost function) is the mathematical expression that quantifies the quality of any candidate solution in an optimization problem. In spatial-temporal scheduling, common objectives include:
- Makespan Minimization: Total time to complete all jobs.
- Total Travel Distance/Cost: For routing problems like VRP.
- Total Tardiness: Sum of delays beyond task time windows.
Simulated Annealing's core mechanism revolves around evaluating changes to this function. The algorithm calculates the difference in the objective function value (ΔE) between the current solution and a neighboring solution. The probability of accepting a worse solution is exp(-ΔE / T), where 'T' is the current temperature. This direct link to the objective function drives the search toward high-quality regions of the solution space.
Traveling Salesman Problem (TSP)
The Traveling Salesman Problem (TSP) is a canonical NP-Hard combinatorial optimization problem and a fundamental benchmark for algorithms like Simulated Annealing. The problem asks: 'Given a list of cities and distances between them, what is the shortest possible route that visits each city exactly once and returns to the origin?'
In logistics and heterogeneous fleet orchestration, TSP is the core sub-problem for planning a single agent's tour. Simulated Annealing is exceptionally well-suited for TSP. A common 'neighbor' operation is the 2-opt swap, which reverses a segment of the tour. The algorithm can efficiently explore the vast space of possible permutations, using its cooling schedule to navigate past local minima in the total distance objective function, often finding near-optimal routes for hundreds of 'cities' or task locations.

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