Skip to content

Companion code to the quantum approximate optimization algorithm (QAOA) chapter of the Springer Quantum Optimization book.

Notifications You must be signed in to change notification settings

QAR-Lab/qaoa_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Optimization Algorithms

This is the companion code to the quantum approximate optimization algorithm (QAOA) chapter of the Springer Quantum Optimization book. You can find the whole code as discussed in the QAOA chapter in the file qaoa.py. The implementation is based on the QAOA MaxCut functions from Pennylane [1] and the graph tools from NetworkX [2].

Usage

We recommend executing this code in a virtual environment using Python version 3.11.5. You can check you Python version in the terminal with:

python -V

//> Python 3.11.5

Create a virtual environment (with the name "qaoa_venv" for example) with the following command:

python -m venv qaoa_venv

Activate your environment. The name of the environment will show as "(name)" to the left of your terminal line if entered successfully. Then install the recommended python packages with the PIP package manager:

source qaoa_venv/bin/activate

(qaoa_venv) pip install -r requirements.txt

With all packages installed correctly, simply run the following to reproduce the results discussed in the chapter:

(qaoa_venv) python qaoa.py

Contributors

Other References

About

Companion code to the quantum approximate optimization algorithm (QAOA) chapter of the Springer Quantum Optimization book.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages