An Algorithm for Portfolio Optimization Problem ∗

Portfolio optimization is to find the stock portfolio minimizing the risk for a required return or maximizing the return for a given risk level. The seminal work in this field is the meanvariance model formulated as a quadratic programming problem. Since it is not computationally practical to solve the original model directly, a number of alternative models have been proposed. In this paper, among the alternative models, we focus on the Mean Absolute Deviation (MAD) model. More specifically, we derive bounds on optimal objective function value. Using the bounds, we also develop an algorithm for the model. We prove mathematically that the algorithm can solve the problem to optimality. The algorithm is tested using the real data from the Korean Stock Market. The results come up to our expectations that the method can solve a variety of problems in a reasonable computational time.


Introduction
The traditional portfolio optimization problem is to find an investment plan for securities with a reasonable trade-off between the rate of return and risk.The mean-variance model of Markowitz (1952) is a single period static model to obtain the portfolio which can achieve a specified average rate of return with the minimum risk.Following Markowitz's paper, a number of alternative models have been proposed for the same problem.The main objective of these alternative models is to overcome the computational complexity of the original quadratic programming problem.A piecewise linear approximation, the Mean Absolute Deviation (MAD), the Weighted Goal Programming (WGP) and the Minimax (MM) models are some examples of them.For more details on these models, please refer to Satchell and Scowcroft (2003).
The MAD model proposed by Konno and Yamazaki (1991) is a linear programming (LP) model where risk is measured by absolute deviation instead of variance.They showed that it is equivalent to the Markowitz model if returns are multivariate normally distributed.Later, Zenios and Kang (1993) analyzed the model for other asymmetric distributions and found that the MAD model does not require any specific type of return distributions.Speranza (1993) generalized the MAD model using a weighted risk function.The author showed that a more compact equivalent model can be constructed when the coefficients in the linear combination are selected suitably.Three other papers followed to introduce more flexible models (Speranza, 1996;Mansini, 1997;Mansini and Speranza, 1997).Thereafter, Mansini and Speranza (1999) extended their previous work by developing three heuristics.More recent papers, Konno and Wijayanayake (2001) and Kellerer et al. (2001) examined the problems, which take into account more realistic features such as fixed transaction costs or minimum transaction lots.Mansini and Ogryczak (2003) introduced a systematic overview of the LP solvable models with a wide discussion of their theoretical properties.
In this paper, we derive objective bounds for the MAD model, which includes fixed transaction costs and minimum transaction lots.Finding such bounds is important because the bounds can be applicable to a wide variety of problems that have similar structure.By taking advantage of the bounds, we also developed an efficient algorithm for the model.Computational experiments using the real data from the Korean Stock Market show that the bounds we have found are tight and the algorithm is very efficient.
The rest of this paper is organized as follows.In Section 2, a brief review of the MAD model is introduced.In Section 3, we derive the bounds and a few properties followed by the presentation of our algorithm.In the following section the results of computational experiments are discussed.Finally, a conclusion follows in the last section.

Mathematical Model
In this section, we briefly discuss the MAD model.First, we define necessary notations: Indices j: index of security (j = 1, . . ., J), t: index of time period (t = 1, . . ., T ).
Parameters r jt : observed rate of return of security j at time period t, r j : average rate of return of securityj, i.e., r j = T t=1 r jt /T , C L , C U : lower and upper limits of the money to be invested, p j : unit purchase price of security j, d j : transaction cost rate of security j, l j : minimum units of security j that must be included in the portfolio, u j : maximum units of security j that can be included in the portfolio, ρ: required rate of return.

Decision variables
x j : units of security j to be included in the portfolio, y t : deviation below the average rate of return at time period t .
The MAD model is as follows: Original Problem (OP): l j x j u j , x j integer, j = 1, . . ., J, (6) We will refer to the above MAD model as Original Problem (OP) throughout the paper.Constraints (3) and (4) specify the maximum and minimum of capital investment.Constraint (5) makes the selected portfolio attain the required rate of return.(5) shows that the fixed proportional transaction costs are assumed to incur and are deducted from the portfolio return.Constraint (6) is to specify the maximum and minimum units of each security type to be included in the portfolio.The objective function is to minimize the sum of below average deviation per period.

The Previous Heuristics
One of the recent important developments for the MAD model is the work by Mansini and Speranza (1999).They introduced three heuristic algorithms and evaluated them using Milan Stock Exchange data.The three heuristics developed are called Procedures A, B, and C.
Procedure A solves an LP-relaxation of the original problem and, subsequently, solves a smaller MILP (mixed integer linear programming) problem, which is composed of the basic variables of the optimal solution of the LP.This smaller problem is called local MILP.Procedure B extended the range of variables in the local MILP by including nonbasic variables too.Procedure C is a further extension of Procedure B utilizing an iterative scheme to change the security type included in the local MILP.
A serious flaw the three algorithms have in common is that they can not guarantee the optimality of their solution.Since the portfolio problem is a static planning problem, which rarely requires an approximate solution hurriedly, this kind of flaw can be a serious obstacle to real world applications.For this reason, we developed a practical method, which guarantees the optimal solution.

The Proposed Algorithm
We first define an LP as follows: LP1: l j x j u j , j = 1, . . ., J, (12) Note that LP1 is the same as the LP-relaxation of OP but with a new equation ( 10) and without the original equations ( 3) and (4).M in (10) denotes a variable for the investment amount, which is to be set to an appropriate value as we process the algorithm.We found some useful properties for LP1.
Property 1.Let f C L be the value of the optimal objective function (VOF) of LP1 when Proof.See the Appendix. Usually Property 2. There exists a case where Proof.See the Appendix.
We will refer to the former as a usual case (Us-case) and the latter as an exceptional case (Ex-case).Note that the Ex-case can not happen unless there is a security whose unit price is more expensive than the gap between the limits, that isC U − C L .In either case, f C L Z * is satisfied.Thus, f C L is a valid lower bound on the optimal objective value of OP, Z * .
We realize that the search time of the OP's optimal can be shortened considerably if we know in advance which of the above two cases a given problem belongs to.The following LP called Feasibility Problem (FP) is developed to identify the type of a given problem.C in the objective function ( 14) denotes an arbitrary constant value.

FP:
Min C (14) We notice that either of two things can happen when we solve FP.FP may terminate with an optimal solution or with infeasibility.When OP belongs to the case of f C L Z * f C U , it must have at least one feasible solution with its VOF in the interval f C L , f C U (refer to Fig. 1(a)).Thus, in this case, feasible solutions to OP satisfy ( 19) and ( 20).Since FP has the same set of constraints as OP except ( 19) and ( 20), the feasible solutions in this case are also feasible to FP.Because the objective function of FP is set to a constant value, FP will generate one of the feasible solutions as optimal.We also realize that the value calculated by plugging this optimal solution into (1) is a valid upper bound on the VOF of the original problem.Let this upper bound be denoted by υ(Note that the optimal to FP is a feasible to OP, but not necessarily optimal.Thus it is an upper bound).So, in this case f C L Z * υ is satisfied.
On the other hand, if ) or if OP is infeasible, then OP can not have a feasible solution with its VOF in f C L , f C U and, consequently, FP becomes infeasible.When FP is infeasible, we may proceed further to check whether it is f C L f C U Z * or OP is infeasible via Property 3. Property 3. If FP without (20) is infeasible, then there exists no feasible solution to OP.If FP without Eq.( 20) is feasible, the value calculated by plugging its optimal into (1) is a valid upper bound on OP.
Proof.See the Appendix.
In either case, because the objective function of FP is a constant value, FP can be solved very quickly.Note that equations ( 19) and ( 20) can be implemented as the upper and lower bounds rather than usual constraints for faster program execution.The algorithm presented below first determines which of the two cases (Us-case and Ex-case) a given problem belongs.Afterwards, based on the evaluation result, it develops the lower and upper bounds as explained above.Using the constructed bounds, we can find the optimal solution of the problem in a reduced computational time.

Algorithm
Step 1. Solve LP1 to obtain f C L and f C U .
Step 2. Perform the Steps 2.1-2.3 to check the feasibility and to construct the bounds.
Step 2.1.Solve FP to see if Step 3. Use λ and υ to create a modified problem (MP).

MP:
(r jt − r j )p j x j y t , t = 1, . . ., T, (24 l j x j u j , x j integer, j = 1, . . ., J, (30) Step 4. Solve MP.The solution obtained is the optimal solution to the original problem.
In Steps 2.1 and 2.2, we construct the upper and lower bounds when it is Us-case.If a given problem is classified as Ex-case, we calculate the bounds in Step 2.3.In either case, we proceed to Step 3 and utilize the bounds to formulate MP.When we solve MP in Step 4, we can find the OP's optimal solution.
To complete the algorithm, we should solve the LP problem (LP1) once and the MILP problems (FP and MP) up to two times.FP can be solved routinely because it has a constant number as its objective function.Furthermore, the bounds specified in MP are tight enough to cut the computational time considerably.More specifics will be discussed in the next section.All in all, fast computational time enabled this way makes it possible to find the optimal solutions of complex problems, which could not be solved to optimality otherwise.

Computational Experiences
In this section we explain the results of computational experiments.The objective of the analysis is two-fold.The main purpose is to estimate how tight the bounds are.The secondary purpose is to check the performance of the algorithm in a real investment environment.For this reason, the experiments are performed using real data sets from the Korean Stock Market.
We have coded the algorithm in object-oriented Pascal on a personal computer with Intel Pentium processor (1.2 GHz), 256 Mb memory, and a Windows 2000 operating system.CPLEX 7.0 is used to solve the LP and MILP problems.Inside CPLEX, the tolerance gap of the best integer objective and the objective of the best node remaining was set to 10 −6 .A program run is terminated when the computational time exceeds a practical limit, say, ten hours during each test case.
The data is a monthly record of 600 stocks covering from July 1998 to June 2000.The required rate of return, ρ, is varied from 0.25% to 1.5% per month, with a step size of 0.25%.These values are suitable to reflecting the possible interest rates of the Korean financial market.We selected eight different values (10,20,30,40,50,60,70, and 80 million Korean wons) for the lower limit of the capital,C L .The gap between C L and C U is varied from 1.25% to 10.00% of the total investment.With the experimental design, we generated 48 problem instances by randomly selecting 400 stocks from the data.
As proven theoretically, the algorithm successfully found an optimal solution for all the problem sets.The computational time required ranges from 148.94 to 1434.03 with the average of 672.84 CPU seconds.Thus it is safe to say that the speed of the algorithm is pretty fast.
In contrast, the straightforward application of the branch and bound method using CPLEX alone generates an optimal solution in 35 out of 48 instances, which is about a 72.9% success rate.All the unsuccessful cases are due to memory overflow rather than the time limit.It requires a huge amount of main memory, e.g., 5 Gb, to handle the trees and the memory requirement.When it falls short of the physical memory, it resorts to memory paging.Eventually, even with the memory paging, the operation is terminated with a memory overflow error.Thus whether or not the branch and bound method can solve a given problem is mainly determined by the memory size rather than the actual computing power of a system.
To measure the efficiency of the derived bounds, we have compared them with the VOF.As summarized in Table 1, it is shown that the lower bound is very close to the VOF.It deviates no more than 1.31%.The upper bound, however, shows a little more deviation ranging 1.14% to 9.52% of difference.It is also noted that the gap between the upper and lower bounds nearly equals to the capital gap when the capital gap is relatively small.For example, we see that the bounds are (-0.03,1.40) for the capital gap of 1.43%.This can be explained by the shadow price, i.e., the percent change in the objective function equals to that of the right hand side as long as the basis remains unchanged.For a larger gap, say 5.00%, two values show more disparity because the basis is changed in this case.
As mentioned in (Kellerer et al., 2001), the amount we are allowed to invest is usually an exact amount rather than the amount in a range.Previous research, however, substitutes the exact amount with a capital range.This approximation is necessary and has been justified because it is more practical to handle the amount in a range.However, it is not recommended to allow the gap to be unrealistically large.2.00% or less of the gap size would be appropriate for most cases.Returning to the results, we have observed that the bounds are very tight deviating no more than 2.00% for this realistic gap range.
Another concern that we have in mind is how much improvement in solution quality can be made possible by the algorithm.For this purpose, we selected two heuristics, A and C, by Mansini and Speranza (1999), and calculated the percent error from the optimal solution: where Z H and Z * are the VOF's of the heuristic and the optimal solutions respectively.⊗ Bold case represents the instance where an optimal was found by the corresponding heuristic.
Table 2 shows the percent errors by Procedures A and C. Summarizing the results, we may reduce up to 0.5617% and 0.2726% errors by implementing our algorithm instead of Procedures A or C respectively.We also discovered that Procedures A and C can rarely find the optimal solution.Procedure C found twice and Procedure A did none out of 48 problem cases.From a practical point of view, less than 1% of improvement achieved by the algorithm may not be significant.Nevertheless, from a theoretical point of view, it is an important groundwork for more complex MILP models such as m-MAD.
In terms of computational time, our algorithm takes around 3.25 times longer than Procedure A, but around 2.81 times shorter than Procedure C on average.The details can be found in Table 3.We think the computational time is satisfactory because we would rather solve the portfolio problem to optimality, even though it takes some more time than to obtain an approximate solution.
Lastly, we have examined the relation between the gap of the investment, C U − C L , and the performance of the algorithms.More specifically, we investigated the influences of the gap size on the solution quality and the computational time.For the test, we assumed eight different values ranging from 1.25% to 10.00% for the gap.For each setting, we run 10 different test problems.The results are in Figs. 2 and 3. We first note that the accuracy of the proposed algorithm is not affected at all because it is an algorithm to find an optimal solution.But the performance of the other two algorithms is noticeably influenced by the gap.For the gap range of 5% or less, the percent error of the solution remains less than 0.10%.However, as the gap increases beyond 5.00%, the accuracy of   the algorithms degrades very rapidly.
The running time of the three algorithms is depicted in Fig. 3.It shows that the proposed algorithm exhibits little change over the whole gap range except for a little hump at 5%.The other two algorithms reveal a similar feature.Overall, the computational time of all three algorithms does not seem to be influenced much by the gap of the capital range.

Conclusions
In this paper, we have investigated the MAD model to construct the upper and lower bounds on the optimal objective function value.By taking advantage of the bounds and properties that we found, we have developed an algorithm to solve the MILP problem.It is proved mathematically that the algorithm can solve the problem to optimality.Using the data from the Korean Stock Market, we performed extensive experiments to check the efficiency of the bounds as well as the performance of the algorithm.As a result, we have observed that the bounds are very close to the optimal objective function value, and the algorithm can solve a variety of problems in a reasonable computational time.For all problem sets, the method successfully generates optimal solutions in less than 1.434 CPU seconds.
To sum up, the method we have developed is accurate and efficient enough to solve realistic problems in a reasonable amount of time.The bounds we have derived will be applicable to a wide range of problems that have similar structure.We hope that the work in this paper would contribute to expanding the real world application of portfolio optimization and become a good addition to the existing solution methodologies.J.S. Kim is a professor of information and industrial engineering at Hanyang University in Korea.He received his doctor of engineering and MS degrees from the University of California at Berkeley.His areas of research include mathematical programming, multiechelon inventory system, game theory applications to logistics problems, and investment analysis.
(a) Case when some feasible solutions reside in[f C L , f C U ].(b).Case when all feasible solutions reside in (f C U , ∞).

Fig. 1
Fig.1shows the two cases of f C L Z * f C U and f C L f C U Z * .We will refer to the former as a usual case (Us-case) and the latter as an exceptional case (Ex-case).Note that the Ex-case can not happen unless there is a security whose unit price is more expensive than the gap between the limits, that isC U − C L .In either case, f C L Z * is satisfied.Thus, f C L is a valid lower bound on the optimal objective value of OP, Z * .We realize that the search time of the OP's optimal can be shortened considerably if we know in advance which of the above two cases a given problem belongs to.The following LP called Feasibility Problem (FP) is developed to identify the type of a given problem.C in the objective function (14) denotes an arbitrary constant value.

Fig. 2 .
Fig. 2. Percent errors of the algorithms for various capital gaps.

Fig. 3 .
Fig. 3. Average computational times of the algorithms for various capital gaps.

Y
.C. Kim received his MS degree in industrial engineering from Hanyang University.He is currently pursuing his PhD degree in industrial engineering from Hanyang University.His research interests are portfolio management and integer programming.K.Y.Shin received his MS degree in industrial engineering from Hanyang University.He is currently pursuing his PhD degree in industrial engineering from Hanyang University.His research interests are mathematical programming and forecasting.
/T and λ ← f C U .ii)If it is infeasible, terminate the algorithm.

Table 1
Percent deviations of the lower and upper bounds from the VOF

Table 3
Minimum, average and maximum of the computational times in CPU seconds