  In this paper, we address a key issue of designing architectures and
algorithms which generate optimal demand response in a decentralized manner for
a smart-grid consisting of several stochastic renewables and dynamic loads. By
optimal demand response, we refer to the demand response which maximizes the
utility of the agents connected to the smart-grid. By decentralized we refer to
the desirable case where neither the independent system operator (ISO) needs to
know the dynamics/utilities of the agents, nor do the agents need to have a
knowledge of the dynamics/utilities of other agents connected to the grid. The
communication between the ISO and agents is restricted to the ISO announcing a
pricing policy and the agents responding with their energy
generation/consumption bids in response to the pricing policy.
  We provide a complete solution for both the deterministic and stochastic
cases. It features a price iteration scheme that results in optimality of
social welfare. We also provide an optimal solution for the case where there is
a common randomness affecting and observed by all agents. This solution can be
computationally complex, and we pose approximations. For the more general
partially observed randomness case, we exhibit a relaxation that significantly
reduces complexity. We also provide an approximation strategy that leads to a
model predictive control (MPC) approach. Simulation results comparing the
resulting optimal demand response with the existing architectures employed by
the ISO illustrate the benefit in social welfare utility realized by our
scheme. To the best of the authors' knowledge, this is the first work of its
kind to explicitly mark out the optimal response of dynamic demand.
