Optimization For Energy Management In The Community Microgrids