diversification function

Function to compute diversification as a constraint