Skip to main content
QUICK REVIEW

[Paper Review] PyQUBO: Python Library for Mapping Combinatorial Optimization Problems to QUBO Form

Mashiyat Zaman, Kôtarô Tanahashi|arXiv (Cornell University)|Mar 2, 2021
Quantum Computing Algorithms and ArchitectureComputer Science27 references7 citations
TL;DR

PyQUBO is an open-source Python library that enables users to efficiently map complex combinatorial optimization problems into Quadratic Unconstrained Binary Optimization (QUBO) and Ising model formats suitable for execution on Ising machines, including quantum annealers. The library’s C++-optimized backend achieves O(n) time complexity for expression construction, significantly outperforming pure Python and SymPy implementations, making it practical for large-scale problems.

ABSTRACT

We present PyQUBO, an open-source, Python library for constructing quadratic unconstrained binary optimizations (QUBOs) from the objective functions and the constraints of optimization problems. PyQUBO enables users to prepare QUBOs or Ising models for various combinatorial optimization problems with ease thanks to the abstraction of expressions and the extensibility of the program. QUBOs and Ising models formulated using PyQUBO are solvable by Ising machines, including quantum annealing machines. We introduce the features of PyQUBO with applications in the number partitioning problem, knapsack problem, graph coloring problem, and integer factorization using a binary multiplier. Moreover, we demonstrate how PyQUBO can be applied to production-scale problems through integration with quantum annealing machines. Through its flexibility and ease of use, PyQUBO has the potential to make quantum annealing a more practical tool among researchers.

Motivation & Objective

  • To address the challenge of manually formulating QUBO and Ising Hamiltonians for complex combinatorial optimization problems.
  • To provide a high-level, readable, and extensible Python interface for constructing QUBOs and Ising models.
  • To improve performance and scalability for large-scale optimization problems through C++-based implementation.
  • To support integration with real-world Ising machines, including D-Wave quantum annealing systems.
  • To enable researchers to prototype and debug complex optimization problems with automated constraint validation and parameter tuning.

Proposed method

  • PyQUBO uses high-level Python classes to abstract mathematical expressions and constraints, enabling intuitive formulation of QUBO and Ising Hamiltonians.
  • It supports binary variable encoding for integer and discrete variables, allowing conversion of non-binary problems into QUBO form.
  • The library employs a binary tree-based internal representation of expressions to enable efficient, copy-free construction with O(n) time complexity in the C++ backend.
  • It provides built-in methods for constraint enforcement using penalty terms, ensuring feasibility of solutions.
  • PyQUBO integrates with the D-Wave Ocean SDK and supports direct export to QUBO matrices for use on D-Wave Advantage quantum annealing hardware.
  • The library includes advanced debugging features such as model validation and parameter tuning for complex problem instances.
Figure 2: A summary of logical gate circuit elements and their truth tables.
Figure 2: A summary of logical gate circuit elements and their truth tables.

Experimental results

Research questions

  • RQ1How can combinatorial optimization problems be systematically and efficiently mapped into QUBO and Ising model formats using a high-level programming interface?
  • RQ2What performance advantages does a C++-optimized backend offer over pure Python or symbolic computation libraries like SymPy in constructing large-scale QUBO expressions?
  • RQ3To what extent can PyQUBO scale to real-world, production-sized optimization problems when integrated with quantum annealing hardware?
  • RQ4How does PyQUBO’s internal data structure (e.g., binary trees vs. sorted arrays) impact memory usage and construction time for large Hamiltonians?
  • RQ5Can PyQUBO reduce the development and debugging overhead for researchers working with Ising machines in diverse application domains?

Key findings

  • PyQUBO’s C++-based implementation (Array(C++)) achieves O(n) time complexity for expression construction, outperforming pure Python and SymPy, which exhibit O(n²) complexity due to list copying during term addition.
  • The memory usage and running time of PyQUBO (C++) are significantly lower than those of SymPy and Python-based PyQUBO, especially for large problems such as graph partitioning and TSP with high QUBO matrix density.
  • The Array(C++) implementation in PyQUBO shows better performance than the Set(C++) variant, with lower memory footprint and faster compile times due to efficient data structure management.
  • PyQUBO successfully enabled the formulation and solution of real-world problems such as number partitioning, knapsack, graph coloring, and integer factorization using a binary multiplier.
  • Integration with the D-Wave Ocean SDK and D-Wave Advantage quantum annealing system demonstrated PyQUBO’s practical utility in production-scale optimization workflows.
  • Benchmarking confirmed that PyQUBO’s performance scales effectively with problem size, making it suitable for complex, large-scale combinatorial optimization tasks.
Figure 3: Diagram for a 3-bit binary multiplier. The arrows labeled $C$ and $S$ refer to the sum and carry of the individual half- and full-adders (labeled HA and FA). The $b_{m}a_{n}$ labels represent the $m$ -th and $n$ -th digit binaries joined by an AND gate.
Figure 3: Diagram for a 3-bit binary multiplier. The arrows labeled $C$ and $S$ refer to the sum and carry of the individual half- and full-adders (labeled HA and FA). The $b_{m}a_{n}$ labels represent the $m$ -th and $n$ -th digit binaries joined by an AND gate.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.