pygsti.algorithms.germselection.find_germs_grasp

pygsti.algorithms.germselection.find_germs_grasp#

find_germs_grasp(model_list, germs_list, alpha, randomize=True, randomization_strength=0.001, num_copies=None, seed=None, l1_penalty=0.01, op_penalty=0.0, score_func='all', tol=1e-06, threshold=1000000.0, check=False, force='singletons', iterations=5, return_all=False, shuffle=False, verbosity=0, num_nongauge_params=None, float_type=None, gate_penalty=None)#

Use GRASP to find a high-performing germ set.

Parameters:
  • model_list (Model or list of Model) – The list of Models to be tested. To ensure that the returned germ set is amplficationally complete, it is a good idea to score potential germ sets against a collection (~5-10) of similar models. The user may specify a single Model and a number of unitarily close copies to be made (set by the kwarg num_copies, or the user may specify their own list of Models, each of which in turn may or may not be randomized (set by the kwarg randomize).

  • germs_list (list of Circuit) – List of all germ circuits to consider.

  • alpha (float) – A number between 0 and 1 that roughly specifies a score threshold relative to the spread of scores that a germ must score better than in order to be included in the RCL. A value of 0 for alpha corresponds to a purely greedy algorithm (only the best-scoring germ set is included in the RCL), while a value of 1 for alpha will include all germs in the RCL. See pygsti.algorithms.scoring.filter_composite_rcl() for more details.

  • randomize (Bool, optional) – Whether or not the input Model(s) are first subject to unitary randomization. If False, the user should perform the unitary randomization themselves. Note: If the Model(s) are perfect (e.g. std1Q_XYI.target_model()), then the germ selection output should not be trusted, due to accidental degeneracies in the Model. If the Model(s) include stochastic (non-unitary) error, then germ selection will fail, as we score amplificational completeness in the limit of infinite sequence length (so any stochastic noise will completely depolarize any sequence in that limit).

  • randomization_strength (float, optional) – The strength of the unitary noise used to randomize input Model(s); is passed to randomize_with_unitary(). Default is 1e-3.

  • num_copies (int, optional) – The number of Model copies to be made of the input Model (prior to unitary randomization). If more than one Model is passed in, num_copies should be None. If only one Model is passed in and num_copies is None, no extra copies are made.

  • seed (float, optional) – The starting seed used for unitary randomization. If multiple Models are to be randomized, model_list[i] is randomized with seed + i.

  • l1_penalty (float, optional) – How strong the penalty should be for increasing the germ set list by a single germ. Used for choosing between outputs of various GRASP iterations.

  • op_penalty (float, optional) – How strong the penalty should be for increasing a germ in the germ set list by a single gate.

  • score_func (string) – Label to indicate how a germ set is scored. See list_score() for details.

  • tol (float, optional) – Tolerance used for eigenvector degeneracy testing in twirling operation.

  • threshold (float, optional (default is 1e6)) – Specifies a maximum score for the score matrix, above which the germ set is rejected as amplificationally incomplete.

  • check (bool, optional) – Whether to perform internal consistency checks, at the expense of making the function slower.

  • force (str or list, optional) – A list of Circuits which must be included in the final germ set. If set to the special string “singletons” then all length-1 strings will be included. Setting to None is the same as an empty list.

  • iterations (int, optional) – The number of GRASP iterations to perform.

  • return_all (bool, optional) – Flag set to tell the routine if it should return lists of all initial constructions and local optimizations in addition to the optimal solution (useful for diagnostic purposes or if you’re not sure what your finalScoreFn should really be).

  • shuffle (bool, optional) – Whether the neighborhood should be presented to the optimizer in a random order (important since currently the local optimizer updates the solution to the first better solution it finds in the neighborhood).

  • verbosity (int, optional) – Integer >= 0 indicating the amount of detail to print.

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

Returns:

finalGermList – Sublist of germs_list specifying the final, optimal set of germs.

Return type:

list of Circuit