Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Quantum Computing Experimentation with Amazon Braket

You're reading from   Quantum Computing Experimentation with Amazon Braket Explore Amazon Braket quantum computing to solve combinatorial optimization problems

Arrow left icon
Product type Paperback
Published in Jul 2022
Publisher Packt
ISBN-13 9781800565265
Length 420 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Alex Khan Alex Khan
Author Profile Icon Alex Khan
Alex Khan
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Introduction
2. Section 1: Getting Started with Amazon Braket FREE CHAPTER
3. Chapter 1: Setting Up Amazon Braket 4. Chapter 2: Braket Devices Explained 5. Chapter 3: User Setup, Tasks, and Understanding Device Costs 6. Chapter 4: Writing Your First Amazon Braket Code Sample 7. Section 2: Building Blocks for Real-World Use Cases
8. Chapter 5: Using a Quantum Annealer – Developing a QUBO Function and Applying Constraints 9. Chapter 6: Using Gate-Based Quantum Computers – Qubits and Quantum Circuits 10. Chapter 7: Using Gate Quantum Computers – Basic Quantum Algorithms 11. Chapter 8: Using Hybrid Algorithms – Optimization Using Gate-Based Quantum Computers 12. Chapter 9: Running QAOA on Simulators and Amazon Braket Devices 13. Section 3: Real-World Use Cases
14. Chapter 10: Amazon Braket Hybrid Jobs, PennyLane, and other Braket Features 15. Chapter 11: Single-Objective Optimization Use Case 16. Chapter 12: Multi-Objective Optimization Use Case 17. Other Books You May Enjoy Appendix: Knapsack BQM Derivation

Fine-tuning parameters for QAOA

In the previous sections, we developed the concepts for how QAOA works and used a set of parameters that scale the rotations of the RZ, ZZ, and RX gates. It should also be apparent that rotating the angle too far will only cause it to start moving in the opposite direction of where we want it. Thus, the parameters depend on having an understanding of the problem, the size of the coefficients, and the number of times the RZ, ZZ, and RX gates are repeated. We will continue with our objective function to see whether we can improve on the parameters and get a better result:

  1. In this first example, we will set param2 to 0.1 and vary param1 using x2 while plotting the probabilities of the four possible answers. The code for this is as follows:
    x2=np.arange(0,1.5,.1)# set x
    x=x2
    prob_00=[]
    prob_01=[]
    prob_10=[]
    prob_11=[]
    c_0=objective[0,0]
    c_1=objective[1,1]
    c_01=objective[0,1]
    param2=0.1
  2. he following code uses the param_tuning_example() function...
lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image