Ejemplo n.º 1
0
        /// <summary>
        ///     Factory method to create an agent
        ///     Call the Initialize method
        /// </summary>
        /// <returns></returns>
        public static PersonAgent CreateInstance(SymuEnvironment environment, CognitiveArchitectureTemplate template)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            var entity = new ActorEntity(environment.MainOrganization.ArtifactNetwork);
            var agent  = new PersonAgent(entity.EntityId, environment, template);

            agent.Initialize();
            return(agent);
        }
Ejemplo n.º 2
0
        public void AddPerson(PersonAgent newPerson)
        {
            if (newPerson == null)
            {
                throw new ArgumentNullException(nameof(newPerson));
            }

            // this new person is member of the group
            newPerson.GroupId = AgentId;
            ActorOrganization.CreateInstance(Environment.MainOrganization.ArtifactNetwork.ActorOrganization, newPerson.AgentId, AgentId);
            // All the members of this group have interactions
            var actorIds = Environment.MainOrganization.ArtifactNetwork.ActorOrganization.SourcesFilteredByTarget(AgentId).ToList();

            actorIds.ForEach(actorId => ActorActor.CreateInstance(Environment.MainOrganization.ArtifactNetwork.ActorActor, actorId, newPerson.AgentId));
        }
Ejemplo n.º 3
0
        public override void SetAgents()
        {
            base.SetAgents();

            for (var i = 0; i < ExampleMainOrganization.GroupsCount; i++)
            {
                var group = GroupAgent.CreateInstance(this);
                for (var j = 0; j < ExampleMainOrganization.WorkersCount; j++)
                {
                    var actor = PersonAgent.CreateInstance(this,
                                                           MainOrganization.Templates.Human);
                    group.AddPerson(actor);
                    SetAgentKnowledge(actor, ExampleMainOrganization.ArtifactNetwork.Knowledge.GetEntityIds().ToList(), i);
                    SetAgentTasks(actor, ExampleMainOrganization.ArtifactNetwork.Task.GetEntityIds().ToList(), i);
                }
            }
        }