Skip to content
TradingTune

Simulated Annealing

A probabilistic walk that escapes local optima as it cools.

Quality
Medium to High
Speed
Moderate
Budget
O(N)

How it works

Simulated Annealing borrows an idea from metalworking: heat lets a material explore many shapes, and slow cooling locks in a good one.

It starts from a random parameter set and proposes a small change each cycle. A better result is always kept. A worse result is sometimes kept too, with a probability that shrinks over time. That willingness to occasionally go downhill early is what lets it climb back out of a shallow dip toward a higher peak.

As the run cools, those uphill-only late cycles converge on the best region the early wandering uncovered.

Under the hood

The temperature follows a linear schedule, T = 1 minus i / N across the run. For numeric parameters the neighbourhood size scales with T, so proposals are large early and fine near the end, always clamped to your range and snapped to the step grid.

Booleans flip with a fixed 30% probability rather than a temperature-scaled one, since a bit has no continuous neighbourhood. There is no separate restart logic: the single cooling pass is the whole algorithm.

It is a strong middle ground. With four to ten parameters on a bumpy surface it beats coordinate descent and random, while staying cheaper to reason about than a full Bayesian model.

Temperature
Linear
T = 1 - i / N
Numeric step
Scales with T
Boolean flip
30% per cycle

When to use it

Reach for it when

  • Three to ten parameters with a bumpy metric landscape
  • When a plain hill-climb keeps getting stuck in local optima
  • As a middle ground between Random and Bayesian search

Reach for something else when

  • Very large spaces where TPE is more sample-efficient
  • When you need a deterministic, repeatable plan

Auto-selected: Auto-selected when 4 to 10 parameters are enabled.

Want to see optimization in action? Browse our real strategy backtests vs buy and hold on NVDA, TSLA, and AAPL.

New to this? Read how to run your first optimization or learn how to choose the right optimization method for your strategy.