-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Aggregate computing is a programming paradigm where you write a single program that runs on every device in a network simultaneously. Instead of thinking about individual device behaviour and message passing, you reason about fields — spatial data structures that assign a value to every device.
A function phi: D x T -> V that maps every device d at every time step t to a value v. For example, a gradient field maps every device to its distance from a source.
All building blocks converge to the correct output from any initial state, within a bounded number of rounds. This means the system recovers automatically from failures, device additions/removals, and sensor changes.
If you experience visual jitter, it may be caused by Plotly re-fitting axis ranges. The simulator uses uirevision="stable" and fixed axis ranges to prevent this. Make sure you're using the latest version.
Yes. Use the "Add Random Device" and "Remove Random Device" buttons. The network topology and neighbour lists update automatically, and all fields re-stabilise.
The convergence chart plots the maximum absolute change across all devices between consecutive rounds. When this value reaches zero, the field has stabilised.
Currently the simulator supports grid and random topologies via the UI. Programmatically, you can create any topology using the Network class and add_device() method.
Python 3.10 or later.
Yes. The simulation engine works independently:
from computational_fields.simulation.network import Network
from computational_fields.simulation.engine import SimulationEngine
from computational_fields.blocks.gradient import gradient
net = Network.grid(8, 8, comm_range=1.5,
sensors_fn=lambda did, r, c: {"is_source": did == 0})
engine = SimulationEngine(net, lambda ctx: gradient(ctx, ctx.sense("is_source")))
results = engine.run(20)
print(results[-1]) # final round resultsThrough the export mechanism. When a device calls nbr(ctx, value), its value is stored in the device's exports dict, keyed by the call path. On the next round, neighbours read these exports to get the values produced at the same call path.
Each call to rep, nbr, or share is identified by its position in the program's call stack. This ensures that nbr returns values from the same primitive invocation on neighbouring devices, even when the same function is called multiple times within one round.