Application of Artificial Intelligence in Microgrids