In order to reduce the overall cost of power generation in micro-grid photovoltaic energy storage systems and enhance optimal operation reliability, an optimal operation model for photovoltaic microgrids is established, taking into account construction costs, maintenance costs, and purchase and sale prices. The charge and discharge behavior of hybrid energy storage systems (HESS) is controlled using the levelized energy cost (LCOE) as a criterion. An improved ant colony algorithm (ACO) dynamic programming (IACODP), incorporating attenuation parameter, deflection angle factor, and inflection point parameter, is introduced to optimize the operation of photovoltaic microgrids. Finally, an example is used to verify the superiority and correctness of the proposed algorithm.