anneal¶
-
anneal.
simulated_annealing
(P, ID, beta_min=0.01, beta_max=100.0, cooling_rate=0.01, n_steps_per_T=100, E_min=-inf, quench_to_T0=False, n_steps_T0=1000)[source]¶ General-purpose simulated-annealing optimization function.
Parameters: P : object
Instance of a custom class, wich includes attributes
- P.beta
- P.energy
and methods:
- P.set_beta(beta)
- P.MC_move(), returning 1/0 (accepted/rejected)
- P.update_MC_parameters(acc_ratio)
ID : str
Label for the problem under study.
beta_min : float, optional
Minimum inverse temperature (default: 1e-2)
beta_max: float, optional
Maximum inverse temperature (default: 1e2)
cooling_rate : float, optional
Cooling rate (default: 1e-2)
n_steps_per_T : int, optional
Number of MC moves attempted at each temperature (default: 100)
E_min : float, optional
Global energy minimum, if known (default: -infinity)
quench_to_T0 : bool, optional
If True, perform a T=0 quench at the end of the annealing
n_steps_T0 : int, optional
Number of MC moves after the T=0 quench
Returns: P : object
Current version of P
E : list
List of the final energies for each temperature
elapsed_time : float
Total elapsed time, in seconds