The space of variables $D_{ij}$ satisfying the constraints of a metric form a polytope (or really a cone, since any scalar multiple satisfies it as well). In general, integrating functions over such objects can be (computationally) hard. [Here's an article][1] that talks about this in more detail (for the specific case of integrating polynomials over a simplex). Caveats: * you're integrating over a cone, not a polytope: maybe that makes things easier (although I doubt it) * you're integrating a very specific kind of function and maybe some specific tricks work for that case. * if you're willing to get an approximate answer, I'd suspect that something might be possible [1]: http://arxiv.org/pdf/0809.2083v3