Ejemplo n.º 1
0
 /// <summary>
 ///     Constructor with standard agent template
 ///     and with an existing IAgentId
 /// </summary>
 /// <param name="agentId"></param>
 /// <param name="environment"></param>
 protected ReactiveAgent(IAgentId agentId, SymuEnvironment environment)
 {
     AgentId     = agentId;
     Environment = environment ?? throw new ArgumentNullException(nameof(environment));
     Environment.AgentNetwork.AddAgent(this);
     State   = AgentState.NotStarted;
     Created = Schedule.Step;
 }
Ejemplo n.º 2
0
 private void SetUp(SymuEnvironment environment, MainOrganization organization)
 {
     Engine.SetEnvironment(environment);
     SetUpOrganization();
     Engine.Environment.SetOrganization(organization);
     //Intentionally after SetOrganization because Scenarii are Agents
     SetUpScenarii();
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Constructor of the agent
        /// </summary>
        /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
        protected ScenarioAgent(object parent, SymuEnvironment environment) : base(
                environment?.AgentNetwork.NextAgentId(Class), environment)
        {
            if (environment is null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

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

            var agent = new GroupAgent(environment);

            agent.Initialize();
            return(agent);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Initialize the engine, environment ready to launch the first step
        ///     Used in unit tests
        /// </summary>
        /// <param name="environment"></param>
        public void Initialize(SymuEnvironment environment)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            SetEnvironment(environment);
            PreIteration();
            environment.PreStep();
            environment.Messages.WaitingToClearAllMessages();
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Factory method to create an agent
        ///     Call the Initialize method
        /// </summary>
        /// <returns></returns>
        public static ScenarioAgent CreateInstance(object parent, SymuEnvironment environment)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            var agent = new ScenarioAgent(parent, environment);

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

            var agent = new LearnAgent(environment, template);

            agent.Initialize();
            return(agent);
        }
Ejemplo n.º 8
0
        public static TestCognitiveAgent CreateInstance(byte classId, SymuEnvironment environment)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            var agent = new TestCognitiveAgent(environment.AgentNetwork.NextAgentId(classId), environment);

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

            var agent = new TaskBasedScenario(environment);

            agent.Initialize();
            return(agent);
        }
Ejemplo n.º 10
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.º 11
0
        /// <summary>
        /// </summary>
        /// <param name="environment"></param>
        /// <param name="organization"></param>
        protected void Start(SymuEnvironment environment, MainOrganization organization)
        {
            if (environment is null)
            {
                throw new ArgumentNullException(nameof(environment));
            }

            Engine.State = AgentState.Starting;
            SetUp(environment, organization);
            PreProcess();
            if (backgroundWorker1.IsBusy != true)
            // Start the asynchronous operation.
            {
                backgroundWorker1.RunWorkerAsync();
            }
        }
Ejemplo n.º 12
0
        public IterationResult(SymuEnvironment environment)
        {
            Environment               = environment ?? throw new ArgumentNullException(nameof(environment));
            OrganizationFlexibility   = new OrganizationFlexibility(Environment);
            KnowledgeAndBeliefResults = new KnowledgeAndBeliefResults(Environment);
            Blockers = new BlockerResults(Environment);
            Tasks    = new TaskResults(Environment);
            Messages = new MessageResults(Environment);

            Results.Add(OrganizationFlexibility);
            Results.Add(KnowledgeAndBeliefResults);
            Results.Add(Blockers);
            Results.Add(Tasks);
            Results.Add(Messages);
            Results.Add(KeyFrames);
        }
Ejemplo n.º 13
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private InternetAccessAgent(SymuEnvironment environment,
                             CognitiveArchitectureTemplate template) : base(
         ClassId, environment, template)
 {
 }
Ejemplo n.º 14
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 protected LearnAgent(SymuEnvironment environment, CognitiveArchitectureTemplate template) : base(
         ClassId, environment, template)
 {
     Wiki      = MainOrganization.WikiEntity;
     Knowledge = GetKnowledge();
 }
Ejemplo n.º 15
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private MessageBasedScenario(SymuEnvironment environment) : base(null, environment)
 {
 }
Ejemplo n.º 16
0
 public MessageResults(SymuEnvironment environment) : base(environment)
 {
     Frequency = TimeStepType.Daily;
 }
Ejemplo n.º 17
0
 /// <summary>
 ///     Add a new environment to the symu engine
 /// </summary>
 /// <param name="environment"></param>
 public void SetEnvironment(SymuEnvironment environment)
 {
     Environment = environment ?? throw new ArgumentNullException(nameof(environment));
 }
Ejemplo n.º 18
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private GroupAgent(SymuEnvironment environment) : base(
         ClassId, environment)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private PersonAgent(IAgentId entityId, SymuEnvironment environment,
                     CognitiveArchitectureTemplate template) : base(
         entityId, environment, template)
 {
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Constructor with standard agent template
 ///     and with an existing IAgentId
 /// </summary>
 /// <param name="agentId"></param>
 /// <param name="environment"></param>
 /// <remarks> Make constructor private and create a factory method to create an agent that call the Initialize method</remarks>
 protected CognitiveAgent(IAgentId agentId, SymuEnvironment environment) : base(agentId, environment)
 {
     _cognitiveTemplate = environment.MainOrganization.Templates.Standard;
 }
Ejemplo n.º 21
0
 /// <summary>
 ///     Constructor with specific agentTemplate
 /// </summary>
 /// <param name="agentId"></param>
 /// <param name="environment"></param>
 /// <param name="template"></param>
 /// <remarks> Make constructor private and create a factory method to create an agent that call the Initialize method</remarks>
 protected CognitiveAgent(IAgentId agentId, SymuEnvironment environment, CognitiveArchitectureTemplate template)
     : base(agentId, environment)
 {
     _cognitiveTemplate = template;
 }
Ejemplo n.º 22
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private PersonAgent(SymuEnvironment environment, CognitiveArchitectureTemplate template) : base(
         ClassId, environment, template)
 {
 }
Ejemplo n.º 23
0
 public TestSysDynAgent(IAgentId id, SymuEnvironment environment) : base(id, environment)
 {
 }
Ejemplo n.º 24
0
 public SplitStep(SymuEnvironment environment, AgentId agentId)
 {
     _environment = environment;
     _agentId     = agentId;
 }
Ejemplo n.º 25
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private TaskBasedScenario(SymuEnvironment environment) : base(null, environment)
 {
     Environment.IterationResult.Tasks.On = true;
 }
Ejemplo n.º 26
0
 protected Result(SymuEnvironment environment)
 {
     Environment = environment;
 }
Ejemplo n.º 27
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private TestCognitiveAgent(IAgentId id, SymuEnvironment environment) : base(id, environment,
                                                                             environment.MainOrganization.Templates.Human)
 {
 }
Ejemplo n.º 28
0
 public OrganizationFlexibility(SymuEnvironment environment) : base(environment)
 {
 }
Ejemplo n.º 29
0
 /// <summary>
 ///     Constructor with specific agentTemplate
 /// </summary>
 /// <param name="classId"></param>
 /// <param name="environment"></param>
 /// <param name="template"></param>
 /// <remarks> Make constructor private and create a factory method to create an agent that call the Initialize method</remarks>
 protected CognitiveAgent(IClassId classId, SymuEnvironment environment, CognitiveArchitectureTemplate template)
     : this(environment?.AgentNetwork.NextAgentId(classId), environment, template)
 {
     _cognitiveTemplate = template;
 }
Ejemplo n.º 30
0
 /// <summary>
 ///     Constructor of the agent
 /// </summary>
 /// <remarks>Call the Initialize method after the constructor, or call the factory method</remarks>
 private LearnByAskingAgent(SymuEnvironment environment, CognitiveArchitectureTemplate template)
     : base(environment, template)
 {
 }