Crate djinn [−] [src]
Djinn is a framework for writing distributed agent-based simulations (ABMs), providing:
- a structure for defining agents and their behaviors/decision-making along with some extensions for common behaviors.
- a distributed architecture mediated by Redis which allows computationally-intense agents to be processed in parallel across multiple processes and/or multiple machines.
- utilities for logging and emitting events during the simulation, e.g. to a websocket frontend.
For examples refer to the examples/
folder.
Modules
ext |
Extensions to provide commonly-used, but non-core, functionality. |
Structs
Agent |
Struct containing a unique id and a state. |
Manager |
Manages a simulation and coordinates a set of workers. |
Population |
An interface to the Redis-backed agent population. |
Updates |
A container for queuing and synchronizing agent updates. |
WebSocketServer |
A WebSocket server which receives and publishes events. |
Worker |
A process that computes and applies updates for a local population of agents. |
Traits
Redis |
An interface to a Redis instance or cluster. |
Simulation |
This trait's implementation defines the main logic of a simulation. |
State |
The state that represents an |
Update |
An message that agents can queue for themselves or for others. |
Functions
run |
Convenience function for running a simulation/manager with |
run_workers |
Convenience function to run a node of n workers. This blocks until the workers are done. |