Package modelarium.agents
Class AgentGenerator
java.lang.Object
modelarium.agents.AgentGenerator
- Direct Known Subclasses:
DefaultAgentGenerator,FunctionalAgentGenerator
Abstract base class for generating agent populations in a simulation.
This class provides methods to:
- Generate a full set of agents based on model settings
- Distribute agents evenly across multiple processing cores
Concrete subclasses must implement the generateAgent(ModelSettings) method,
which defines how individual agents are constructed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AgentgenerateAgent(ModelSettings modelSettings) Abstract method for generating a single agent instance.generateAgents(ModelSettings modelSettings) Generates a completeAgentSetbased on the number of agents specified in the model settings.getAgentsForEachCore(ModelSettings modelSettings) Distributes agents across processing cores in a round-robin fashion.
-
Constructor Details
-
AgentGenerator
public AgentGenerator()
-
-
Method Details
-
generateAgents
Generates a completeAgentSetbased on the number of agents specified in the model settings.- Parameters:
modelSettings- the simulation configuration containing the agent count- Returns:
- an
AgentSetcontaining all generated agents
-
getAgentsForEachCore
Distributes agents across processing cores in a round-robin fashion. This ensures an even workload split for multithreaded simulations.- Parameters:
modelSettings- the simulation settings containing agent and core counts- Returns:
- a list of
AgentSetobjects, one per core
-
generateAgent
Abstract method for generating a single agent instance. Must be implemented by concrete subclasses.- Parameters:
modelSettings- the model settings passed to the agent during creation- Returns:
- a new
Agentinstance
-