Пример #1
0
        public void InvokeCDIStrategy()
        {
            // calculate the percentiles for the client metrics
            List <Metrics> clientIntervals = new List <Metrics>();

            foreach (Client client in _clients)
            {
                Metrics current = client.GetCDIIntervalData();
                if (current != null)
                {
                    clientIntervals.Add(current);
                }
            }
            _percentiles = new MetricPercentiles(clientIntervals);

            // construct the customer strategy
            //_iCdiStrategy = new CustomerPercentileStrategy(clientIntervals, Callback);
            //_iCdiStrategy.CalculateCDI();    // customer CDI not used

            // calculate the CDI for each client
            linq.CDI_Settings settings = GetCDISettings(_organizationAnalysis.ParentID);
            foreach (Client client in _clients)
            {
                client.InvokeCDIStrategy(_percentiles, settings);
            }
        }
Пример #2
0
        /// <summary> CDI1 </summary>
        public void InvokeCDIStrategy(MetricPercentiles clientPercentiles, linq.CDI_Settings weights)
        {
            _normalizedMetrics = clientPercentiles.Normalize(_rawMetrics);

            double result = 0;

            foreach (EMetrics metric in Enum.GetValues(typeof(EMetrics)))
            {
                double?value  = _normalizedMetrics.GetAsCDIPercentile(metric);
                double?weight = weights.GetWeight(metric);
                if (value.HasValue && weight.HasValue)
                {
                    result += value.Value * weight.Value;
                }
            }

            // square it to get a better distribution?
            _normalizedMetrics.CDI = _rawMetrics.CDI = (int)Math.Round(result);
        }
        public void CalculatePercentiles()
        {
            List <Metrics> clientIntervals = new List <Metrics>();
            int            i = 0;

            foreach (Client client in _clients)
            {
                Metrics interval = client._iCdiStrategy.RawMetrics;
                if (interval == null)
                {
                    continue;
                }

                Insert(i, interval);
                if (++i >= _clients.Count)
                {
                    break;
                }

                clientIntervals.Add(interval);
            }

            _percentiles = new MetricPercentiles(clientIntervals);
        }
Пример #4
0
 public void InvokeCDIStrategy(MetricPercentiles clientPercentiles, linq.CDI_Settings weights)
 {
     _iCdiStrategy.InvokeCDIStrategy(clientPercentiles, weights);
 }