title: Scipy.optimize: how to restrict argument values
body: <p>I'm trying to use <code>scipy.optimize</code> functions to find a global minimum of a complicated function with several arguments. <code>scipy.optimize.minimize</code> seems to do the job best of all, namely, the 'Nelder-Mead' method. However, it tends to go to the areas out of arguments' domain (to assign negative values to arguments that can only be positive) and thus returns an error in such cases. Is there a way to restrict the arguments' bounds <strong>within the <code>scipy.optimize.minimize</code> function</strong> itself? Or maybe within other <code>scipy.optimize</code> functions?</p>
  
  <p>I've found the following advice: </p>
  
  <blockquote>
    <p>When the parameters fall out of the admissible range, return a wildly huge number (far from the data to be fitted). This will (hopefully) penalize this choice of parameters so much that <code>curve_fit</code> will settle on some other admissible set of parameters as optimal.</p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/questions/9518290/restricting-values-for-curve-fit-scipy-optimize">given in this previous answer</a>, but the procedure will take a lot of computational time in my case.</p>