public static void ComputeDayWeights() { var wH = ApplicationSettings.Instance.HistoricWeight; if (wH < 0) { throw new HelperClasses.LibraryException("The value of historic weight is {0} but it must be a positive value.", wH.ToString()); } var D = ApplicationSettings.Instance.HistoryDaysCount; Days = new StoneDay[D]; for (int d = 0; d < D; d++) { Days[d] = new StoneDay(d); } if (wH == 1) { for (int d = 0; d < D; d++) { Days[d].Weight = 1 / wH; } } else { Days[D - 1].Weight = (1 - wH) / (1 - Math.Pow(wH, D)); for (int d = D - 2; d >= 0; d--) { Days[d].Weight = Math.Pow(wH, D - 1 - d) * Days[D - 1].Weight; } } }
public bool IsGroupMember(StoneGroup group, StoneDay day) { return ( DB .NewContext() .GroupClusterHistories .Count(x => x.Day == day.Number && x.GroupNumber == group.Number && x.ClusterPrefix == this.Prefix) > 0 ); }