Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
A Practical Guide to Quantum Machine Learning and Quantum Optimization

You're reading from  A Practical Guide to Quantum Machine Learning and Quantum Optimization

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781804613832
Pages 680 pages
Edition 1st Edition
Languages
Authors (2):
Elías F. Combarro Elías F. Combarro
Profile icon Elías F. Combarro
Samuel González-Castillo Samuel González-Castillo
Profile icon Samuel González-Castillo
View More author details

Table of Contents (27) Chapters

Preface 1. Part I: I, for One, Welcome our New Quantum Overlords
2. Chapter 1: Foundations of Quantum Computing 3. Chapter 2: The Tools of the Trade in Quantum Computing 4. Part II: When Time is Gold: Tools for Quantum Optimization
5. Chapter 3: Working with Quadratic Unconstrained Binary Optimization Problems 6. Chapter 4: Adiabatic Quantum Computing and Quantum Annealing 7. Chapter 5: QAOA: Quantum Approximate Optimization Algorithm 8. Chapter 6: GAS: Grover Adaptive Search 9. Chapter 7: VQE: Variational Quantum Eigensolver 10. Part III: A Match Made in Heaven: Quantum Machine Learning
11. Chapter 8: What Is Quantum Machine Learning? 12. Chapter 9: Quantum Support Vector Machines 13. Chapter 10: Quantum Neural Networks 14. Chapter 11: The Best of Both Worlds: Hybrid Architectures 15. Chapter 12: Quantum Generative Adversarial Networks 16. Part IV: Afterword and Appendices
17. Chapter 13: Afterword: The Future of Quantum Computing
18. Assessments 19. Bibliography
20. Index
21. Other Books You May Enjoy Appendix A: Complex Numbers
1. Appendix B: Basic Linear Algebra 2. Appendix C: Computational Complexity 3. Appendix D: Installing the Tools 4. Appendix E: Production Notes

6.1 Grover’s algorithm

In this section, we will cover the most important properties of Grover’s algorithm. We will not cover all the theoretical details behind the procedure — for that, we recommend the book by Nielsen and Chuang [69] and, especially, the lecture notes by John Watrous [95] — but we need to at least get familiar with how the method operates, what oracles are and how they are used in the algorithm, and what kind of circuits are needed to implement it.

Let’s start with the basics. Grover’s algorithm is used for searching elements that satisfy certain conditions. More formally, the algorithm assumes that we have a collection of elements indexed by strings of bits, and a Boolean function that takes those binary strings and returns ”true” (or ) if the element indexed by the string satisfies the condition and ”false” (or ) otherwise. For instance, imagine that we are searching among 8 different elements...

6.2 Quantum oracles for combinatorial optimization

As we have seen, the Dürr-Høyer algorithm can be used to find the minimum of a function with high probability and with a quadratic speedup over brute force search. However, in order to use it, we need a quantum oracle that, given binary strings and , checks whether .

In our case, we are interested in functions that can appear in QUBO and HOBO problems. This means that will be a polynomial with real coefficients and binary variables, and we could implement the quantum oracle with a straightforward approach: design a classical circuit for it using AND, OR, and NOT gates, and then simulate the classical gates with the Toffoli quantum gate, as we showed in Section 1.5.2.

However, in 2021, Gilliam, Woerner, and Gonciulea, introduced an improved way of implementing quantum oracles for QUBO and HOBO problems in a paper titled Grover adaptive search for constrained polynomial binary optimization [45].

In this section, we will...

6.3 Using GAS with Qiskit

If you want to practice what you have learned in this chapter about Grover’s search, the Dürr-Høyer algorithm, and the construction of oracles, you can try to implement your own version of GAS in Qiskit from scratch. It is not a difficult project and it can be very satisfactory. However, there is no need for that. In the Qiskit Optimization module, you can find a ready-to-use implementation of Grover Adaptive Search (we will be using version 0.4.0 of the package). Let’s see how to use it.

One additional advantage of working with Qiskit’s GAS implementation is that it accepts the optimization problem format that we used with QAOA in Section 5.2.2. The simplest way of using it is by defining a QUBO problem like the one that we can create with the following piece of code:

from qiskit_optimization.problems import QuadraticProgram 
 
qp = QuadraticProgram() 
 
qp.binary_var(’x’) 
 
qp.binary_var(’y’) 
...

Summary

In this chapter, we have learned about Grover’s search algorithm and how it can be adapted to find minima of functions with the Dürr-Høyer algorithm. We have also learned about quantum oracles and their role in these two methods.

After that, we learned how to perform arithmetic in phase encoding and how to retrieve the results by using the mighty Quantum Fourier Transform. We also studied how to use all these techniques to implement oracles that can be used in Grover’s Adaptive Search to solve combinatorial optimization problems.

Finally, we also learned how to use GAS with Qiskit to obtain solutions of both QUBO problems and constrained quadratic programs.

Now, get ready for the next chapter: we will be studying the Variational Quantum Eigensolver and some of its most important applications!

lock icon The rest of the chapter is locked
You have been reading a chapter from
A Practical Guide to Quantum Machine Learning and Quantum Optimization
Published in: Mar 2023 Publisher: Packt ISBN-13: 9781804613832
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}