Skip to main content

A package for QAOA Maxcut calculations

Project description


A package for QAOA Max-cut Calculations.

Packages required:

  • numpy
  • networkx
  • matplotlib
  • qiskit

How to install

You can install from the PyPI:

pip install --upgrade qaoalib


Calculate Max-cut expectation with Qmc or QmcFastKron (faster version):

import networkx as nx
from qaoalib.qaoa import Qmc, QmcFastKron

G = nx.fast_gnp_random_graph(10, 0.5)  # Random graph with 10 nodes
params = [0.2, 0.4, 0.3, 0.5]          # 4 params, depth = 2

qmc = Qmc(G, params) # or QmcFastKron(G, params)

Plot landscapes of the QAOA Max-cut expectation function:

import networkx as nx
from qaoalib.qaoa.landscape import HybridFast

G = nx.fast_gnp_random_graph(10, 0.5)
prev_params = [0.1, 0.2] # previous parameters (gamma1, beta1)

ins = HybridFast(G, prev_params) # plots the landscape wrt gamma2 and beta2 with previous parameters given.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qaoalib-0.1.9.tar.gz (13.1 kB view hashes)

Uploaded source

Built Distribution

qaoalib-0.1.9-py3-none-any.whl (17.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page