  In this article we present a unified treatment for obtaining bounds on the
potential energy of codes in the general context of polynomial metric spaces
(PM-spaces). The lower bounds we derive via the linear programming (LP)
techniques of Delsarte and Levenshtein are universally optimal in the sense
that they apply to a broad class of energy functionals and, in general, cannot
be improved for the specific subspace. Tests are presented for determining
whether these universal lower bounds (ULB) can be improved on larger spaces.
Our ULBs are applicable on the Euclidean sphere, infinite projective spaces, as
well as Hamming and Johnson spaces. Asymptotic results for the ULB for the
Euclidean spheres and the binary Hamming space are derived for the case when
the cardinality and dimension of the space grow large in a related way. Our
results emphasize the common features of the Levenshtein's universal upper
bounds for the cardinality of codes with given separation and our ULBs for
energy. We also introduce upper bounds for the energy of designs in PM-spaces
and the energy of codes with given separation.
