# Problem 5: Find the Ising Equivalent of a QUBO Representing a NOT Gate

• My answer is: j01 = 0.5

Furthermore: h0 = 0.0, h1 = 0.0 and offset = -0.5

The possible ground states are 2, when s0 != s1 and both have the same energy: -1.

This is the output of my script:

Giving QUBO: E(x0,x1) = -x0 -x1 +2*x0*x1
The Ising formulation is:
h0: 0.0 | h1: 0.0 | j01: 0.5
With an offset of: -0.5

************ Check Results using EmbeddingComposite **************
s0: -1 | s1: 1 | Energy: -1.0 | Probability: 62.6
s0: 1 | s1: -1 | Energy: -1.0 | Probability: 37.4

************ Check Results using dmod.ExactSolver **************
s0: -1 | s1: 1 | Energy: -1.0
s0: 1 | s1: -1 | Energy: -1.0

Here is the code:

https://github.com/CalogeroZarbo/quantum_training/blob/master/dwave_problem5.py

• The answer is j01=0.5 where h0=h1=0.

I used the to_ising() method to get the parameters without calculating manually. Then applied the parameters found on test 2-B.

When smaple_ising() method is used with the linear and quadratic parameters, energy values return are reflecting the offset on all states.

The condition to have the ground states for all valid states will make sure that all valid states have equal probability.

The result screens and code below:

************ Test 1 results: Given NOT gate as a QUBO - using Classical Solver to get all states**************

|q1 = 1 |q2 = 0 | Energy = -1.000000 |
|q1 = 0 |q2 = 1 | Energy = -1.000000 |
|q1 = 0 |q2 = 0 | Energy = 0.000000 |
|q1 = 1 |q2 = 1 | Energy = 0.000000 |

************ Test 2-A results: Finding Ising parameters (h,j,offset) - converting qubo to ising and reading parameters **************
Ising linear parameters : {1: 0.0, 2: 0.0}
Ising quadratic parameters : {(1, 2): 0.5}
ising offset parameter : -0.5

******* Test 2-B results: Applying Ising parameters found (h,j,offset) - using Classical Solver to get all states********
|s1 = 1 |s2 = -1 | Energy = -1.000000 |
|s1 = -1 |s2 = 1 | Energy = -1.000000 |
|s1 = -1 |s2 = -1 | Energy = 0.000000 |
|s1 = 1 |s2 = 1 | Energy = 0.000000 |

************ Test 3 - using sample_ising() method to show the energy offset **************

|s0 = 1 |s1 = -1 | Energy = -0.500000 |
|s0 = 1 |s1 = -1 | Energy = -0.500000 |
|s0 = 1 |s1 = -1 | Energy = -0.500000 |
|s0 = 1 |s1 = -1 | Energy = -0.500000 |
|s0 = -1 |s1 = 1 | Energy = -0.500000 |
|s0 = -1 |s1 = 1 | Energy = -0.500000 |
|s0 = -1 |s1 = 1 | Energy = -0.500000 |
|s0 = -1 |s1 = 1 | Energy = -0.500000 |
|s0 = -1 |s1 = -1 | Energy = 0.500000 |
|s0 = -1 |s1 = -1 | Energy = 0.500000 |
|s0 = -1 |s1 = -1 | Energy = 0.500000 |
|s0 = -1 |s1 = -1 | Energy = 0.500000 |
|s0 = 1 |s1 = 1 | Energy = 0.500000 |
|s0 = 1 |s1 = 1 | Energy = 0.500000 |
|s0 = 1 |s1 = 1 | Energy = 0.500000 |
|s0 = 1 |s1 = 1 | Energy = 0.500000 |

• Both Calogero and Yasas have posted great solutions to Problem 5! Nice to see you running this on the QC.  And yes the answer is 2 ground states.

Now try Problem 6, posted today.