Package modelarium

Class Model

java.lang.Object
modelarium.Model

public class Model extends Object
Main class for executing an agent-based model using multithreaded execution.

This class is responsible for configuring the environment, distributing agents across worker threads, running the simulation (synchronously or asynchronously), and collecting results.

  • Constructor Details

    • Model

      public Model(Config config)
      Constructs a new model instance with the specified settings.
      Parameters:
      config - the settings to use for model initialisation and execution
  • Method Details

    • run

      public void run()
      Runs the model using the configurations given during construction.

      Calling this method again starts a new run with the same configuration and replaces the previously exposed results after generation begins.

      Throws:
      ModelRunException - if a worker fails or the calling thread is interrupted while waiting for workers
    • getResults

      public ReadOnlyResults getResults()
      Returns the results of the most recent model run.
      Returns:
      a new ReadOnlyResults instance
      Throws:
      IllegalStateException - if the model has not yet been run