Energy Markets and Responsive Grids: Modeling, Control, and Optimization