An optimal investment model with Markov-driven volatilities