Optimal energy management of a micro-grid with renewable energy resources and demand response