Markowitz Portfolio Optimization with a Quantum Annealer · 31 Conclusions • Quantum annealing is...

Preview:

Citation preview

ORNL is managed by UT-Battelle, LLC for the US Department of Energy

Markowitz Portfolio Optimization with a Quantum Annealer

Erica Grant, Travis Humble

Oak Ridge National Laboratory

University of Tennessee

2

Portfolio Selection

Goals:• Maximize returns

• Minimize risk

• Stay within budget

Inputs:• Uniform random

historical price data

• Budget

• Risk tolerance

Output:• A portfolio

representing a list of investments and the expected return Investment Price Expected

Return/Day1= buy0 = pass

Stock A $150 + $0.10 0Stock B $200 + $0.25 1Stock C $250 + $0.50 0

Budget: $200 Risk Tolerance: Low

3

Portfolio Selection as Binary Integer Programming

𝑥 𝜖 {0, 1}

𝑖 = asset number

𝑝+= price

𝑟+ = expected return

𝑏 = budget

max1

∑+ 𝑟+𝑥+

𝑠. 𝑡. ∑+ 𝑝+𝑥+ ≤ 𝑏

4

Unconstrained Markowitz Formulation𝑚𝑎𝑥1

𝑓(𝑥)

𝑓 𝑥 = 𝜃=>+

𝑥+𝑟++𝑥+ − 𝜃@ >+

𝑥+𝑝+𝑥+ − 𝑏@

− 𝜃A>+,B

𝑥+𝑐𝑜𝑣 ℎ+, ℎB 𝑥B

• 𝑏 = 𝑏𝑢𝑑𝑔𝑒𝑡, 𝑝+ = 𝑝𝑟𝑖𝑐𝑒, 𝑟+= 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑟𝑒𝑡𝑢𝑟𝑛, 𝑥+ 𝜖 0, 1

• Weights: 𝜃=, 𝜃@, 𝜃A ≥ 0 s.t. 𝜃= + 𝜃@ + 𝜃A = 1

• ℎ+ = vector of historical price data

• 𝑐𝑜𝑣 ℎ+, ℎB =∑NOPQ (RS,NTURS)(RV,NTRV)

WT=where m= number of price points

𝒙𝒊 = 𝟏 → 𝒃𝒖𝒚 𝒙𝒊 = 𝟎 → 𝒅𝒐𝒏c𝒕 𝒃𝒖𝒚

5

Unconstrained Markowitz Formulation𝑚𝑎𝑥1

𝑓(𝑥)

𝑓 𝑥 = 𝜃=>+

𝑥+𝑟++𝑥+ − 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ − 𝜃A>+,B

𝑥+𝑐𝑜𝑣 ℎ+, ℎB 𝑥B

• 𝑏 = 𝑏𝑢𝑑𝑔𝑒𝑡, 𝑝+ = 𝑝𝑟𝑖𝑐𝑒, 𝑟+= 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑟𝑒𝑡𝑢𝑟𝑛, 𝑥+ 𝜖 0, 1

• Weights: 𝜃=, 𝜃@, 𝜃A ≥ 0 s.t. 𝜃= + 𝜃@ + 𝜃A = 1

• ℎ+ = vector of historical price data

• 𝑐𝑜𝑣 ℎ+, ℎB =∑NOPe (RS,NTURS)(RV,NTRV)

fwhere 𝑛 = #of assets

𝒙𝒊 = 𝟏 → 𝒃𝒖𝒚 𝒙𝒊 = 𝟎 → 𝒅𝒐𝒏c𝒕 𝒃𝒖𝒚

Expected Return

6

Unconstrained Markowitz Formulation𝑚𝑎𝑥1

𝑓(𝑥)

𝑓 𝑥 = 𝜃=>+

𝑥+𝑟++𝑥+ − 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ − 𝜃A>+,B

𝑥+𝑐𝑜𝑣 ℎ+, ℎB 𝑥B

• 𝑏 = 𝑏𝑢𝑑𝑔𝑒𝑡, 𝑝+ = 𝑝𝑟𝑖𝑐𝑒, 𝑟+= 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑟𝑒𝑡𝑢𝑟𝑛, 𝑥+ 𝜖 0, 1

• Weights: 𝜃=, 𝜃@, 𝜃A ≥ 0 s.t. 𝜃= + 𝜃@ + 𝜃A = 1

• ℎ+ = vector of historical price data

• 𝑐𝑜𝑣 ℎ+, ℎB =∑NOPe (RS,NTURS)(RV,NTRV)

fwhere 𝑛 = #of assets

𝒙𝒊 = 𝟏 → 𝒃𝒖𝒚 𝒙𝒊 = 𝟎 → 𝒅𝒐𝒏c𝒕 𝒃𝒖𝒚

Budget Penalty

7

Unconstrained Markowitz Formulation𝑚𝑎𝑥1

𝑓(𝑥)

𝑓 𝑥 = 𝜃=>+

𝑥+𝑟++𝑥+ − 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ − 𝜃A>+,B

𝑥+𝑐𝑜𝑣 ℎ+, ℎB 𝑥B

• 𝑏 = 𝑏𝑢𝑑𝑔𝑒𝑡, 𝑝+ = 𝑝𝑟𝑖𝑐𝑒, 𝑟+= 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑟𝑒𝑡𝑢𝑟𝑛, 𝑥+ 𝜖 0, 1

• Weights: 𝜃=, 𝜃@, 𝜃A ≥ 0 s.t. 𝜃= + 𝜃@ + 𝜃A = 1

• ℎ+ = vector of historical price data

• 𝑐𝑜𝑣 ℎ+, ℎB =∑NOPe (RS,NTURS)(RV,NTRV)

fwhere 𝑛 = #of assets

𝒙𝒊 = 𝟏 → 𝒃𝒖𝒚 𝒙𝒊 = 𝟎 → 𝒅𝒐𝒏c𝒕 𝒃𝒖𝒚

Diversification

8

Fitting to Unconstrained Problem

• Assets can be divided into any desired fraction based on the budget.

• Normalize purchase price to the budget.

• Use Binary Fractional series: fractions=12q,12=,12@, … ,

12f Special thanks to Benjamin Stump

for the binary fractional series idea

9

Quantum Annealing for Unstructured Search

• Quantum annealing is a model of quantum computing tailored to unconstrained search

• QA operates by preparing a uniform superposition of all possible binary combinations.

• The initial state is then evolved toward a Hamiltonian that defines the objective function.

• Measurement samples the prepared probability distribution, which should concentrate at the global extrema.

10

Quantum Annealing for Unstructured Search

• D-Wave Systems provides a fourth-generation quantum annealer, 2000Q– Programmable superconducting integrated circuit– 2048-qubit register in a 2D Chimera layout– EM shielding, UHV, cooled to 14mK

• This is a special-purpose optimization solver that finds the energetic minimum of an Ising model– Search uses quantum annealing to find minima

• Non-zero temperature, flux noise, and other fluctuations complicate device physics

11

QUBO to Quantum Ising Hamiltonian

𝑓 𝑥 = −𝜃=>+

𝑥+𝑟++𝑥+ + 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ + 𝜃A>+,B

𝑥+𝑐𝑜𝑣 𝑝+, 𝑝B 𝑥B

𝑓 𝑥 = 𝑄+,B∼ 𝑥+𝑥B + 𝑞+𝑥+𝑞+ = 𝑄++ 𝑎𝑛𝑑 𝑄+,B∼ = 𝑄+,B 𝑖 ≠ 𝑗

Ising: 𝑦 𝜖 {−1, 1}

QUBO: 𝑥 𝜖 0, 1

𝐽+,B =14𝑄+,B∼ ℎ+ =

𝑞+2+>

B

𝐽+,B

𝛾 = =|∑+,B 𝑄+,B +

=@∑+ 𝑞+

}𝐻 =>+,B

𝐽+,B�̂�+�̂�B +>+

ℎ+ �𝑥+ + 𝛾

𝑚𝑖𝑛1𝑓(𝑥)

𝑓 𝑥 = >+

ℎ+𝑦+ +>+,B

𝐽+,B 𝑦+𝑦B + 𝛾

Coupler Strengths

12

QUBO to Quantum Ising Hamiltonian

𝑓 𝑥 = −𝜃=>+

𝑥+𝑟++𝑥+ + 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ + 𝜃A>+,B

𝑥+𝑐𝑜𝑣 𝑝+, 𝑝B 𝑥B

𝑓 𝑥 = 𝑄+,B∼ 𝑥+𝑥B + 𝑞+𝑥+𝑞+ = 𝑄++ 𝑎𝑛𝑑 𝑄+,B∼ = 𝑄+,B 𝑖 ≠ 𝑗

Ising: 𝑦 𝜖 {−1, 1}

QUBO: 𝑥 𝜖 0, 1

𝐽+,B =14𝑄+,B∼ ℎ+ =

𝑞+2+>

B

𝐽+,B

𝛾 = =|∑+,B 𝑄+,B +

=@∑+ 𝑞+

}𝐻 =>+,B

𝐽+,B�̂�+�̂�B +>+

ℎ+ �𝑥+ + 𝛾

𝑚𝑖𝑛1𝑓(𝑥)

𝑓 𝑥 = >+

ℎ+𝑦+ +>+,B

𝐽+,B 𝑦+𝑦B + 𝛾

Qubit Weights

13

QUBO to Quantum Ising Hamiltonian

𝑓 𝑥 = −𝜃=>+

𝑥+𝑟++𝑥+ + 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ + 𝜃A>+,B

𝑥+𝑐𝑜𝑣 𝑝+, 𝑝B 𝑥B

𝑓 𝑥 = 𝑄+,B∼ 𝑥+𝑥B + 𝑞+𝑥+𝑞+ = 𝑄++ 𝑎𝑛𝑑 𝑄+,B∼ = 𝑄+,B 𝑖 ≠ 𝑗

Ising: 𝑦 𝜖 {−1, 1}

QUBO: 𝑥 𝜖 0, 1

𝐽+,B =14𝑄+,B∼ ℎ+ =

𝑞+2+>

B

𝐽+,B

𝛾 = =|∑+,B 𝑄+,B +

=@∑+ 𝑞+

𝑚𝑖𝑛1𝑓(𝑥)

𝑓 𝑥 = >+

ℎ+𝑦+ +>+,B

𝐽+,B 𝑦+𝑦B + 𝛾

Constant }𝐻 =>+,B

𝐽+,B�̂�+�̂�B +>+

ℎ+ �𝑥+ + 𝛾

14

QUBO to Quantum Ising Hamiltonian

𝑓 𝑥 = −𝜃=>+

𝑥+𝑟++𝑥+ + 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ + 𝜃A>+,B

𝑥+𝑐𝑜𝑣 𝑝+, 𝑝B 𝑥B

𝑓 𝑥 = 𝑄+,B∼ 𝑥+𝑥B + 𝑞+𝑥+𝑞+ = 𝑄++ 𝑎𝑛𝑑 𝑄+,B∼ = 𝑄+,B 𝑖 ≠ 𝑗

Ising: 𝑦 𝜖 {−1, 1}

QUBO: 𝑥 𝜖 0, 1

𝐽+,B =14𝑄+,B∼ ℎ+ =

𝑞+2+>

B

𝐽+,B

𝛾 = =|∑+,B 𝑄+,B +

=@∑+ 𝑞+

𝑚𝑖𝑛1𝑓(𝑥)

𝑓 𝑥 = >+

ℎ+𝑦+ +>+,B

𝐽+,B 𝑦+𝑦B + 𝛾

Ising Form

}𝐻 =>+,B

𝐽+,B�̂�+�̂�B +>+

ℎ+ �𝑥+ + 𝛾

15

QUBO to Quantum Ising Hamiltonian

𝑓 𝑥 = −𝜃=>+

𝑥+𝑟++𝑥+ + 𝜃@>+

𝑥+𝑝+𝑥+ − 𝑏 @ + 𝜃A>+,B

𝑥+𝑐𝑜𝑣 𝑝+, 𝑝B 𝑥B

𝑓 𝑥 = 𝑄+,B∼ 𝑥+𝑥B + 𝑞+𝑥+𝑞+ = 𝑄++ 𝑎𝑛𝑑 𝑄+,B∼ = 𝑄+,B 𝑖 ≠ 𝑗

Ising: 𝑦 𝜖 {−1, 1}

QUBO: 𝑥 𝜖 0, 1

𝐽+,B =14𝑄+,B∼ ℎ+ =

𝑞+2+>

B

𝐽+,B

𝛾 = =|∑+,B 𝑄+,B +

=@∑+ 𝑞+

𝑚𝑖𝑛1𝑓(𝑥)

𝑓 𝑥 = >+

ℎ+𝑦+ +>+,B

𝐽+,B 𝑦+𝑦B + 𝛾

Quantum Ising

}𝐻 =>+,B

𝐽+,B�̂�+�̂�B +>+

ℎ+ �𝑥+ + 𝛾

16

Solving on D-Wave 2000QD-Wave 2000Q:• 2048 qubits

• Anneal times

• Embeddings

• Reverse Annealing

Parameters:

• 𝜃=, 𝜃@, 𝜃A• Number of assets

• Random historical Price Data

Outputs:• Portfolio:

[-1, 1, 1, 1, -1, -1…] à

[0, 1, 1, 1, 0, 0…]

• Energy of the portfolio

17

Benchmarking against Brute Force Solver

• Probability of success:

𝑃𝑂𝑆 = ���

• 𝑙 = # of ground state energies found by the D-Wave

• 𝑁� = number of samples/anneals

• Average Probability of success

𝑃𝑂𝑆 = ∑+�� ��� +

��• 𝑁� = # problems• 𝑖 indicates problem

• POS ratio: ��� ���� �

• 𝑃𝑂𝑆 � for reverse annealing• 𝑃𝑂𝑆 � for forward annealing

• Energy Binning

Energy à Energy Level

18

Best Fit for Probability of Success

𝑦 = 1.2245 𝑒Tq.��=|∗1�.����

• Embedding = Find_embedding()

• Slices = 0

• Anneal time = 𝟓𝝁𝒔

• Forward annealing

19

Forward Annealing Controls

20

Spin Reversal Control

21

Example Program Embedding in Hardware

find_embedding() Embedding

Clique Embedding

Problem size = 20

• 23 unit cells • 15 unit cells

22

Clique vs Find Embedding

Forward Annealing:

• Embeddings:• find_embedding()• Clique

• Anneal Time = 15𝜇𝑠• Spin Reversal = 0

23

Clique vs Find Embedding

Anneal time = 15 𝜇𝑠Number of anneals = 1,000

24

Forward Annealing: Clique vs Find Embedding

Anneal time = 15 𝜇𝑠Number of anneals = 1,000

25

Reverse Annealing

Parameters:

• Initial State• Reinitialize • S• Pause time

26

Reverse Annealing Sweep

27

Reverse Annealing Sweep

28

Reverse Annealing Sweep

29

Reverse Annealing Sweep

30

Overall Probability of Success

Reverse Annealing:

• S = .9• Pause = 15𝜇𝑠• I.S. = Forward• Reinitialize = False

Forward Annealing:

• Embeddings:• find_embedding()• Clique

• Anneal Time = 15𝜇𝑠• Spin Reversal = 0

31

Conclusions• Quantum annealing is a method for solving QUBO problems and

Markowitz Portfolio optimization is an example which demonstrates real-world application.

• Various parameters both in the QUBO and the D-Wave computer can be controlled/fine-tuned to yield better results.

• Forward annealing reveals a sub-exponential decrease in probability of success as problem size increases.

• Spin reversal transform improves variance.

• Clique Embedding improves probability of success over the find_embedding() method.

• Reverse annealing reveals a better probability of success and a better average solution if initial state is close to ground state.

32

Future Work

• Measure efficiency of using reverse annealing with forward annealing.

• Compare quantum annealing to classical heuristics.

• Investigate using real market data.

ORNL is managed by UT-Battelle, LLC for the US Department of Energy

Questions

University of Tennessee, Knoxville

Oak Ridge National Laboratory

Quantum Computing Institute

In collaboration with Khalifa University

Nada Elsokkary, Faisal Khan

34

Asseti

350

375

312

300

330

Asseti

1.0606

1.1363

.94545

.90909

1

Asseti, 0

1.0606

1.1363

.94545

.90909

1

Asseti, 1

.53030

.56815

.47273

.45450

.5

Asseti, 2

.26515

.28408

.23636

.22727

.25

𝒑𝒌𝒑𝒎 𝒂𝒊 → 𝒂𝒊,𝒌

35

Probability of Success

36

Optimality Gap

Optimality Gap:

𝑎𝑏𝑠𝐸¦§�𝐸¨1�

− 1

Recommended