private void SetAgents(int count)
        {
            var agentIds = new List <IAgentId>();

            for (var i = 0; i < count; i++)
            {
                var agent = TestCognitiveAgent.CreateInstance(Environment);
                agent.Cognitive.InteractionPatterns.IsPartOfInteractionSphere = true;
                agent.State = AgentState.Started;
                agentIds.Add(agent.AgentId);
            }

            for (var i = 0; i < count; i++)
            {
                var agentId1 = agentIds[i];
                // interaction are undirected
                for (var j = i + 1; j < count; j++)
                {
                    var agentId2 = agentIds[j];
                    ActorActor.CreateInstance(Environment.MainOrganization.ArtifactNetwork.ActorActor, agentId1, agentId2);
                }
            }

            Environment.InitializeInteractionSphere();
        }
Esempio n. 2
0
        public void Initialize()
        {
            // Entities
            MainOrganization.Models.SetOn(1);
            _result     = new KnowledgeAndBeliefResults(Environment);
            _knowledge  = new Knowledge(MainOrganization.ArtifactNetwork, MainOrganization.Models, "1", 1);
            _knowledge1 = new Knowledge(MainOrganization.ArtifactNetwork, MainOrganization.Models, "2", 1);
            _belief     = _knowledge.AssociatedBelief;
            _belief1    = _knowledge1.AssociatedBelief;

            Environment.SetOrganization(MainOrganization);
            Simulation.Initialize(Environment);


            // Agents
            _agent = TestCognitiveAgent.CreateInstance(Environment);
            _agent.Start();
            _agent1 = TestCognitiveAgent.CreateInstance(Environment);
            _agent1.Start();
        }