Package modelarium.entities.generators
Class AgentGenerator
java.lang.Object
modelarium.entities.generators.AgentGenerator
- Direct Known Subclasses:
DefaultAgentGenerator,FunctionalAgentGenerator
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateAgentsForEachThread(Config config, RandomGenerator random) Generates the model's agents and distributes them across the model's worker cores.protected voidreset()Resets any temporary state retained while generating a population.
-
Constructor Details
-
AgentGenerator
public AgentGenerator()Constructs an agent generator.
-
-
Method Details
-
generateAgentsForEachThread
Generates the model's agents and distributes them across the model's worker cores.- Parameters:
config- the model settings containing the agent and thread countsrandom- the random generator the agent generator can use for constructing agents- Returns:
- a list of
AgentSetobjects, 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.
-