예제 #1
0
        public void LearnTest0()
        {
            _learningModel.On = false;
            var realLearning = _learningModel.Learn(_knowledge.EntityId, 0, -1, 0, 0);

            Assert.AreEqual(0, _actorKnowledge.GetKnowledgeSum());
            Assert.AreEqual(0, realLearning);
        }
예제 #2
0
파일: Database.cs 프로젝트: lmorisse/Symu
        /// <summary>
        ///     Store the knowledge from a message of email type
        /// </summary>
        /// <param name="knowledgeId"></param>
        /// <param name="knowledgeBits"></param>
        /// <param name="maxRateLearnable"></param>
        /// <param name="step"></param>
        public void StoreKnowledge(IAgentId knowledgeId, Bits knowledgeBits, float maxRateLearnable, ushort step)
        {
            if (knowledgeId == null || knowledgeId.IsNull || knowledgeBits is null)
            {
                return;
            }

            InitializeKnowledge(knowledgeId, step);
            var agentKnowledge = GetKnowledge(knowledgeId);

            _learningModel.Learn(knowledgeBits, maxRateLearnable, agentKnowledge, step);
        }
예제 #3
0
        /// <summary>
        ///     each task allows to learn a little more about knowledge
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void AfterSetTaskDone(object sender, TaskEventArgs e)
        {
            // The learning is done randomly on the knowledgeBits
            var knowledgeBit = Knowledge.GetRandomBitIndex();
            // Agent is learning via email
            // We simplify here, we should send an email to ask for information to a database, then treat the reply
            // That is why we have to initialize a Bits
            var bits = new Bits(0);

            bits.InitializeWith0(Knowledge.Length);
            // The source has the maximum knowledge bit
            bits.SetBit(knowledgeBit, 1);
            LearningModel.Learn(Knowledge.EntityId, bits,
                                Environment.MainOrganization.Communication.Email.MaxRateLearnable,
                                Schedule.Step);
            // the information learned is stored in a wiki
            // not the total knowledge of the agent, it is tacit knowledge for the agent
            // wiki will be filled quicker by a non expert
            Wiki.StoreKnowledge(Knowledge.EntityId, bits, 1, Schedule.Step);
        }