Skip to content

Simulated Annealing

Simulated Annealing

Simulated Annealing is a probabilistic technique for approximating the global optimum of a given function. It performs well on problems where approximate global optima are more desirable than exact local optima.

Compatible Backends

Backend Default
DWave

Initialization

Python
from luna_quantum.solve.parameters.algorithms.simulated_annealing.simulated_annealing import SimulatedAnnealing

algorithm = SimulatedAnnealing(
    backend=None,
    num_reads=None,
    num_sweeps=1000,
    beta_range=None,
    beta_schedule_type='geometric',
    initial_states_generator='random',
    num_sweeps_per_beta=1,
    seed=None,
    beta_schedule=None,
    initial_states=None,
    randomize_order=False,
    proposal_acceptance_criteria='Metropolis'
)

Usage

Python
from luna_quantum.algorithms import SimulatedAnnealing

algorithm = SimulatedAnnealing()
solve_job = algorithm.run(model, name="my-solve-job")

Parallel Tempering

Parallel Tempering uses multiple optimization procedures per temperature. During the cooling process, an exchange of replicas can take place between the parallel procedures, thus enabling higher energy mountains to be overcome.

Compatible Backends

Backend Default
DWave

Initialization

Python
from luna_quantum.solve.parameters.algorithms.simulated_annealing.parallel_tempering import ParallelTempering

algorithm = ParallelTempering(
    backend=None,
    n_replicas=2,
    random_swaps_factor=1,
    max_iter=100,
    max_time=5,
    convergence=3,
    target=None,
    rtol=1e-05,
    atol=1e-08,
    fixed_temp_sampler_num_sweeps=10000,
    fixed_temp_sampler_num_reads=None
)

Usage

Python
from luna_quantum.algorithms import ParallelTempering

algorithm = ParallelTempering()
solve_job = algorithm.run(model, name="my-solve-job")

Population Annealing

Population Annealing uses a sequential Monte Carlo method to minimize the energy of a population. The population consists of walkers that can explore their neighborhood during the cooling process. Afterwards, walkers are removed and duplicated using bias to lower energy. Eventually, a population collapse occurs where all walkers are in the lowest energy state.

Compatible Backends

Backend Default
DWave

Initialization

Python
from luna_quantum.solve.parameters.algorithms.simulated_annealing.population_annealing import PopulationAnnealing

algorithm = PopulationAnnealing(
    backend=None,
    max_iter=20,
    max_time=2,
    fixed_temp_sampler_num_sweeps=10000,
    fixed_temp_sampler_num_reads=None
)

Usage

Python
from luna_quantum.algorithms import PopulationAnnealing

algorithm = PopulationAnnealing()
solve_job = algorithm.run(model, name="my-solve-job")

QBSolv-like Simulated Annealing

QBSolv Like Simulated Annealing breaks down the problem and solves the parts individually using a classic solver that uses Simulated Annealing. This particular implementation uses hybrid.SimulatedAnnealingSubproblemSampler as a sampler for the subproblems to achieve a QBSolv like behaviour.

Note

This solver is only available for commercial and academic licenses.

Compatible Backends

Backend Default
DWave

Initialization

Python
from luna_quantum.solve.parameters.algorithms.base_params.simulated_annealing_params import SimulatedAnnealingBaseParams
from luna_quantum.solve.parameters.algorithms.simulated_annealing.qbsolv_like_simulated_annealing import QBSolvLikeSimulatedAnnealing

algorithm = QBSolvLikeSimulatedAnnealing(
    decomposer_size=50,
    rolling=True,
    rolling_history=0.15,
    max_iter=100,
    max_time=5,
    convergence=3,
    target=None,
    rtol=1e-05,
    atol=1e-08,
    backend=None,
    simulated_annealing=SimulatedAnnealingBaseParams(
        num_reads=None,
        num_sweeps=1000,
        beta_range=None,
        beta_schedule_type='geometric',
        initial_states_generator='random'
    )
)

Usage

Python
from luna_quantum.algorithms import QBSolvLikeSimulatedAnnealing

algorithm = QBSolvLikeSimulatedAnnealing()
solve_job = algorithm.run(model, name="my-solve-job")

Repeated Reverse Simulated Annealing

Repeated Reverse Simulated Annealing finds the solution to a problem using an annealing process. Initially, random states are chosen in the solution landscape. Afterwards, as the temperature decreases, states are chosen that are more energetically favorable. At the end of the complete annealing process, the resulting states make up the solution.

Note

This solver is only available for commercial and academic licenses.

Compatible Backends

Backend Default
DWave

Initialization

Python
from luna_quantum.solve.parameters.algorithms.simulated_annealing.repeated_reverse_simulated_annealing import RepeatedReverseSimulatedAnnealing

algorithm = RepeatedReverseSimulatedAnnealing(
    backend=None,
    num_reads=None,
    num_sweeps=1000,
    beta_range=None,
    beta_schedule_type='geometric',
    initial_states_generator='random',
    num_sweeps_per_beta=1,
    seed=None,
    beta_schedule=None,
    initial_states=None,
    randomize_order=False,
    proposal_acceptance_criteria='Metropolis',
    num_reads_per_iter=None,
    timeout=5.0,
    max_iter=10,
    target=None
)

Usage

Python
from luna_quantum.algorithms import RepeatedReverseSimulatedAnnealing

algorithm = RepeatedReverseSimulatedAnnealing()
solve_job = algorithm.run(model, name="my-solve-job")