public override void SetResults() { if (!Environment.AgentNetwork.Any()) { return; } var result = new BlockerResult(); // Blockers from agents //foreach (var blockerResult in environment.WhitePages.AllAgents().Where(agent => agent.Blockers != null) // .Select(x => x.Blockers.Result)) //{ // result.InProgress += blockerResult.InProgress; // result.Done += blockerResult.Done; // result.ExternalHelp += blockerResult.ExternalHelp; // result.Guess += blockerResult.Guess; // result.InternalHelp += blockerResult.InternalHelp; // result.Search += blockerResult.Search; // result.Cancelled += blockerResult.Cancelled; //} // alive agents HandleResults(Environment.AgentNetwork.AllCognitiveAgents().Where(agent => agent.TaskProcessor != null) .Select(x => x.TaskProcessor.TasksManager.BlockerResult), result); // stopped agents HandleResults(Environment.AgentNetwork.StoppedAgents.OfType <CognitiveAgent>() .Where(agent => agent.TaskProcessor != null) .Select(x => x.TaskProcessor.TasksManager.BlockerResult), result); Results.TryAdd(Environment.Schedule.Step, result); }
private static void HandleResults(IEnumerable <BlockerResult> blockerResults, BlockerResult result) { foreach (var blockerResult in blockerResults) { result.InProgress += blockerResult.InProgress; result.Done += blockerResult.Done; result.ExternalHelp += blockerResult.ExternalHelp; result.Guess += blockerResult.Guess; result.InternalHelp += blockerResult.InternalHelp; result.Search += blockerResult.Search; result.Cancelled += blockerResult.Cancelled; } }