# Quantum computing basics - what is QUBO and how to solve optimization problems using pyqubo and QC?

January 8, 2023

Quadratic unconstrained binary optimization (QUBO) is a mathematical optimization problem that is often used in the field of quantum computing. It involves finding the optimal solution to a problem by minimizing a quadratic objective function subject to binary (i.e., 0 or 1) constraints.

In the context of quantum computing, QUBO problems can be used to find the optimal configuration of qubits (the basic units of quantum information) for a given task. This is important because the performance of many quantum algorithms depends on the specific configuration of the qubits, and finding the optimal configuration can significantly improve the efficiency and accuracy of the algorithm.

To solve a QUBO problem, one typically uses a quantum annealer, a type of quantum computer specifically designed for finding the global minimum of a QUBO function. The quantum annealer works by mapping the QUBO problem onto a physical system, such as a lattice of superconducting qubits, and then using quantum mechanics to search for the optimal configuration of the qubits.

Here is a simple example of how to use pyqubo to solve a QUBO optimization problem in Python:

```import pyqubo

# Define the QUBO objective function
def objective_function(x, y):
return (x - 1)**2 + (y - 2)**2

# Create a PyQUBO model for the objective function
model = pyqubo.Model(objective=objective_function)

# Define the variables x and y with binary values
x, y = model.variables("x", "y")

# Compile the PyQUBO model into a form that can be solved by a quantum annealer
qubo, offset = model.compile()

# Solve the QUBO using a quantum annealer (in this case, we are using a dummy solver)
solution, broken, energy = pyqubo.solvers.dummy_solver(qubo)

# Print the optimal solution
print(solution)
```

This program defines a simple objective function that is a quadratic function of two binary variables x and y, and then creates a pyqubo model for this objective function. The model is compiled into a form that can be solved by a quantum annealer, and then the QUBO is solved using the dummy_solver function from pyqubo. Finally, the optimal solution is printed.

This is just a simple example, and pyqubo can be used to solve much more complex QUBO optimization problems as well. For more information about pyqubo, see the documentation at https://pyqubo.readthedocs.io/.

Today there exists already a large number of academically published QUBO formulations - a list of QUBO transformations can be found here.

One of the main benefits of using QUBO problems in quantum computing is that they can be easily expressed in terms of the native operations of quantum annealers, which makes them well-suited for use on these types of computers. In addition, QUBO problems can be easily transformed into other types of optimization problems, such as Ising models, which are also commonly used in quantum computing.

Overall, QUBO optimization is a powerful tool for finding the optimal solutions to a wide variety of problems in the field of quantum computing, and it is likely to play a central role in the development of advanced quantum algorithms and technologies in the future.