Ejemplo n.º 1
0
        /// <summary>
        ///     Add an agentId's beliefs
        ///     using the beliefLevel
        /// </summary>
        /// <param name="beliefId"></param>
        /// <param name="beliefLevel"></param>
        public void AddBelief(IAgentId beliefId, BeliefLevel beliefLevel)
        {
            if (!On)
            {
                return;
            }

            ActorBelief.CreateInstance(_actorBeliefNetwork, _agentId, beliefId, beliefLevel);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Agent don't have still this belief, it's time to learn a new one
        /// </summary>
        /// <param name="beliefId"></param>
        /// <param name="beliefLevel"></param>
        public void LearnNewBelief(IAgentId beliefId, BeliefLevel beliefLevel)
        {
            if (_actorBeliefNetwork.Exists(_agentId, beliefId))
            {
                return;
            }

            ActorBelief.CreateInstance(_actorBeliefNetwork, _agentId, beliefId, beliefLevel);
            InitializeBeliefs(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Add an agentId's beliefs based on a knowledgeId to the network
        ///     using the beliefLevel
        /// </summary>
        /// <param name="knowledgeId"></param>
        /// <param name="beliefLevel"></param>
        public void AddBeliefFromKnowledgeId(IAgentId knowledgeId, BeliefLevel beliefLevel)
        {
            if (!On)
            {
                return;
            }

            var belief = GetBeliefFromKnowledgeId(knowledgeId);

            if (belief == null)
            {
                throw new NullReferenceException(nameof(belief));
            }

            ActorBelief.CreateInstance(_actorBeliefNetwork, _agentId, belief.EntityId, beliefLevel);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Initialize AgentBelief with a stochastic process based on the agent belief level
        /// </summary>
        /// <param name="actorBelief">agentBelief to initialize</param>
        /// <param name="neutral">if !HasInitialBelief, then a neutral initialization is done</param>
        public void InitializeActorBelief(ActorBelief actorBelief, bool neutral)
        {
            if (actorBelief == null)
            {
                throw new ArgumentNullException(nameof(actorBelief));
            }

            var belief = GetBelief(actorBelief.Target);

            if (belief == null)
            {
                throw new NullReferenceException(nameof(belief));
            }

            var level      = neutral ? BeliefLevel.NoBelief : actorBelief.BeliefLevel;
            var beliefBits = belief.InitializeBits(_model, level);

            actorBelief.SetBeliefBits(beliefBits);
        }