コード例 #1
0
        /// <summary>
        ///     Initialize influence model :
        ///     update networkInfluences
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="cognitiveArchitecture"></param>
        /// <param name="whitePages"></param>
        /// <param name="beliefsModel"></param>
        /// <param name="model"></param>
        public InfluenceModel(InfluenceModelEntity entity, CognitiveArchitecture cognitiveArchitecture,
                              AgentNetwork whitePages, BeliefsModel beliefsModel, RandomGenerator model)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (cognitiveArchitecture == null)
            {
                throw new ArgumentNullException(nameof(cognitiveArchitecture));
            }

            // In case of turning On the model during the simulation, champs must be initialized
            _whitePages   = whitePages ?? throw new ArgumentNullException(nameof(whitePages));
            _beliefsModel = beliefsModel;
            _model        = model;

            On = cognitiveArchitecture.KnowledgeAndBeliefs.HasBelief && entity.IsAgentOn();
            if (!On)
            {
                return;
            }

            if (cognitiveArchitecture.InternalCharacteristics.CanInfluenceOrBeInfluence && On)
            {
                Influenceability = NextInfluenceability(cognitiveArchitecture.InternalCharacteristics);
                Influentialness  = NextInfluentialness(cognitiveArchitecture.InternalCharacteristics);
            }
            else
            {
                Influenceability = 0;
                Influentialness  = 0;
            }
        }
コード例 #2
0
        /// <summary>
        ///     Initialize Knowledge model :
        ///     update NetworkKnowledges
        /// </summary>
        /// <param name="agentId"></param>
        /// <param name="entity"></param>
        /// <param name="cognitiveArchitecture"></param>
        /// <param name="network"></param>
        /// <param name="model"></param>
        public KnowledgeModel(IAgentId agentId, KnowledgeModelEntity entity,
                              CognitiveArchitecture cognitiveArchitecture,
                              GraphMetaNetwork network, RandomGenerator model)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (network == null)
            {
                throw new ArgumentNullException(nameof(network));
            }

            if (cognitiveArchitecture == null)
            {
                throw new ArgumentNullException(nameof(cognitiveArchitecture));
            }

            On                     = entity.IsAgentOn();
            _agentId               = agentId;
            _knowledgeNetwork      = network.Knowledge;
            _actorKnowledgeNetwork = network.ActorKnowledge;
            _knowledgeAndBeliefs   = cognitiveArchitecture.KnowledgeAndBeliefs;
            _messageContent        = cognitiveArchitecture.MessageContent;
            _model                 = model;
        }
コード例 #3
0
        /// <summary>
        /// </summary>
        /// <param name="agentId"></param>
        /// <param name="models"></param>
        /// <param name="knowledgeNetwork"></param>
        /// <param name="entityKnowledgeNetwork">ActorKnowledgeNetwork, ResourceKnowledgeNetwork depending on the agent</param>
        /// <param name="cognitiveArchitecture"></param>
        /// <param name="model"></param>
        /// <param name="randomLevel"></param>
        public LearningModel(IAgentId agentId, MainOrganizationModels models, OneModeNetwork knowledgeNetwork,
                             TwoModesNetwork <IEntityKnowledge> entityKnowledgeNetwork,
                             CognitiveArchitecture cognitiveArchitecture, RandomGenerator model, byte randomLevel)
        {
            if (models == null)
            {
                throw new ArgumentNullException(nameof(models));
            }

            if (cognitiveArchitecture == null)
            {
                throw new ArgumentNullException(nameof(cognitiveArchitecture));
            }

            models.Learning.CopyTo(this);
            _agentId                 = agentId;
            TasksAndPerformance      = cognitiveArchitecture.TasksAndPerformance;
            _internalCharacteristics = cognitiveArchitecture.InternalCharacteristics;
            _knowledgeNetwork        = knowledgeNetwork;
            _entityKnowledgeNetwork  =
                entityKnowledgeNetwork ?? throw new ArgumentNullException(nameof(entityKnowledgeNetwork));
            _randomLevel = randomLevel;
            if (!cognitiveArchitecture.InternalCharacteristics.CanLearn ||
                !cognitiveArchitecture.KnowledgeAndBeliefs.HasKnowledge)
            {
                // Agent is not concerned by this model
                On = false;
            }

            _model = model;
        }
コード例 #4
0
ファイル: ForgettingModel.cs プロジェクト: lmorisse/Symu
        public ForgettingModel(IAgentId agentId, TwoModesNetwork <IEntityKnowledge> entityKnowledgeNetwork,
                               CognitiveArchitecture cognitive, ForgettingModelEntity entity, bool knowledgeModelOn, byte randomLevel)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (cognitive is null)
            {
                throw new ArgumentNullException(nameof(cognitive));
            }

            _agentId = agentId;
            _entityKnowledgeNetwork =
                entityKnowledgeNetwork ?? throw new ArgumentNullException(nameof(entityKnowledgeNetwork));
            InternalCharacteristics = cognitive.InternalCharacteristics;
            _randomLevel            = randomLevel;

            entity.CopyTo(this);
            if (!knowledgeModelOn || !cognitive.KnowledgeAndBeliefs.HasKnowledge || !InternalCharacteristics.CanForget)
            {
                // If KnowledgeModel Off or has no knowledge, there is no knowledge to forget
                // Agent is not concerned by this model
                On = false;
            }
        }
コード例 #5
0
        public void CopyTo(CognitiveArchitecture cognitive)
        {
            if (cognitive is null)
            {
                throw new ArgumentNullException(nameof(cognitive));
            }

            KnowledgeAndBeliefs.CopyTo(cognitive.KnowledgeAndBeliefs);
            InternalCharacteristics.CopyTo(cognitive.InternalCharacteristics);
            TasksAndPerformance.CopyTo(cognitive.TasksAndPerformance);
            MessageContent.CopyTo(cognitive.MessageContent);
            InteractionCharacteristics.CopyTo(cognitive.InteractionCharacteristics);
            InteractionPatterns.CopyTo(cognitive.InteractionPatterns);
        }
コード例 #6
0
ファイル: ActorTaskModel.cs プロジェクト: lmorisse/Symu
        /// <summary>
        ///     Initialize influence model :
        ///     update networkInfluences
        /// </summary>
        /// <param name="agentId"></param>
        /// <param name="cognitiveArchitecture"></param>
        /// <param name="network"></param>
        public ActorTaskModel(IAgentId agentId, CognitiveArchitecture cognitiveArchitecture, GraphMetaNetwork network)
        {
            if (cognitiveArchitecture == null)
            {
                throw new ArgumentNullException(nameof(cognitiveArchitecture));
            }

            if (network == null)
            {
                throw new ArgumentNullException(nameof(network));
            }

            _agentId          = agentId;
            _actorTaskNetwork = network.ActorTask;
            _taskNetwork      = network.Task;
        }
コード例 #7
0
        /// <summary>
        ///     Initialize Beliefs model :
        ///     update NetworkBeliefs
        /// </summary>
        /// <param name="agentId"></param>
        /// <param name="entity"></param>
        /// <param name="cognitiveArchitecture"></param>
        /// <param name="network"></param>
        /// <param name="model"></param>
        public BeliefsModel(IAgentId agentId, BeliefModelEntity entity, CognitiveArchitecture cognitiveArchitecture,
                            GraphMetaNetwork network, RandomGenerator model)
        {
            if (network == null)
            {
                throw new ArgumentNullException(nameof(network));
            }

            if (cognitiveArchitecture == null)
            {
                throw new ArgumentNullException(nameof(cognitiveArchitecture));
            }

            _agentId             = agentId;
            _beliefNetwork       = network.Belief;
            _actorBeliefNetwork  = network.ActorBelief;
            _knowledgeAndBeliefs = cognitiveArchitecture.KnowledgeAndBeliefs;
            _messageContent      = cognitiveArchitecture.MessageContent;
            _model = model;
            Entity = entity ?? throw new ArgumentNullException(nameof(entity));
        }
コード例 #8
0
ファイル: ForgettingModel.cs プロジェクト: lmorisse/Symu
 public ForgettingModel(IAgentId agentId, TwoModesNetwork <IEntityKnowledge> entityKnowledgeNetwork,
                        CognitiveArchitecture cognitive, MainOrganizationModels models, byte randomLevel) :
     this(agentId, entityKnowledgeNetwork, cognitive, models?.Forgetting, models != null && models.Knowledge.On, randomLevel)
 {
 }