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’) ...