Binary Beetle Antennae Search Algorithm for Tangency Portfolio Diversification

The tangency portfolio, also known as the market portfolio, is the most efficient portfolio and arises from the intercept point of the Capital Market Line (CML) and the efficient frontier. In this paper, a binary optimal tangency portfolio under cardinality constraint (BOTPCC) problem is defined and studied as a nonlinear programming (NLP) problem. Because such NLP problems are widely approached by heuristic, a binary beetle antennae search algorithm is employed to provide a solution to the BTPSCC problem. Our method proved to be a magnificent substitute to other evolutionary algorithms in real-world datasets, based on numerical applications and computer simulations.


Introduction
Portfolio management is crucial when making financial decisions. Option replication, risk management, transaction costs, insurance costs, and other popular financial fields can be easily managed employing modern optimization techniques, such as genetic algorithms [1], cutting planes and non-differential optimization methods [2], conic programming [3], branch and bound method [4], Riesz-space theory [5,6] etc. For instance, the problem of finding the minimum-cost insured portfolio is approached by the Riesz space theory in [5,6]. Therein, it is presented that if the asset span is a lattice-subspace, a portfolio can be built that replicates the desired payoff in a subset of states. The problem of finding the optimal mean-variance portfolio is approached by genetic algorithms in [1], and memetic meta-heuristics in [7]. The model in [1] is defined as mixed-integer nonlinear programming (NLP) problem, while the model in [7] is defined as time-varying NLP problem, and their performance in large scale problems is investigated systematically for both.
In this paper, a binary optimal tangency portfolio under cardinality constraint (BOTPCC) problem is defined and studied as a NLP problem. Note that the tangency portfolio, also known as the market portfolio, is the most efficient portfolio and arises from the intercept point of the Capital Market Line and the efficient frontier. Because such NLP problems are widely approached by heuristic, a binary beetle antennae search algorithm (BBAS), which is introduced in [8], is employed to provide a solution to the BTPSCC problem. Generally, the beetle antennae search is a memetic meta-heuristic optimization algorithm and has been employed broadly in various scientific fields in the last few years (see [9][10][11][12][13][14][15][16][17]). For example, inline with beetle antennae search (BAS) and enhanced contract net protocol, an assignment framework for fog computing networks is presented in [10]. In this manner, the hard task rapidly and successfully offload the assignment to fog nodes is achieved. Moreover, based on BAS a soft-sensor model for optimizing the Elman neural network is presented in [12]. As a result, the neural network's prediction accuracy increases, and real-time control of the Polyvinyl chloride polymerization process is achieved.
The important points to this work can be summed up as follows: 1) we introduce and investigate the BOTPCC problem as a NLP problem, 2) we state the conversion of BBAS the enables it to manage constrained optimization problems, 3) we present comparison between BBAS, the binary bat algorithm (BBA) of [18], the binary genetic algorithm (BGA) of [19] and the binary particle swarm optimization under V4 function (VPSO) of [20] on a NLP problem in the field of finance.
The paper is structured as follows. Section 2 introduces and analyses the BOTPCC problem. Furthermore, a properly converted meta-heuristic algorithm addresses the BOTPCC optimization problem. Section 3 includes three applications which use real-world data and examines the performance of BBAS against the BBA, BGA and VPSO in different and relatively small portfolios setups. Last, in section 4, the concluding comments are presented.

Binary optimal tangency portfolio under cardinality constraint
According to one of the core findings of Modern Portfolio Theory, investors would want to keep as many different assets as possible in ideal markets with no restrictions on short selling and limitless trading with no transaction costs. In reality, however, this situation is unsustainable, since the sum of transaction costs that would be charged for a large number of small stocks will significantly increase the overall cost. Furthermore, managing portfolios with a large number of different assets can be time-consuming, so investors tend to prefer portfolios with a smaller number of different assets [21]. So, during a portfolio selection process a significant consideration is that much of a portfolio's risk diversification can be accomplished with a relatively limited, but well-chosen collection of assets. As a consequence, the critical question of deciding the required weight for an asset is inextricably connected to the question of whether or not to include the asset in the first place [22].

Definition of the BOTPCC problem
A portfolio investment is a collection of securities and other assets put together to meet a set of objectives. Portfolios that are on the Capital Market Line (CML) are always favoured by investors who use mean-variance analysis to maximize their expected return for a given level of variance risk. The most effective portfolio, known as the tangency portfolio, is the intersection point of the CML and the efficient frontier. Our approach to the BOTPCC problem is similar to the tangency portfolio optimization presented in [22].
According to Sharpe Ratio [23], any portfolio with one risk-free asset and one or more risky assets would have a linear relationship between its expected return and its risk . This can be formulated as follows: where is the risk-free asset's return and is the risk premium per unit of risk (i.e. the portfolio's Sharpe Ratio). Considering the usual hypothesis on capital markets with many risky and one risk-free asset, the endowment of a rational risk averse investor will be split and then a percentage will be invested in the risk-free asset and the rest (1 − ) in some portfolio of risky assets , where the composition of decides . Assume the market space = [ 1 , 2 , … , ] ∈ ℝ which comprises of the prices of assets, the investor will select the weights , for the assets = 1,2, … , , within the portfolio = [ 1 , 2 , … , ] ∈ ℝ to optimize . It's worth noting that the investor's risk aversion is reflected in , and that every investor's should be the same. As a consequence, the portfolio (also known as tangency portfolio) can be calculated without taking into account the investor's risk aversion or utility function.
Furthermore, the constant number implies the number of assets the investor can hold and, hence, to avoid over-diversification. To mathematically express the cardinality constraint, the binary variables 1 , 2 , … , , which indicate the assets included in the portfolio, are considered. These variables may have a value of 0 or 1, with = 1 indicating that the investor holds the asset and = 0 indicating that the investor does not hold the asset.
Based on the aforementioned analysis, if there exists a market of assets, where only of them must be contained in the portfolio , the optimal tangency portfolio under cardinality constraint (OTPCC) problem can be written as follows: where implies the covariance between the expected returns of assets and and implies the expected return of asset .
To convert the OTPCC to a binary optimization problem as well as to be more realistic, the following changes are employed. Setting = [ 1 , 2 , … , ] ∈ ℝ the expected return of all the assets of the market and the covariance matrix of the risky assets of the market , we have = T and = � T . Note that both the risky and risk-free assets are contained in the market . But in reality, there is no such thing as a risk-free asset when it comes to investing because nothing can be guaranteed 100%. For that reason, the risk-free assets in our model are considered to be the market's assets with a variance (risk) bellow a small constant number . Thus, setting = [ℎ 1 , ℎ 2 , … , ℎ ], where ℎ = 1, if Var[ℎ ] < , and ℎ = 0, otherwise, we can consider = T ( ⊙ ). Note that Var[ ] signifies the variance of and ⊙ signifies the Hadamard (or element-wise) product. To calculate the expected return, the variance and the covariance matrix of the market , we rely on the past values (or delays). Thus, the constant number ∈ ℕ represents the delays. Also note that each asset price is normalized based on its in number delays.
Based on the aforementioned analysis, the BOTPCC problem can be formulated in the following NLP form: subject to

BBAS approach on the BOTPCC problem
Beetle tracks food based on the intensity of the smell it detects on its two antennae. BAS is a meta-heuristic optimization algorithm that mimics the searching behavior of a beetle to find the optimal solution to the problem [24]. A binary version of BAS, called BBAS, introduced in [8]. Because BBAS is only applicable to unconstrained optimization, some supplementary processes must be employed to hold solutions within the feasible range. To achieve this, our modified version of BBAS embodies the penalty function method [25].
Penalty functions work in a series of sequences, each time changing a set of penalty parameters and starting a new one with the previous one. The following penalty function is maximized during the construction of any sequence: where ( ) is the objective function and ( , ( )) is the penalty term, with being a set of penalty parameters and ( ) being the inequality constraint function. Generally, the main advantage of this method is that it can satisfy any convex or nonconvex constraint. In this approach, the penalty method employed incorporates the bracket operator 〈⋅〉 with 〈 〉 = 0, if is positive, otherwise 〈 〉 = . Mainly, this operator is employed to manage the constraints on inequality. Hence, employing the following penalty term: for each , where ( ) denotes the -th inequality constraint function. Note that because the infeasible points are substituted with a negative value, the bracket operator is an external penalty method. In this way, this approach assists BBAS to manipulate convex or nonconvex constraints more accurately. The BBAS algorithm's principle, however, is similar to that defined in [8].
Based on the aforementioned analysis, the penalty function for the BOTPCC problem, written with MATLAB routines, is the following: where ( ) is (6) and sum(⋅) is the MATLAB routine that returns the sum of the elements of its input. The next algorithm is the modified BBAS algorithm, which is capable to solve the BOTPCC problem. Therein, the ones(⋅), round(⋅), rands(⋅) denote standard MATLAB routines.

Algorithm 1 BBAS algorithm for the BOTPCC problem.
Input: Set as objective function f(p) the (6) and as penalty function F(p,R) the (12).

Applications
This section examines and compares the performance of BBAS against the performance of state-of-the-art methods such as BBA, BGA and VPSO on the BOTPCC problem. The data used are the daily close prices of the stocks contained in Tab. 1. Note that Tab. 1 contains the stocks' ticker symbols and it is divided into 3 blocks. Furthermore, in all numerical examples as well as in all the meta-heuristic algorithms employed in this section, we have set the penalty parameter = 1 5 and the maximum iterations to 1000, while the population size of BBA, BGA and VPSO has been set to 30. Also, the delays number has been set to = 50 and the variance (risk) number for finding the risk-free assets has been set to = 2 − 3.

Application in 8 stocks market
In this application, we consider a market = [ 1 , 2 , … , 8 ], where contains the daily close prices of the 8 stocks included in the first block of Tab. 1. For the time-period 5/5/2020 to 10/9/2020, there exist 49 observations. With the cardinality number being set to = 4, the optimal portfolio consists of no more than four stocks, at least one of which is risk-free. Thus, we solve the BOTPCC problem for each one of these 49 observations with the BBAS, BBA, BGA and VPSO. The results are presented in Fig. 1. (a) Risk-free return of Portfolios.
(c) Time-period average of (6). Figure 1. The risk-free return, the (6) value and the time-period average of (6) for a market consisting of 8 stocks in application 3.1.

Application in 12 stocks market
For the second application, we add another 4 stocks in the market of the previous application. That is, we consider a market = [ 1 , 2 , … , 12 ], where contains the daily close prices of the 12 stocks included in the first and second blocks of Tab. 1. As stated before, for the time-period 5/5/2020 to 10/9/2020, there exist 49 observations. With the cardinality number being set to = 6, the optimal portfolio consists of no more than six stocks, at least one of which is risk-free. Hence, the BOTPCC problem is solved for each one of these 49 observations with the BBAS, BBA, BGA and VPSO. The results are presented in Fig. 2. (a) Risk-free return of Portfolios.
(c) Time-period average of (6). Figure 2. The risk-free return, the (6) value and the time-period average of (6) for a market consisting of 8 stocks in application 3.2.

Application in 16 stocks market
For the third application, we add another 4 stocks in the market of the second application. Hence, we consider a market = [ 1 , 2 , … , 16 ], where contains the daily close prices of the 16 stocks included in all the blocks of Tab. 1. As previously stated, for the time-period 5/5/2020 to 10/9/2020, there exist 49 observations. With the cardinality number being set to = 8, the optimal portfolio consists of no more than eight stocks, at least one of which is risk-free. So, the BOTPCC problem is approached with the BBAS, BBA, BGA and VPSO for each one of these 49 observations. The results are presented in Fig. 3.
(a) Risk-free return of Portfolios.
(c) Time-period average of (6). Figure 3. The risk-free return, the (6) value and the time-period average of (6) for a market consisting of 8 stocks in application 3.3.

Analysis of applications results
The three applications in this section solved the BOTPCC problem for the time-period 5/5/2020 to 10/9/2020 and for a market consisting of 8, 12 and 16 stocks. Figs.1-3 depict 49 consecutive BOTPCC problems approached with BBAS, BBA, BGA, and VPSO.
On the one hand, Figs.1a, 2a, 3a show the return of the risk-free asset included in the portfolios under a market consisting of 8, 12, 16 stocks, respectively. Therein, it is observable that the returns of the risk-free assets of each portfolio are not identical. This implies that the optimal portfolios generated by BBAS, BBA, BGA, and VPSO are all different. Figs.1b, 2b, 3b show the (6) value, where (6) represents the . Therein, it is observable that the in applications 3.1 and 3.2 is identical for every optimal portfolio generated by BBAS, BBA, BGA, and VPSO, while in application 3.3 optimal portfolio generated by BBAS, BBA, BGA, and VPSO are not identical. Fig. 3b results imply that the market size affects the performances of BBAS, BBA, BGA, and VPSO. Figs.1c, 2c, 3c show the time-period average of . It is observable, therein, that the time-period average of in applications 3.1 and 3.2 is identical for every optimal portfolio generated by BBAS, BBA, BGA, and VPSO, while in application 3.3 optimal portfolio generated by BBAS, BBA, BGA, and VPSO are not identical. Fig. 3c results imply that the BBA produces slightly more efficient optimal portfolios than the BBAS, BGA, and VPSO, while BBAS produces the least efficient optimal portfolios.
On the other hand, Tab. 2 contains the average time consumption required from BBAS, BBA, BGA, and VPSO to produce 49 consecutive optimal portfolios for the BOTPCC problems in applications 3.1, 3.2 and 3.3. It is observable, therein, that BBAS is by far the fastest algorithm. More precisely, BBAS is almost 10 times faster than the second fastest VPSO. Furthermore, VPSO and BBA have almost the same average time consumption, while BGA is the slowest.
The general conclusion arising from the aforementioned analysis is that BBAS worked excellently and efficiently in solving the BOTPCC problem. When compared to BBA, BGA, and VPSO, the average time consumption of BBAS is by far the lowest, but its accuracy suffers more than BBA, BGA, and VPSO as the market dimension increases.

Conclusion
The BOTPCC problem is presented in this paper as a NLP financial problem. A properly modified BBAS method is used to solve the BOTPCC problem, and its effectiveness has been demonstrated in three applications with different market dimensions. BBAS was also compared to BBA, BGA, and VPSO, which are all popular meta-heuristics methods. We deduced that the BBAS approach offers such a solution to the BOTPCC problem, which makes it a highly competitive alternative to BBA, BGA, and VPSO, based on our applications. The results of the applications show that the presented method is reliable in three market formations on real-world data.