  Let $V$ be a real algebraic variety with singularities and $f$ be a real
polynomial non-negative on $V$. Assume that the regular locus of $V$ is dense
in $V$ by the usual topology. Using Hironaka's resolution of singularities and
Demmel--Nie--Powers' Nichtnegativstellensatz, we obtain a sum of squares-based
representation that characterizes the non-negativity of $f$ on $V$. This
representation allows us to build up exact semidefinite relaxations for
polynomial optimization problems whose optimal solutions are possibly
singularities of the constraint sets.
