  In this paper we develop a numerical method for solving a class of
optimization problems known as optimal location or quantization problems. The
target energy can be written either in terms of atomic measures and the
Wasserstein distance or in terms of weighted points and power diagrams
(generalized Voronoi diagrams). The latter formulation is more suitable for
computation. We show that critical points of the energy are centroidal power
diagrams, which are generalizations of centroidal Voronoi tessellations, and
that they can be approximated by a generalization of Lloyd's algorithm (Lloyd's
algorithm is a common method for finding centroidal Voronoi tessellations). We
prove that the algorithm is energy decreasing and prove a convergence theorem.
Numerical experiments suggest that the algorithm converges linearly. We
illustrate the algorithm in two and three dimensions using simple models of
optimal location and crystallization. In particular, we test a conjecture about
the optimality of the BCC lattice for a simplified model of block copolymers.
