Пример #1
0
        private void HandleCapacity()
        {
            float sum;
            float max;

            if (!Environment.AgentNetwork.Any())
            {
                return;
            }

            if (Environment.Schedule.IsWorkingDay)
            {
                max = Environment.AgentNetwork.AllCognitiveAgents()
                      .Count(agent => agent.Cognitive.TasksAndPerformance.CanPerformTask);
                sum = Environment.AgentNetwork.AllCognitiveAgents()
                      .Where(agent => agent.Cognitive.TasksAndPerformance.CanPerformTask)
                      .Select(x => x.Capacity.Initial).Sum();
            }
            else
            {
                max = Environment.AgentNetwork.AllCognitiveAgents()
                      .Count(agent => agent.Cognitive.TasksAndPerformance.CanPerformTaskOnWeekEnds);
                sum = Environment.AgentNetwork.AllCognitiveAgents()
                      .Where(agent => agent.Cognitive.TasksAndPerformance.CanPerformTaskOnWeekEnds)
                      .Select(x => x.Capacity.Initial).Sum();
            }

            var density = new DensityStruct(sum, max, Environment.Schedule.Step);

            Capacity.Add(density);

            SumCapacity.Add(Capacity.Sum(x => x.ActualNumber));
        }