pygsti.algorithms.germselection.find_germs_breadthfirst_greedy

pygsti.algorithms.germselection.find_germs_breadthfirst_greedy#

find_germs_breadthfirst_greedy(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', force_rank_increase=False, save_cevd_cache_filename=None, load_cevd_cache_filename=None, file_compression=False, evd_tol=1e-10, initial_germ_set_test=True, 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 Models 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 is 1/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 (str or list of Circuits, optional (default 'singletons')) – 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. If none then not circuits are forcibly 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.

  • force_rank_increase (bool, optional) – Whether to force the greedy iteration to select a new germ that increases the rank of the jacobian at each iteration (this may result in choosing a germ that is sub-optimal with respect to the chosen score function). Also results in pruning in subsequent optimization iterations. Defaults to False.

  • evd_tol (float, optional) – A threshold value to use when taking eigenvalue decompositions/SVDs such that values below this are set to zero.

  • initial_germ_set_test (bool, optional (default True)) – A flag indicating whether or not to check the initially constructed germ set, which is either the list of singleton germs (if force=’singletons’), a user specified list of circuits is such a list if passed in for the value of force, or a greedily selected initial germ if force=None. This can be skipped to save computational time (the test can be expensive) if the user has reason to believe this initial set won’t be AC. Most of the time this initial set won’t be.

  • 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)

  • save_cevd_cache_filename (Optional[str])

  • load_cevd_cache_filename (Optional[str])

  • file_compression (bool)

Returns:

A list of the built-up germ set (a list of Circuit objects).

Return type:

list