/// <summary> /// цена вычитания транзакции /// </summary> /// <param name="t"></param> /// <param name="r"></param> /// <returns></returns> public static double DeltaRemove(Claster <T> cluster, Transaction <T> t, double r) { int widthNew = cluster.W; foreach (var item in t.SetOfObejct.Where(x => cluster.Occ(x) == 1)) { widthNew--; } return((cluster.Square - t.Length) * (cluster.Size - 1) / Math.Pow(widthNew, r) - cluster.Square * cluster.Size / Math.Pow(cluster.W, r)); }
/// <summary> /// цена добавления транзакции /// </summary> /// <param name="t"></param> /// <param name="r"></param> /// <returns></returns> public static double DeltaAdd1(Claster <T> cluster, Transaction <T> t, double r) { // для пустого кластера вычисляем вот так if (cluster == null) { return(t.Length / Math.Pow(t.Length, r)); } int widthNew = cluster.W; foreach (var item in t.SetOfObejct.Where(x => cluster.Occ(x) == 0)) { //if (cluster.Occ(item) == 0) widthNew++; } return((cluster.Square + t.Length) * (cluster.Size + 1) / Math.Pow(widthNew, r) - cluster.Square * cluster.Size / Math.Pow(cluster.W, r)); }