Self-Learning Control of Finite Markov Chains