scipy.optimize.minimize keep track of objective function
问题 I'm working with scipy.optimize.minimize , and I'm optimizing 3 parameters with a function like this def foo(A, x, y, z): test = my_function(A[0], A[1], A[2], x, y, z) return test In this answer I found some insight: How to display progress of scipy.optimize function? So I came up with this function: def callbackF(Xi, x, y, z) global Nfeval print '{0:4d} {1: 3.6f} {2: 3.6f} {3: 3.6f} {4: 3.6f}'.format(Nfeval, Xi[0], Xi[1], Xi[2], foo(Xi, x, y, z)) Nfeval += 1 So my code will look like this