Class FunctionalDefaultAgentGenerator


public class FunctionalDefaultAgentGenerator extends DefaultAgentGenerator
Class for generating agents (via a default generator) by delegating creation logic to a user-defined function.

This implementation of DefaultAgentGenerator is intended for flexibility and cross-language use (e.g. from Python).

  • Constructor Details

    • FunctionalDefaultAgentGenerator

      public FunctionalDefaultAgentGenerator(BiFunction<Config,RandomGenerator,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(Config config, RandomGenerator random)
      Generates a single agent by applying the user-provided generator function.
      Specified by:
      generateAgent in class DefaultAgentGenerator
      Parameters:
      config - the model settings passed to the agent during creation
      random - the random generator the agent generator can use for constructing agents
      Returns:
      a new Agent instance