Esempio n. 1
0
 def __call__(self,
              fcn,
              x0,
              xmin,
              xmax,
              tol=EPSILON,
              maxnfev=None,
              step=None,
              finalsimplex=[0, 1, 1],
              verbose=0):
     x0 = np.asarray(x0)
     n = len(x0)
     if step is None:
         step = abs(x0) + 1.2
     maxnfev = self.get_maxnfev(maxnfev, n)
     init = 0
     x0, fval, nfev, err = \
         _saoopt.neldermead(verbose, maxnfev, init, finalsimplex, tol, step,
                            xmin, xmax, x0, fcn)
     iquad = 1
     simp = 1.0e-2 * tol
     step = n * [0.4]
     self.par, self.fmin, tmpnfev, ifault = \
         _saoopt.minim(verbose, maxnfev - nfev, init, iquad, simp, tol*10,
                       step, xmin, xmax, x0, fcn)
     self.nfev = nfev + tmpnfev
     return self.nfev, self.fmin, self.par
Esempio n. 2
0
 def __call__(self,
              fcn,
              x0,
              xmin,
              xmax,
              tol=EPSILON,
              maxnfev=None,
              step=None,
              finalsimplex=[0, 1, 1],
              verbose=0):
     x0 = np.asarray(x0)
     n = len(x0)
     if step is None:
         step = n * [1.2]
     maxnfev = self.get_maxnfev(maxnfev, n)
     init = 0
     par, fmin, nfev, err = \
         _saoopt.neldermead(verbose, maxnfev, init, finalsimplex, tol, step,
                            xmin, xmax, x0, fcn)
     return nfev, fmin, par