quboify
quboify is an open-source Python package for constructing Quadratic Unconstrained Binary Optimization (QUBO) models from symbolic expressions while preserving symbolic parameters.
The primary use case of quboify is to take a SymPy model, and convert it into QUBO form with a qubovert data structure while maintaining the symbolic expressions such that late-stage adjustments of parameters is possible.
quboify offers only limited links to existing quantum optimization solvers. As these solvers are expected to develop and change in the future, this toolkit offers an extendable solver-independent interface.
quboify was developed at the Institute of Energy Systems Engineering (ICE-1) at Forschungszentrum Jülich GmbH, Germany.
Getting Started
Installation
The authors recommend installation using Pixi:
pixi add quboify
Alternatively from PyPI:
pip install quboify
The core package builds and modifies QUBOs without any solver installed. To run the built-in
solver backends (used by the example below via solve_simulated_annealing()), install the optional
solvers extra, which pulls in the D-Wave and Gurobi dependencies:
pip install "quboify[solvers]"
Usage
The following example showcases quboify's main additions over mqt-qao: the preservation of symbolic variables and parameters. It supports variable names containing characters such as - (see a-0-0) and allows parameter modification without reconstructing the QUBO (see p).
from quboify import Constraints, ObjectiveFunctions, Problem, Solver, Symbols
variables = Symbols()
constraints = Constraints()
obj_func = ObjectiveFunctions()
a = variables.add_binary_variable("a-0-0")
b = variables.add_discrete_variable("b", [-1, 1, 3])
c = variables.add_continuous_variable("c", -2, 2, 0.25)
p = variables.add_parameter("p")
constraints.add_constraint(variables.encoding_constraints)
constraints.add_constraint("b + c >= 2", variable_precision=True)
obj_func.add_objective_function(a*p + b*c*p + c**2)
problem = Problem(variables, constraints, obj_func)
solver = Solver(problem)
problem.set_parameters({"p": 2})
solutions = solver.solve_simulated_annealing()
print(f"Best solution: {solutions.best_solution}")
print(f"with objective function value: {solutions.best_solution_objective_values}")
problem.set_parameters({"p": -1})
solutions = solver.solve_simulated_annealing()
print(f"Best solution: {solutions.best_solution}")
print(f"with objective function value: {solutions.best_solution_objective_values}")
Contributing
If you wish to contribute to quboify by creating Work Items (Issues) or Merge Requests (Pull Requests), you can login with your Google, Github or ORCID accounts using the "Helmholtz AAI" login option.
Referencing
In case you are using quboify in your work, we would be thankful if you referred to it by citing the following publication (also found in paper/paper.md):
to be published
Acknowledgements
The project originated as a fork of mqt-qao. The authors acknowledge the original developers for establishing the foundational concepts on which quboify builds.
The code and paper for this project were written as part of the project “Quantum-based Energy Grids (QuGrids)”, which is receiving funding from the programme “Profilbildung 2022”, an initiative of the Ministry of Culture and Science of the State of North Rhine-Westphalia.
Metadata
Release files for quboify 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quboify-1.1.4.tar.gz | 92.1 kB | Without provenance | Details for quboify-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quboify-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for quboify-1.1.4-py3-none-any.whl |
Total release size: 122.7 kB
Release files / quboify-1.1.4.tar.gz
| Download URL | quboify-1.1.4.tar.gz |
|---|---|
| Size | 92.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd510ff9e7642445c3ad41ae75340a97c7c11816f154a0479d390b6f7e91b3e0
|
|
BLAKE2b-256 checksum How to use checksums |
d4841207f4bc0bf24b6019e320c50797091e831823f7a34d4640dc31ecbe6bde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / quboify-1.1.4-py3-none-any.whl
| Download URL | quboify-1.1.4-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ba17043529b00115dd29fb593cad674cf2918462043378edaee5b1ece6a7a9f
|
|
BLAKE2b-256 checksum How to use checksums |
4a99b056403e5c5f5f687dbc93b691fdde84e02e319c002cdbfb7a493ab85b99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for quboify 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.