Intelligent Optimizations of Energy Storage Systems for Microgrids