Simulated Annealing
SimulatedAnnealingSolver
Section titled “SimulatedAnnealingSolver”Simple classical solver class using Simulated Annealing. Designed to integrate with the solver factory.
Signature
Section titled “Signature”class SimulatedAnnealingSolver(BaseClassicalSolver): def solve(self) -> QUBOSolution
Description
Section titled “Description”This solver uses a Simulated Annealing to probabilistically explore the solution space. It is suitable for approximating solutions on medium-sized QUBO instances. Computation is entirely classical and based on the SimulatedAnnealingSolver
. The output is fully compatible with the QUBOSolution
structure used in the qubo-solver
package.
Fields
Section titled “Fields”Field | Type | Description |
---|---|---|
use_quantum |
bool |
Have to be False to uses a classical solver. |
classical_solver_type |
str |
Set to "simulated_annealing" to use Simulated Annealing as the solving method. |
max_iter |
int |
Maximum number of iterations to perform for simulated annealing or tabu search. |
sa_initial_temp |
float |
Starting temperature (controls exploration). |
sa_final_temp |
float |
Minimum temperature threshold for stopping. |
sa_alpha |
float |
Cooling rate - should be slightly below 1 (e.g., 0.95–0.99). |
from qubosolver import QUBOInstancefrom qubosolver.solver import QuboSolverfrom qubosolver.config import SolverConfig, ClassicalConfig
qubo = QUBOInstance(coefficients=[[-2.0, 1.0], [1.0, -2.0]])config = SolverConfig(use_quantum = False, classical=ClassicalConfig(classical_solver_type="simulated_annealing"))
solver = QuboSolver(qubo, config)
solution = solver.solve()print(solution)
Recommended for local, classical solving when exact optimization is not required.