Inspiration

Optimization is a field of mathematics with a wide range of applications -- in medicine, self-driving cars, image detection, and much more. With the aid of quantum algorithms and hardware, the field of optimization can expand greatly in efficiency and usage. With this in mind, I decided to create Optim.QC -- a subframework built on top of Qiskit to perform various quantum optimization algorithms.

What it does

Optim.QC is a simple but powerful quantum optimization library. All you have to do is create a quantum circuit using qiskit (and parameterize it), define a valid Hamiltonian, pass it into one of Optim.QC's optimization algorithms, and that's it! Optim.QC offers three main options for optimization:

1) Vanilla gradient descent

2) Quantum natural gradient descent (uses quantum Fisher information)

3) Newton's method (uses second-order Hessian information).

Using Optim.QC, I was even able to test it out by constructing a VQE to solve for H2's energy function!

How we built it

The library was built in Python using the Qiskit and NumPy frameworks. The library was ran in Google Colab notebooks.

All first and second order partial derivatives were evaluated using finite differences.

Challenges we ran into

A big challenge was ensuring the gradient and hessian calculations were correct, because if they were not, optimization would not proceed correctly. And in fact, it took hours upon hours to ensure the hessian matrix was correctly calculated for all possible scenarios -- I even had to revert back to Qiskit version 0.46.3 to test my hessian value against Qiskit's to make sure it was correct!

Accomplishments that we're proud of

I'm proud of having been able to create an end-to-end quantum optimization framework in such a short period of time. I'm also proud of having applied the project to very interesting use cases, including constructing VQEs to find the lowest energy state of molecules.

What we learned

I learned a lot about quantum optimization, and how cost functions can really just be posed as the expectation of the Hamiltonian, and how the gradient of the expectation can be used to update a quantum circuit's parameters. I also learned a great deal about the quantum natural gradient, and the quantum fisher information matrix, which can significantly speed up the optimization process.

What's next for Optim.QC

In the future, I hope to add relevant quantum optimization algorithms for:

- Quantum Annealing

- Quantum semidefinite programming

Sources

[1] https://physlab.org/wp-content/uploads/2023/04/QuantumGD_24100266.pdf

[2] https://github.com/Qiskit/qiskit (Qiskit version 0.46.3 source)

[3] https://www.youtube.com/watch?v=Qsa-_QbpBMg

[4] https://qiskit-community.github.io/qiskit-algorithms/tutorials/12_gradients_framework.html

[5] https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.gradients.QFI.html

Built With

Share this project:

Updates