tequila.optimizers.optimizer_scipy.minimize¶
-
tequila.optimizers.optimizer_scipy.
minimize
(objective: tequila.objective.objective.Objective, gradient: Union[str, Dict[tequila.objective.objective.Variable, tequila.objective.objective.Objective]] = None, hessian: Union[str, Dict[Tuple[tequila.objective.objective.Variable, tequila.objective.objective.Variable], tequila.objective.objective.Objective]] = None, initial_values: Dict[collections.abc.Hashable, numbers.Real] = None, variables: List[collections.abc.Hashable] = None, samples: int = None, maxiter: int = 100, backend: str = None, backend_options: dict = None, noise: tequila.circuit.noise.NoiseModel = None, method: str = 'BFGS', tol: float = 0.001, method_options: dict = None, method_bounds: Dict[collections.abc.Hashable, numbers.Real] = None, method_constraints=None, silent: bool = False, save_history: bool = True, *args, **kwargs) → tequila.optimizers.optimizer_scipy.SciPyResults[source]¶ Minimization function using scipy methods.
- Parameters
objective (Objective) – The tequila objective to optimize
gradient (typing.Union[str, typing.Dict[Variable, Objective], None] : Default value = None):) – ‘2-point’, ‘cs’ or ‘3-point’ for numerical gradient evaluation (does not work in combination with all optimizers), dictionary of variables and tequila objective to define own gradient, None for automatic construction (default) Other options include ‘qng’ to use the quantum natural gradient.
hessian (typing.Union[str, typing.Dict[Variable, Objective], None], optional) – ‘2-point’, ‘cs’ or ‘3-point’ for numerical gradient evaluation (does not work in combination with all optimizers), dictionary (keys:tuple of variables, values:tequila objective) to define own gradient, None for automatic construction (default)
initial_values (typing.Dict[typing.Hashable, numbers.Real], optional) – Initial values as dictionary of Hashable types (variable keys) and floating point numbers. If given None they will all be set to zero
variables (typing.List[typing.Hashable], optional) – List of Variables to optimize
samples (int, optional) – samples/shots to take in every run of the quantum circuits (None activates full wavefunction simulation)
maxiter (int : (Default value = 100)) – max iters to use.
backend (str, optional) – Simulator backend, will be automatically chosen if set to None
backend_options (dict, optional) – Additional options for the backend Will be unpacked and passed to the compiled objective in every call
noise (NoiseModel, optional) – a NoiseModel to apply to all expectation values in the objective.
method (str : (Default = "BFGS")) – Optimization method (see scipy documentation, or ‘available methods’)
tol (float : (Default = 1.e-3)) – Convergence tolerance for optimization (see scipy documentation)
method_options (dict, optional) – Dictionary of options (see scipy documentation)
method_bounds (typing.Dict[typing.Hashable, typing.Tuple[float, float]], optional:) – bounds for the variables (see scipy documentation)
method_constraints (optional) – (see scipy documentation
silent (bool) – No printout if True
save_history (bool) – Save the history throughout the optimization
- Returns
The results of optimization
- Return type
SciPyReturnType