Class FunctionalAgentGenerator

java.lang.Object
modelarium.agents.AgentGenerator
modelarium.agents.FunctionalAgentGenerator

public class FunctionalAgentGenerator extends AgentGenerator
An implementation of AgentGenerator that delegates agent creation logic to a user-defined functional interface.

Intended for flexibility and cross-language use (e.g. from Python).

  • Constructor Details

    • FunctionalAgentGenerator

      public FunctionalAgentGenerator(Function<ModelSettings,Agent> generatorFunction)
      Constructs a new generator with the specified logic.
      Parameters:
      generatorFunction - the function used to generate each agent
  • Method Details

    • generateAgent

      protected Agent generateAgent(ModelSettings modelSettings)
      Description copied from class: AgentGenerator
      Abstract method for generating a single agent instance. Must be implemented by concrete subclasses.
      Specified by:
      generateAgent in class AgentGenerator
      Parameters:
      modelSettings - the model settings passed to the agent during creation
      Returns:
      a new Agent instance