Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2023 Nov 8;13(1):19434.
doi: 10.1038/s41598-023-45392-w.

Best practices for portfolio optimization by quantum computing, experimented on real quantum devices

Affiliations

Best practices for portfolio optimization by quantum computing, experimented on real quantum devices

Giuseppe Buonaiuto et al. Sci Rep. .

Abstract

In finance, portfolio optimization aims at finding optimal investments maximizing a trade-off between return and risks, given some constraints. Classical formulations of this quadratic optimization problem have exact or heuristic solutions, but the complexity scales up as the market dimension increases. Recently, researchers are evaluating the possibility of facing the complexity scaling issue by employing quantum computing. In this paper, the problem is solved using the Variational Quantum Eigensolver (VQE), which in principle is very efficient. The main outcome of this work consists of the definition of the best hyperparameters to set, in order to perform Portfolio Optimization by VQE on real quantum computers. In particular, a quite general formulation of the constrained quadratic problem is considered, which is translated into Quadratic Unconstrained Binary Optimization by the binary encoding of variables and by including constraints in the objective function. This is converted into a set of quantum operators (Ising Hamiltonian), whose minimum eigenvalue is found by VQE and corresponds to the optimal solution. In this work, different hyperparameters of the procedure are analyzed, including different ansatzes and optimization methods by means of experiments on both simulators and real quantum computers. Experiments show that there is a strong dependence of solutions quality on the sufficiently sized quantum computer and correct hyperparameters, and with the best choices, the quantum algorithm run on real quantum devices reaches solutions very close to the exact one, with a strong convergence rate towards the classical solution, even without error-mitigation techniques. Moreover, results obtained on different real quantum devices, for a small-sized example, show the relation between the quality of the solution and the dimension of the quantum processor. Evidences allow concluding which are the best ways to solve real Portfolio Optimization problems by VQE on quantum devices, and confirm the possibility to solve them with higher efficiency, with respect to existing methods, as soon as the size of quantum hardware will be sufficiently high.

PubMed Disclaimer

Conflict of interest statement

The authors declare no competing interests.

Figures

Figure 1
Figure 1
Schematic of the VQE algorithm. The ansatz wave-function |ψ(θ)) is initialized with random parameters and encoded in a given set of quantum gates. The PO problem is translated into an Ising Hamiltonian and encoded into a set of Pauli gates. The collection of output measurement allows the reconstruction of the expectation value of the Hamiltonian H, which is the energy that needs to be minimized. A classical optimization algorithm provides an update rule for the parameters of the wave-function, which ideally moves iteratively towards the ground state of the problem, thus providing an estimation of the corresponding eigenstate. This corresponds to the solution of the original PO problem.
Figure 2
Figure 2
Noiseless experiments performed on IBM QASM simulator, supposing a fault-tolerant quantum machine, with no quantum noise influencing the quality of the results. Convergence of the solutions towards the optimal one during training epochs, evaluated with different optimizers and different ansatzes. For all these experiments, a penalty term λ=10 was used.
Figure 3
Figure 3
Noisy experiments, performed on IBM QASM simulator, by importing IBM Cairo quantum computer noise model. Convergence of the solutions towards the optimal one during training epochs, evaluated with different optimizers and ansatzes. For all these experiments, a penalty term λ=10 was used.
Figure 4
Figure 4
Effect of variable penalty coefficient, used to transform the constrained into an unconstrained problem. Dots represent the random sampling of possible solutions satisfying the constraint of the continuous problem. Among them, a few are also possible solutions to the integer PO problem. The square corresponds to the optimal solution found by the classical branch-and-bound method. The other symbols correspond to the optimal solutions found to the QUBO problem, with constraints embedded in the objective function by setting different values of the penalty coefficient. For each penalty value, the evaluation of the best PO has been performed taking the average of 2000 runs from the quantum circuit optimized via the VQE.
Figure 5
Figure 5
Results of experiments run on different real quantum devices with λ=10. Dots represent the random sampling of possible solutions satisfying the constraint of the continuous problem. The square corresponds to the optimal solution found by the classical branch-and-bound method. The other symbols correspond to the optimal solutions found to the QUBO problem, by means of different IBM quantum computers. For each quantum hardware, the evaluation of the best PO has been performed taking the average of 2000 runs from the quantum circuit optimized via the VQE.
Figure 6
Figure 6
Results of experiments run with the nine ansatz considered, on different real quantum devices, ordered according to growing quantum volumes. The box extends from the quartile Q1 to Q3 of the data, with a yellow line at the median (Q2). The black lines extend from the edges of the box to show the range of the data. Here a standard approach is followed, as they extend to a maximum of 1.5(Q3-Q1) from the edges of the box, ending at the farthest data point in the interval. Data outliers are plotted as black squares, while the white dots represent the mean of the result distribution for each hardware.

References

    1. Markowitz H. Portfolio selection. J. Financ. 1952;7:77–91.
    1. Marinescu R, Dechter R. And/or Branch-and-Bound Search for Pure 0/1 Integer Linear Programming Problems. In: Beck JC, Smith BM, editors. Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems. Springer; 2006. pp. 152–166.
    1. Niu S-F, Wang G-X, Sun X-L. A branch-and-bound algorithm for discrete multi-factor portfolio optimization model. J. Shanghai Univ. 2008;12:26–30. doi: 10.1007/s11741-008-0105-3. - DOI
    1. Pinelis M, Ruppert D. Machine learning portfolio allocation. J. Financ. Data Sci. 2022;8:35–54. doi: 10.1016/j.jfds.2021.12.001. - DOI
    1. Gunjan A, Bhattacharyya S. A brief review of portfolio optimization techniques. Artif. Intell. Rev. 2022 doi: 10.1007/s10462-022-10273-7. - DOI