示例#1
0
        public virtual void DiffInPercent(DblArray targeted, DblArray planned)
        {
            Debug.Assert(targeted.Elements != null);
            Debug.Assert(planned.Elements != null);
            Debug.Assert(targeted.Elements.Length == planned.Elements.Length);

            Clear();

            if (Elements == null || Elements.Length != targeted.Elements.Length)
            {
                CreateArray(targeted.Elements.Length);
            }
            int count_not_zero_item = 0;

            for (int i = 0; i < targeted.Elements.Length; i++)
            {
                Elements[i] = 0;
                if (targeted.Elements[i] != 0)
                {
                    Elements[i] = Round((double)(((100 / targeted.Elements[i]) * planned.Elements[i]) - 100));
                    count_not_zero_item++;
                    Sum    += Elements[i];
                    AbsSum += Math.Abs(Elements[i]);
                }
            }
            if (count_not_zero_item > 0)
            {
                Average    = Round(Sum / count_not_zero_item);
                AbsAverage = Round(AbsSum / count_not_zero_item);
            }
//            Sum = Math.Round(Sum);
//            AbsSum = Math.Round(AbsSum);
//            Average = Math.Round(Average);
//            AbsAverage = Math.Round(AbsAverage);
        }
示例#2
0
 public DblArray Sub(DblArray arr, DblArray res)
 {
     for (int i = 0; i < Elements.Length; i++)
     {
         res.Elements[i] = Elements[i] - arr.Elements[i];
     }
     res.Calculate();
     return(res);
 }
 public void SetDatas(DblArray datas)
 {
     _datas = datas;
 }
        public void AssignCashDeskInfo(CashDeskPlanningInfo cashdeskinfo, DateTime date)
        {
            _CashDeskInfo = cashdeskinfo;

            TargetedCashDeskUnits.Clear();

            if (CashDeskInfo != null)
            {
                AvgCashDeskAmount = CashDeskInfo.CashDeskAmount;
                MinPercent = CashDeskInfo.MinimumPresence;
                MaxPercent = CashDeskInfo.MaximumPresence;

                DateCashDeskPeoplePerHour datecashdesk = CashDeskInfo.GetDayCashDeskData(date);
                TargetedCashDeskUnits = new DblArray50MinMax(24, MinPercent, MaxPercent);
                if (datecashdesk != null)
                {
                    //Random n = new Random(5000);

                    for (int i = 0; i < 24; i++)
                    {
                        if (AvgCashDeskAmount != 0)
                        {
                            //TargetedCashDeskUnits.Elements[i] = n.NextDouble () / AvgCashDeskAmount;
                            TargetedCashDeskUnits.Elements[i] = datecashdesk.GetReceipt(i) / AvgCashDeskAmount;

                            // _GetPeoplePerHour(datecashdesk.GetReceipt(i), AvgCashDeskAmount);
                        }
                        else
                        {
                            TargetedCashDeskUnits.Elements[i] = 0;
                        }
                    }
                }

                TargetedCashDeskUnits.Calculate();
            }
        }
示例#5
0
 public DblArray Sub(DblArray arr, DblArray res)
 {
     for (int i = 0; i < Elements.Length; i++)
     {
         res.Elements[i] = Elements[i] - arr.Elements[i];
     }
     res.Calculate();
     return res;
 }
示例#6
0
        public virtual void DiffInPercent(DblArray targeted, DblArray planned)
        {
            Debug.Assert(targeted.Elements != null);
            Debug.Assert(planned.Elements != null);
            Debug.Assert(targeted.Elements.Length == planned.Elements.Length);

            Clear();

            if (Elements == null || Elements.Length != targeted.Elements.Length)
                CreateArray(targeted.Elements.Length);
            int count_not_zero_item = 0;
            for (int i = 0; i < targeted.Elements.Length; i++)
            {
                Elements[i] = 0;
                if (targeted.Elements[i] != 0)
                {
                    Elements[i] = Round((double)(((100 / targeted.Elements[i]) * planned.Elements[i]) - 100));
                    count_not_zero_item++;
                    Sum += Elements[i];
                    AbsSum += Math.Abs(Elements[i]);
                }
            }
            if (count_not_zero_item > 0)
            {
                Average = Round(Sum / count_not_zero_item);
                AbsAverage = Round(AbsSum / count_not_zero_item);
            }
            //            Sum = Math.Round(Sum);
            //            AbsSum = Math.Round(AbsSum);
            //            Average = Math.Round(Average);
            //            AbsAverage = Math.Round(AbsAverage);
        }