Skip to content

Parallel Tempering

Introduction

Parallel Tempering initializes multiple simulated annealing searches with different temperatures and chooses to swap those temperatures with a probability based on its temperature and difference of current scores.

Example

from gradient_free_optimizers import ParallelTemperingOptimizer

...

opt = ParallelTemperingOptimizer(search_space, population=20)
opt.search(objective_function, n_iter=100)

About the implementation

The population of the parallel tempering optimizer consists of multiple initializations of the simulated annealing optimizer class. Each of those receives a random starting temperature. The algorithm calculates the probability of swapping temperatures for every combination of annealer instances.

\[ p = \min \left( 1, exp^{(\text{score}_i-\text{score}_j)(\frac{1}{T_i} - \frac{1}{T_j})} \right) \]

The indices \(i\) and \(j\) correspond to the two simulated annealing optimizers.

Parameters

population

Size of the population for population-based optimization algorithms. A member of the population is called single optimizer, individual or particle depending on the type of algorithm. Each member of the population is a separate optimizer class with information about the positions and scores of the optimizer and all methods to perform the iteration and evaluation steps.

All population based optimizers in this package calculate the new positions one member at a time. So if the optimizer performs 10 iterations and has a population size of 10, then each member of the population would move once to a new position.

  • type: int
  • default: 10
  • typical range: 4 ... 25

n_iter_swap

The number of iterations the algorithm performs before switching temperatures of the individual optimizers in the population.

  • type: int
  • default: 10
  • typical range: 5 ... 50

rand_rest_p

Probability for the optimization algorithm to jump to a random position in an iteration step. It is set to 0 per default. The idea of this parameter is to give the possibility to inject randomness into algorithms that don't normally support it.

  • type: float
  • default: 0
  • typical range: 0.01 ... 0.1