code: def opt(self, x_init, f_fp=None, f=None, fp=None):
          
          tnc_rcstrings = ['Local minimum', 'Converged', 'XConverged', 'Maximum number of f evaluations reached',
               'Line search failed', 'Function is constant']
  
          assert f_fp != None, "TNC requires f_fp"
  
          opt_dict = {}
          if self.xtol is not None:
              opt_dict['xtol'] = self.xtol
          if self.ftol is not None:
              opt_dict['ftol'] = self.ftol
          if self.gtol is not None:
              opt_dict['pgtol'] = self.gtol
  
          opt_result = optimize.fmin_tnc(f_fp, x_init, messages=self.messages,
                         maxfun=self.max_f_eval, **opt_dict)
          self.x_opt = opt_result[0]
          self.f_opt = f_fp(self.x_opt)[0]
          self.funct_eval = opt_result[1]
          self.status = tnc_rcstrings[opt_result[2]]
docs: Run the TNC optimizer