Parallel#

HARK.parallel.multi_thread_commands_fake(agent_list: List, command_list: List, num_jobs=None) None#

Executes the list of commands in command_list for each AgentType in agent_list in an ordinary, single-threaded loop. Each command should be a method of that AgentType subclass. This function exists so as to easily disable multithreading, as it uses the same syntax as multi_thread_commands.

Parameters:
  • agent_list ([AgentType]) – A list of instances of AgentType on which the commands will be run.

  • command_list ([string]) – A list of commands to run for each AgentType.

  • num_jobs (None) – Dummy input to match syntax of multi_thread_commands. Does nothing.

Return type:

none

HARK.parallel.multi_thread_commands(agent_list: List, command_list: List, num_jobs=None) None#

Executes the list of commands in command_list for each AgentType in agent_list using a multithreaded system. Each command should be a method of that AgentType subclass.

Parameters:
  • agent_list ([AgentType]) – A list of instances of AgentType on which the commands will be run.

  • command_list ([string]) – A list of commands to run for each AgentType in agent_list.

Return type:

None

HARK.parallel.run_commands(agent: Any, command_list: List) Any#

Executes each command in command_list on a given AgentType. The commands should be methods of that AgentType’s subclass.

Parameters:
  • agent (AgentType) – An instance of AgentType on which the commands will be run.

  • command_list ([string]) – A list of commands that the agent should run, as methods.

Returns:

agent – The same AgentType instance passed as input, after running the commands.

Return type:

AgentType