Cluster algorithm which minimizes a distance while fulfilling a constraint
I found this article on "Clustering with Constraints" to be a helpful resource to what you're talking about:

Credit:
Clustering with Constraints
Incorporating Prior Knowledge
into Clustering
Adapted from a Tutorial of Sugato Basu and Ian Davidson (SDM 2005)