Smart Energy Management: A Computational Approach