pygsti.algorithms.germselection.find_germs_breadthfirst#
- find_germs_breadthfirst(model_list, germs_list, randomize=True, randomization_strength=0.001, num_copies=None, seed=0, op_penalty=0, score_func='all', tol=1e-06, threshold=1000000.0, check=False, force='singletons', pretest=True, mem_limit=None, comm=None, profiler=None, verbosity=0, num_nongauge_params=None, float_type=None, mode='compactEVD', gate_penalty=None)#
Greedy algorithm starting with 0 germs.
Tries to minimize the number of germs needed to achieve amplificational completeness (AC). Begins with 0 germs and adds the germ that increases the score used to check for AC by the largest amount (for the model that currently has the lowest score) at each step, stopping when the threshold for AC is achieved. This strategy is something of a “breadth-first” approach, in contrast to
find_germs_depthfirst(), which only looks at the scores for one model at a time until that model achieves AC, then turning it’s attention to the remaining models.- Parameters:
model_list (Model or list) – The model or list of Model objects to select germs for.
germs_list (list of Circuit) – The list of germs to construct a germ set from.
randomize (bool, optional) – Whether or not to randomize model_list (usually just a single Model) with small (see randomization_strength) unitary maps in order to avoid “accidental” symmetries which could allow for fewer germs but only for that particular model. Setting this to True will increase the run time by a factor equal to the number of randomized copies (num_copies).
randomization_strength (float, optional) – The strength of the unitary noise used to randomize input Model(s); is passed to
randomize_with_unitary().num_copies (int, optional) – The number of randomized models to create when only a single gate set is passed via model_list. Otherwise, num_copies must be set to None.
seed (int, optional) – Seed for generating random unitary perturbations to models.
op_penalty (float, optional) – Coefficient for a penalty linear in the sum of the germ lengths.
score_func ({'all', 'worst'}, optional) – Sets the objective function for scoring the eigenvalues. If ‘all’, score is
sum(1/eigenvalues). If ‘worst’, score is1/min(eiganvalues).tol (float, optional) – Tolerance (eps arg) for
_compute_bulk_twirled_ddd(), which sets the difference between eigenvalues below which they’re treated as degenerate.threshold (float, optional) – Value which the score (before penalties are applied) must be lower than for a germ set to be considered AC.
check (bool, optional) – Whether to perform internal checks (will slow down run time substantially).
force (list of Circuits) – A list of Circuit objects which must be included in the final germ set. If the special string “singletons” is given, then all of the single gates (length-1 sequences) must be included.
pretest (boolean, optional) – Whether germ list should be initially checked for completeness.
mem_limit (int, optional) – A rough memory limit in bytes which restricts the amount of intermediate values that are computed and stored.
comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator for distributing the computation across multiple processors.
profiler (Profiler, optional) – A profiler object used for to track timing and memory usage.
verbosity (int, optional) – Level of detail printed to stdout.
num_nongauge_params (int, optional) – Force the number of nongauge parameters rather than rely on automated gauge optimization.
float_type (numpy dtype object, optional) – Numpy data type to use for floating point arrays. Automatically resolved based on whether the model’s basis is real-valued. Can be manually specified by user, which can be useful for controlling memory footprint.
gate_penalty (dict, optional (default None)) – An optional dictionary allowing the specification of gate-specific penalties to add for each instance of the specified gate(s) in each germ. Should be specified as a dictionary whose keys are strings corresponding to gate names, and whose values are the penalty factor to add for each instance of that gate. E.g. {‘Gcnot’:2} would correspond to a penalty term where each instance of a ‘Gcnot’ gate gets and additional 2 units added to the cost function for a candidate germ.
mode (str)
- Returns:
A list of the built-up germ set (a list of
Circuitobjects).- Return type:
list