Methods for Optimal Microgrid Management