static double DeltaRemove(CLOPECluster cluster, List<int> transaction, double r) { int squareNew = cluster.Square - transaction.Count; int widthNew = cluster.Width; for (int i = 0; i < transaction.Count; i++) if (cluster.Occ[transaction[i]] == 1) widthNew--; return squareNew * (cluster.Size - 1) / Math.Pow(widthNew, r) - cluster.Square * cluster.Size / Math.Pow(cluster.Width, r); }
static double DeltaAdd(CLOPECluster cluster, List<int> transaction, double r) { if (cluster == null) return transaction.Count / Math.Pow(transaction.Count, r); int squareNew = cluster.Square + transaction.Count; int widthNew = cluster.Width; for (int i = 0; i < transaction.Count; i++) if (!cluster.Occ.ContainsKey(transaction[i])) widthNew++; return squareNew * (cluster.Size + 1) / Math.Pow(widthNew, r) - cluster.Square * cluster.Size / Math.Pow(cluster.Width, r); }