void PlaceIntoCluster(ITransaction t) { CheckingForAtLeastOneEmptyCluster(); ICluster bestCluster = BestClusterSearch(t, null); bestCluster.Add(t); clusterKeys.Add(bestCluster); }
bool SpecifyClusterForTransactions(int index) { var t = transactions[index]; var currentCluster = clusterKeys[index]; ICluster bestCluster = BestClusterSearch(t, currentCluster, currentCluster.GetRemCost(t)); if (bestCluster != currentCluster) { currentCluster.Remove(t); bestCluster.Add(t); clusterKeys[index] = bestCluster; return(true); } return(false); }
/// <summary> /// simulation of active work with the cluster /// </summary> /// <param name="cluster"></param> /// <param name="i"></param> private void _workWithClusterData(ICluster <int> cluster, int i) { int tempItem = 0; for (var j = 0; j < 2500; j++) { cluster.Add(i, i * j); if (cluster.ContainsKey(i + j)) { tempItem += cluster[i + j]; } } foreach (var item in cluster) { tempItem += item.Value; } }