docs: public void cluster (ArrayList<Instance> insts) {
  
  		
  		System.out.println("Initial centers");
  		for(int i=0;i<k;i++){
  			assignedClusters[i] = new ArrayList<Instance>();
  		}
  		for(int i=0;i<insts.size();i++){
  			assignedClusters[i%k].add(insts.get(i));
  		}
  		for(int i=0;i<k;i++){
  			centroids[i] = calculateCentroid(assignedClusters[i]);
  			clusterQualities[i] = calculateClusterQuality(assignedClusters[i], centroids[i]);
  		}
  		
  		
  
  		for (int numChanged = 0, itr = 0; (numChanged > 0) || (itr == 0); ++itr) {
  
  			numChanged = 0;
  
  			while (true) {
  
  				int numReassigned = doBatchKmeans();
  
  				System.out.println("After an iteration of Batch K-Means, " +
  						numReassigned + " documents were moved.");
  
  				double oldQuality = 0.0;
  				double newQuality = 0.0;
  
  				for (int b = 0; b < this.centroids.length; ++b) {
  					oldQuality += this.clusterQualities[b];
  					newQuality += this.newQualities[b];
  				}
  
  				double qualityDelta = oldQuality - newQuality;
  
  				System.out.println("Change in quality is: " + qualityDelta);
  
  				if (qualityDelta < this.TOL) {
  					System.out.println(
  							"Benefit of change is below tolerance... Switching to incremental...\n");
  
  					break;
  				}
  
  				if (numReassigned == 0) {
  					System.out.println(
  							"Batch K-Means has made no changes! Switching to incremental...\n");
  
  					break;
  				}
  
  				// We like the new results. Let's make them authoritative
  				for (int kk = 0; kk < this.assignedClusters.length; ++kk) {
  					this.assignedClusters[kk] = this.newClusters[kk];
  					this.centroids[kk] = this.newCentroids[kk];
  					this.clusterQualities[kk] = this.newQualities[kk];
  				}
  
  				numChanged = numReassigned;    // Record the fact we made a change!
  			}
  
  			double qual = 0.0;
  
  			for (int i = 0; i < this.clusterQualities.length; ++i) {
  				qual += this.clusterQualities[i];
  			}
  
  			System.out.println("Quality of partition generated by Batch K-Means: " +
  					qual);
  		}
  
  		System.out.println("Batch K-Means Complete!\n");
  		
  	}