Beispiel #1
0
        /// <summary>
        ///     Finalize all the agent's cognitive models
        /// </summary>
        protected override void FinalizeModels()
        {
            base.FinalizeModels();
            if (KnowledgeModel.On)
            {
                KnowledgeModel.InitializeExpertise(Schedule.Step);
                foreach (var knowledgeId in KnowledgeModel.Expertise.Select(x => x.Target))
                {
                    BeliefsModel.AddBeliefFromKnowledgeId(knowledgeId);
                }
            }

            if (BeliefsModel.On)
            {
                BeliefsModel.InitializeBeliefs();
            }
        }
        public void CheckBeliefTest1()
        {
            float mandatoryCheck = 0;
            float requiredCheck  = 0;
            byte  mandatoryIndex = 0;
            byte  requiredIndex  = 0;

            _murphy.On = true;
            _beliefsModel.Entity.On = true;
            _beliefsModel.AddBelief(_belief.EntityId, BeliefLevel.NeitherAgreeNorDisagree);
            _beliefsModel.InitializeBeliefs();
            // Force beliefBits
            _beliefsModel.SetBelief(_belief.EntityId, 0, 1);
            _belief.Weights.SetBit(0, 1);
            _murphy.CheckBelief(_belief, _taskBits, _actorBelief, ref mandatoryCheck, ref requiredCheck,
                                ref mandatoryIndex,
                                ref requiredIndex);
            Assert.AreEqual(1, mandatoryCheck);
            Assert.AreEqual(1, requiredCheck);
        }
Beispiel #3
0
 public void InitializeBeliefTest()
 {
     _cognitiveArchitecture.KnowledgeAndBeliefs.HasInitialBelief = false;
     _beliefsModel.InitializeBeliefs();
     Assert.IsTrue(Network.ActorBelief.ExistsSource(_agentId));
 }