mbqc_scheduling.run

mbqc_scheduling.run(spacial_graph, time_order, do_search=False, timeout=None, nthreads=1, probabilistic=None, task_bound=None)

Search for optimal initalization-measurement paths.

Parameters:
  • spacial_graph (SpacialGraph) – The spacial graph.

  • time_order (PartialOrderGraph) – The dependency graph on the measurements. This is usually calculated from a Pauli Frames via the get(_py)_order; cf. the pauli_tracker package.

  • do_search (bool) – Whether to search for all best paths or just take the first one, which is the time optimal path. Searching for all best paths may take some time …

  • timeout (Optional[int]) – A timeout for the search. You’ll probably want to set this, because if the run is cancelled by some other reason, the results are generally lost, but when the run cancelled because of a timeout, the function returns as normally with the results obtained so far. However, note that is timeout is too short, i.e., shorter than how long it would take to get the first path (which depends potentially probabilistic), then the function will return an empty list.

  • nthreads (int) – The number of threads to use for the search. If nthreads is below 3, it will not multithread. Otherwise it will start a threadpool (where one thread is used to manage shared data). The tasks for the threadpool are all the possible focused Scheduler sweeps after doing one initial focus, cf. source code …. The number of those task scales exponentially with the number of bits in the first layer of the dependency graph. Use the task_bound option to limit the number of these tasks (but the then last task may take some time because it does all remaining tasks).

  • probabilistic (Optional[Tuple[AcceptFunc, Optional[int]]]) – Whether to do the search probabilistically or deterministically. If None, the search will be deterministic. For larger problems, you will want to do it probabilistically, with a relatively low accept rate, because otherwise it takes forever (scaling is in the worst something between factorial and double exponential). The second tuple element is an optional seed for the random number generator. However, note that if multithreaded, i.e., nthreads > 1, fixing the seed does not ensure reproducibibility (the threads communicate the results with each other, and depending on that they adjust the search; this communication is not deterministic (on this level here) since it depends on how the threads are scheduled).

  • task_bound (int) – The maximum number of tasks to start in the search, cf. nthreads.

Returns:

A list of the optimal paths. Turn it into the corresponding Python object via Paths.into_py_paths().

Return type:

Paths