title: clustering using some constraints
body: <p>I am trying to cluster / assign few items (say 200 destinations) to some sales managers (say 50 sales managers) such that the overall distance to be traveled by the managers is least. I am using k-means clustering. The answer I get is least distances but the the number of destinations assigned is not very uniform. One sales mgr is getting 10 destinations while the other is getting only 1 and others in between.</p>
  
  <p>So I want to add a restriction that the maximum destination allowed should be say 6 so that no sales manager is getting more than 6 destinations. Any help on how to add this restriction?</p>
  
  <pre><code>D1=read.xlsx("brisbane.xlsx")
  km &lt;- kmeans(cbind(D1$lat, D1$lng), centers = 50,iter.max = 100000)
      scluster&lt;-km$cluster
      centers&lt;-km$centers
  out1 &lt;- cbind(D1, clusterNum = scluster)
  write.csv(out1,"brisbaneout.csv")
  write.csv(centers,"brisbanecenters.csv")
  </code></pre>