/// <summary> /// Missing knowledge is guessed or searched in agent's databases /// The worker possibly complete the task incorrectly /// and learn by doing /// </summary> /// <param name="task"></param> /// <param name="knowledgeId"></param> /// <param name="knowledgeBit"></param> /// <param name="blocker"></param> /// <param name="resolution">guessing or searched</param> public void RecoverBlockerIncompleteKnowledgeByGuessing(SymuTask task, Blocker blocker, IAgentId knowledgeId, byte knowledgeBit, BlockerResolution resolution) { if (task is null) { throw new ArgumentNullException(nameof(task)); } RecoverBlockerIncompleteByGuessing(task, blocker, Environment.MainOrganization.Murphies.IncompleteKnowledge, resolution); if (task.Incorrectness == ImpactLevel.Blocked) { return; } LearningModel.LearnByDoing(knowledgeId, knowledgeBit, Schedule.Step); switch (blocker) { // No blocker, it's a required knowledgeBit case null: task.KnowledgesBits.RemoveFirstRequired(knowledgeId); // Blockers Management - no blocker has been created break; // blocker, it's a mandatory knowledgeBit default: task.KnowledgesBits.RemoveFirstMandatory(knowledgeId); break; } }
/// <summary> /// Missing belief is guessed /// The worker possibly complete the task incorrectly /// and learn by doing /// </summary> /// <param name="task"></param> /// <param name="blocker"></param> /// <param name="murphy"></param> /// <param name="resolution"></param> public void RecoverBlockerIncompleteByGuessing(SymuTask task, Blocker blocker, MurphyIncomplete murphy, BlockerResolution resolution) { if (task is null) { throw new ArgumentNullException(nameof(task)); } if (murphy == null) { throw new ArgumentNullException(nameof(murphy)); } var impact = murphy.NextGuess(); if (impact > task.Incorrectness) { task.Incorrectness = impact; } if (task.Incorrectness == ImpactLevel.Blocked) { //Agent decide to cancel the task TaskProcessor.Cancel(task); } else { task.Weight *= murphy.NextImpactOnTimeSpent(); if (blocker != null) { task.Recover(blocker, resolution); } } }