method = sys.argv[1] K = 30 if method.count(',') == 0 else method.count(',') + 1 if len(sys.argv) > 2: K = eval(sys.argv[2]) maxfev = '1050' if len(sys.argv) <= 3 else sys.argv[3] eps = 0.5 if len(sys.argv) <= 4 else eval(sys.argv[4]) accrual = 'latest' if len(sys.argv) <= 5 else sys.argv[5] m_opts = dict(K=K, method=method, eps=eps, accrual=accrual) if method.find(',') >= 0: shortname = 'mE%dG%d%s' % (int( eps * 100), K, accrual if accrual != 'latest' else '') comments = 'Iterative epsgreedy-sampling mix (%s), eps=%s, pop. K=%d, cr. accrual = %s' % ( method, eps, K, accrual) else: shortname = 'pE%dG%d%s_%s' % (int( eps * 100), K, accrual if accrual != 'latest' else '', method) comments = 'Iterative epsgreedy-sampling %s, eps=%s, pop. K=%d, cr. accrual = %s' % ( method, eps, K, accrual) e = Experiment(eval(maxfev), shortname, comments) for i in e.finstances(): (n_iters, optmethod) = minimize_f(i, **m_opts) e.f.finalizerun() comment = ' with %d iterations' % n_iters if optmethod is not None: comment += ' (* %s)' % optmethod e.freport(i, comment)
return (pop.total_iters, optmethod) if __name__ == "__main__": method = sys.argv[1] K = 30 if method.count(',') == 0 else method.count(',') + 1 if len(sys.argv) > 2: K = eval(sys.argv[2]) maxfev = '1050' if len(sys.argv) <= 3 else sys.argv[3] m_opts = dict(K = K, method = method) # b stands for "basinhopping" if method.find(',') >= 0: shortname = 'mUNIF%d' % K comments = 'Iterative UNIFORM-sampling mix (%s), pop. K=%d' % (method, K) else: shortname = 'pUNIF%d_%s' % (K, method) comments = 'Iterative UNIFORM-sampling %s, pop. K=%d' % (method, K) e = Experiment(eval(maxfev), shortname, comments) for i in e.finstances(): (n_iters, optmethod) = minimize_f(i, **m_opts) e.f.finalizerun() comment = ' with %d iterations' % n_iters if optmethod is not None: comment += ' (* %s)' % optmethod e.freport(i, comment)