Optimal Algorithms for Latent Bandits with Cluster Structure