title: scipy.optmize.minimize: Iteration limit exceeded
body: <p>I started using scipy.optimize.minimize for a work project in which I try to optimize the allocation of product across stores given historical sales data for each store.</p>
  
  <p>I obtain data for ~300 stores from an excel sheet and store it in a Store class. With the data I build a histogram and fit a normal distribution to the histogram, and save the mean and standard deviation of the fitted normal distribution in their respective Store object. (no problem so far with this part).</p>
  
  <p>The problem comes when I try to to maximize the total "Probability" that the product will be sold depending on how I distribute the product across the stores.</p>
  
  <p>There is more stuff going on in my program, but this is the relevant part (missing is the acquisition of data from the excel file, and the fitting of the normal distribution to each store):</p>
  
  <pre class="lang-py prettyprint-override"><code>import math, numpy
  from scipy.optimize import minimize
  
  unitsAvailable = 400
  
  def distribution_objective(allocations):
      target = 0
      for i in range(len(stores)):
          target += normal(allocations[i], stores[i].mu, stores[i].std)
  
      return - target
  
  
  def constraint1(allocations):
  
      return unitsAvailable - sum(allocations)
  
  def constraint2(allocations):
  
      return min(allocations)
  
  cons = [{'type':'eq', 'fun':constraint1}, {'type':'ineq', 'fun':constraint2}]
  guess_allocs = []
  
  for i in range(len(stores)):
      guess_allocs.append(unitsAvailable / len(stores))
  
  distribution_solution = minimize(distribution_objective, guess_allocs, method='SLSQP', constraints=cons, options={'disp':True})
  </code></pre>
  
  <p>Running my program I obtain the following message:</p>
  
  <pre><code>Iteration limit exceeded    (Exit mode 9)
              Current function value: -124.1033692190603
              Iterations: 101
              Function evaluations: 46808
              Gradient evaluations: 101
  </code></pre>
  
  <p>Why does this happen?</p>