Skip to main content
Log in

Quantum algorithm and experimental demonstration for the subset sum problem

  • Research Paper
  • Published:
Science China Information Sciences Aims and scope Submit manuscript

Abstract

To solve the subset sum problem, a well-known nondeterministic polynomial-time complete problem that is widely used in encryption and resource scheduling, we propose a feasible quantum algorithm that utilizes fewer qubits to encode and achieves quadratic speedup. Specifically, this algorithm combines an amplitude amplification algorithm with quantum phase estimation, and requires n + t + 1 qubits and O(2(0.5+o(1))n) operations to obtain the solution, where n is the number of elements, and t is the number of qubits used to store the eigenvalues. To verify the performance of the algorithm, we simulate the algorithm with the online quantum simulator of IBM named ibmq_simulator using Qiskit and then run it on two IBM quantum computers called ibmq_santiago and ibmq_bogota. The experimental results indicate that compared with the brute force algorithm, the proposed algorithm results in quadratic acceleration for the problem of a set S with four elements and two subsets whose sum equals target w. Using the iterator twice, we obtain success probabilities of 0.940 ± 0.004, 0.751 ± 0.040, and 0.665 ± 0.060 on the simulator, ibmq_santiago, and ibmq_bogota, respectively, and the fidelity between the theoretical and experimental quantum states is calculated to be 0.944 ± 0.002, 0.753 ± 0.017, and 0.657 ± 0.028, respectively. If the error rates of the experimental quantum logic gates can be reduced, the success probabilities of the proposed algorithm on real quantum devices can be further improved.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Garey M R. Computers and intractability: a guide to the theory of np-completeness. Rev Esc Enferm USP, 1979, 44: 340

    Google Scholar 

  2. Merkle R, Hellman M. Hiding information and signatures in trapdoor knapsacks. IEEE Trans Inform Theor, 1978, 24: 525–530

    Article  MATH  Google Scholar 

  3. Kate A, Goldberg I. Generalizing cryptosystems based on the subset sum problem. Int J Inf Secur, 2011, 10: 189–199

    Article  Google Scholar 

  4. Murakami Y, Sakai R. Security of knapsack cryptosystem using subset-sum decision problem against alternative-solution attack. In: Proceedings of International Symposium on Information Theory and Its Applications (ISITA), 2018. 614–617

  5. Murakami Y, Hamasho S, Kasahara M. A public-key cryptosystem based on decision version of subset sum problem. In: Proceedings of International Symposium on Information Theory and its Applications, 2012. 735–739

  6. Glass C A, Kellerer H. Parallel machine scheduling with job assignment restrictions. Naval Res Logist, 2007, 54: 250–257

    Article  MathSciNet  MATH  Google Scholar 

  7. Guéret C, Prins C. A new lower bound for the open-shop problem. Ann Oper Res, 1999, 92: 165–183

    Article  MathSciNet  MATH  Google Scholar 

  8. Qi X T. Coordinated logistics scheduling for in-house production and outsourcing. IEEE Trans Automat Sci Eng, 2008, 5: 188–192

    Article  Google Scholar 

  9. Cai L, Chan S M, Chan S O. Random separation: a new method for solving fixed-cardinality optimization problems. In: Proceedings of International Workshop on Parameterized and Exact Computation. Berlin: Springer, 2006. 239–250

    MATH  Google Scholar 

  10. Caro Y, Yuster R. The characterization of zero-sum (mod 2) bipartite Ramsey numbers. J Graph Theor, 1998, 29: 151–166

    Article  MathSciNet  MATH  Google Scholar 

  11. Borgwardt K H, Tremel B. The average quality of greedy-algorithms for the Subset-Sum-Maximization Problem. ZOR — Methods Model Oper Res, 1991, 35: 113–149

    Article  MathSciNet  MATH  Google Scholar 

  12. Koiliaris K, Xu C. Faster pseudopolynomial time algorithms for subset sum. ACM Trans Algorithms, 2019, 15: 1–20

    Article  MathSciNet  MATH  Google Scholar 

  13. Horowitz E, Sahni S. Computing partitions with applications to the knapsack problem. J ACM, 1974, 21: 277–292

    Article  MathSciNet  MATH  Google Scholar 

  14. Pisinger D. Linear time algorithms for knapsack problems with bounded weights. J Algorithms, 1999, 33: 1–14

    Article  MathSciNet  MATH  Google Scholar 

  15. Kellerer H, Pferschy U, Pisinger D. Multidimensional Knapsack Problems. In: Knapsack Problems. Berlin: Springer, 2004. 235–283

    Chapter  MATH  Google Scholar 

  16. Tsai S. Fast parallel molecular solution for DNA-based computing: the 0–1 knapsack problem. In: Proceedings of International Conference on Algorithms and Architectures for Parallel Processing, 2009. 416–427

  17. Nicolau J D V, Lard M, Korten T, et al. Parallel computation with molecular-motor-propelled agents in nanofabricated networks. Proc Natl Acad Sci USA, 2016, 113: 2591–2596

    Article  Google Scholar 

  18. van Delft F C M J M, Ipolitti G, Nicolau J D V, et al. Something has to give: scaling combinatorial computing by biological agents exploring physical networks encoding NP-complete problems. Interface Focus, 2018, 8: 20180034

    Article  Google Scholar 

  19. Henkel C V, Bäck T, Kok J N, et al. DNA computing of solutions to knapsack problems. Biosystems, 2007, 88: 156–162

    Article  Google Scholar 

  20. Henkel C V, Bladergroen R S, Balog C I A, et al. Protein output for DNA computing. Nat Comput, 2005, 4: 1–10

    Article  MathSciNet  MATH  Google Scholar 

  21. Isenberg C. The soap film: an analogue computer: soap films provide a simple method of obtaining analogue solutions to some mathematical problems. Am Scientist, 1976, 64: 514–518

    Google Scholar 

  22. Aaronson S. Guest column: NP-complete problems and physical reality. SIGACT News, 2005, 36: 30–52

    Article  Google Scholar 

  23. Wu K, García de Abajo J, Soci C, et al. An optical fiber network oracle for NP-complete problems. Light Sci Appl, 2014, 3: e147

    Article  Google Scholar 

  24. Shaked N T, Messika S, Dolev S, et al. Optical solution for bounded NP-complete problems. Appl Opt, 2007, 46: 711–724

    Article  Google Scholar 

  25. Caulfield H J, Dolev S. Why future supercomputing requires optics. Nat Photon, 2010, 4: 261–263

    Article  Google Scholar 

  26. Xu X Y, Huang X L, Li Z M, et al. A scalable photonic computer solving the subset sum problem. Sci Adv, 2020, 6: eaay5853

    Article  Google Scholar 

  27. Schroeppel R, Shamir A. A T = O(2n/2), S = O(2n/4) algorithm for certain NP-complete problems. SIAM J Comput, 1981, 10: 456–464

    Article  MathSciNet  MATH  Google Scholar 

  28. Becker A, Coron J S, Joux A. Improved generic algorithms for hard knapsacks. In: Proceedings of Annual International Conference on the Theory and Applications of Cryptographic Techniques. Berlin: Springer, 2011. 364–385

    MATH  Google Scholar 

  29. Howgrave-Graham N, Joux A. New generic algorithms for hard knapsacks. In: Proceedings of Annual International Conference on the Theory and Applications of Cryptographic Techniques. Berlin: Springer, 2010. 235–256

    MATH  Google Scholar 

  30. Childs A M, Eisenberg J M. Quantum algorithms for subset finding. 2003. ArXiv:quant-ph/0311038

  31. Bernstein D J, Jeffery S, Lange T, et al. Quantum algorithms for the subset-sum problem. In: Proceedings of International Workshop on Post-Quantum Cryptography. Berlin: Springer, 2013. 16–33

    MATH  Google Scholar 

  32. Helm A, May A. Subset sum quantumly in 1.17n. In: Proceedings of the 13th Conference on the Theory of Quantum Computation, Communication and Cryptography (TQC 2018), 2018

  33. Bonnetain X, Bricout R, Schrottenloher A, et al. Improved classical and quantum algorithms for subset-sum. In: Proceedings of International Conference on the Theory and Application of Cryptology and Information Security. Cham: Springer, 2020. 633–666

    MATH  Google Scholar 

  34. Chang W L, Ren T T, Feng M, et al. Quantum algorithms of the subset-sum problem on a quantum computer. In: Proceedings of WASE International Conference on Information Engineering, 2009. 54–57

  35. Daskin A. A quantum approach to subset-sum and similar problems. 2017. ArXiv:1707.08730

  36. Aleksandrowicz G, Alexander T, Barkoutsos P, et al. Qiskit: an open-source framework for quantum computing. 2019. https://www.qiskit.org/

  37. García-Pérez G, Rossi M A C, Maniscalco S. IBM Q Experience as a versatile experimental test bed for simulating open quantum systems. npj Quantum Inf, 2020, 6: 10

    Article  Google Scholar 

  38. Kitaev A Y. Quantum measurements and the Abelian stabilizer problem. 1995. ArXiv:quant-ph/9511026

  39. Brassard G, Hoyer P, Mosca M, et al. Quantum amplitude amplification and estimation. Contemporary Math, 2002, 305: 53–74

    Article  MathSciNet  MATH  Google Scholar 

  40. Grover L K. A fast quantum mechanical algorithm for database search. In: Proceedings of the 28th Annual ACM Symposium on Theory of Computing, Philadelphia, 1996. 212–219

  41. Cross A W, Bishop L S, Sheldon S, et al. Validating quantum computers using randomized model circuits. Phys Rev A, 2019, 100: 032328

    Article  Google Scholar 

  42. Altepeter J B, Jeffrey E R, Kwiat P G. Photonic state tomography. Adv Atom Mol Opt Phys, 2005, 52: 105–159

    Article  Google Scholar 

Download references

Acknowledgements

This work was supported by National Key Research and Development Program of China (Grant Nos. 2019YFA0308700, 2017YFA0303700) and National Natural Science Foundation of China (Grant No. 11690031).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ping Xu.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zheng, Q., Zhu, P., Xue, S. et al. Quantum algorithm and experimental demonstration for the subset sum problem. Sci. China Inf. Sci. 65, 182501 (2022). https://doi.org/10.1007/s11432-021-3334-1

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11432-021-3334-1

Keywords

Navigation