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:
- In this first example, we will set
param2
to0.1
and varyparam1
usingx2
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
- he following code uses the
param_tuning_example()
function...