The traditional grid operation is unfortunately lacking the resilience and responsiveness in reacting to contingency events due to the poor utilization of available resources in mitigating the shortfalls. Such an unaddressed issue may affect the grid stability and the ultimate grid blackout. Therefore, this paper models a grid optimization module consisting of a mid and low (microgrid) voltage level grid component of an urban grid network for a disaster recovery. The model minimizes the cost of generation required to meet the demand through the economic dispatch in combination with the unit commitment. Two optimization problems are formulated that resemble the grid operation: normal (grid-connected) and islanded. A constrained-based linear programming optimization problem is used to solve the formulated problems, where the dual-simplex algorithm is used as the linear solver. The model ensures sufficient demand to be met during the outages through the N-1 contingency criterion for critical infrastructures. The simulation length is limited to 24 h and is solved using the MATLAB® R2017b software. Three different cases are established to evaluated the modelled grid resilience during the grid-connected or the islanding of operations subject to adversed events. The simulated results provide the economical outage recovery that will maintain the grid resilience across the grid.