qat.plugins.SPSAMinimizePlugin

class qat.plugins.SPSAMinimizePlugin(x0=None, collective=False, binding_args=None, **kwargs)

A variational minimizer based on the Simultaneous Perturbation Stochastic Approximation (SPSA) algorithm.

This is a particularization of the Optimizer class.

Parameters
  • x0 (np.array, optional) – Initial parameters values. If set to None, the initial parameters will be randomly chosen.

  • binding_args (dict, optional) – arguments to bind job variables (see Optimizer documentation). Defaults to None.

  • maxiter (int, optional) – maximal number of iterations. Defaults to 100.

  • a (int, optional) – \(a\) parameter. Defaults to 1.

  • A (int, optional) – \(A\) parameter. Defaults to 10.

  • alpha (float, optional) – \(\alpha\) parameter. Defaults to 0.602.

  • c (float, optional) – \(c\) parameter. Defaults to 0.01.

  • gamma (float, optional) – \(\gamma\) parameter. Defaults to 0.101.

  • precision (float, optional) – stop after ‘stop_condition’ consecutive times when difference between two successive function evalutions are lower than precision. Defaults to 1e-4.

  • stop_condition (int, optional) – see ‘precision’. Defaults to 5.

  • a_calibration (bool, optional) – whether to calibrate a param. Defaults to False

  • n_calibrations (int, optional) – Defaults to 25.

  • seed (int, optional) – seed for random number generator. Defaults to None.

References

https://en.wikipedia.org/wiki/Simultaneous_perturbation_stochastic_approximation

compile(batch: Batch) Batch

Loops a batch through all the plugins present inside the QPU.

Parameters

batch (Batch) – a batch of jobs. If a single job is provided, the job is embedded into a Batch, compiled, and the first result is returned.

Returns

a batch of jobs

Return type

Batch