{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# _*Portfolio Optimization*_ \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction\n", "\n", "This tutorial shows how to solve the following mean-variance portfolio optimization problem for $n$ assets:\n", "\n", "$\\begin{aligned}\n", "\\min_{x \\in \\{0, 1\\}^n} q x^T \\Sigma x - \\mu^T x\\\\\n", "\\text{subject to: } 1^T x = B\n", "\\end{aligned}$\n", "\n", "where we use the following notation:\n", "\n", "- $x \\in \\{0, 1\\}^n$ denotes the vector of binary decision variables, which indicate which assets to pick ($x[i] = 1$) and which not to pick ($x[i] = 0$),\n", "- $\\mu \\in \\mathbb{R}^n$ defines the expected returns for the assets,\n", "- $\\Sigma \\in \\mathbb{R}^{n \\times n}$ specifies the covariances between the assets,\n", "- $q > 0$ controls the risk appetite of the decision maker,\n", "- and $B$ denotes the budget, i.e. the number of assets to be selected out of $n$.\n", "\n", "We assume the following simplifications:\n", "- all assets have the same price (normalized to 1),\n", "- the full budget $B$ has to be spent, i.e. one has to select exactly $B$ assets.\n", "\n", "The equality constraint $1^T x = B$ is mapped to a penalty term $(1^T x - B)^2$ which is scaled by a parameter and subtracted from the objective function. \n", "The resulting problem can be mapped to a Hamiltonian whose ground state corresponds to the optimal solution.\n", "This notebook shows how to use the Variational Quantum Eigensolver (VQE) or the Quantum Approximate Optimization Algorithm (QAOA) to find the optimal solution for a given set of parameters.\n", "\n", "Experiments on real quantum hardware for this problem are reported for instance in the following paper:\n", "
\n", "Improving Variational Quantum Optimization using CVaR. Barkoutsos et al. 2019." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:05.710593Z", "start_time": "2020-07-13T20:34:57.647535Z" } }, "outputs": [], "source": [ "from qiskit import Aer\n", "from qiskit.circuit.library import TwoLocal\n", "from qiskit.aqua import QuantumInstance\n", "from qiskit.finance.applications.ising import portfolio\n", "from qiskit.optimization.applications.ising.common import sample_most_likely\n", "from qiskit.finance.data_providers import RandomDataProvider\n", "from qiskit.aqua.algorithms import VQE, QAOA, NumPyMinimumEigensolver\n", "from qiskit.aqua.components.optimizers import COBYLA\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import datetime" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### [Optional] Setup token to run the experiment on a real device\n", "If you would like to run the experiment on a real device, you need to setup your account first.\n", "\n", "Note: If you do not store your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define problem instance\n", "\n", "Here an Operator instance is created for our Hamiltonian. In this case the paulis are from an Ising Hamiltonian translated from the portfolio problem. We use a random portfolio problem for this notebook. It is straight-forward to extend this to using real financial data as illustrated here:
\n", "[Loading and Processing Stock-Market Time-Series Data](11_time_series.ipynb)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:15.224327Z", "start_time": "2020-07-13T20:35:15.213892Z" } }, "outputs": [], "source": [ "# set number of assets (= number of qubits)\n", "num_assets = 4\n", "\n", "# Generate expected return and covariance matrix from (random) time-series\n", "stocks = [(\"TICKER%s\" % i) for i in range(num_assets)]\n", "data = RandomDataProvider(tickers=stocks,\n", " start=datetime.datetime(2016,1,1),\n", " end=datetime.datetime(2016,1,30))\n", "data.run()\n", "mu = data.get_period_return_mean_vector()\n", "sigma = data.get_period_return_covariance_matrix()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [ "nbsphinx-thumbnail" ] }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQcAAAD8CAYAAAB6iWHJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANXklEQVR4nO3df6zddX3H8edrpRT5MahAQlcqs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ATVfXipPvpQlXtqqrTgOOBFUkm+uvggR4OU8Cyac+PB56ZUC/aR8PfyW8Dbq6q70y6n67N9mcIfTvQw+EB4JQkJyU5GFgFrJ1wT9qD4Qd3NwAbq+oLk+6nK/vyZwh9O6DDoap2AlcDdzL4YOvbVfXIZLvqRpJvAv8JnJpkKsmVk+6pI2cDHwLOnXZnsYsm3VQHlgD3JHmIwT9ad1XVdyfZ0AF9KlPS7A7oIwdJszMcJDUZDpKaDAdJTYaDpCbDQVKT4SCp6f8Ai2IivvZdDWEAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# plot sigma\n", "plt.imshow(sigma, interpolation='nearest')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:15.231767Z", "start_time": "2020-07-13T20:35:15.226490Z" } }, "outputs": [], "source": [ "q = 0.5 # set risk factor\n", "budget = num_assets // 2 # set budget\n", "penalty = num_assets # set parameter to scale the budget penalty term\n", "\n", "qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We define some utility methods to print the results in a nice format." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:15.243604Z", "start_time": "2020-07-13T20:35:15.233567Z" } }, "outputs": [], "source": [ "def index_to_selection(i, num_assets):\n", " s = \"{0:b}\".format(i).rjust(num_assets)\n", " x = np.array([1 if s[i]=='1' else 0 for i in reversed(range(num_assets))])\n", " return x\n", "\n", "def print_result(result):\n", " selection = sample_most_likely(result.eigenstate)\n", " value = portfolio.portfolio_value(selection, mu, sigma, q, budget, penalty)\n", " print('Optimal: selection {}, value {:.4f}'.format(selection, value))\n", " \n", " eigenvector = result.eigenstate if isinstance(result.eigenstate, np.ndarray) else result.eigenstate.to_matrix()\n", " probabilities = np.abs(eigenvector)**2\n", " i_sorted = reversed(np.argsort(probabilities))\n", " print('\\n----------------- Full result ---------------------')\n", " print('selection\\tvalue\\t\\tprobability')\n", " print('---------------------------------------------------')\n", " for i in i_sorted:\n", " x = index_to_selection(i, num_assets)\n", " value = portfolio.portfolio_value(x, mu, sigma, q, budget, penalty) \n", " probability = probabilities[i]\n", " print('%10s\\t%.4f\\t\\t%.4f' %(x, value, probability))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## NumPyMinimumEigensolver (as a classical reference)\n", "Lets solve the problem. First classically...\n", "\n", "We can now use the Operator we built above without regard to the specifics of how it was created. We set the algorithm for the NumPyMinimumEigensolver so we can have a classical reference. The problem is set for 'ising'. Backend is not required since this is computed classically not using quantum computation. The result is returned as a dictionary." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:15.264319Z", "start_time": "2020-07-13T20:35:15.245811Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Optimal: selection [0 1 0 1], value -0.0005\n", "\n", "----------------- Full result ---------------------\n", "selection\tvalue\t\tprobability\n", "---------------------------------------------------\n", " [0 1 0 1]\t-0.0005\t\t1.0000\n", " [1 1 1 1]\t16.0040\t\t0.0000\n", " [0 1 1 1]\t4.0013\t\t0.0000\n", " [1 0 1 1]\t4.0052\t\t0.0000\n", " [0 0 1 1]\t0.0025\t\t0.0000\n", " [1 1 0 1]\t4.0023\t\t0.0000\n", " [1 0 0 1]\t0.0034\t\t0.0000\n", " [0 0 0 1]\t4.0007\t\t0.0000\n", " [1 1 1 0]\t4.0033\t\t0.0000\n", " [0 1 1 0]\t0.0007\t\t0.0000\n", " [1 0 1 0]\t0.0045\t\t0.0000\n", " [0 0 1 0]\t4.0018\t\t0.0000\n", " [1 1 0 0]\t0.0016\t\t0.0000\n", " [0 1 0 0]\t3.9988\t\t0.0000\n", " [1 0 0 0]\t4.0027\t\t0.0000\n", " [0 0 0 0]\t16.0000\t\t0.0000\n" ] } ], "source": [ "exact_eigensolver = NumPyMinimumEigensolver(qubitOp)\n", "result = exact_eigensolver.run()\n", "\n", "print_result(result)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Solution using VQE\n", "We can now use the Variational Quantum Eigensolver (VQE) to solve the problem. We will specify the optimizer and variational form to be used.\n", "\n", "Note: You can switch to different backends by providing the name of backend." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:26.536878Z", "start_time": "2020-07-13T20:35:24.379996Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Optimal: selection [0. 0. 1. 1.], value 0.0025\n", "\n", "----------------- Full result ---------------------\n", "selection\tvalue\t\tprobability\n", "---------------------------------------------------\n", " [0 0 1 1]\t0.0025\t\t0.7519\n", " [0 1 1 0]\t0.0007\t\t0.2480\n", " [1 1 0 1]\t4.0023\t\t0.0000\n", " [1 1 0 0]\t0.0016\t\t0.0000\n", " [1 0 0 1]\t0.0034\t\t0.0000\n", " [0 1 0 1]\t-0.0005\t\t0.0000\n", " [1 1 1 0]\t4.0033\t\t0.0000\n", " [1 0 0 0]\t4.0027\t\t0.0000\n", " [1 0 1 1]\t4.0052\t\t0.0000\n", " [1 0 1 0]\t0.0045\t\t0.0000\n", " [0 0 1 0]\t4.0018\t\t0.0000\n", " [0 1 0 0]\t3.9988\t\t0.0000\n", " [0 0 0 1]\t4.0007\t\t0.0000\n", " [0 1 1 1]\t4.0013\t\t0.0000\n", " [0 0 0 0]\t16.0000\t\t0.0000\n", " [1 1 1 1]\t16.0040\t\t0.0000\n" ] } ], "source": [ "backend = Aer.get_backend('statevector_simulator')\n", "seed = 50\n", "\n", "cobyla = COBYLA()\n", "cobyla.set_options(maxiter=500)\n", "ry = TwoLocal(qubitOp.num_qubits, 'ry', 'cz', reps=3, entanglement='full')\n", "vqe = VQE(qubitOp, ry, cobyla)\n", "vqe.random_seed = seed\n", "\n", "quantum_instance = QuantumInstance(backend=backend, seed_simulator=seed, seed_transpiler=seed)\n", "\n", "result = vqe.run(quantum_instance)\n", "\n", "print_result(result)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Solution using QAOA\n", "\n", "We also show here a result using the Quantum Approximate Optimization Algorithm (QAOA). This is another variational algorithm and it uses an internal variational form that is created based on the problem." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:28.570970Z", "start_time": "2020-07-13T20:35:26.539093Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Optimal: selection [0. 1. 0. 1.], value -0.0005\n", "\n", "----------------- Full result ---------------------\n", "selection\tvalue\t\tprobability\n", "---------------------------------------------------\n", " [0 1 0 1]\t-0.0005\t\t0.1673\n", " [0 1 1 0]\t0.0007\t\t0.1670\n", " [1 1 0 0]\t0.0016\t\t0.1668\n", " [0 0 1 1]\t0.0025\t\t0.1666\n", " [1 0 0 1]\t0.0034\t\t0.1663\n", " [1 0 1 0]\t0.0045\t\t0.1661\n", " [1 1 1 1]\t16.0040\t\t0.0000\n", " [0 0 0 0]\t16.0000\t\t0.0000\n", " [0 1 1 1]\t4.0013\t\t0.0000\n", " [0 1 0 0]\t3.9988\t\t0.0000\n", " [1 1 0 1]\t4.0023\t\t0.0000\n", " [1 0 1 1]\t4.0052\t\t0.0000\n", " [1 0 0 0]\t4.0027\t\t0.0000\n", " [1 1 1 0]\t4.0033\t\t0.0000\n", " [0 0 0 1]\t4.0007\t\t0.0000\n", " [0 0 1 0]\t4.0018\t\t0.0000\n" ] } ], "source": [ "backend = Aer.get_backend('statevector_simulator')\n", "seed = 50\n", "\n", "cobyla = COBYLA()\n", "cobyla.set_options(maxiter=250)\n", "qaoa = QAOA(qubitOp, cobyla, 3)\n", "\n", "qaoa.random_seed = seed\n", "\n", "quantum_instance = QuantumInstance(backend=backend, seed_simulator=seed, seed_transpiler=seed)\n", "\n", "result = qaoa.run(quantum_instance)\n", "\n", "print_result(result)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2020-07-13T20:35:29.079589Z", "start_time": "2020-07-13T20:35:28.573543Z" } }, "outputs": [ { "data": { "text/html": [ "

Version Information

Qiskit SoftwareVersion
Qiskit0.19.1
Terra0.14.1
Aer0.5.1
Ignis0.3.0
Aqua0.7.0
IBM Q Provider0.7.0
System information
Python3.7.4 (default, Aug 13 2019, 15:17:50) \n", "[Clang 4.0.1 (tags/RELEASE_401/final)]
OSDarwin
CPUs6
Memory (Gb)16.0
Fri Jul 17 17:36:55 2020 CEST
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "

This code is a part of Qiskit

© Copyright IBM 2017, 2020.

This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.

Any modifications or derivative works of this code must retain this
copyright notice, and modified files need to carry a notice indicating
that they have been altered from the originals.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import qiskit.tools.jupyter\n", "%qiskit_version_table\n", "%qiskit_copyright" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 1 }