This function returns both the (hopefully) optimized vector of parameters, and
an updated version of the optimizer itself. This is intended to be used when
you want more control over the optimization process compared to the more black
box approach of the mize function. In return for having to
manually call this function every time you want the next iteration of
optimization, you gain the ability to do your own checks for convergence,
logging and so on, as well as take other action between iterations, e.g.
visualization.
Normally calling this function should return a more optimized vector of
parameters than the input, or at least leave the parameters unchanged if no
improvement was found, although this is determined by how the optimizer was
configured by make_mize. It is very possible to create an
optimizer that can cause a solution to diverge. It is the responsibility of
the caller to check that the result of the optimization step has actually
reduced the value returned from function being optimized.
Details of the fg list can be found in the 'Details' section of
mize.