Implements multi armed bandit algorithm