qat.plugins.ScipyMinimizePlugin
- class qat.plugins.ScipyMinimizePlugin(collective=False, binding_args=None, **kwargs)
A variational plugin for hybrid quantum classical optimization based on the scipy.optimize.minimize method.
It is a particularization of the
Optimizer
class.- Parameters
x0 (np.array, optional) – initial value of the parameters. Defaults to None, in which case we assume random initilization.
binding_args (dict) – arguments passed to the variable binding method
kwargs – minimize parameters (see scipy.optimize.minimize documentation), e.g ‘method’, ‘tol’, ‘options’…
Note
Parameters can be changed dynamically using the
qat.plugins.ScipyMinimizePlugin.set_options()
method.Example:
import numpy as np form qat.plugins import ScipyMinimizePlugin from qat.linalg import LinAlg plugin = ScipyMinimizePlugin(x0=np.random.random(10), method="COBYLA", tol=1e-3, options={"maxiter": 300}) stack = plugin | LinAlg() # Any job will run, as long as it contains 10 variables! result = stack.submit(my_job)
- set_options(**kwargs)
Sets new options for the minimize function.
- Parameters
kwargs – a new set of options