pygsti.optimize.optimize.minimize

Contents

pygsti.optimize.optimize.minimize#

minimize(fn, x0, method='cg', callback=None, tol=1e-10, maxiter=1000000, maxfev=None, stopval=None, jac=None, verbosity=0, **addl_kwargs)#

Minimizes the function fn starting at x0.

This is a gateway function to all other minimization routines within this module, providing a common interface to many different minimization methods (including and extending beyond those available from scipy.optimize).

Parameters:
  • fn (function) – The function to minimize.

  • x0 (numpy array) – The starting point (argument to fn).

  • method (string, optional) – Which minimization method to use. Allowed values are: “simplex” : uses _fmin_simplex “supersimplex” : uses _fmin_supersimplex “customcg” : uses fmax_cg (custom CG method) “brute” : uses scipy.optimize.brute “basinhopping” : uses scipy.optimize.basinhopping with L-BFGS-B “swarm” : uses _fmin_particle_swarm “evolve” : uses _fmin_evolutionary (which uses DEAP) < methods available from scipy.optimize.minimize >

  • callback (function, optional) – A callback function to be called in order to track optimizer progress. Should have signature: myCallback(x, f=None, accepted=None). Note that create_objfn_printer(…) function can be used to create a callback.

  • tol (float, optional) – Tolerance value used for all types of tolerances available in a given method.

  • maxiter (int, optional) – Maximum iterations.

  • maxfev (int, optional) – Maximum function evaluations; used only when available, and defaults to maxiter.

  • stopval (float, optional) – For basinhopping method only. When f <= stopval then basinhopping outer loop will terminate. Useful when a bound on the minimum is known.

  • jac (function) – Jacobian function.

  • verbosity (int) – Level of detail to print to stdout.

  • addl_kwargs (dict) – Additional arguments for the specific optimizer being used.

Returns:

Includes members ‘x’, ‘fun’, ‘success’, and ‘message’.

Return type:

scipy.optimize.Result object