You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uv sync # install dependencies
uv run ruff check src/ experiments/ # lint
uv run ruff format --check src/ experiments/ # format check
Running Experiments
uv run experiments/scenarios/<name>/run.py [OPTIONS]
Scenario options
sequential / fork-join
Flag
Description
--format {markdown,latex}
Output table format (default: markdown)
--output, -o PATH
Write tables to file instead of stdout
--plot
Generate analysis plots
--plot-format {pdf,png}
Plot output format (default: pdf)
football / football-2team
Flag
Description
--format {markdown,latex}
Output table format (default: markdown)
--output, -o PATH
Write table to file instead of stdout
--skip-viz
Skip PNG/PDF rendering (faster iteration)
--plot
Generate analysis plots
--plot-format {pdf,png}
Plot output format (default: pdf)
Adding a new scenario
Create experiments/scenarios/<name>/
Place .pnml files in it
Create run.py importing from lib
Run: uv run experiments/scenarios/<name>/run.py
Outputs should go to an outputs/ subfolder (gitignored).
Analysis Tooling
The lib package exposes the following public API.
PNML I/O
Function
Description
load_pnml(path)
Load a Petri net from a PNML file. Returns (net, initial_marking, final_marking).
load_pnml_stochastic(path)
Load a Petri net with stochastic information. Returns (net, im, fm, stochastic_map).
Structural Utilities
Function
Description
incidence_matrix(net)
Compute the incidence matrix (rows=places, columns=transitions).
reachability_graph(net, im)
Build the full reachability graph from an initial marking.
is_reachable_restricted(net, im, fm, allowed)
BFS reachability check using only allowed transitions.
Power Indices
Function
Description
shapley_shubik(net, im, fm, agent_mapping)
Shapley-Shubik index via coalition enumeration over the reachability characteristic function.
banzhaf(net, im, fm, agent_mapping)
Banzhaf index — normalized swing count over all coalitions.
usability(net, im, fm, agent_mapping)
Shared-credit index over firing-sequence prefixes; divides credit by the number of capable agents per transition.
gatekeeper(net, im, fm, agent_mapping)
Immediate-dominator-based index; weights transitions by how many other transitions they dominate in the transition graph.
Pre-computed characteristic function variants (shapley_shubik_from_values, banzhaf_from_values) accept a v: dict[frozenset[str], float] mapping coalitions to values, for use with custom characteristic functions (e.g. stochastic absorbing-chain probabilities).
Distributional Metrics
Function
Description
gini_coefficient(values)
Gini coefficient of a distribution (0 = equal, 1 = maximally unequal).
granularity(agent_mapping)
Gini index of the supply-degree distribution across transitions.
Visualization
Function
Description
save_net_png(net, im, fm, path)
Render a Petri net as PNG (optional stochastic decorations).
plot_power_bars(...)
Grouped bar chart of per-agent power across configurations.
plot_power_heatmap(...)
Heatmap grid (configs x agents, one subplot per index).
plot_index_correlation(...)
Pairwise scatter plots between indices, colored by configuration.
plot_lorenz_curves(...)
Lorenz curves per configuration (one subplot per index).
plot_rank_agreement(...)
Spearman rank-correlation heatmaps between indices.
plot_power_deltas(...)
Power change from a baseline configuration per agent/index.
plot_granularity_scatter(...)
Granularity vs per-index summary statistics scatter plot.
About
Reproduction package for a study on agentic power in organisational workflows.