An Asymptotically Optimal Multi-Armed Bandit Algorithm and Hyperparameter Optimization