descent_numpy

compas.numerical.descent_numpy(x0, fn, iterations=1000, gtol=1e-06, bounds=None, limit=0, args=())[source]

A gradient descent optimisation solver.

Parameters
  • x0 (array-like) – n x 1 starting guess of x.

  • fn (obj) – The objective function to minimize.

  • iterations (int) – Maximum number of iterations.

  • gtol (float) – Mean residual of the gradient for convergence.

  • bounds (list) – List of lower and upper bound pairs [[lb, ub], …], None=unconstrained.

  • limit (float) – Value of the objective function for which to terminate optimisation.

  • args (tuple) – Additional parameters needed for fn.

Returns

  • float – Final value of the objective function.

  • array – Values of x at the found local minimum.