示例#1
0
        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;
                }
            }
        }
示例#2
0
 public bool IsGroupMember(StoneGroup group, StoneDay day)
 {
     return
         (
         OfflineDB.GroupClusterHistories.Contains
         (
             new GroupClusterHistory(day.Number, group.Number, this.Prefix).ToBinaryValue()
         )
         );
 }