Beispiel #1
0
        public void UpdateForgettingKnowledgeTest()
        {
            var forgettingBits = new float[] { 1 };
            var forgetting     = new ActorKnowledge(_agentId, _knowledge.EntityId, forgettingBits, 0, -1);

            InitializeModel(true, 0);
            _forgettingModel.ForgettingExpertise.Add(forgetting);
            // working on the index 0 today
            var workingBits = new byte[] { 0 };

            _forgettingModel.UpdateForgettingProcess(new AgentId(2, 1), workingBits);
            // ForgettingBits should not be updated because the KnowledgeId is not the same
            Assert.AreEqual(1, forgetting.GetKnowledgeBit(0));
        }
Beispiel #2
0
        /// <summary>
        ///     Simulate the work on a specific task
        /// </summary>
        /// <param name="task"></param>
        public virtual float WorkOnTask(SymuTask task)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            float timeSpent;

            if (Schedule.Type == TimeStepType.Intraday)
            {
                timeSpent = Math.Min(Environment.MainOrganization.Models.Intraday, Capacity.Actual);
            }
            else
            {
                timeSpent = Cognitive.TasksAndPerformance.TasksLimit.LimitSimultaneousTasks
                            // Mono tasking
                    ? Math.Min(task.Weight, Capacity.Actual)
                            // Multi tasking
                    : Math.Min(task.Weight / 2, Capacity.Actual);
            }

            timeSpent      = Math.Min(task.WorkToDo, timeSpent);
            task.WorkToDo -= timeSpent;
            if (task.WorkToDo < Tolerance)
            {
                SetTaskDone(task);
            }
            else
            {
                UpdateTask(task);
            }

            // As the agent work on task that requires knowledge, the agent can't forget the associate knowledge today
            ForgettingModel.UpdateForgettingProcess(task.KnowledgesBits);

            Capacity.Decrement(timeSpent);
            return(timeSpent);
        }