コード例 #1
0
ファイル: ReactiveAgent.cs プロジェクト: lmorisse/Symu
 /// <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;
 }
コード例 #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();
 }
コード例 #3
0
ファイル: ScenarioAgent.cs プロジェクト: lmorisse/Symu
        /// <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;
        }
コード例 #4
0
ファイル: GroupAgent.cs プロジェクト: lmorisse/Symu
        /// <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);
        }
コード例 #5
0
ファイル: SymuEngine.cs プロジェクト: lmorisse/Symu
        /// <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();
        }
コード例 #6
0
ファイル: ScenarioAgent.cs プロジェクト: lmorisse/Symu
        /// <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);
        }
コード例 #7
0
ファイル: LearnAgent.cs プロジェクト: lmorisse/Symu
        /// <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);
        }
コード例 #8
0
ファイル: TestCognitiveAgent.cs プロジェクト: lmorisse/Symu
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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();
            }
        }
コード例 #12
0
ファイル: IterationResult.cs プロジェクト: lmorisse/Symu
        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);
        }
コード例 #13
0
ファイル: InternetAccessAgent.cs プロジェクト: lmorisse/Symu
 /// <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)
 {
 }
コード例 #14
0
ファイル: LearnAgent.cs プロジェクト: lmorisse/Symu
 /// <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();
 }
コード例 #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)
 {
 }
コード例 #16
0
 public MessageResults(SymuEnvironment environment) : base(environment)
 {
     Frequency = TimeStepType.Daily;
 }
コード例 #17
0
ファイル: SymuEngine.cs プロジェクト: lmorisse/Symu
 /// <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));
 }
コード例 #18
0
ファイル: GroupAgent.cs プロジェクト: lmorisse/Symu
 /// <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)
 {
 }
コード例 #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)
 {
 }
コード例 #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;
 }
コード例 #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;
 }
コード例 #22
0
ファイル: PersonAgent.cs プロジェクト: lmorisse/Symu
 /// <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)
 {
 }
コード例 #23
0
ファイル: TestSysDynAgent.cs プロジェクト: lmorisse/Symu
 public TestSysDynAgent(IAgentId id, SymuEnvironment environment) : base(id, environment)
 {
 }
コード例 #24
0
ファイル: SplitStep.cs プロジェクト: lmorisse/Symu
 public SplitStep(SymuEnvironment environment, AgentId agentId)
 {
     _environment = environment;
     _agentId     = agentId;
 }
コード例 #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;
 }
コード例 #26
0
 protected Result(SymuEnvironment environment)
 {
     Environment = environment;
 }
コード例 #27
0
ファイル: TestCognitiveAgent.cs プロジェクト: lmorisse/Symu
 /// <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)
 {
 }
コード例 #28
0
 public OrganizationFlexibility(SymuEnvironment environment) : base(environment)
 {
 }
コード例 #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;
 }
コード例 #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)
 {
 }