batss.simulation

A module for simulating population protocols.

The main class Simulation is created with a description of the protocol and the initial condition, and is responsible for running the simulation.

The general syntax is

a, b, u = 'A', 'B', 'U'
approx_majority = {
    (a,b): (u,u),
    (a,u): (a,a),
    (b,u): (b,b),
}
n = 10 ** 5
init_config = {a: 0.51 * n, b: 0.49 * n}
sim = Simulation(init_config=init_config, rule=approx_majority)
sim.run()
sim.history.plot()

More examples given in https://github.com/UC-Davis-molecular-computing/ppsim/tree/main/examples

time_trials() is a convenience function used for gathering data about the convergence time of a protocol.

Module Attributes

Rule

Type representing transition rules for protocol.

Functions

state_enumeration(init_dist, rule)

Finds all reachable states by breadth-first search.

time_trials(rule, ns, initial_conditions[, ...])

Gathers data about the convergence time of a rule.

Classes

Simulation(init_config, rule, *[, ...])

Class to simulate a population protocol.