This python library performs simulations of tree-shaped quantum networks under random requests for e-bits.
python3 tree_sim.py help
will print a description of how to use tree_sim.py as a command-line tool.
python3 run_example_simulations.py
will perform the simulations that reproduce the data in example_sim_results and the graphs in example_graphs. It will skip re-doing simulations for which the output data or graphs are already present in the directories it expects. If you wish to re-run the simulation, or run the simulation after tweaking run_example_simulations.py, you must delete the corresponding output files first.
run_example_simulations.py can also be used as an example of how to work with tree_sim.py to run many simulations to compute statistics.
There are also some examples in Jupyter Notebook form under jupyter_examples
.
The raw data in example_sim_results is organized like this:
-
The folders dynamic_response_sim, multi_size_sim, and word_size_sim correspond to the similarly named functions in run_example_simulations.py.
-
Within multi_size_sim and word_size_sim, results are further split by values of n and b respectively.
-
Each individual data file corresponds to one call to tree_sim.py, but may contain data from many simulations in the case where multi samples or dynamic sampling is requested.
Individual data files are named (p, k, n, t, b).data where these are the input variables defining the parameters of the simulation:
-
p
: request rate such that$\frac{k^np}{b}$ pairs make$b$ requests every cycle -
k
: branching factor of the tree -
n
: number of layers in the tree -
t
: duration of the simulation in cycles -
b
: request batch size such that$\frac{k^np}{b}$ pairs make$b$ requests every cycle
The data files in dynamic_response_sim are labelled (p, k, n, t, b)_run_i.data where i is an index identifying which run of the simulation it is.
These data files are pickled objects containing dictionaries, lists, and numpy objects. The outermost object is a dictionary which always includes the following keys:
init_data
: A tuple of (p, k, n, t, b), the same simulation specification parameters used to generate the file name.stats
: A tuple of (requests_enqueued, requests_satisfied, requests_expired, entanglements_expired, entanglements_used, entanglements_made), which are the total counts of these events over the course of the simulations captured in this file.request_cycles
: A list containing the age at expiration or completion for every request that terminated during the simulation(s).request_success
: A list containing a 1 for each request that completed and a 0 for each request that terminated.
samples
: The number of samples taken.individual_samples
: Dictionaries following the above format that contain the data from each individual sample.