code: def opt(self, x_init, f_fp=None, f=None, fp=None):
          
          rcstrings = ['','Maximum number of iterations exceeded', 'Gradient and/or function calls not changing']
  
          opt_dict = {}
          if self.xtol is not None:
              print("WARNING: bfgs doesn't have an xtol arg, so I'm going to ignore it")
          if self.ftol is not None:
              print("WARNING: bfgs doesn't have an ftol arg, so I'm going to ignore it")
          if self.gtol is not None:
              opt_dict['gtol'] = self.gtol
  
          opt_result = optimize.fmin_bfgs(f, x_init, fp, disp=self.messages,
                                              maxiter=self.max_iters, full_output=True, **opt_dict)
          self.x_opt = opt_result[0]
          self.f_opt = f_fp(self.x_opt)[0]
          self.funct_eval = opt_result[4]
          self.status = rcstrings[opt_result[6]]
docs: Run the optimizer