This paper presents an improved reinforcement learning method to minimize electricity costs on the premise of satisfying the power balance and generation limit of units in a microgrid with grid- connected mode. Firstly, the microgrid control requirements are analyzed and the objective functi