Esempio n. 1
0
    def initialize_agents_from_files(self, agent_directory):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)
                agent.initialize_total_assets()
Esempio n. 2
0
    def initialize_agents_from_files(self, agent_directory):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)
                agent.initialize_total_assets()
Esempio n. 3
0
    def initialize_agents_from_files(self, agent_directory, network_config):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        self.network = nx.read_gexf(network_config)

        # print(self.network.edges(data=True))

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)
Esempio n. 4
0
    def initialize_agents_from_files(self, agent_directory, network_config):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        self.network = nx.read_gexf(network_config)

        # print(self.network.edges(data=True))

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)
Esempio n. 5
0
    def get_parameters_from_file(self, args):

        import os
        from src.environment import Environment
        from src.agent import Agent

        #
        # Initialize Environment and give arguments
        #

        # we need to give environment config
        environment_directory = str(args[0])
        identifier = args[1]

        # calling the Environment Class
        environment = Environment(environment_directory, identifier)

        # # get the agent_directory from the environment
        agent_directory = environment.agent_directory
        # # and loop over all agents in the directorys
        listings = os.listdir(agent_directory)

        for file in listings:

            if 'agent5.xml' in file:
                # #
                # # TESTING
                # #

                # # test whether the parameters are read properly
                text = "Initiating agent object..\n"
                self.print_info(text)

                agent = Agent()
                environment.agents.append(agent)
                print agent

                text = "Reading in parameters by calling method..\n"
                self.print_info(text)

                agent_filename = agent_directory + file
                agent.get_parameters_from_file(agent_filename, environment)
                print agent
Esempio n. 6
0
    def initialize_agents_from_files(self, agent_directory):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        self.transition_probabilities = nx.DiGraph()

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_nodes_for_graph(agent_filename, self)

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)
Esempio n. 7
0
    def initialize_agents_from_files(self, agent_directory):

        from src.agent import Agent
        agent_files = os.listdir(agent_directory)

        self.network = nx.Graph()

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_nodes_for_graph(agent_filename, self)

        for each_agent_file in agent_files:

            if '.xml' in each_agent_file:
                agent = Agent()
                agent_filename = agent_directory + each_agent_file
                agent.get_parameters_from_file(agent_filename, self)
                self.agents.append(agent)