Class AgentGenerator

java.lang.Object
modelarium.entities.generators.AgentGenerator
Direct Known Subclasses:
DefaultAgentGenerator, FunctionalAgentGenerator

public abstract class AgentGenerator extends Object
Abstract class for generating the agent population a model will simulate.

Implementations are responsible for constructing the model's agents from its configuration settings and for distributing those agents across the model's worker threads.

  • Constructor Details

    • AgentGenerator

      public AgentGenerator()
      Constructs an agent generator.
  • Method Details

    • generateAgentsForEachThread

      public abstract List<AgentSet> generateAgentsForEachThread(Config config, RandomGenerator random)
      Generates the model's agents and distributes them across the model's worker cores.
      Parameters:
      config - the model settings containing the agent and thread counts
      random - the random generator the agent generator can use for constructing agents
      Returns:
      a list of AgentSet objects, one per thread
    • reset

      protected void reset()
      Resets any temporary state retained while generating a population.

      The model calls this hook after every generation attempt, including an attempt which throws. Stateful generators should override it so the same generator can be reused for a later run.