TreeSearchConfig
- class TreeSearchConfig(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, layer_max=25, layout_objective='gate_count')
Configuration for the tree-search strategy.
Tree-search enumerates the candidate entangler placements of the topology at each level, optimizes them, and keeps the best before growing one level deeper. One level here is one layer.
The fields this strategy defines come first below. The rest are inherited from
SynthesisConfig, which documents them in full.- Variables:
layer_max – Maximum number of layers the search may grow to.
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
layer_maxis negative.