Demand-side management (DSM) has an important role in the optimization of energy utilization that aims to reduce the energy consumption and to increase the efficiency of the electrical distribution system. This paper presents a methodology for the optimization and control of shifting loads in a power distribution grid. A mixed integer non-linear programming model including variations on the spot price is presented. Moreover, a semidefinite relaxation is presented which allows to obtain a boundary of the problem. An integer solution is obtained by using a rounding algorithm. The paper has a threefold contribution: the use of group theory as a simple concept for designing algorithms, a general model which includes some stochastic behavior of the spot prices, and a semidefinite relaxation which can be solved efficiently. A numerical simulation in cvx/matlab complements the analysis and demonstrates the advantages of the proposed methodology to minimize customer electricity bills and reduce peak power demand.