This book brings together emerging objectives and paradigms in the control of both AC and DC microgrids; further, it facilitates the integration of renewable-energy and distribution systems through localization of generation, storage and consumption. The control objectives in a microgrid are addressed through the hierarchical control structure. After providing a comprehensive survey on the state of the art in microgrid control, the book goes on to address the most recent control schemes for both AC and DC microgrids, which are based on the distributed cooperative control of multi-agent systems. The cooperative control structure discussed distributes the co-ordination and optimization tasks across all distributed generators. This does away with the need for a central controller, and the control system will not collapse in response to the outage of a single unit. This avoids adverse effects on system flexibility and configurability, as well as the reliability concerns in connection with single points of failure that arise in traditional, centralized microgrid control schemes. Rigorous proofs develop each control methodology covered in the book, and simulation examples are provided to justify all of the proposed algorithms. Given its extensive yet self-contained content, the book offers a comprehensive source of information for graduate students, academic researchers, and practicing engineers working in the field of microgrid control and optimization.