Text this: Reinforcement learning algorithm based on minimum state method and average reward