public List <IEntitySpecification> Calculate(IEnumerable <IEntitySpecification> entitySpecifications, int countClusters, int countTry) { var isChanged = true; var ct = 0; _items = entitySpecifications.ToList(); _clusters = _clusterService.Init(countClusters).ToList(); _items = InitClustering(countClusters, 0).ToList(); Update(); while (isChanged && ct < countTry) { ++ct; isChanged = Assign(); Update(); } return(_items); }