Skip to content

Results are limited to QUBO Solver v0.9.1

Product news
You are reading QUBO Solver v0.9.1, an older version of this documentation. Go to the latest version (v0.10.0)

30-Second Quickstart

Qubo Solver can be installed from PyPI (external) with your favorite pyproject-compatible Python manager. Using pip, for example:

pip install qubo-solver
from qubosolver import Instance, Solver, matrix, analysis
# Define an Instance from a symmetric matrix
Q = matrix.tensor(
[
[-0.2, 0.0, 1.0],
[0.0, -1.0, 1.5],
[1.0, 1.5, -0.1],
]
)
instance = Instance(Q)
# Instantiate the quantum solver (default)
solver = Solver(instance)
solution = solver.solve()
print(analysis.to_dataframe([solution]))
labels bitstrings costs counts probs
0 0 110 -1.2 985 0.985
1 0 001 -0.1 15 0.015

The solver returns a Solution instance holding the candidate bitstrings and their QUBO costs. As the quantum solver samples the solution space, it also reports each bitstring's count (how many times it was measured) and probability.