def fmin(fn, space, algo, max_evals, trials=None, rstate=None, allow_trials_fmin=True, pass_expr_memo_ctrl=None, catch_eval_exceptions=False, verbose=0, return_argmin=True):
 if (rstate is None):
  env_rseed = os.environ.get('HYPEROPT_FMIN_SEED', '')
  if env_rseed:
   rstate = np.random.RandomState(int(env_rseed))
  else:
   rstate = np.random.RandomState()
 if (allow_trials_fmin and hasattr(trials, 'fmin')):
  return trials.fmin(fn, space, algo=algo, max_evals=max_evals, rstate=rstate, pass_expr_memo_ctrl=pass_expr_memo_ctrl, verbose=verbose, catch_eval_exceptions=catch_eval_exceptions, return_argmin=return_argmin)
 if (trials is None):
  trials = base.Trials()
 domain = base.Domain(fn, space, pass_expr_memo_ctrl=pass_expr_memo_ctrl)
 rval = FMinIter(algo, domain, trials, max_evals=max_evals, rstate=rstate, verbose=verbose)
 rval.catch_eval_exceptions = catch_eval_exceptions
 rval.exhaust()
 if return_argmin:
  return trials.argmin

def fmin ( fn , space , algo , max_evals , trials = None , rstate = None , allow_trials_fmin = True , pass_expr_memo_ctrl = None , catch_eval_exceptions = False , verbose = 0 , return_argmin = True ) : if ( rstate is None ) : env_rseed = os . environ . get ( 'HYPEROPT_FMIN_SEED' , '' ) if env_rseed : rstate = np . random . RandomState ( int ( env_rseed ) ) else : rstate = np . random . RandomState ( ) if ( allow_trials_fmin and hasattr ( trials , 'fmin' ) ) : return trials . fmin ( fn , space , algo = algo , max_evals = max_evals , rstate = rstate , pass_expr_memo_ctrl = pass_expr_memo_ctrl , verbose = verbose , catch_eval_exceptions = catch_eval_exceptions , return_argmin = return_argmin ) if ( trials is None ) : trials = base . Trials ( ) domain = base . Domain ( fn , space , pass_expr_memo_ctrl = pass_expr_memo_ctrl ) rval = FMinIter ( algo , domain , trials , max_evals = max_evals , rstate = rstate , verbose = verbose ) rval . catch_eval_exceptions = catch_eval_exceptions rval . exhaust ( ) if return_argmin : return trials . argmin
minimize a function using the downhill simplex algorithm .