Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
This notebook implements the quantum-based resiliency planning using QAOA. This instance of the notebook does not use the Classiq built-in simulator but a specific build of the Qiskit Aer simulator for AMD GPUs. To leverage the Qiskit AMD simulator it is required to have a local AMD card availible.

Before running

This notebook has commented out the code that compiles the AMD Qiskit Aer simulator, in order to use the AMD simulator make sure that you uncomment the code in the first cell, and selecte GPU device in the Qiskit Aer simulator cell.

Create the graph

Output:
output
Output:
Output:
For convience and easy visualization, let’s add a helper function that prints the solution into the graph. This function gets our assigned solution (the 2D array of binary variables).
Output:
output
Output:

Helper Functions

Define Objective Function

Define Single Assignment Cosntraint

Create QAOA Code

Pre-execution setup

We will create a qaoa_samples() function that will leverage the GPU accelerated Qiskit Aer simulator

Create the simulator

NOTE: Make you device=gpu is set when you want to use the AMD GPU, for now it is set to CPU.
We will use a small converter to changet the qiskit output format back to Classiq format.

Execute QAOA

Output:
Output:
Output:
output
Output:
output
Output:
output
Output:
output
Output: