title: Options of the function scipy.optimize.minimize
body: <p>I am trying to minimize a very long function (it is the sum of 500000 parts of sub-functions) in order to fit some parameters to a probabilistic model. I use the <code>scipy.optimize.minimize</code> function. I tried both <code>Powell</code> and <code>Nelder-Mead</code> algorithms, and Powell looks really faster in my settings. But still, I really don't understand how to force the process to give me some results after a given time, even if they are not &quot;optimal&quot;.</p>
  <p>I fill the options <code>maxiter</code>, <code>maxfev</code>, <code>xtol</code> and <code>ftol</code>, but I don't really understand these options, since I tried to put a <code>print</code> in my function and I noticed that the algorithm evaluate it more than <code>maxfev</code> times, but when It reaches the maxiter point, It sends an error &quot;max number of iterations reached&quot;.</p>
  <p>How do they work with respect to the two algorithms I am using? The doc is very unclear.</p>
  <p>My code:</p>
  <pre><code>def log_likelihood(r, alpha, a, b, customers):
      if r &lt;= 0 or alpha &lt;= 0 or a &lt;= 0 or b &lt;= 0:
          return -np.inf
      c = sum([log_likelihood_individual(r, alpha, a, b, x, tx, t) for x, tx, t in customers])
      print -c
      return c
  
  negative_ll = lambda params: -log_likelihood(*params,customers=customers)
  params0 = (1, 1, 1, 1)
  res = minimize(negative_ll, params0, method='Powell', callback=print_callback, options={'disp': True, 'ftol':0.05, 'maxiter':3, 'maxfev&quot;:15})
  </code></pre>