Thompson Sampling is Asymptotically Optimal in General Environments