\n", "[Improving Variational Quantum Optimization using CVaR. Barkoutsos et al. 2019.](https://arxiv.org/abs/1907.04769)" ] }, { "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.algorithms import VQE, QAOA, NumPyMinimumEigensolver\n", "from qiskit.algorithms.optimizers import COBYLA\n", "from qiskit.circuit.library import TwoLocal\n", "from qiskit.utils import QuantumInstance\n", "from qiskit_finance.applications.optimization import PortfolioOptimization\n", "from qiskit_finance.data_providers import RandomDataProvider\n", "from qiskit_optimization.algorithms import MinimumEigenOptimizer\n", "from qiskit_optimization.applications import OptimizationApplication\n", "from qiskit_optimization.converters import QuadraticProgramToQubo\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", "seed = 123\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", " seed=seed)\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": [ { "output_type": "display_data", "data": { "text/plain": "

",
"image/svg+xml": "\n\n\n\n",
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQcAAAD8CAYAAAB6iWHJAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAANRUlEQVR4nO3df8yddXnH8feHUorIb2hGAx24QZjGTZCmw5AsBCQBNHTLMIM/FAyki5GJy0zULWGZ/wz3hyYGI2mADIxRDCjrDAvBgFEzQGpTEOiQjoRQrAMKFhoQVrj2x7nLHh6/D4We+9zntH2/kpPnPuf+9lzXSZtPz3Pf59xXqgpJmm+/aTcgaTYZDpKaDAdJTYaDpCbDQVKT4SCpaaxwSHJkkjuTPNb9PGKBda8l2dDd1o5TU9IwMs7nHJL8C/BcVV2d5AvAEVX1+ca67VV18Bh9ShrYuOHwKHBmVW1Jsgz4UVWd3FhnOEh7mHHD4TdVdXi3HeD5nffnrdsBbAB2AFdX1W0LPN9qYDXAuw/KaX904gG73dusemzjodNuYXKydx7CqldfnXYLE/Mizz9bVUtb+/bf1R9O8kPgmMauf5h7p6oqyUJJc3xVPZXkD4C7kvyiqv57/qKqWgOsAVjxgQPrZ3cs31V7e5yPnHbutFuYnAOXTLuDidjxxOZptzAxP3zt5icW2rfLcKiqDy+0L8n/JFk259eKpxd4jqe6n48n+RFwKvA74SBpdoz7PnAtcEm3fQnwb/MXJDkiyZJu+2jgDOCRMetKmrBxw+Fq4JwkjwEf7u6TZEWS67o17wXWJXkAuJvRMQfDQZpxu/y14q1U1Vbg7Mbj64DLu+3/BP54nDqShrd3Hl6WNDbDQVKT4SCpyXCQ1GQ4SGo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zbIrMyq2lpVOyfjXgec1mddSf0bZFZmkmVz7l4AbBy3rqTJGmpW5meSXADsYDQr89Ie6vZtzbQbmBBf155nJl5br8ccJO09/ISkpCbDQVLTPh8OSc5N8miSTUm+MO1++pLkhiRPJ3lo16v3HEmWJ7k7ySPdx/WvnHZPfXg7X0MYvKd9+ZhDdxD1l4zOsGwG7gcurqpHptpYD5L8GaNPrt5UVe+fdj996c58Lauq9UkOYfThuz/f0//OkgR499yvIQBXNr6GMJh9/Z3DSmBTVT1eVa8C3wFWTbmnXlTVjxmdGdqrVNWWqlrfbb/I6LT4sdPtanw1MlNfQ9jXw+FYYO7HuDezF/xD21ckOQE4Fbhvyq30IsmiJBuAp4E7q2qqr2tfDwftoZIcDNwKfLaqXph2P32oqteq6hTgOGBlkqn+Orivh8NTwPI594/rHtMM634nvxX4VlV9b9r99G2hryEMbV8Ph/uBk5K8J8kBwEXA2in3pLfQHbi7HthYVV+Zdj99eTtfQxjaPh0OVbUDuAK4g9GBre9W1cPT7aofSb4N3AOcnGRzksum3VNPzgA+Dpw158pi50+7qR4sA+5O8iCj/7TurKofTLOhffpUpqSF7dPvHCQtzHCQ1GQ4SGoyHCQ1GQ6SmgwHSU2Gg6Sm/wNVABW5bfXHjgAAAABJRU5ErkJggg==\n"
},
"metadata": {
"needs_background": "light"
}
}
],
"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": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"\\ This file has been generated by DOcplex\n",
"\\ ENCODING=ISO-8859-1\n",
"\\Problem name: Portfolio\n",
"\n",
"Minimize\n",
" obj: 0.015284386652 x_0 - 0.000780952145 x_1 + 0.000517920547 x_2\n",
" + 0.000870005837 x_3 + [ 0.002541388592 x_0^2 + 0.000146804433 x_0*x_1\n",
" + 0.000257201062 x_0*x_2 - 0.000199722426 x_0*x_3 + 0.000258486713 x_1^2\n",
" + 0.000106085519 x_1*x_2 + 0.000088963242 x_1*x_3 + 0.000791504681 x_2^2\n",
" - 0.000247774763 x_2*x_3 + 0.000197892585 x_3^2 ]/2\n",
"Subject To\n",
" c0: x_0 + x_1 + x_2 + x_3 = 2\n",
"\n",
"Bounds\n",
" 0 <= x_0 <= 1\n",
" 0 <= x_1 <= 1\n",
" 0 <= x_2 <= 1\n",
" 0 <= x_3 <= 1\n",
"\n",
"Binaries\n",
" x_0 x_1 x_2 x_3\n",
"End"
]
},
"metadata": {},
"execution_count": 4
}
],
"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",
"portfolio = PortfolioOptimization(expected_returns=mu, covariances=sigma, risk_factor=q, budget=budget)\n",
"qp = portfolio.to_quadratic_program()\n",
"qp"
]
},
{
"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 = result.x\n",
" value = result.fval\n",
" print('Optimal: selection {}, value {:.4f}'.format(selection, value))\n",
" \n",
" eigenstate = result.min_eigen_solver_result.eigenstate\n",
" eigenvector = eigenstate if isinstance(eigenstate, np.ndarray) else 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 = QuadraticProgramToQubo().convert(qp).objective.evaluate(x)\n",
" #value = portfolio.to_quadratic_program().objective.evaluate(x)\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": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Optimal: selection [0. 1. 1. 0.], value 0.0003\n\n----------------- Full result ---------------------\nselection\tvalue\t\tprobability\n---------------------------------------------------\n [0 1 1 0]\t0.0003\t\t1.0000\n [1 1 1 1]\t4.0973\t\t0.0000\n [0 1 1 1]\t1.0211\t\t0.0000\n [1 0 1 1]\t1.0382\t\t0.0000\n [0 0 1 1]\t0.0018\t\t0.0000\n [1 1 0 1]\t1.0368\t\t0.0000\n [0 1 0 1]\t0.0004\t\t0.0000\n [1 0 0 1]\t0.0174\t\t0.0000\n [0 0 0 1]\t1.0208\t\t0.0000\n [1 1 1 0]\t1.0369\t\t0.0000\n [1 0 1 0]\t0.0176\t\t0.0000\n [0 0 1 0]\t1.0208\t\t0.0000\n [1 1 0 0]\t0.0160\t\t0.0000\n [0 1 0 0]\t1.0192\t\t0.0000\n [1 0 0 0]\t1.0364\t\t0.0000\n [0 0 0 0]\t4.0795\t\t0.0000\n"
]
}
],
"source": [
"exact_mes = NumPyMinimumEigensolver()\n",
"exact_eigensolver = MinimumEigenOptimizer(exact_mes)\n",
"\n",
"result = exact_eigensolver.solve(qp)\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": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Optimal: selection [0. 1. 1. 0.], value 0.0003\n\n----------------- Full result ---------------------\nselection\tvalue\t\tprobability\n---------------------------------------------------\n [0 1 0 1]\t0.0004\t\t0.4896\n [0 0 1 1]\t0.0018\t\t0.2603\n [0 1 1 0]\t0.0003\t\t0.2500\n [0 0 1 0]\t1.0208\t\t0.0000\n [1 0 0 1]\t0.0174\t\t0.0000\n [0 0 0 1]\t1.0208\t\t0.0000\n [1 0 1 1]\t1.0382\t\t0.0000\n [1 1 1 0]\t1.0369\t\t0.0000\n [1 1 1 1]\t4.0973\t\t0.0000\n [1 0 0 0]\t1.0364\t\t0.0000\n [0 1 0 0]\t1.0192\t\t0.0000\n [1 0 1 0]\t0.0176\t\t0.0000\n [0 1 1 1]\t1.0211\t\t0.0000\n [0 0 0 0]\t4.0795\t\t0.0000\n [1 1 0 1]\t1.0368\t\t0.0000\n [1 1 0 0]\t0.0160\t\t0.0000\n"
]
}
],
"source": [
"from qiskit.utils import algorithm_globals\n",
"\n",
"algorithm_globals.random_seed = 1234\n",
"backend = Aer.get_backend('statevector_simulator')\n",
"\n",
"cobyla = COBYLA()\n",
"cobyla.set_options(maxiter=500)\n",
"ry = TwoLocal(num_assets, 'ry', 'cz', reps=3, entanglement='full')\n",
"quantum_instance = QuantumInstance(backend=backend, seed_simulator=seed, seed_transpiler=seed)\n",
"vqe_mes = VQE(ry, optimizer=cobyla, quantum_instance=quantum_instance)\n",
"vqe = MinimumEigenOptimizer(vqe_mes)\n",
"result = vqe.solve(qp)\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": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Optimal: selection [0. 1. 1. 0.], value 0.0003\n\n----------------- Full result ---------------------\nselection\tvalue\t\tprobability\n---------------------------------------------------\n [0 1 0 1]\t0.0004\t\t0.1751\n [0 1 1 0]\t0.0003\t\t0.1749\n [0 0 1 1]\t0.0018\t\t0.1735\n [1 1 0 0]\t0.0160\t\t0.1592\n [1 0 1 0]\t0.0176\t\t0.1577\n [1 0 0 1]\t0.0174\t\t0.1577\n [0 1 0 0]\t1.0192\t\t0.0003\n [1 0 1 1]\t1.0382\t\t0.0003\n [1 1 1 0]\t1.0369\t\t0.0003\n [1 1 0 1]\t1.0368\t\t0.0003\n [0 0 1 0]\t1.0208\t\t0.0002\n [0 0 0 1]\t1.0208\t\t0.0002\n [0 1 1 1]\t1.0211\t\t0.0002\n [1 0 0 0]\t1.0364\t\t0.0001\n [1 1 1 1]\t4.0973\t\t0.0000\n [0 0 0 0]\t4.0795\t\t0.0000\n"
]
}
],
"source": [
"algorithm_globals.random_seed = 1234\n",
"backend = Aer.get_backend('statevector_simulator')\n",
"\n",
"cobyla = COBYLA()\n",
"cobyla.set_options(maxiter=250)\n",
"quantum_instance = QuantumInstance(backend=backend, seed_simulator=seed, seed_transpiler=seed)\n",
"qaoa_mes = QAOA(optimizer=cobyla, reps=3, quantum_instance=quantum_instance)\n",
"qaoa = MinimumEigenOptimizer(qaoa_mes)\n",
"result = qaoa.solve(qp)\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": [
{
"output_type": "display_data",
"data": {
"text/plain": "",
"text/html": "### Version Information

"
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": "",
"text/html": "### This code is a part of Qiskit

"
},
"metadata": {}
}
],
"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": {
"name": "python3",
"display_name": "Python 3.8.6 64-bit ('opt-qiskit')",
"metadata": {
"interpreter": {
"hash": "9c837c7ac14898b4157c3602a52e89b1bd57ef10d6bdaa28fc65fa6f9116fa6b"
}
}
},
"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.8.6-final"
},
"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
}

Qiskit Software | Version |
---|---|

Qiskit | None |

Terra | 0.17.0.dev0+89d15f3 |

Aer | 0.7.4 |

Ignis | 0.5.2 |

Aqua | None |

IBM Q Provider | 0.11.1 |

System information | |

Python | 3.8.6 (default, Mar 10 2021, 14:41:09) \n[Clang 12.0.0 (clang-1200.0.32.29)] |

OS | Darwin |

CPUs | 8 |

Memory (Gb) | 32.0 |

Thu Mar 18 18:34:56 2021 JST |

© Copyright IBM 2017, 2021.

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.