# Introduction

I do not think I can give a better introduction to this challenge than the verbiage on the first notebook:

Quantum Computing has the potential to revolutionize computing, as it can solve problems that are not possible to solve on a classical computer. This extra ability that quantum computers have is called quantum advantage. To achieve this goal, the world needs passionate and competent end-users: those who know how to apply the technology to their field.

In this challenge you will be exposed, at a high-level, to quantum computing through Qiskit. As current or future users of quantum computers, you need to know what problems are appropriate for quantum computation, how to structure the problem model/inputs so that they are compatible with your chosen algorithm, and how to execute a given algorithm and quantum solution to solve the problem.

Preparing for a quantum future starts now. By learning how to model and apply our current problems prepares us to tackle future issues which we may not even be aware of yet. Each and every of these challenges is another stepping stone in our journey of quantum learning.

With that said, let us dive into the challenges!

# Crop Yield

Our first challenge tasks us with finding optimal crop distributions given a set of land and types of crops we can plant. The goal is to maximize our food output. What we will soon learn is that this type of problem can be modelled as a Quadratic equation, and the minimum of the equation will not only give us the most efficient food output, but this type of problem is something that Quantum computers excel at doing.

## Quadratic Equation Model

Let us start off with how a quadratic equation looks like with an example and constraints.

The next step is to convert it to usable code. Qiskit has a useful `QuadraticProgram`

module that allows us to do just that.

Then if we print out the Linear Programming string we can confirm that it looks right.

That does indeed look right based on our example. Time to see if we can use this knowledge and apply it to the crop yield challenge!

## Crop Yield Application

We are given a problem set of 3 hectares of land and various constraints on the crops we can grow.

We can then take the same approach as the example and model this to code we can use with a quantum computer.

## Classical Solution

We shall solve the equation three separate ways - the first avoiding the quantum world and using a classic Numpy approach.

And with that we have a baseline to work with. Let’s repeat the solution using two quantum methods.

## VQE Solution

The first quantum approach we will explore is the Variational Quantum Eigensolver algorithm, or VQE. The algorithm uses a variational technique to find the minimum eigenvalue of the Hamiltonian 𝐻 of a given system.

An instance of VQE requires defining two algorithmic sub-components: a trial state (ansatz) which is a QuantumCircuit, and one of the classical optimizers. The ansatz is varied, via its set of parameters, by the optimizer, such that it works towards a state, as determined by the parameters applied to the ansatz, that will result in the minimum expectation value being measured of the input operator (Hamiltonian).

## QAOA Solution

The second quantum solution we will explore is the Quantum Approximate Optimization Algorithm, or QAOA.

The QAOA implementation directly extends VQE and inherits VQE’s optimization structure. However, unlike VQE, which can be configured with arbitrary ansatzes, QAOA uses its own fine-tuned ansatz, which comprises 𝑝 parameterized global 𝑥 rotations and 𝑝 different parameterizations of the problem hamiltonian. QAOA is thus principally configured by the single integer parameter, p, which dictates the depth of the ansatz, and thus affects the approximation quality.

Let’s apply it and see if it not only finds the same solution, but if the fine-tuned ansatz also allows us to reduce the amount of evaluations required.

# Portfolio Optimization

The second of the problems in this challenge revolves around exploring a Monte Carlo sampling to help valuate Options pricing. It has been shown that when applying these techniques to quantum computers we are able to achieve a quadratic speedup in comparison to the classical approach.

Our challenge can be broken down into three steps:

Let’s use a classical approach first to show how it works in action.

## Classical Solution

Using a fictitious QuantumTech share, we were tasked with filling in the appropriate details. We are essentially creating many possible realities, then computing the average.

A Monte Carlo approach simply samples random values for the parameters of your function from an underlying distribution and computes the function multiple times, each time using a different set of randomly sampled values. In doing so, we can obtain an expected value for the function we are trying to evaluate by taking an average over all the computed values of the function

Which when executed, the simple example returns us a target price.

While we have the average, let’s look at the distribution of the various “realities” we created as part of the Monte Carlo approach.

Alright we have a good grasp on how this looks like classically. Let’s take a look at the quantum approach and how we can get a quadratic speedup.

## Quantum Solution

To convert our classical approach to a quantum one we would need to perform three steps.

- Represent the probability distribution P describing the evolution of the share price of QuantumTech on a quantum computer.
- Construct the quantum model which computes the payoff of the option,f(X).
- Calculate the expectation value of the payoff Ep[f(X)]

## Quantum Uncertainty Model

Returning to our QuantumTech example, the first component of our option pricing model is to create a quantum circuit that takes in the probability distribution implied.

## Payoff Function

Let’s have a look at the payoff function for our QuantumTech option. Recall that the payoff function equals zero as long as the share price in 1 months time, St, is less than the strike price K and then increases linearly thereafter. The code below illustrates this.

## Evaluate Expected Payoff

Lastly, we can use Quantum Amplitude Estimation to compute the expected payoff of the option. Qiskit has a built-in module, `EuropeanCallPricing`

which we can leverage to make this happen.

One of the challenge components of this notebook was also to find a more accurate representation than above. While we saw how to implement the overall process, we ideally would want to reduce the error as much as possible and have our estimated values as close to the exact values as we can.

By tweaking the various variables we are able to accomplish just that.

# Quantum Chemistry

Quantum computing promises spectacular improvements in drug-design. In particular, in order to design new anti-retrovirals it is important to perform chemical simulations to confirm that the anti-retroviral binds with the virus protein. Such simulations are notoriously hard and sometimes ineffective on classical supercomputers. Quantum computers promise more accurate simulations allowing for a better drug-design workflow.

In this challenge we will explore the VQE approach more in-depth and attempt to see whether our toy anti-retroviral molecule binds with a toy virus.

## Define Protease/Anti-Retroviral

We are given the toy Protease to use in our challenge.

We are also given our toy Anti-Retroviral. These two items will be used in the next steps where our goal is to see if we are able to bond both of them.

## Model the Macro Molecule

Now that we know what our Macro Molecule should look like, we can use the previous examples in the notebook to help model our new one. In theory we should be able to add on the Anti-Retroviral, which should just be the Carbon, to the existing model we had for the Protease.

## Energy Landscape - Does It Bind?

Following the example earlier in the notebook we can model up the binding interaction and plot out the energy landscape to see if our toy example binds.

With the structure setup, we can then execute and graph it out.

The last question we needed to answer was whether this interaction bonded or not. Sadly, based on the energy landscape graph we have to answer:

D. No, there is no clear minimum for any separation, so there is no binding.

While this wasn’t a great ending for our toy Anti-Retroviral, it at least shows us how we can structure such problems in a quantum space, and just how much of an impact a speedup in this space could result in.

# Conclusion

As usual, I left this event having learned much more than I started it with. Even though I don’t fancy myself a future virologist learning how a space like Quantum Computing could intersect with other fields, and just how important it is that we are talking to one another and cross polinating our specific areas of focus. When we all work together, building upon one another, we will move the collective human needle forward. I’m excited for my small part in that journey so far, and I cannot wait to see where it takes me.

As always thanks folks, until next time!