代写 algorithm City University of Hong Kong Department of Economics and Finance

City University of Hong Kong Department of Economics and Finance
Course EF5213 Assignment #3 ( due March 10, 2019 ) 1. Consider the MVO problem that determines the optimal portfolio content w and w0 by minimizing the
portfolio risk subject to an expected return P as minimize 1 wT w
2
subject to wT  w0 0  P , uTw  w0  1 , and a1  w1  b1 , … , an  wn  bn ,
given riskfree rate 0, asset mean returns , and their variance-covariance . There are buy and sell limits in the optimization according to the given positive quantities {a1, … , an} and {b1, … , bn}. It should be noted that the optimal portfolio content can be determined through the Kuhn-Tucker conditions as
MVO problem.
Consider the following procedures in your implementation:
L (w0 u)i 0 when ai wi bi
wi
Modify the Markowitz algorithm in the lecture and develop a VBA implementation for the current
 0 when wi  ai
 0 when wi  bi , for i  0, 1, … , n
(1) Define an OUT subset , and separate  into two disjoint subsets lower and upper. Consider the MVO problem with wi  bi for i  lower, and wi  ai for i  upper. The optimal solution of this MVO problem is given by
w0 1(Am 0 Cm)uT 1, w(1m 0 1um)1v, mmmmm
  (1) uT1T1 P020mmmm
(Cm0  2Am0  Bm)
where i  0 for i  lower , i  0 for i  upper , and else i  jlowerij (bj)  jupperij (aj)
vi   bi for i  lower , vi  ai for i  upper , and else vi  0
  jlower j (bj)  jupper j (aj) ,   jlower uj (bj)  jupper uj (aj)
Here, {m, m, um} refer to the modified versions of {, , u} corresponding to the assets in the OUT
subset. The terms {, , } are defined according to the contents in lower and upper using {, , u}.
(2) Check that all the entries of w satisfy both the buy and sell limits. If so, proceed to step (3). If this is not the case, return to step (1) and try another separation of  or another OUT subset.
(80 points)

(3) Check that KKT conditions have been satisfied. If so, w0 and w defined in (1) will be an optimal solution given portfolio return P. Otherwise, return to step (1) and try another separation of  or another OUT subset.
Some useful comments:
Given OUT subset I( 1 : Nc , 1 : Nout ), consider the separation into two disjoint subsets:
Ilower( 1 : Mc , 1 : Mout ) and Iupper( 1 : Mc , 1 : Nout  Mout )
– When Mout  0, Ilower is empty and Iupper has the same content as I. There is Mc  1 possibility.
– When Mout  1, Ilower takes one element in I, and Iupper keeps the rest. There are Mc  Nout possibilities. – When Mout  k, we can resuse the separation in the previous case.
From previous separation, Ilower( 1 : Mc , 1 : k  1) and Iupper( 1 : Mc , 1 : Nout  k  1 ) for Mout  k  1 We can build Inew ( 1 : Mnew, 1 : k ) and Inew ( 1 : Mnew, 1 : Nout  k ) for Mout  k,
lower c upper c
The idea is
Inew ( J’ , 1 : k )  Ilower( J , 1 : k  1)  i, where i is either one entry taken from Iupper( J , 1 : Nout  k  1 )
Inew ( J’ , 1 : Nout  k)  Iupper( J , 1 : Nout  k  1 ) excluding the entry with i lower
and the new Mc can be obtained by counting.
lower