ErrorAwareAdaptiveConfig
- class ErrorAwareAdaptiveConfig(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, no_improvement_steps=2, warn_on_plateau=True, level_max=25, level_min=1, compress=None)
Error-aware search that grows one full topology sweep per level.
Each level appends the same fixed-shape sweep over every topology edge, with no per-level search, so one level is
n_qubits - 1layers. This stays cheap per level regardless of topology size, at the cost of a coarser granularity thanErrorAwareTreeSearchConfig. The bounds below are therefore in levels, while the result is reported in layers.The fields this strategy defines come first below. The rest are inherited from
SynthesisConfig, which documents them in full.- Variables:
level_max – Maximum number of levels the search may grow to. One level is
n_qubits - 1layers.level_min – Minimum number of levels the returned circuit holds. The search still tries the shallower levels and records them in
layer_history, but none of them can win. The default1keeps at least one entangler in the circuit;0lets the search return the closing single-qubit layer alone. Compression keeps as many layers aslevel_minlevels hold.compress – Whether to compress the chosen level’s circuit. One layer at a time is removed and the rest refitted; a removal is kept when the overall error falls.
metadata["error_aware"]["layers"]then counts the layers left, andcompressed_from_layersthe layers the growth chose. Costs a few extra optimizations per layer tried.None(the default) leaves it to the gate set; the gate sets of this package compress.no_improvement_steps – How many search steps without an improving overall error the search tolerates before stopping. This is the knob for how far past the optimum to keep looking: raise it to record more of the trade-off curve, lower it to stop sooner and spend less time. Must be at least
1.warn_on_plateau – Whether to report a
PlateauWarningwhen no level the search tried fits better than the shallowest one, and the compiled circuit’s compilation error is abovetolerance_error.tolerance_error – Early exit for the search: a level whose compilation error falls below it stops the search there, even if the overall error would keep improving.
(more details)layout_method – Boundary qubit relabeling, or the strategy that searches for one.
(more details)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.