Optimizing the Smart Grid with Data and Analytics: Opportunities, Technologies, Applications and Challenges