This is Carl Edward Rasmussen’s minimize method rewritten in Python.
Inputs:
X: Input for the function f.
f: The function to be minimized. f is a method that takes X as
input and provides af function evaluation.
df: The function gradient, evaluated at X.
length: The maximum number of line searches.
- callback: An optional user-supplied function to call after each iteration.
- Called as callback(Xk), where Xk is the current parameter vector.
- Returns: By default the function value for each iteration, but if
- return_result is set to True, then it returns a tuple
containing (function value, final function inputs).