When to use raw QUBO submission
Use the QUBO endpoint when your problem doesn't map to one of the named problem types (TSP, VRP, portfolio, etc.), or when you need fine-grained control over the penalty weights and matrix structure. Researchers, quantum computing practitioners, and optimization engineers typically work directly with QUBO matrices.
Submit a custom QUBO
import nerox
import numpy as np
client = nerox.Client()
# Build any QUBO matrix: minimize x^T Q x over x ∈ {0,1}^n
# Example: 3-variable problem
Q = np.array([
[ 1, -2, 0],
[-2, 3, -1],
[ 0, -1, 2],
], dtype=float)
Q = (Q + Q.T) / 2 # always symmetrize
job = client.optimize.qubo(
Q=Q,
solver="gpu", # gpu | tabu | qaoa | hybrid
n_runs=1024,
)
result = job.wait()
print(f"Solution: {result.solution}") # [0, 1, 1] etc.
print(f"Objective: {result.objective}")Benchmark across all solvers
solvers = ["gpu", "tabu", "qaoa"]
results = {}
for solver in solvers:
job = client.optimize.qubo(Q=Q, solver=solver)
r = job.wait(timeout=120)
results[solver] = {"obj": r.objective, "time": r.runtime_s}
print(f"{solver:8s}: obj={r.objective:.4f} t={r.runtime_s:.2f}s")
best_solver = min(results, key=lambda s: results[s]["obj"])
print(f"Best solver: {best_solver}")Sparse QUBO submission
For large sparse problems (most real-world instances), supply the matrix in COO (coordinate) format instead of dense numpy arrays. NEROX automatically uses sparse GPU kernels for problems with sparsity above 80%.
import scipy.sparse as sp # Sparse Q matrix in COO format rows = [0, 1, 1, 2] cols = [1, 0, 2, 1] data = [-2.0, -2.0, -1.0, -1.0] n = 100 Q_sparse = sp.coo_matrix((data, (rows, cols)), shape=(n, n)) job = client.optimize.qubo(Q=Q_sparse, solver="gpu", n_runs=512) result = job.wait()
Reading the QUBO Formulation guide
If you need to convert a constrained optimization problem into a QUBO matrix, see the QUBO Formulation Guide which covers penalty methods, constraint encoding, integer variable expansion, and coefficient scaling.
