AdaptiveConfig
- class AdaptiveConfig(tolerance_error=1e-08, layout_method='trivial', optimizer='bfgs2', global_search='basin_hopping', n_trials_warm=1, n_trials_cold=1, warm_start_from_level=1, refine_best_trial=False, parallel_mode='openmp', use_float=False, round_single_qubit_rotations=None, seed=None, verbosity='silent', barrier=False, compress=None, level_max=25, level_min=0, layout_objective='gate_count')
Configuration for the adaptive decomposition strategy.
The adaptive strategy grows the ansatz level by level, optimizing at each step and stopping once
tolerance_erroris met, then runs the tolerance-respecting compression pass to drop redundant layers. One level here is one full sweep over the topology’s edges, son_qubits - 1layers on a star.The fields this strategy defines come first below. The rest are inherited from
SynthesisConfig, which documents them in full.- Variables:
compress – Whether to run the backend circuit-compression pass after the initial decomposition. Tolerance-respecting: the backend removes a layer only if, after re-optimizing the reduced circuit, the residual error is still below
tolerance_error; a removal that would cross the tolerance is rejected and the previous circuit kept.None(the default) leaves it to the gate set; the gate sets of this package compress.level_max – Maximum number of ansatz levels the backend may use before giving up.
level_min – Minimum number of ansatz levels the search may use.
0(the default) starts from the circuit without entanglers, which a target such as the identity needs. Raise this only to skip levels a target is known to outgrow. Read by the adaptive strategy alone; the others take no floor.tolerance_error – Target compilation error; small enough makes the compilation numerically exact.
(more details)layout_method – Boundary qubit relabeling, or the strategy that searches for one.
(more details)layout_objective – What a
layout_methodsearch minimizes over the candidates."gate_count"(the default) counts the native entanglers."error"ranks a candidate by its overall error: its compilation error and the errors the gate set gives its gates, combined. Every candidate meetstolerance_error, so"error"puts the mapping whose gates cost least first. It needs the error of every native gate that is not a frame change."duration"ranks a candidate by how long its circuit runs: each gate starts once the qubits the gate set says it reserves are free. It needs the duration of every native gate that is not a frame change, and the compiled circuit’s duration is recorded onmetadata["duration"], in the unit the gate set’s durations are given in.optimizer – Backend numerical optimizer that fits the ansatz parameters.
(more details)global_search – Which global search wraps
BFGS2’s local optimizer. Other optimizers ignore it.(more details)n_trials_warm – Optimizations per candidate gate structure seeded from the previous level’s result.
(more details)n_trials_cold – Optimizations per candidate gate structure from a fully random point.
(more details)warm_start_from_level – First level whose warm trials seed from the previous one.
(more details)refine_best_trial – Whether a further optimization refines the best trial.
(more details)parallel_mode – Backend parallelization mode.
(more details)use_float – Whether to run the backend in single precision.
(more details)seed – Seed for the backend’s random number generator.
(more details)verbosity – How much the compiler prints.
(more details)round_single_qubit_rotations – The angles to round single-qubit rotation angles onto where the fit allows.
(more details)barrier – Whether to insert a barrier after every native entangler, for readability when drawing.
(more details)
- Raises:
ConfigError – If
level_minis negative or abovelevel_max.