A coordinated and hierarchical operation of active distribution networks with microgrids, specifically when they have distributed energy resources allocated and operated in an optimized way, results in a reduction in operating costs, losses, and greater flexibility and. A coordinated and hierarchical operation of active distribution networks with microgrids, specifically when they have distributed energy resources allocated and operated in an optimized way, results in a reduction in operating costs, losses, and greater flexibility and. This paper employs a physical connection and information exchange between the distribution network and microgrids to leverage the advantages of centralized-distributed optimization. This establishes a coordinated demand response model between the distribution network and microgrids, gradually. Distribution networks have undergone a series of changes, with the insertion of distributed energy resources, such as distributed generation, energy storage systems, and demand response, allowing the consumers to produce energy and have an active role in distribution systems. A master–slave game equilibrium algorithm based on a Kriging metamodel.