Introduction to Quantum Optimization

Introduction to Quantum Optimization

A tutorial from Quantum Explorer's 2023 by IBM

"Life comes in the concept of optimization since we need to balance everything to maximize happiness! Here the decision variables are too many including health, family, friends, work, inner peace etc. Constraint is that nothing can be avoided."

What are Optimization Problems?

Optimization problems are at the heart of almost every complex decision-making. Maximizing sleep quality or finding the most optimal combination of renewable energy sources to minimize the usage of fossil fuel energy.

Let's consider an example of a zoo. There are 9 different sections of the zoo e.g. Bird section, Reptile section, Water Creatures etc. We reached the zoo at 5:00 pm and it will be closed by 7:00 pm.

The problem is to maximize the fun in the given limited amount of time.

We need to consider some decision variables to define our problem. These variables are as follows:

  • Number of sections

  • Distance between two sections

  • Average wait time to get into a section

  • Time spent in a section

  • Fun score

We also need to consider some restrictions or constraints while roaming in the zoo. These constraints are as follows:

  • Time limit (Zoo closes at 7:00 pm)

  • Visit a section only once. This constraint is necessary or else the computer will tell us to visit the section with the maximum fun score again and again which is not optimal for the visitors

  • Certain sections can be closed off early to give rest to some animals.

The decision variables need to be combined in a way to form a formula that we call an objective function by keeping the constraints in mind.

Let's consider another question for the same problem: What is the shortest route that visits every 9 sections and returns us to the gate at 7 p.m.?

First of all how many different routes are possible? This is the same as having 9 nodes and in how many ways can we arrange them? For the first position, we have 9 possibilities, For the second position we have 8 possibilities ..... For the ninth position, we will have only 1 possibility left. Hence a total number of possible ways is given by 9*8*7*6*5*4*3*2*1 = 9! = 362880 different routes.

A classical computer will take every possible route and calculate the distance of each route. Finally, it will choose the route with minimum distance or the shortest route. This is a very famous problem called as Travelling Salesmen Problem.

Travelling Salesman Problem:

  • Goal: Find the shortest possible route

  • Approach: Solve as a graph problem (n nodes with edges representing distance)

  • Constraint: Visit each ride exactly once and return to the original starting point.

This can be solved as a graph problem with 'n' nodes. Each node represents different cities or a section in a zoo and each edge represents the distance between two such nodes. The number of possible routes is given by n!. Hence the time complexity of solving the above problem using the classical brute force approach will be O(n!). Hence this can grow so large as 'n' increases. This is called an NP-complete problem which is notorious for computing given a large number 'n'.

To solve the optimization problem with a computer we need to start with the formulation of the problem. The formulation of the problem means to describe our optimization problem mathematically in the form of a function f(x), that can be either minimized or maximized.

Let's consider 5 nodes of the zoo and focus on the specific route for the formulation.

Consider a route: 1-2-3-4-5-1

Let's label each path in the diagram.

Let's define a binary variable:

At last, we define our objective function which is the distance to be minimized.

The first constraint is that we can only visit the same node once in a cycle. When visiting a node in a time order, let's say there are 4 different routes to get there.

So to choose only one path out of the four the following conditions must be met:

The same rule is applied while coming out of any node. Consider an example where we have 4 different paths while coming out of a node.

To choose only one path, the following condition is met:

Constraints: Can visit same ride once in a cycle subject to

In the Cost function, we have two binary variables 'x' multiplied by each other. Hence this is a Quadratic function and the constraints are given by a linear function. Now the process of optimizing a quadratic objective function is called Quadratic Programming.

How do we solve an optimization problem using a quantum computer?

A molecule for example has its signature energy function and this is called a Hamiltonian.

A Hamiltonian is an energy function representing the total energy of a given physical system.

For this problem, we can use Minimum Eigen Solvers(VQE, QAOA) to find the ground state energies of a molecule. These algorithms find the eigenvector and eigenstates that correspond to the solution we are looking for. These are extensively used in Quantum Chemistry.

But how does this help in solving the optimization problem?

We can map our optimization problem into a Quantum energy function and solve it just like we would solve a problem to find the ground state energy of a Hamiltonian. For us to solve a quadratic programming optimization problem on a quantum computer we will need to map the problem into an Ising Hamiltonian.

We first take our quadratic program statement and then convert it to a so-called qubo form. Qubo stands for quadratic unconstrained binary optimization. For us to convert a quadratic program into qubo we need to do mainly three things first:

1) We need to convert the inequality constraints in the statement into equality constraints by introducing what we call slack variables denoted by 'b'.

2) We convert these equality constraints into penalty terms and add them to the objective function by introducing a positive constant λ value.

3) We encode the integer variables into binary variables since qubo model needs only binary variables.

The last step would be to convert our Qubo model into what we call an Ising model or an Ising Hamiltonian. We can do this by replacing the binary variables with Pauli Z matrices that have eigenvalues of +1 and -1 corresponding to the spin up and spin down in our Ising model.

Now that we have our quadratic program mapped into an Ising Hamiltonian this will allow us to apply variational quantum algorithms like VQE or QAOA which can calculate the ground state energy of the Hamiltonian and with its corresponding minimum eigenvalue, we find the optimal solution we are looking for in our optimization problem.

Conclusion:

In this blog, we studied Optimization problems, the definition and complexity of the Travelling Salesman Problem, Mapping of a Quadratic cost function to the Ising Model etc.

Credit for the above blog:

I have gained this information from the Introductory video on Quantum Optimization by Quantum Explorer's 2023. Thank You! Yuri Kobayashi for such a wonderful explanation of the above concept.