Practical Implementation of a Quantum Backtracking Algorithm

  • Simon Martiel
  • Maxime RemaudEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12011)


In previous work, Montanaro presented a method to obtain quantum speedups for backtracking algorithms, a general meta-algorithm to solve constraint satisfaction problems (CSPs). In this work, we derive a space efficient implementation of this method. Assume that we want to solve a CSP with m constraints on n variables and that the domain in which these variables take their value is of cardinality d. Then, we show that the implementation of Montanaro’s backtracking algorithm can be done by using \(\mathcal {O}(n\log {d})\) data qubits. We detail an implementation of the predicate associated to the CSP with an additional register of \(\mathcal {O}(\log {m})\) qubits. We explicit our implementation for graph coloring and SAT problems, and present simulation results. Finally, we discuss the impact of the usage of static and dynamic variable ordering heuristics in the quantum setting.


Backtracking algorithm Quantum walk CSP Graph coloring SAT 



This work was supported by Atos. The implementation was developed in python using Atos’ pyAQASM library. All simulations were performed on the Atos Quantum Learning Machine. We acknowledge support from the French ANR project ANR-18-CE47-0010 (QUDATA), the QuantERA ERA-NET Cofund in Quantum Technologies implemented within the European Union’s Horizon 2020 Program (QuantAlgo project), and the French ANR project ANR-18-QUAN-0017 (QuantAlgo Project).


  1. 1.
    Ambainis, A.: Quantum walks and their algorithmic applications. Int. J. Quantum Inf. 01(04), 507–518 (2003). Scholar
  2. 2.
    Ambainis, A.: Quantum walk algorithm for element distinctness. SIAM J. Comput. 37(1), 210–239 (2007). Scholar
  3. 3.
    Ambainis, A., Kokainis, M.: Quantum algorithm for tree size estimation, with applications to backtracking and 2-player games. In: Proceedings of the 49th STOC. ACM (2017).
  4. 4.
    Aono, Y., Nguyen, P.Q., Shen, Y.: Quantum lattice enumeration and tweaking discrete pruning. In: Peyrin, T., Galbraith, S. (eds.) ASIACRYPT 2018. LNCS, vol. 11272, pp. 405–434. Springer, Cham (2018). Scholar
  5. 5.
    Belovs, A., Childs, A.M., Jeffery, S., Kothari, R., Magniez, F.: Time-efficient quantum walks for 3-distinctness. In: Fomin, F.V., Freivalds, R., Kwiatkowska, M., Peleg, D. (eds.) ICALP 2013. LNCS, vol. 7965, pp. 105–122. Springer, Heidelberg (2013). Scholar
  6. 6.
    Campbell, E., Khurana, A., Montanaro, A.: Applying quantum algorithms to constraint satisfaction problems. Quantum 3, 167 (2018). Scholar
  7. 7.
    Childs, A., Cleve, R., Deotto, E., Farhi, E., Gutmann, S., Spielman, D.: Exponential algorithmic speedup by a quantum walk. In: Proceedings of the 35th STOC. ACM (2003).
  8. 8.
    Davis, M., Logemann, G., Loveland, D.: A machine program for theorem-proving. Commun. ACM 5(7), 394–397 (1962). Scholar
  9. 9.
    Davis, M., Putnam, H.: A computing procedure for quantification theory. JACM 7(3), 201–215 (1960). Scholar
  10. 10.
    Eén, N., Sörensson, N.: An extensible SAT-solver. In: Giunchiglia, E., Tacchella, A. (eds.) SAT 2003. LNCS, vol. 2919, pp. 502–518. Springer, Heidelberg (2004). Scholar
  11. 11.
    Gomes, C.P., Kautz, H., Sabharwal, A., Selman, B.: Satisfiability solvers. In: Handbook of Knowledge Representation. Elsevier (2008). Scholar
  12. 12.
    Gu, J., Purdom, P.W., Franco, J., Wah, B.W.: Algorithms for the satisfiability (SAT) problem: a survey. In: Handbook of Combinatorial Optimization. Springer (1999) Scholar
  13. 13.
    Kempe, J.: Quantum random walks: an introductory overview. Contemp. Phys. 44(4), 307–327 (2003). Scholar
  14. 14.
    Magniez, F., Nayak, A., Roland, J., Santha, M.: Search via quantum walk. In: Proceedings of the 39th STOC. Theory of Computing (2007).
  15. 15.
    Malaguti, E., Toth, P.: A survey on vertex coloring problems. Int. Trans. Oper. Res. 17(1), 1–34 (2010). Scholar
  16. 16.
    Montanaro, A.: Quantum walk speedup of backtracking algorithms. Theory Comput. 14(15), 1–24 (2018). Scholar
  17. 17.
    Montanaro, A.: Quantum speedup of branch-and-bound algorithms. arXiv:1906.10375 (2019)
  18. 18.
    Montanaro, A.: Data from Quantum algorithms for CSPs. c9pb. Accessed Jul 2019.
  19. 19.
    Santha, M.: Quantum walk based search algorithms. In: Agrawal, M., Du, D., Duan, Z., Li, A. (eds.) TAMC 2008. LNCS, vol. 4978, pp. 31–46. Springer, Heidelberg (2008). Scholar
  20. 20.
    Szegedy, M.: Quantum speed-up of Markov chain based algorithms. In: FOCS 2004. IEEE (2004).
  21. 21.
    van Beek, P.: Backtracking search algorithms. In: Handbook of Constraint Programming. Elsevier (2006). Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.Atos, Quantum R&DLes Clayes-sous-BoisFrance

Personalised recommendations