Learning first-order Markov models for control