title: scipy minimize returns initial value
body: <p>I am trying to use scipy.minimize to perform a simple minimization (a basic example of simulated maximum likelihood). For some reason it just returns the initial value. What am I doing wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import numpy as np
  from scipy.optimize import minimize
  
  # Simulated likelihood function
  # Arguments:
  # theta: vector representing probabilities
  # sims: vector representing uniform simulated data, e.g. [0.43, 0.11, 0.02, 0.97, 0.77]
  # dataCounts: vector representing counts of actual data, e.g. [4, 10, 7]
  def simLogLikelihood(theta, sims, dataCounts):
  
          # Categorise sims using theta
          simCounts = np.bincount(theta.cumsum().searchsorted(sims))
  
          # Calculate probabilities using simulated data
          simProbs = simCounts/simCounts.sum()
          # Calculate likelihood using simulated probabilities and actual data
          logLikelihood = (dataCounts*np.log(simProbs)).sum()
  
          return -logLikelihood
  
  
  # Set seed
  np.random.seed(121)
  
  # Generate 'true' data
  trueTheta = np.array([0.1, 0.4, 0.5])
  dataCounts = np.bincount(np.random.choice([0, 1, 2], 1000, p=trueTheta))
  
  # Generate simulated data (random draws from [0, 1))
  sims = np.random.random(1000)
  
  # Choose theta to maximise likelihood
  thetaStart = np.array([0.33, 0.33, 0.34])
  bnds = ((0, 1), (0, 1), (0, 1))
  cons = ({'type': 'eq', 'fun': lambda x:  x.sum() - 1.0})
  
  result = minimize(simLogLikelihood, x0=thetaStart, args=(sims, dataCounts), method='SLSQP', bounds=bnds, constraints=cons)
  </code></pre>
  
  <p>(The bounds in <code>bnds</code> reflect the fact that probabilities need to be between zero and one. The constraint in <code>cons</code> is that the probabilities have to sum to one.)</p>
  
  <p>If I run this code, <code>result</code> contains:</p>
  
  <pre><code>     fun: 1094.7593617864004
       jac: array([ 0.,  0.,  0.])
   message: 'Optimization terminated successfully.'
      nfev: 5
       nit: 1
      njev: 1
    status: 0
   success: True
         x: array([ 0.33,  0.33,  0.34])
  </code></pre>
  
  <p>So it just does a single iteration and returns the vector of probabilities I started with. But it is easy to find another vector of probabilities with a lower objective, e.g. [0.1, 0.4, 0.5]. What is going wrong?</p>