Optimize

mrmustard.path.optimize.optimal_path(components, n_init=100, with_BF_heuristic=True, verbose=True)[source]

Find the optimal path for a given set of components.

Parameters:
  • components (list[CircuitComponent]) – A list of CircuitComponent objects.

  • n_init (int) – The number of random contractions to find an initial cost upper bound.

  • with_BF_heuristic (bool) – If True (default), the 1BF/1FB heuristics are included in the optimization process.

  • verbose (bool) – If True (default), the progress of the optimization is shown.

Returns:

A list of tuples representing the optimal path.

Return type:

list[tuple[int, int]]