Clustering formulation using constraint optimization