Skip to content

Random Annealing

Introduction

The random annealing algorithm is based on hill climbing and derived on the regular simulated annealing algorithm. It takes the idea of a temperatur and annealing to change the step-size over time.

Example

from hyperactive import Hyperactive
from hyperactive.optimizers import RandomAnnealingOptimizer

...

optimizer = RandomAnnealingOptimizer(epsilon=0.2)

hyper = Hyperactive()
hyper.add_search(model, search_space, n_iter=50, optimizer=optimizer)
hyper.run()

About the implementation

It also has a start_temp and an annealing_rate but uses them differently. The start_temp gets changed by the annealing_rate similarly to simulated annealing.

\[ \text{start_temp} \leftarrow \text{start_temp} * \text{annealing_rate} \]

In the random annealing algorithm the start_temp acts as a factor that gets multiplied with epsilon to change the step-size of this algorithm over time.

\[ \epsilon' = \epsilon * \text{start_temp} \]

The idea is, that you want the algorithm to explore the search-space in the beginning of the optimization run and concentrate more on fine tuning the best results locally towards the end.

Parameters

epsilon

The step-size of the hill climbing algorithm. Increasing epsilon also increases the average step-size, because its proportional to the standard-deviation of the distribution of the hill-climbing-based algorithm. If epsilon is too large the newly selected positions will be at the edge of the search space. If its value is very low it might not find new positions.

  • type: float
  • default: 0.03
  • typical range: 0.01 ... 0.3

distribution

The mathematical distribution the algorithm draws samples from. All available distributions are taken from the numpy-package.

  • type: string
  • default: "normal"
  • possible values: "normal", "laplace", "logistic", gumbel"

n_neighbours

The number of positions the algorithm explores from its current postion before setting its current position to the best of those neighbour positions. If the value of n_neighbours is large the hill-climbing-based algorithm will take a lot of time to choose the next position to move to, but the choice will probably be a good one. It might be a prudent approach to increase n_neighbours of the search-space has a lot of dimensions, because there are more possible directions to move to.

  • type: int
  • default: 3
  • typical range: 1 ... 10

start_temp

The start temperatur is set to the given value at the start of the optimization run and gets changed by the annealing_rate over time. This start_temp is multiplied with epsilon to change the step-size of this hill-climbing-based algorithm over time.

  • type: float
  • default: 10
  • typical range: 0.5 ... 1.5

annealing_rate

Rate at which the temperatur-value of the algorithm decreases. An annealing rate above 1 increases the temperature over time.

  • type: float
  • default: 0.97
  • typical range: 0.9 ... 0.99