コード例 #1
0
        private ConfigurationRunPropertiesProcessed CalculateConfigurationProperties(IEnumerable <ConfigurationRunProperties> runs)
        {
            double durationBest = double.MaxValue, durationWorst = 0, duration = 0, ineffBest = double.MaxValue, ineffWorst = 0, ineff = 0;

            foreach (var run in runs)
            {
                var currentDuration = run.Duration;
                CalculateDurations(currentDuration, ref durationBest, ref durationWorst, ref duration);

                var currentIneff = run.InefficiencyTime;
                CalculateInefficiency(currentIneff, ref ineffBest, ref ineffWorst, ref ineff);
            }

            var count = runs.Count();

            return(new ConfigurationRunPropertiesProcessed
            {
                Id = 0,
                Configuration = new Configuration
                {
                    Id = runs.First().Configuration.Id,
                    Name = runs.First().Configuration.Name
                },
                Duration = duration / count,
                DurationBest = durationBest,
                DurationWorst = durationWorst,
                InefficiencyTime = ineff / count,
                InefficiencyTimeBest = ineffBest,
                InefficiencyTimeWorst = ineffWorst,
                Cost = runs.First().Cost,
                Procedures = _proceduresService.Combine(runs.Select(x => x.Procedures)),
                Resources = _resourcesService.Combine(runs.Select(x => x.Resources))
            });
        }