yaf2q.optimizer package
Submodules
yaf2q.optimizer.sa module
- class yaf2q.optimizer.sa.SA(num_qubits: int, objective_func, params: SAParams, verbose: bool = False)
Bases:
objectOprtimizer using simulated annealing
- num_qubits
number of qubits
- Type:
int
- objective_func
objective function
- Type:
func
- verbose
displey detailed information
- Type:
bool
- optimize()
optimize a ternary tree specification
- Parameters:
None
- Returns:
ttspec_opt – optimized ternary tree specification
- Return type:
- class yaf2q.optimizer.sa.SAParams(init_sampling: int = 10, num_steps: int = 10, cooling_factor: float = 1.0, seed: int = None)
Bases:
objectParameters of simulated annealing
- init_sampling
sampling number for determining the initial temperature
- Type:
int, default 10
- num_steps
anealing steps
- Type:
int, default 10
- cooling_factor
coooling factor for annealing
- Type:
float, default 1.0
- seed
seed for random generation
- Type:
int
Notes
Annealing scheduling curve is T = (x + 1)^(-a), where T is temperature, x is annealing step (int), and a is cooling factor.
- cooling_factor: float = 1.0
- init_sampling: int = 10
- num_steps: int = 10
- seed: int = None