The Vivarium Engine

The engine houses the SimulationContext – the key vivarium object for running and interacting with simulations. It is the top level manager for all state information in vivarium. By intention, it exposes a very simple interface for managing the simulation lifecycle.

Also included here is the simulation Builder, which is the main interface that components use to interact with the simulation framework. You can read more about how the builder works and what services is exposes here.

Finally, there are a handful of wrapper methods that allow a user or user tools to easily setup and run a simulation.

class vivarium.framework.engine.SimulationContext(model_specification=None, components=None, configuration=None, plugin_configuration=None)[source]
Parameters
property name
setup()[source]
initialize_simulants()[source]
step()[source]
run()[source]
finalize()[source]
report(print_results=True)[source]
get_performance_metrics()[source]
Return type

DataFrame

add_components(component_list)[source]

Adds new components to the simulation.

get_population(untracked=True)[source]
Parameters

untracked (bool) –

class vivarium.framework.engine.Builder(configuration, plugin_manager)[source]

Toolbox for constructing and configuring simulation components.

This is the access point for components through which they are able to utilize a variety of interfaces to interact with the simulation framework.

lookup

Provides access to simulant-specific data via the lookup table abstraction.

Type

LookupTableInterface

value

Provides access to computed simulant attribute values via the value pipeline system.

Type

ValuesInterface

event

Provides access to event listeners utilized in the event system.

Type

EventInterface

population

Provides access to simulant state table via the population system.

Type

PopulationInterface

resource

Provides access to the resource system, which manages dependencies between components.

Type

ResourceInterface

time

Provides access to the simulation’s clock.

Type

TimeInterface

components

Provides access to the component management system, which maintains a reference to all managers and components in the simulation.

Type

ComponentInterface

lifecycle

Provides access to the life-cycle system, which manages the simulation’s execution life-cycle.

Type

LifeCycleInterface

data

Provides access to the simulation’s input data housed in the data artifact.

Type

ArtifactInterface

Notes

A Builder should never be created directly. It will automatically be created during the initialization of a SimulationContext

vivarium.framework.engine.run_simulation(model_specification=None, components=None, configuration=None, plugin_configuration=None)[source]
Parameters