Here we think about the way to implement 2-opt method on quantum computer using quantum circuit
2-opt method
Evalutating the cost function swapping two cities. To use this method on quantum computer, we need some techniques.
Thinking about the route we round ABCD cities, we need N*Nqubits for N cities. To realize 2-opt method on ising model we have to swap 4qubits once together.
Now we could make a 2-opt swap 1001 to 0110. Let's try on IonQ Device on blueqat cloud
Copy
from bqcloud import load_api
from bqcloud import Device
#import API key.
api = load_api()
task = api.execute(Circuit(4).x[0,3].rxx(math.pi/2)[0,1].rxx(math.pi/2)[2,3].ryy(math.pi/2)[0,1].ryy(math.pi/2)[2,3], Device.IonQDevice, 100)
Copy
print(task.status())
Status.QUEUED
Copy
# get the result
result = task.wait(timeout=3600)
if result:
print(result.shots())
else:
print("timeout")
But, if we only think about the 2-opt method, what we need is just these two states,
0110
1001
To realize these states once on the quantum circuit, we can use entanglement. By realizing this circuit we can rezlize 2-opt swap operation on just one circuit.
Here we also succeded to make flip on IonQ device. To apply this 2-opt method to combinatorial optimizaiton on quantum computer would be little complicated. I will follow on articles later, one by one. Thank you for reading.