In this paper, a two-level optimization model of mixed quadratic integer programming (MIQP) is presented in order to optimally operate microgrids under worst-case output conditions of renewable energy sources. This two-level model is divided into two high-level and low-level problems. In the high-level problem, the goal is to reduce energy loss and load shedding in the demand response program, ...