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, sim_name=None, logging_verbosity=1)[source]
Parameters:
property name: str
setup()[source]
Return type:

None

initialize_simulants()[source]
Return type:

None

step()[source]
Return type:

None

run()[source]
Return type:

None

finalize()[source]
Return type:

None

report(print_results=True)[source]
Parameters:

print_results (bool)

Return type:

Dict[str, Any]

get_performance_metrics()[source]
Return type:

DataFrame

add_components(component_list)[source]

Adds new components to the simulation.

Parameters:

component_list (List[Component])

Return type:

None

get_population(untracked=True)[source]
Parameters:

untracked (bool)

Return type:

DataFrame

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.

logging

Provides access to the logging system.

Type:

LoggingInterface

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

resources

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: