Smart Energy Management for Smart Grid