In this section, the problem of finding the best possible portfolio composition is exposed and the theory behind the objectives to solve it is explained in a general way. In addition, the most used techniques will be listed, differentiating between classical approaches and intelligent approaches. Subsequently, what is quadratic programming will be explained and some techniques within this discipline of mathematical optimization will be mentioned. It will be shown how the portfolio optimization problem can be described as a quadratic programming problem. In addition, a brief explanation of the Dual Active Set Method will be provided, a technique widely used in this discipline, and which will be used in the following chapters.

2.3.1 Problem and techniques

As Gunjan (2023) explains, portfolio optimization is the process of selecting the best mix of assets to hold in a portfolio based on pre-defined objectives. The objectives can be the maximization of return or the minimization of risk, or both. Portfolio optimization involves finding the optimal weights for each asset in the portfolio so that the overall portfolio meets the desired objectives. This can be a challenging problem due to the large number of assets to choose from and the complex relationships between them.

Portfolio optimization is an important process for investors as it helps them minimize risk and maximize return on their investments. By carefully selecting the assets to hold in their portfolio, investors can achieve their desired level of risk and return while diversifying their investments to reduce overall risk. Portfolio optimization is a crucial mechanism used to reduce investment risk.

There are various techniques that can be used to solve the portfolio optimization problem. In Gunjan (2023) these techniques are classified into two categories: classical approaches and intelligent approaches. Below is a general explanation of some of the techniques belonging to each approach.

Classical approaches:

  • Mean-variance: This technique, proposed in Markowitz and Markowitz (1967), is based on the idea of minimizing the variance for a given expected return or maximizing the expected return for a given variance. It is a parametric quadratic programming (hereinafter PQP) technique that can be used to solve quadratic optimization problems that arise in portfolio optimization (Aijun Zhang & Chun-hung Li & Agus Sudjianto (2008)). The mean variance approach assumes that investors are risk averse and prefer portfolios with lower variance. The technique consists of constructing a portfolio frontier that represents the set of portfolios that offer the highest expected return for a given level of risk. The optimal portfolio from this frontier is then selected based on the investor’s risk preferences.

  • Skewed variance: This technique extends the mean-variance approach by accounting for skewed distribution. It was proposed in Samuelson (1970) and can be used when the distribution function is not quadratic in nature. Skewness measures the skewness of a distribution and can provide additional information about the potential risks and returns of a portfolio. By incorporating asymmetry into the portfolio optimization process, investors can better understand potential downside risks and make more informed decisions.

  • Value at Risk (VaR): This statistical approach measures the potential loss in value of a portfolio over a defined period for a given confidence interval. It was introduced in the first edition of Jorion (2007) in 1997 and requires the determination of three parameters: time period, confidence level, and value-at-risk unit. VaR provides a measure of the maximum potential loss that could occur with a given probability in a specified time horizon. It is commonly used by financial institutions to manage their risk exposure and comply with regulatory requirements.

  • Conditional Value-at-Risk (CVaR): This approach widens the VaR by considering the expected loss that exceeds the VaR. It was introduced in Rockafellar and Uryasev (2002) and can handle extreme losses by using dynamic weights derived from historical data. CVaR provides a measure of the expected loss that could occur beyond the VaR threshold. It is also known as Expected Shortfall (ES) or Tail Value-at-Risk (TVaR) and is considered a more consistent measure of risk than VaR.

  • Mean-Absolute Deviation (MAD): This technique can be used for large-scale and highly diversified portfolio selection problems. It was introduced in Konno and Yamazaki (1991) and penalizes both positive and negative deviations. MAD provides a measure of the average absolute deviation of portfolio returns from their mean value. It is considered more robust than variance-based measures, as it is less sensitive to outliers.

  • Minimax: This technique uses the minimum return as a measure of risk. It was introduced in Cai et al. (2004) and has certain advantages when the returns are not normally distributed. Minimax provides a worst-case measure for a portfolio by minimizing the maximum potential loss that could occur. It can be useful for investors who are particularly concerned about downside risks.

Smart approaches:

  • Bayesian Networks: These probabilistic graphical models can be used to model risk and return. They were featured on Shenoy and Shenoy (2000) and can be used to visualize the relationship between different variables in a model. Bayesian networks provide a way to represent complex dependencies between variables using directed acyclic graphs (DAGs). They can be used to model uncertain relationships between variables and to make probabilistic predictions about future events. In the context of portfolio management, Bayesian networks can be used to model relationships between different assets and make predictions about their future returns based on historical data and other relevant information.

  • Support Vector Regression (SVR): This machine learning technique can be used to determine the amount to buy and sell. It was introduced by Drucker et al. (1996) and has certain advantages over statistical-based techniques, such as its ability to learn from historical data. SVR involves building a hyperplane that separates data points with different labels while maximizing the margin between them. It can be used for regression tasks where the goal is to predict continuous values ​​instead of discrete labels. In the context of portfolio management, SVR can be used to predict future asset prices based on historical data and other relevant information.

  • Artificial neural networks: As explained previously, these computational models can be used to solve complex computational and learning problems. In the context of portfolio management, neural networks can be used to predict future asset prices or returns based on historical data and other relevant information, which is what they are used for in this paper.

  • Reinforcement Learning: This type of machine learning involves an agent or model interacting with its environment to learn from its actions. It was featured in Sutton and Barto (2018) and works to maximize agent reward. Reinforcement learning involves learning through trial and error interactions with an environment. The agent takes actions based on its current state and receives rewards or penalties based on the results of those actions. Over time, the agent learns to take actions that maximize his accumulated reward. In the context of portfolio management, reinforcement learning can be used to develop trading strategies that maximize returns while managing risk.

2.3.1 Quadratic programming

This sub-heading explains what quadratic programming is. What are some of the techniques that exist within this discipline of mathematical optimization. It also exposes how the portfolio optimization problem can be described as a quadratic programming problem and briefly explains how one of the most used techniques in this discipline works, specifically the so-called Dual Active Set Method, which is used in the later chapters.

Quadratic programming can be chosen from among the techniques listed in the previous subheading for several reasons. First, it is a well-established technique that has been widely used in portfolio optimization. It can handle complex optimization problems with multiple constraints and can provide an efficient and effective way to solve the portfolio optimization problem. This makes it a useful tool for investors looking to minimize risk while achieving the desired level of return. Finally, quadratic programming has a solid theoretical foundation and has been widely studied in the literature. This makes it a reliable and well-understood technique that can be used with confidence in portfolio optimization.

There are several quadratic programming techniques, among the most used are:

  • Interior Point: This is a linear or nonlinear programming method that achieves optimization by going through the centre of the solid defined by the problem instead of around its surface. A polynomial time linear programming algorithm using an interior point method was found by Karmarkar (1984).

  • Active Set: This is an algorithm used to identify the active constraints in a set of inequality constraints. The active constraints are then expressed as equality constraints, thus transforming an inequality constrained problem into a simpler equality constrained subproblem. The active set method was first introduced in an article by Beale (1959) and developed by Fletcher (1971) and Bunch and Kaufman (1977).

  • Dual Active Set: The method, as exposed by Goldfarb and Idnani (1982) and Goldfarb and Idnani (1983), is an efficient and numerically stable dual algorithm for positive definite quadratic programming that takes advantage of the fact that the unrestricted minimum of the objective function can be used as a point of departure.

  • Augmented Lagrangian: It was independently introduced in Magnus R. Hestenes (1969) and Powell (1969). It is used to solve constrained optimization problems by adding a penalty term to the objective function that penalizes any violation of the constraints. The penalty term is typically a multiple of a constraint violation measure, such as the sum of squared constraint violations.

  • Conjugate Gradient: This is an iterative method for solving systems of linear equations with a symmetric positive definite matrix. It can also be used to solve unrestricted optimization problems by finding the minimum of a quadratic function. The method generates a sequence of search addresses that are conjugated with respect to the matrix that defines the system of equations or quadratic function. The conjugate gradient method was originally introduced in an article by Magnus R. Hestenes and Stiefel (1952).

  • Gradient Projection: The gradient projection method was introduced in J. B. Rosen (1960) and J. Rosen (1961). This is an iterative method for solving constrained optimization problems by projecting the gradient into the feasible region at each iteration. The projected gradient is then used as the search direction, and a line search is performed along this direction to find a new iteration that satisfies the constraints and reduces the objective function.

From the previously mentioned techniques, the Dual Active Set Method algorithm (hereinafter, DASM) was selected, which, as previously mentioned, was introduced in Goldfarb and Idnani (1982) and Goldfarb and Idnani (1983), it is an optimization algorithm to solve quadratic programming problems. The algorithm predicts the active set of constraints that are equally satisfied in the solution of the problem. Computes a sequence of optimal solutions of QP problems involving some of the constraints of the original problem, called a sequence of dual feasible points.

Below is a general example of how the DASM algorithm could work using what-if values for a 2-asset portfolio optimization problem, the example was built from Goswami, Mondal, and Paruya (2012) and Walker (2014):

Under the assumption that it is about finding the best composition of a portfolio in which, for simplicity, we have 2 assets, the quadratic problem would be posed as follows Equation 1:

\[ \begin{aligned} min~~Q(\vec{w}) &= \vec{w}^TC\vec{w}\\ subject~to:\\ w_{1}+w_{2}=1\\ 0\leq{w_{i}}\leq{1}\\ w_{1}\mathbb{E} + w_{2}\mathbb{E} \geq{0.005} \end{aligned} \tag{1}\]

Assuming that they have average monthly returns \(r=\begin{bmatrix} 0.02 & 0.03 \end{bmatrix}\) and covariance matrix \(C=\begin{bmatrix} 0.001 & 0.0008 \\ 0.0008 & 0.002 \end{bmatrix}\) . The vectors and matrices needed for the DASM algorithm can be constructed as follows:

  • The average monthly return vector would be \(r=\begin{bmatrix} 0.02 & 0.03 \end{bmatrix}\).

  • The covariance matrix C would be used as the matrix D in DASM.

  • The constraint \(w_{1}+w_{2}=1\) can be written in matrix form as \(\begin{bmatrix} 1 & 1 \end{bmatrix}\begin{bmatrix} w_1 \\ w_2 \end{bmatrix}=1\). This would be the first row of the \(A\) array in DASM.

  • The minimum return requirement \(w_{1}\mathbb{E} + w_{2}\mathbb{E} \geq{0.005}\) can be written in matrix form as \(\begin{bmatrix} 0.02 & 0.03 \end{bmatrix}\begin{bmatrix} w_1 \\ w_2 \end{bmatrix}\geq{0.005}\). This would be another row of the \(A\) array in DASM.

  • The constraints \(0\leq{w_i}\leq{1}\) can be written in matrix form as \(\begin{bmatrix} 1 & 0 \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \end{bmatrix} \geq{0}\) and \(\begin{bmatrix} 0 & 1 \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \end{bmatrix} \geq{0}\) for lower bounds and \(\begin{bmatrix} -1 & 0 \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \end{bmatrix} \geq{-1}\) and \(\begin{bmatrix} 0 & -1 \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \end{bmatrix} \geq{-1}\) for upper bounds.

  • The matrix \(A\) would look like this: \(A=\begin{bmatrix} 1 & 1 \\ 0.02 & 0.03 \\ 1 & 0 \\ 0 & 1 \\ -1 & 0 \\ 0 & -1 \end{bmatrix}\)

The corresponding vector \(b\) would be \(\begin{bmatrix} 1 & 0.005 & 0 & 0 & -1 & -1\end{bmatrix}\). We can then use the DASM algorithm to solve this quadratic programming problem and determine the optimal asset allocation in our portfolio.

Step 0: Find the unrestricted minimum by solving the unrestricted quadratic programming problem. Set the number of elements in the active set A (empty set) to zero.

Step 1: Choose a violated constraint, if any. In this case, suppose that the constraint \(w_{1}+w_{2}=1\) is violated.

Step 2: Calculate the primary and dual step directions and the step length \(t=min(t_{1},t_{2})\). Suppose \(t=t_{2}\).

Step 3: Step up and update the active set A and the solution (\(S\)) for pair (x, A). Since \(t=t_{2}\) , we add the pth constraint (in this case \(w_1+w_2=1\)) to \(\bar{N}\) and update \(H\) and \(N^{*}\) in Equation 2.

\[ \begin{aligned} N^{*}=(\bar{N}^{T}Q^{-1}\bar{N})\bar{N}^{T}Q^{-1}\\ H=Q^{-1}(I-\bar{N}N^{*}) \end{aligned} \tag{2}\]

Where:

\(N^{*}\) is the pseudo-inverse or generalized Moore-Penrose inverse of \(\bar{N}\).

\(\bar{N}\) is the matrix of the normal vectors of the constraints in the active set \(A\).

\(H\) is the reduced inverse Hessian operator of \(Q\).

These steps are repeated iteratively until all constraints are satisfied and the optimal asset allocation has been determined.