Access the full text.

Sign up today, get DeepDyve free for 14 days.

Frausto Solis, Juan; Purata Aldaz, José L.; González del Angel, Manuel; González Barbosa, Javier; Castilla Valdez, Guadalupe

Axioms
, Volume 11 (2) – Jan 21, 2022

/lp/multidisciplinary-digital-publishing-institute/saipo-taipo-and-genetic-algorithms-for-investment-portfolios-BPjU1HQVE1

- Publisher
- Multidisciplinary Digital Publishing Institute
- Copyright
- © 1996-2022 MDPI (Basel, Switzerland) unless otherwise stated Disclaimer The statements, opinions and data contained in the journals are solely those of the individual authors and contributors and not of the publisher and the editor(s). MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. Terms and Conditions Privacy Policy
- ISSN
- 2075-1680
- DOI
- 10.3390/axioms11020042
- Publisher site
- See Article on Publisher Site

axioms Article SAIPO-TAIPO and Genetic Algorithms for Investment Portfolios Juan Frausto Solis * , José L. Purata Aldaz, Manuel González del Angel, Javier González Barbosa and Guadalupe Castilla Valdez Graduate Program Division, Tecnológico Nacional de México/Instituto Tecnológico de Ciudad Madero, Ciudad Madero 89440, Mexico; luis.pa@cdmadero.tecnm.mx (J.L.P.A.); manuel.delangel1139@gmail.com (M.G.d.A.); jjgonzalezbarbosa@hotmail.com (J.G.B.); gpe_cas@yahoo.com.mx (G.C.V.) * Correspondence: juan.frausto@itcm.edu.mx Abstract: The classic model of Markowitz for designing investment portfolios is an optimization problem with two objectives: maximize returns and minimize risk. Various alternatives and improve- ments have been proposed by different authors, who have contributed to the theory of portfolio selection. One of the most important contributions is the Sharpe Ratio, which allows comparison of the expected return of portfolios. Another important concept for investors is diversiﬁcation, measured through the average correlation. In this measure, a high correlation indicates a low level of diversiﬁcation, while a low correlation represents a high degree of diversiﬁcation. In this work, three algorithms developed to solve the portfolio problem are presented. These algorithms used the Sharpe Ratio as the main metric to solve the problem of the aforementioned two objectives into only one objective: maximization of the Sharpe Ratio. The ﬁrst, GENPO, used a Genetic Algorithm (GA). In contrast, the second and third algorithms, SAIPO and TAIPO used Simulated Annealing and Threshold Accepting algorithms, respectively. We tested these algorithms using datasets taken Citation: Frausto Solis, J.; Purata from the Mexican Stock Exchange. The ﬁndings were compared with other mathematical models of Aldaz, J.L.; González del Angel, M.; related works, and obtained the best results with the proposed algorithms. González Barbosa, J.; Castilla Valdez, G. SAIPO-TAIPO and Genetic Algorithms for Investment Portfolios. Keywords: Investment Portfolio Optimization; genetic algorithm; Simulated Annealing and Threshold Axioms 2022, 11, 42. https://doi.org/ Accepting; Sharpe Ratio; Markowitz model 10.3390/axioms11020042 Academic Editors: Witold Pedrycz, Laura Cruz-Reyes and Rafael 1. Introduction Alejandro Espin Andrade In ﬁnance, applying the diversiﬁcation of assets that make up an investment portfolio Received: 1 December 2021 aims to maximize proﬁts and minimize risk. The mean-variance portfolio integration model Accepted: 17 January 2022 developed by Harry Markowitz in 1952 has been a widely accepted tool for asset portfolio Published: 21 January 2022 integration [1]. Markowitz’s portfolio theory states that the investor should analyze the Publisher’s Note: MDPI stays neutral portfolio as a whole, studying the characteristics of risk and global return. The participation with regard to jurisdictional claims in of each asset is chosen based on its expected return. In other words, volatility is treated as a published maps and institutional afﬁl- risk factor, and the portfolio is integrated, considering the risks and seeking the maximum iations. level of proﬁtability available [2]. Some investigations have expanded the work of the Markowitz model, such as the mean semi-variance model [3], mean objective model [4], and portfolio optimization models with fuzzy logic [5]. Different metaheuristics algorithms have been applied to solve difﬁcult problems, and recently important overviews have Copyright: © 2022 by the authors. been published regarding these types of problems [6–8]. The reason for employing these Licensee MDPI, Basel, Switzerland. algorithms is that they obtain suitable solutions within reasonable execution times [9]. For This article is an open access article instance, a two-stage multi-attribute portfolio analysis framework using genetic algorithms distributed under the terms and (GA) to solve a multi-attribute portfolio selection problem was proposed [10]. Moreover, conditions of the Creative Commons Genetic Algorithms have been used for selecting and evaluating investment portfolios [11]. Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ As seen in [12], the mean-variance approach was used as a reference to propose a new 4.0/). model which included different constraints, using GA as an optimization method. Chen Axioms 2022, 11, 42. https://doi.org/10.3390/axioms11020042 https://www.mdpi.com/journal/axioms Axioms 2022, 11, 42 2 of 20 et al., applied machine learning algorithms to predict asset values of the Shanghai stock market; they used a GA to solve a multi-objective optimization problem [13]. Pekar et al., used differential evolution (DE) to solve the portfolio selection problem [14]; where they employed the Omega function and Sortino ratio to measure the portfolio’s risk based on the Sharpe Ratio. Presently, DE algorithms have been applied in several portfolio applications: Dow Jones [14], S&P, BOFA, Frank Russell, MSCI [15], and National Stock Exchange [16]. The use of DE combined with other methods has increased the quality of results [15,17]. Notably, in a previous study [15], the following algorithms were evaluated: NSGA-II, Differential Evolution (GDE3), SMPSO, and SPEA2; where SPEA and Differential Evolution were reported as the best algorithms. A modiﬁed Particle Swarm Optimization (PSO) method is used in different indexes such as S&P 100, Hang Seng, DAX 100, FTSE 100, and Nikkei [18]; the mathematical model includes bounding and cardinality constraints. A Fireﬂy Algorithm (FA) and an Imperialist Competitive Algorithm (ICA) are used to select the best set of assets using the mean semi-variance approach as the objective function [19]. In [20] a hybrid algorithm was proposed that combines Ant Colony Optimization (ACO), Artiﬁcial Bee Colony (ABC) optimization, and GA for solving the cardinality constrained portfolio optimization problem. Different classical and hybrid methods or techniques for portfolio integration have been applied, such as Threshold Accepting (TA) and Simulated Annealing (SA). TA was used to select sets of assets that minimized portfolio risks [21,22] and optimized tracking errors [23]. Chang et al., [24] attempted to ﬁnd the efﬁcient frontier by using GA, TA, and SA over several stock markets (DAX, FTSE, S&P, and Nikkei). Fogarasi and Levendovszky [25] explored a solution to sparse mean reverting portfolio selection using a Greedy method and an SA algorithm. In [26], the following algorithms were used: GA, Genetic network programming (GNP), SA, and PSO. In [27], the quality of SA and GA in rectifying this problem was performed by adding an aversion risk coefﬁcient to the Markowitz model. The results were similar; however, SA obtained shorter runtimes. Wang et al., used a modiﬁed Generalized Simulated Annealing GSA and the Sharpe Ratio to construct optimal portfolios; they used stocks from S&P 500 [28]. A High-Speed Hill-Climbing algorithm, called HC-S-R, was proposed for the DAX stock exchange in [29]; where they applied a similar acceptance criterion to TA and reported better results than the classical algorithm. In [30], the Archive Multi-objective Simulated Annealing (AMOSA) was used to solve the two objectives of the mean-variance model with eight stock indexes that included NASDAQ, S&P 500, FTSE 100, and Hang Seng. In [31], a hybrid FA–SA algorithm was proposed; the experimental results showed this algorithm performed better than FA, SA, GA, and PSO when the transaction costs were considered. Kumar et al., applied a modiﬁed SA combined with ABC, Radial Basis Function Network (RBFN), and an Artiﬁcial Neural Network (ANN); where they integrated portfolios with stocks from NSE [32]. SA, GA, and Quantum Annealing was applied in [33], with stocks from S&P 500, Nasdaq, Russel 2000, and Wilshire 5000. The algorithms GENPO, SAIPO, and TAIPO proposed in this work are based on the Genetic Algorithm (GA), Simulated Annealing (SA), and Threshold Accepting (TA). These proposed algorithms use the closing prices of the assets to calculate the indicators to obtain the Sharpe Ratio (SR) [34] value of the portfolio, which is used as an evaluation function in the search process of the algorithms. The algorithms used are focused on portfolio integration and aimed at both diversiﬁcation of assets and minimization of portfolio risks; this was achieved through the model proposed by Sharpe [35] and is standard in using the correlation between candidate assets [36,37]. In addition, a constraint was used that allowed for the consideration of only the assets that had an expected return equal to or greater than the Minimum Acceptable Rate of Return (MARR). To test the proposed algorithms, assets from the Mexican Stock Exchange were used, then results were compared with the hybrid algorithms developed by the mathematical models of related works. The rest of this paper is organized as follows. In Section 2, we review the related models, including the Markowitz model. Moreover, we describe the classical Simulated Axioms 2022, 11, 42 3 of 20 Annealing, Threshold Accepting, and Genetic Algorithms. In Section 3, the algorithms proposed in this work are described. In Section 4, we present the experiments and results. Finally, in Section 5, the conclusions of this work are presented. 2. Background & Related Works As we mentioned before, this work proposes the use of classical algorithms GA, TA, and SA. We present a general description of these algorithms in the ﬁrst subsection. Moreover, new successful models are usually based on the Markowitz model; they are referred to here as Yu, Gilli, and Masese models. Then, we brieﬂy present all these models in the Related Works subsection. 2.1. Classical Genetic and Simulated Annealing like Algorithms 2.1.1. Genetic Algorithms John Holland proposed Genetic Algorithms (GA) in 1975 [38]. These algorithms imitate nature for solving complex problems [39–41]. They select solutions from the solution space of the problems considered. Basically, a GA evolves a population of individuals (solutions) by selecting operations similar to those in biological evolution (for instance, mutation and crossing over). The procedure of the Classic GA is shown in Algorithm 1. Algorithm 1. Classic Genetic Algorithm 1: Set ﬁrst gen i = 0 2: Begin /* Produce new generation */ 3: Begin /* Reproductive cycle */ 4: Select two individuals, X y X of P(i), 1 2 5: Crossing point random selection. 6: Cross X y X getting two offspring X , X . 1 2 h1 h2 7: Insertion X y X in P(i) h1 h2 8: Mutation random elements of P(i); 9: Compute ﬁtness function (i) of elements, 10: Order individuals best evaluated in P(i). 11: Limit the population to its original size. 12: End 13: IF convergence = true or gen = max generation 14: End 2.1.2. Simulated Annealing and Threshold Accepting Proposed by Kirkpatrick in the 1980s [42], the Simulated Annealing (SA) algorithm is based on the Metropolis algorithm [43], which is used in the heat treatment of metals. SA begins with an initial solution; then, a neighbor solution is selected randomly. A new solution is accepted if it is better than the old solution; otherwise, the new solution is accepted with a probability based on the Boltzmann distribution; with this criterion, the acceptance rate of incorrect solutions decreases during the execution of the algorithm. This strategy is used to escape from local optima. The parameters of this algorithm include an initial temperature T , ﬁnal temperature T , cooling rate a, and the number of iterations for i f each metropolis cycle, as shown in Algorithm 2. The Threshold Accepting (TA) algorithm was proposed by Dueck and Scheuer [44] and is similar to Simulated Annealing. The fundamental difference is the acceptance criterion of new solutions. In TA, a poor solution can be accepted if the decrease does not exceed a certain tolerance or threshold, which decreases during the execution of the algorithm. This criterion avoids calculating probabilities or making random decisions. The parameters of this algorithm are the number of iterations n , number of steps n , and a threshold iter ste ps sequence, as shown in Algorithm 3. Both SA and TA algorithms have been applied to successfully solve different problems [45,46]. Axioms 2022, 11, 42 4 of 20 Algorithm 2. Classic Simulated Annealing 1: Simulated Annealing T , T , a i f 2: T = T 3: s = random initial solution current 4: while T T do k f 5: while Metro polis lenght do 6: s = generateNeighbor (s ) new current 7: D = E(s ) E(s ) new current 8: if D < 0 then 9: s = s current new 10: else if e < random(0, 1) then 11: s = s new current 12: end if 13: end while 14: T = a T k k 15: end while 16: end Simulated Annealing Algorithm 3. Classic Threshold Accepting 1: Initialize n and n iter ste ps 2: Compute Threshold Sequence T , r = 1, 2, . . . n iter 3: Generate random initial solution X 2 X 4: for r = 1 to n do iter 5: for i = 1 to n do ste ps 6: Generate X 2 N(X ) n c 7: D = f (X ) f (X ) n c 8: if D < T then 9: X = X c n 10: end if 11: end for 12: end for The process of parameter tuning for the SA and TA algorithms used in this paper is based on the analytical tuning method presented in [47]. This method states that the initial and ﬁnal temperatures are functions of the maximum and minimum cost or energy values E and E . These values are used in the Boltzmann distribution criterion, which max min DE establishes that, in a temperature T, a poor solution is accepted if random(0, 1) e . The values DE and DE are used in the Boltzmann distribution for determining the max min initial and ﬁnal temperatures. To obtain these values, a set of previous executions must be carried out [46]. The parameters used in the tuning process are shown in Table 1. The probability of accepting a new solution is close to one at high temperatures, thus the deterioration of the energy is at a maximum. T is associated with DE and P(DE ), max max and can be calculated with Equation (1), while P(DE ) is given by Equation (2). The max minimum deterioration P(DE ), calculated with Equation (3), is used to establish T , as min f shown in Equation (4). The cooling scheme establishes the method behind decreases in temperature using a factor a. For rapid decrements, an a value equal to 0.7 is commonly used, and for slow decrements, the ﬁgure is 0.99 [46]. Given a current temperature T , the next temperature value T is calculated with Equation (5). k+1 The parameter L , refers to the number of iterations of the Metropolis cycle at each temperature. In high temperatures, few iterations are required, since the equilibrium is reached quickly; for this reason, L is usually close to one. Nevertheless, at low min temperatures, a more exhaustive search is required; therefore, a larger L is used. For a given value of L , then L can be calculated with Equation (6). Since Equations (5) k k+1 Axioms 2022, 11, 42 5 of 20 and (6) are applied successively from T to T , L is calculated as L = b L , while i max max min T = a T , where n and b are calculated with Equations (7) and (8), respectively [48]. f i Table 1. Parameters used for SA and TA Analytical Tuning. Parameter Description Equation s , s Current and candidate solution - i j Energy associated with s and s - E(s ), E s i j i j DE , DE Maximum and minimum deterioration - max min DE max T Initial temperature (1) T = ln(P(DE )) max DE max (2) P(DE ) = e max Probability of accepting a solution with P(DE ), P(DE ) max DE min min maximum and minimum deterioration (3) P DE = e ( ) min DE min T Final temperature T = (4) f f ln(P(DE )) min a Temperature decrease factor - T Current temperature T = aT (5) k k+1 k Length of the Markov chain in L L = bL (6) k k+1 k Metropolis cycle L Value of L at T - min k i ln(T )ln(T ) f i n Number of steps from T to T (7) i f n = ln(a) ln(L )ln(L ) max min b Increment coefﬁcient of L (8) k b = e V Neighborhood of the solution s - i i jV j Probability of selecting s (9) P s si j P s = 1 e N Number of random samples in V (10) Si N = jV jln 1 P s = CjV j si j si C Exploration level (11) C = ln P s L Value of L at T L = CjV j (12) max max k f si On the other hand, the probability of selecting the solution s from N random samples in V is given by Equation (9); for this expression, N is calculated with Equation (10), Si where C deﬁnes the exploration level calculated with Equation (11). To guarantee a good exploration level, the value of C must be between 1 C 4.6. Finally, once C is deﬁned, L can be established with Equation (12). max 2.2. Related Works 2.2.1. Markowitz Model A typical feature of Markowitz’s theory is that it provides a quantitative solution to portfolio asset allocation, as it considers the possible trade-off between expected return and risk exposure between established securities or assets. Thus, the investment portfolio design problem is a multi-objective optimization issue with two main objectives [1]: maximize the expected return, and minimize the variance of the portfolio models with Equations (13) and (14), respectively. This model uses a mean-risk relationship, which is known as the mean-variance approach. Max E(R) = m x (13) å i i i=1 Axioms 2022, 11, 42 6 of 20 n n Min s (R) = x x s (14) å å i j i j i=1 j=1 Subject to : x = 1 (15) å i i=1 x 0(i = 1, . . . , n) (16) where E R is the expected return of the portfolio; m is the expected return of asset i; x is ( ) i i the fraction or weight of asset i in the portfolio, this weight must be positive (Equation (16)), in addition, the sum of all weights must be equal to one as shown in Equation (15); n is the number of assets in the portfolio; s (R) is the variance of the portfolio; s is the covariance i j between asset i and j. 2.2.2. Yu Model A genetic algorithm (GA) was proposed [10] for a two-stage multi-attribute portfolio analysis framework to solve the portfolio selection problem. First, a GA is used for evaluat- ing asset quality with multiple asset attributes, and some are selected. Then, another GA is used to optimize capital allocation among the selected assets in the second stage. Finally, the ﬁtness function F(R) is used to make a rational trade-off between minimizing risk and maximizing expected return, as shown in Equation (17). n n n minF(R) = x x s + m x g (17) å å i j i j å i i i=1 j=1 i=1 where x , x are the portion of the stocks i, j integrating the portfolio, and s ; is the covariance i j i j of them. Moreover, m is the mean of the stock value and å m x is the expected return of i i i i=1 the portfolio. Finally, represents the MARR. In another section, we present the results obtained with this model. 2.2.3. Gilli Model This model uses a single-objective minimization approach based on the classical Markowitz model. The Gilli model seeks to create optimal portfolios in terms of variance and expected return [21]. The mathematical model is shown in Equations (18) and (19). minF(R) = s (R) + p(g E(R)) (18) 2 2 s (R) – s (R) max min when g > E(R) gR p = (19) Otherwise where, the variables s (R) and E(R) denote the variance and the expected return of the 2 2 portfolio, respectively, while p is a penalty function. The values for s (R) , s (R) max min are the maximum and minimum variance, and R is an average of the expected return value of numerous randomly generated portfolios. While g is the required return and has been pre-deﬁned. These parameters are used for deﬁning the scaling constant p. The problem in this model is to deﬁne this scaling constant for achieving the best portfolios. Therefore, this model uses the scaling constant for achieving optimal portfolios. Axioms 2022, 11, 42 7 of 20 2.2.4. Masese Model This model is similar to the classical formulation of Markowitz for investment portfo- lios, and is an optimization problem deﬁned by Equation (20). This model aims to minimize the variance of the portfolio [22]; they use the classical Threshold Accepting algorithm [44]. n n Min s (R) = x x s (20) å å i j i j i=1 j=1 Subject to su p in f x x x (21) i i n n (22) in f su p su p in f where x and x , shown in Equation (21), are the minimum and maximum weights for the stock in the portfolio, and n and n in Equation (22), are the constraints setting the in f su p minimum and a maximum number of stocks in the portfolio. The authors of this paper reported that their model outperforms the Markowitz Model for portfolio selection. 3. Proposed Algorithms The three algorithms proposed in this work, GENPO [49], SAIPO, and TAIPO, are described in this section. These algorithms use optimization heuristics for obtaining the stocks and then integrating the portfolio that is modeled as an optimization problem. GENPO uses a Genetic Algorithm, SAIPO uses a Simulated Annealing Algorithm, and TAIPO uses a Threshold Accepting Algorithm. 3.1. Mathematical Model for the Evaluation Function The Sharpe Ratio (SR) is a ﬁnancial metric proposed by W. Sharpe [34]. This ﬁnancial ratio indicates how suitable an investment is concerning its risk. This ratio can be used to determine which investment obtains the greatest return with the same risk. In other words, it determines the additional return achieved by investing in riskier ﬁnancial assets. SR is calculated with Equation (23). E(R) g SR = (23) s(R) where E(R) is the portfolio’s expected return, g is the MARR (Minimum Acceptable Rate of Return), and s(R) represents the portfolio’s risk. The MARR parameter means that any stock (or investment) should not be part of the portfolio if it does not surpass it. Sharpe Ratio (SR) is based on the Markowitz model, and it is assumed that there are adequate statistics for determining: (a) the expected value of the shares and (b) the standard deviation (the risk measure) of the asset value over a given period. On the other hand, the problem of selecting the best stocks from a speciﬁc market can be formulated as those that maximize the expected return and, at the same time, minimize the risk value of the portfolio; a practical alternative centers on ﬁnding stocks which maximize the Sharpe ratio. This strategy allows the discovery of portfolios with assets from different ﬁnancial areas selected when the SR is maximized. The proposed model represented by Equation (24) seeks to maximize the Sharpe Ratio, subject to the expected value of the portfolio being greater or equal to the MARR ratio. E(R) g maxSR = (24) n n n 2 2 s x + 2 s s x x r å å å i i i j i j i j i=1 i=1 j6=i Axioms 2022, 11, 42 8 of 20 Subject to m g (25) where E(R) = m x is the expected return of the portfolio, m is the expected return of asset i i i i, and x is the weight of the asset i in the portfolio. This model includes a constraint shown in Equation (25), that allows only assets with an expected return equal to or greater than the MARR to be included in the portfolio. The MARR parameter is represented here by g. As mentioned before [49], maximizing the value of the Sharpe Ratio allows solving the problem of two objectives in one. However, it is an NP-hard problem; thus, ﬁnding the optimal solution is not an easy task. We used Equation (26) to estimate the risk of the portfolio, while the average correlation of the portfolio was obtained with a simple process [37]. This correlation is provided in Equation (27), and we used it to check that the correlation of the entire portfolio had a low value. In [50], the correlation between assets and bonds was analyzed. Similarly, a previous study [37] used a strategy to evaluate portfolios and risks from different portfolios. n n n 2 2 s(R) = s x + 2 s s x x r (26) å i i å å i j i j i j i=1 i=1 j6=i 2 2 2 s R s x ( ) å i i i=1 r = (27) n n 2 s s x x å å i j i j i=1 j6=i The interpretation of Equation (27) is as follows: if r 1 the portfolio has little diversiﬁcation; on the other hand, if r 0 the portfolio is highly diversiﬁed. The portfolio solution found with the model implemented in this paper, contained the weighted values of the assets x ; the expected value portfolio’s E(R) and its risk s(R), in addition to the Sharpe Ratio and average correlation of the portfolio r . This model and the implemented algorithms aim to ﬁnd a balance between the expected value and the portfolio’s risk. Moreover, the implemented algorithms seek to ﬁnd an equilibrium between the Sharpe metric and the managing portfolio risk. 3.2. Genetic Portfolio Optimization Algorithm (GENPO) Algorithm 4 shows the structure of the GENPO algorithm. This is a Genetic Algorithm where the initial population is conformed randomly by a set of weights in the range (0,1); additionally, the summation of these weights should be one. The ﬁtness function was previously shown in Equation (24), and is applied for each population generated by the algorithm. Then, the subsequent generations are generated, choosing one or two solutions, depending on the genetic operator used: crossover or mutation, respectively. From lines 1 to 5, a population is generated using a random number in the range (0,1). The ﬁtness Sharpe Ratio (SR) is the ﬁtness function based on Sharpe Ratio described in Equation (24). Moreover, it establishes the population size and the generations. Lines 6 to 16 integrate the selection step. Two individuals from the population are eval- uated by the ﬁtness function and two individuals from the binary tournament, evaluating from the higher expected value. In the Crossover step, the x values (the portion of assets) are randomly selected to generate offspring from the selected individuals in the previous step. These offspring could be part of the population depending on their SR. They are sorted from highest to lowest. The last two individuals are discarded from the population to retain the population size. From line 17 to the end, lays up the best individual from each generation to store their variables and performance. The best individual from generation i is compared with the previous individuals of generation i 1. The process is repeated each time a new population is generated. This Axioms 2022, 11, 42 9 of 20 process is performed to determine if the number of generations achieves the maximum permitted number without enhancement, which is used as a stop criterion. The result of the algorithm is a portfolio with the best assets and the investment proportion applied in each one. This combination of assets has the best proﬁt–risk ratio and the lowest correlation, leading to the highest portfolio diversiﬁcation. Algorithm 4. GENPO 1: Begin /* GENPO */ 2: Set ﬁrst gen i = 0 3: Generate initial population (portfolio) P(i) 4: Compute Sharpe Ratio (SR) evaluation initial for each individual SR(i) 5: While Converge = False or i < MaxGen do 6: Begin /* Produce new generation */ 7: Begin /* Reproductive cycle */ 8: Select two individuals (portfolios), X y X of P(i), 1 2 9: Crossing point random selection. 10: Cross X y X getting two offspring X , X . 1 2 h1 h2 11: Insertion X y X in P(i) h1 h2 12: Mutation random elements of P(i); 13: Compute ﬁtness function (i) of elements, 14: Order individuals best evaluated in P(i). 15: Limit the population to its original size. 16: End 17: Save best individual of the population P(i) 18: If SR(i + 1) < SR(i) + tolerance then //* if SR doesn’t grow enough *// 19: gamma = gamma + 1 //* gamma counter grow *// 20: If gamma >= conv then //*conv=generations number without improv SR *// 21 Convergence=TRUE 22: End 23: End while 24: i = i + 1 25: If i > MaxGen then 26: Converge: = TRUE 27: End 3.3. Simulated Annealing for Investment Portfolio Optimization (SAIPO) The SAIPO algorithm uses the negative value of the Sharpe Ratio, shown in Equation (24), as the objective function. SAIPO (Algorithm 5) receives as initial parameters (line 1) an initial temperature (T ), ﬁnal temperature (T ), a cooling rate a, an internal cycle length L , and an internal cycle f k increment coefﬁcient b. In line 2, a random initial solution is generated, represented by X , deﬁned as a portfolio with random weights. Then, in line 3, the negative value of the Sharpe Ratio is calculated. In line 4, the current temperature T takes the value of the initial temperature T . In line 5, the main cycle begins, which is executed until the current temperature is greater than or equal to the ﬁnal temperature. In line 6, the Metropolis cycle begins. In line 7, a new solution is generated by applying a perturbation to the current solution. This new solution is compared with the existing solution, then calculating the difference between both solutions in line 8. When this difference is negative (line 9), the new solution is accepted in line 10; if this new solution is better than the best previously found, it is accepted as the best global solution in line 12. Alternatively, if the difference is greater or equal to zero, the new solution is accepted by applying the Boltzmann acceptance criterion in line 14. In line 19, the number of iterations of the Metropolis cycle (L ) increases, multiplying its previous value by b. In line 20, the current temperature T is decreased by multiplying its value by the a value. Finally, in line 22, the Sharpe Ratio is calculated Axioms 2022, 11, 42 10 of 20 by multiplying its negative value by 1. Lastly, in line 23, the output of the algorithm is generated. Algorithm 5. SAIPO 1: Parameters (T , T , a, L , b) i f k 2: Generate random initial solution X = X c best 3: s = f (X ) = SRneg = s c n best 4: k = 0; T = T 5: while T T do k f 6: while k < L do 7: X = Perturbation (X ); s = f (X ) n c n n 8: D = s s n c 9: if D < 0 then 10: s = s ; X = X c n c n 11: if s < s then best 12: s = s ; X = X c c best best 13: end if D/T 14: else if random (0,1)< e then 15: s = s ; X = X c n c n 16: end if 17: k = k + 1 18: end while 19: L = b L k+1 k 20: T = a T k+1 k 21: end while 22: SR = s best 23: return SR, X best 24: end SAIPO Based on the neighborhood structure method presented in [23], in this work, a pertur- bation is applied to generate a neighbor solution X close to the current solution X . This n c procedure is detailed in Algorithm 6. Algorithm 6. Perturbation Procedure 1: Parameters (q, X ) 2: Select two assets i and j randomly 3: If wi q then 4: wi = wi q 5: else if wi < q then 6: q = wi 7: wi = 0 8: end if 9: wj = wj + q 10: X 3 (wi, wj) In line 2, two assets i and j with weights w and w are randomly selected. Then, a i j quantity q is subtracted from asset i in line 4, and the same quantity is added to asset j in line 9. Therefore, the weight of asset i in the portfolio, when the neighbor solution is generated, will be w q, and the weight of asset j will be w + q. This quantity q is obtained i j by experimentation. 3.4. Threshold Accepting for Investment Portfolio Optimization (TAIPO) Algorithm 7 shows the TAIPO algorithm that shares the same structure as SAIPO. These two algorithms have a temperature cycle and a Metropolis cycle. TAIPO has an additional parameter in line 1: a decreasing tolerance rate d. As in SAIPO, in the TAIPO algorithm, a perturbation is applied to the current solution to generate a new solution Axioms 2022, 11, 42 11 of 20 in line 7. However, in this algorithm, if the new solution is worse, the current solution is replaced if the difference does not exceed a certain tolerance (Tol) or threshold (line 9), which decreases by multiplying its previous value by d in line 17. In the beginning, Tol has a value equal to T (line 4), which implies that at high temperatures, the new solution will be generally accepted as the current solution. That is, during the processing of 90% of temperatures, Tol has the same value of T ; in this case, d is equal to 1. For the remaining temperatures, d takes the value of 0.96, obtained by experimentation, making the process more restrictive in the last iterations [46]. Algorithm 7. TAIPO 1: Parameters (T , T , a, L , b, d) i f k 2: Generate random initial solution X = X c best 3: s = f (X ) = SRneg = s c n best 4: k = 0; Tol = T = T k i k 5: while T T do k f 6: while k < L do 7: X = Perturbation X ; s = f X ( ) ( ) n c n n 8: D = s s n c 9: if D < Tol then 10: S = S ; X = X c n c n 11: if s < s then best 12: s = s ; X = X c c best best 13: end if 14: end if 15: k = k + 1 16: end while 17: Tol = d Tol k+1 k 18: L = b L k+1 k 19: T = a T k+1 k 20: end while 21: SR = s best 22: return SR, X best 23: end TAIPO In this work, we used the classic TA algorithm and compared its performance with the algorithms proposed. As described in Algorithm 3, TA used a threshold sequence. The procedure shown in Algorithm 8, which is based on the method proposed in [23], was used to generate this sequence. Algorithm 8. Generation of Threshold Sequence 1: Initialize n iter 2: for i = 1 to n do iter 3: Generate random solution X 4: X = Perturbation (X ) // Generate neighbor solution n c 5: Com pute D = j f (X ) f (X )j i n c 6: end for 7: Sort D D D . . . D and use as Threshold Sequence 1 2 3 i In line 1, the size of the sequence is declared, which will be equal to the number of iterations of the TA classic algorithm. In line 3, a random solution is generated, then in line 4, a neighbor solution is generated, applying the perturbation described in Algorithm 6. In line 5, the difference between the new solution and the current solution is calculated. This process is repeated until the given number of iterations is generated. Finally, these differences are ordered from highest to lowest in line 7. 3.5. Proposed Algorithms Hybridized with Related Models The Sharpe Ratio (Equation (24)) is regularly used as the objective function of GENPO, SAIPO, and TAIPO. To compare the performance of the algorithms proposed in this work with the related works described previously, we developed three hybrid algorithms using the last algorithm but replaced the objective function with that used by the reference models Axioms 2022, 11, 42 12 of 20 of Gilli, Yu, and Masese. These three hybrid algorithms are named: GENPO-X, SAIPO-X, and TAIPO-X, where X is the name of a reference model. Hybrid Pseudocodes The SAIPO Hybrid Algorithm shown in Algorithm 9 has a similar structure to the single SAIPO of Algorithm 5. In the beginning, the initial parameters are speciﬁed in line 1. Then, the objective function is deﬁned in line 2. There are three alternatives or different models. Used in line 3 is the model presented in [10], the Yu model, shown in Equation (17). On the other hand, to use the Gilli model [21] calculated with Equation (18), it is necessary to compute the penalty p, established with Equation (19). This process is shown in lines 4–8. Finally, the function of the Masese model [22], calculated with Equation (20), is presented in line 10. After selecting the model, a random feasible solution is generated in line 11. Then, the temperature cycle begins in line 13, and the Metropolis cycle begins in line 14. The Sharpe ratio is calculated at the end of the algorithm (lines 29–30). The rest of the process and parameters are similar to SAIPO. Algorithm 9. SAIPO Hybrid Algorithm 1: Parameters (T , T , a, L , b) i f k 2: Deﬁne objective function f (X) 2 2 3: if f (X) = Yu model then f (X) = s (R) ( E(R) g end if //Objective function for Yu model 4: else if f (X) = Gilli model then 2 2 5: Generate 1000 random port f olios and com pute s (R) ; s (R) ; R max min 2 2 s (R) s (R) max min 6: if g > E(R) then p = end if gR 7: else p = 0 8: f (X) = s (R) + p(g E(R)) //Objective function for Gilli model 9: end if 10: else if f (X) = Masese model then f (X) = s (R) end if //Objective function for Masese model 11: Generate a random feasible solution X 12: s = s = f (X ); k = 0; X = X ; T = T . c c c i best best k 13: while T T do k f 14: while k < L do 15: X = Perturbation (X ); s = f (X ) n c n n 16: D = s s ; r = random (0,1) n c 17: if D < 0. then 18: s = s ; X = X c n c n 19: if s > s then s = s ; X = X end if c best best c best c 20: else if r < eˆ(D/T ) then 21: s = s ; X = X c n c n 22: end if 23: k = k + 1 24: end while 25: L = b L ; k+1 k 26: T = a T k+1 k 27: end while 28: SRu p = E(R) g; SRdown = s(R) 29: SR = SRu p/SRdown 30: return s , X , SR best best 31: end SAIPO Hybrid Algorithm Algorithm 10, TAIPO Hybrid Algorithm, is similar to the SAIPO Hybrid Algorithm, changing the new solutions acceptance criterion, as shown in line 16. Algorithm 11 illustrates the procedure of the GENPO Hybrid Algorithm. As with TAIPO and SAIPO hybrid algorithms, the ﬁtness function is deﬁned in line 4. In line 6, the Yu model is used as presented in [10], computed with Equation (17). On the other hand, the process behind the Gilli model [21] shown in Equations (18) and (19) is described in lines 9–14. Finally, the function of the Masese model [22], shown in Equation (20), is presented in lines 15–17. The remainder of the process is the same as in the GENPO algorithm. Axioms 2022, 11, 42 13 of 20 Algorithm 10. TAIPO Hybrid Algorithm 1: Parameters (T , T , a, L , b, d) i f k 2: Deﬁne objective function f (X) 2 2 3: if f (X) = Yu model then f (X) = s (R) ( E(R) g end if //Objective function for Yu model 4: else if f (X) = Gilli model then 2 2 5: Generate 1000 random port f olios and com pute s (R) ; s (R) ; R max min 2 2 s (R) s (R) max min 6: if g > E(R) then p = end if gR 7: else p = 0 8: f (X) = s (R) + p(g E(R)) //Objective function for Gilli model 9: end if 10: else if f (X) = Masese model then f (X) = s (R) end if //Objective function for Masese model 11: Generate a random feasible solution X 12: s = s = f (X ); k = 0; Tol = T ; X = X ; T = T c best c k k c best k i 13: while T T do k f 14: while k < L do 15: X = Perturbation (X ); s = f (X ); D = s s n c n n n c 16: if D < Tol then s = s ; X = X k c n c n 17: if s < s then s = s ; X = X end if c best best c best c 18: end if 19: k = k + 1 20: end while 21: Tol = d Tol k+1 k 22: L = b L k+1 k 23: T = a T k+1 k 24: end while 25: SRu p = E(R) g; SRdown = s(R) 26: SR = SRu p/SRdown 27: return s , X , SR best best 28: end TAIPO Hybrid Algorithm Algorithm 11. GENPO Hybrid Algorithm 1: Begin /* GenPO */ 2: Set ﬁrst gen i = 0 3: Generate initial population (portfolio) P(i) 4: Deﬁne objective function f (X) 5: if f (X) = Yu model then 2 2 6: f (X) = s (R) ( E(R) g 7: end if //Objective function for Yu model 8: else if f (X) = Gilli model then 2 2 9: Generate 1000 random port f olios and com pute s (R) ; s (R) ; R max min 10: if g > E(R) then 2 2 s (R) s (R) max min 11: p = end if gR 12: else p = 0 13: f (X) = s (R) + p(g E(R)) //Objective function for Gilli model 14: end if //Objective function for Gilli model. 15: else if f (X) = Masese model then 16: f (X) = s (R) 17: end if //Objective function for Masese model 18: While Converge = False or i<MaxGen do 19: Begin /* Produce new generation */ 20: Begin /* Reproductive cycle */ 21 Select two individuals (portfolios), X y X of P(i), 1 2 22: Crossing point random selection. 23: Cross X y X getting two offspring X , X . 1 2 h1 h2 24: Insertion X y X in P(i) h1 h2 25: Mutation random elements of P(i); 26: Compute ﬁtness function (i) of elements, 27: Order individuals best evaluated in P(i). 28: Limit the population to its original size. 29: End 30: Save best individual of the population P(i) 31: If f (X)(i + 1) < f (X)(i) + tolerance then //* if SR doesn´t grow enough *// 32: gamma = gamma + 1 //* gamma counter grow *// 33: If gamma >= conv then //* conv = generations number without improv SR *// 34: Convergence = TRUE 35: End 36: End while 37: i = i + 1 38: If i>MaxGen then 39: Converge: = TRUE 40: End Axioms 2022, 11, 42 14 of 20 4. Results The experiments performed with the algorithms presented in this paper, and the comparison with the hybrid algorithms described previously are shown in this section. To perform analytical tuning for SAIPO and TAIPO algorithms, some previous executions were required. Moreover, we showed the parameters used for those executions in Table 2. Table 2. Tuning parameters for TAIPO and SAIPO algorithms. Initial Final Number of Alpha Temperature Temperature L Executions Value T Tf 30 100 0.00001 100 0.95 4.1. Experiments To test all algorithms, we used a dataset with 47 stocks taken from the Mexican Stock Exchange. The period evaluated was from 1 January 2017 to 30 June 2018. In this paper, the performance of the proposed algorithms was compared with the Hybrid Algorithms described in Section 3.5. The MARR or risk-free rate used was 8%. The main metric that we used was the Sharpe Ratio, which allowed measurement of the relationship between expected return and risk. The performance of the algorithms was also measured with other metrics: expected return, risk, average portfolio correlation, and runtime. GENPO algorithm used an initial population of 50 individuals through 100 gen- erations, and used 2 parents with a random selection cross point to generate 2 offspring, then applied an 8% mutation for the entire population. Finally, a stop criterion was imple- mented in the algorithm after 20 repetitions without improvement. Based on the evaluation, the individuals were ordered from best to worst and the least qualiﬁed individuals were eliminated from the population, leaving the population at its original size. We compared the performance of the algorithms in two circumstances: ﬁrst by ap- plying the MARR constraint shown in Equation (25), which allowed only assets with an expected return equal to or greater than the MARR to be included in the portfolio; and then without this constraint. The average values of 30 runs are shown in Tables 3 and 4. Table 3. Algorithm performance without MARR constraint. Average Runtime Sharpe Expected Algorithm Risk Stocks Correlation (seconds) Ratio Return TAIPO 8.1 0.0973 0.8683 0.0043 7 292.93 SAIPO 8.1 0.0973 0.8682 0.0041 7 301.63 TA 8.1 0.0976 0.871 0.0044 7 745.03 TAIPO-Yu 0.0015 0.0556 0.0801 0.0304 26 10.16 SAIPO-Yu 0.0055 0.0556 0.0803 0.0294 26 10.1 TA-Yu 0.0103 0.0587 0.0788 0.0346 27 5.46 TAIPO-Gilli 0.7685 0.0554 0.1226 0.0296 27 11.01 SAIPO-Gilli 0.7605 0.0554 0.1221 0.0297 27 11.23 TA-Gilli 0.7636 0.0554 0.1223 0.0297 27 5.78 TAIPO Masese 0.1765 0.0656 0.0919 0.0134 10 9.84 SAIPO Masese 0.4795 0.0664 0.1124 0.0117 10 10.52 TA Masese 0.6323 0.0662 0.1229 0.0127 10 11.8 GENPO 6.95 0.087 0.7244 0.0187 21 462.14 GENPO-Yu 0.3874 0.0575 0.0803 0.0157 44 430.62 GENPO-Gilli 0.8077 0.0563 0.1255 0.0164 43 561.57 GENPO-Masese 0.6034 0.0564 0.1141 0.0207 20 487.96 Note in Table 3, we obtained the best result of the Sharpe Ratio using the algorithms TAIPO, SAIPO, and TA, while the second-best result was achieved by GENPO. When the asset constraint was not applied, the TA-Yu algorithm selected a portfolio with negative SR. Axioms 2022, 11, 42 15 of 20 This negative value is a consequence of the expected lower return than the MARR (eight percent), which is the acceptable minimum value for accepting a portfolio. Table 4. Algorithm performance with MARR constraint. Sharpe Expected Average Runtime Algorithm Risk Stocks Ratio Return Correlation (seconds) TAIPO 8.1 0.0980 0.8716 0.0048 7 17.43 SAIPO 8.1 0.0975 0.8699 0.0048 7 18.02 TA 8.1 0.0974 0.8687 0.0048 7 136.21 TAIPO-Yu 0.5915 0.0886 0.1324 0.0785 11 2.05 SAIPO-Yu 0.5915 0.0886 0.1324 0.0784 11 2.04 TA-Yu 0.5957 0.0884 0.1326 0.0785 11 2.81 TAIPO-Gilli 5.1604 0.0673 0.4273 0.0479 17 2.48 SAIPO-Gilli 5.1747 0.0673 0.4282 0.0478 17 2.53 TA-Gilli 5.148 0.0673 0.4264 0.048 17 3.15 TAIPO-Masese 3.3167 0.0714 0.317 0.0435 10 1.8 SAIPO-Masese 3.2771 0.0719 0.3154 0.0432 10 2.0 TA-Masese 3.3202 0.0718 0.3183 0.0427 10 3.79 GENPO 7.96 0.0951 0.8420 0.0011 9 68.64 GENPO-Yu 0.9061 0.0870 0.1569 0.0326 16 80.40 GENPO-Gilli 0.8663 0.0673 0.4215 0.0514 19 87.41 GENPO-Masese 4.9194 0.0676 0.4126 0.0384 13 88.25 In the risk metric, we obtained the best results with the hybrid algorithms SAIPO- Gilli, TAIPO-Gilli, TA-Gilli, and GENPO-Gilli. In terms of expected return, the portfolios obtained with TAIPO, SAIPO, TA, and GENPO, had higher values than the other algorithms. As shown in Tables 3 and 4, TAIPO, SAIPO, and TA algorithms achieved equivalent results in Sharpe Ratio with and without a constraint. However, the SR placed higher than the rest of the algorithms when the MARR constraint was applied. In Table 4, we observe that the average correlation is higher when the MARR con- straint is implemented than when it does not (as in Table 3). However, this difference is lower in TAIPO, SAIPO, and TA. We obtain the best average correlation value with the GENPO algorithm. When the MARR constraint satisﬁes the assets, they can conform to the portfolio, and the algorithms may select them. In addition, portfolios with the lowest number of stocks are collected with TAIPO, SAIPO, and TA, which can be advantageous for these algorithms. We can observe that when the MARR is implemented, the runtime is reduced among all algorithms. Although the TA algorithm attains similar results to TAIPO and SAIPO in the Sharpe Ratio, the runtime is higher. Thus, the new TAIPO algorithm proposed in this paper represents a better alternative than the classical Threshold Accepting algorithm. However, SAIPO and TAIPO algorithms require a lower runtime than Genetic algorithms. Table 5 shows the relationship between the result reached in the Sharpe Ratio and the Shar pe Ratio runtime (seconds), that is , of each algorithm; a higher value represents a better Runtime result. When the constraint was applied, the best results were obtained with TAIPO-Gilli and SAIPO-Gilli. Shar pe Ratio When the constraint was not implemented, we obtained the largest , with Runtime the algorithm TA-Gilli. This metric can be used when seeking faster solutions, although faster solutions do not necessarily obtain the best quality results. 4.2. Statistical Test To compare the results, a Friedman test [51] was applied, considering 30 observations, where each algorithm represented a treatment. Tables 6 and 7 show the results applied to the TA, TAIPO, and SAIPO algorithms and their hybrid versions. With a signiﬁcance value of 5% and a p-value equal to zero, we can conclude that there are signiﬁcant differences Axioms 2022, 11, 42 16 of 20 in at least one algorithm. In addition, those that reached the best results were the TAIPO, SAIPO, and TA algorithms, with the higher sum of ranks. Table 5. Sharpe Ratio vs. Runtime. MARR Constraint Without MARR Constraint Algorithm Sharpe/Runtime Sharpe/Runtime TAIPO 0.4647 0.0277 SAIPO 0.4495 0.0269 TA 0.0595 0.0109 TAIPO-Yu 0.2885 0.0001 SAIPO-Yu 0.2900 0.0005 TA-Yu 0.2120 0.0019 TAIPO-Gilli 2.0808 0.0698 SAIPO-Gilli 2.0453 0.0677 TA-Gilli 1.6343 0.1321 TAIPO-Masese 1.8426 0.0179 SAIPO-Masese 1.6386 0.0456 TA-Masese 0.8760 0.0536 GENPO 0.1160 0.0150 GENPO-Yu 0.0113 0.0009 GENPO-Gilli 0.0099 0.0014 GENPO-Masese 0.0557 0.0012 Table 6. Friedman Test TA, TAIPO and SAIPO Algorithms without MARR constraint. Algorithm Median Sum of Ranks TA 8.1051 332 SAIPO 8.1051 330 TAIPO 8.1040 328 TAIPO-Gilli 0.7650 207 SAIPO-Gilli 0.7699 199 TA-Gilli 0.7557 197 TA-Masese 0.5874 163 SAIPO-Masese 0.4451 148 TAIPO-Masese 0.3164 130 TA-Yu 0.0088 111 SAIPO-Yu 0.0067 105 TAIPO-Yu 0.0025 90 Table 7. Friedman Test TA, TAIPO and SAIPO Algorithms with MARR constraint. Algorithm Median Sum of Ranks SAIPO 8.1000 332 TA 8.1000 330 TAIPO 8.0990 328 SAIPO-Gilli 5.1709 254 TAIPO-Gilli 5.1566 240 TA-Gilli 5.1480 226 TA-Masese 3.2775 155 SAIPO-Masese 3.2226 149 TAIPO-Masese 3.2577 146 TA-Yu 0.5956 84 SAIPO-Yu 0.5923 53 TAIPO-Yu 0.5889 43 In both cases, whether a constraint is applied or not, the TAIPO, SAIPO, and TA algorithms secured the best results in the Sharpe Ratio. Axioms 2022, 11, 42 17 of 20 For the algorithms GENPO–Sharpe and its hybrid variants, considering a signiﬁcance value of 5%, and with a p-value equal to zero, there were signiﬁcant differences between them. Table 8 shows results for instances without constraint. Table 8. Friedman Test Genetics Algorithms without MARR constraint. Algorithm Median Sum of Ranks GENPO 7.032 120 GENPO-Gilli 0.769 81.5 GENPO-Masese 0.617 68.5 GENPO-Yu 0.033 30 In the same way, a Friedman test was applied for the instance with constraint, obtaining a p-value equal to zero, showing a statistically signiﬁcant difference. Results are displayed in Table 9. Table 9. Friedman Test Genetics Algorithms with MARR constraint. Algorithm Median Sum of Ranks GENPO 8.086 120 GENPO-Masese 4.921 90 GENPO-Yu 0.924 51 GENPO-Gilli 0.866 39 Table 10 shows the comparison of the best algorithms when the constraint was not ap- plied. With a p-value of zero, the null hypothesis can be rejected, thus if there are differences between the groups, the TAIPO, SAIPO, and TA algorithms show better performance. Table 10. Friedman Test for best algorithms without MARR constraint. Algorithm Median Sum of Ranks TA 8.1049 92 SAIPO 8.1032 90 TAIPO 8.1037 88 GENPO 6.9434 30 Table 11 shows the results of the Friedman test undertaken to compare the performance of the best algorithms in each group when the MARR constraint was applied. Table 11. Friedman Test for best algorithms with MARR constraint. Algorithm Median Sum of Ranks GENPO 8.1055 77 SAIPO 8.1009 76 TA 8.1006 75 TAIPO 8.1002 72 With a p-value of 0.964 and a signiﬁcance value of 0.05, we can conclude that there are no signiﬁcant differences. 5. Conclusions This paper presents three algorithms for portfolio optimization: GENPO based on Genetic Algorithms, SAIPO based on Simulated Annealing, and TAIPO, which improves upon the classical Threshold Accepting algorithm (TA). We compared them with state-of- the-art algorithms, namely: Gilli, Yu, and Masese models. This comparison was undertaken Axioms 2022, 11, 42 18 of 20 by replacing the Sharpe ratio with the objective functions used in these models. The proposed algorithms maximize the Sharpe Ratio (SR) and apply the Minimum Acceptable Rate of Return (MARR) as an essential constraint. Therefore, we present three families of algorithms for portfolio optimization in this paper. For instance, the GA family constituents are GENPO, GENPO-Yu, GENPO-Gilli, and GENPO-Masese. The proposed algorithms were designed to select the best combination of assets from any stock exchange such as S&P 500 and any other stock market. However, they were only tested with datasets from the Mexican stock exchange (BMV). The optimal result of these algorithms was deﬁned as the proportion of each asset that maximized the objective function. The experimental results revealed that the proposed algorithms, GENPO, SAIPO, and TAIPO, obtained the highest quality portfolio within each family. Upon application of the MARR constraint, the portfolio with the highest quality was obtained. Moreover, for the same algorithm, when this constraint was included, the execution time was signiﬁcantly shorter. Regarding the GA family, the proposed GENPO algorithm showed the highest quality in both cases, with and without application of the MARR constraint. Moreover, GENPO did not require excessive tuning time to obtain high-quality portfolios. Similarly, the algorithms SAIPO, TAIPO, and TA showed superior performance with or without the MARR constraint. In addition, they had the lowest average correlation than that of their respective family. Finally, in the statistical test, where the performance of the proposed algorithms was compared, no signiﬁcant differences were found when the MARR constraint was applied. However, when the MARR constraint was not applied, SAIPO, TAIPO, and TA obtained a signiﬁcant difference in quality compared with the GENPO algorithm. The difference was that the TAIPO and SAIPO algorithms converge faster than GENPO and TA algorithms. Therefore, TAIPO and SAIPO represent excellent alternatives for the portfolio integration problem. The SAIPO and TAIPO algorithms contained more parameters than GENPO; their tuning process was longer and involved a series of previous executions; for this reason, the tuning of these algorithms was more complex than that of GENPO. However, once the appropriate parameters were obtained, the execution time of SAIPO and TAIPO was shorter than the time used by GENPO. However, with TAIPO, unlike SAIPO, for the acceptance criterion of new solutions, the calculation of probabilities was not required, which rendered the execution time of TAIPO slightly lower than SAIPO. For future research, we propose an application of these algorithms to larger stock mar- kets, including other objective functions and metrics. Finally, we propose the application and extension of these algorithms with other heuristics for design portfolios among several markets. Moreover, the applicability of these algorithms regarding derivatives and other stocks remains a problem that should be studied. Author Contributions: Conceptualization, J.F.S. and G.C.V.; methodology, M.G.d.A. and J.L.P.A.; software, M.G.d.A. and J.L.P.A.; validation, G.C.V., J.G.B. and J.F.S.; formal analysis, J.F.S. and J.G.B.; investigation, M.G.d.A., J.L.P.A. and J.F.S.; writing—original draft preparation, M.G.d.A. and J.L.P.A.; writing—review and editing, J.G.B., J.F.S. and G.C.V.; supervision, J.F.S. and J.G.B.; project administration, J.F.S. All authors have read and agreed to the published version of the manuscript. Funding: This research received no external funding. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: In this section, Data supporting are located in this paper. Acknowledgments: The authors thank Conacyt for the scholarship for graduate studies that let us become researchers and/or full professors. Conﬂicts of Interest: The authors declare no conﬂict of interest. Axioms 2022, 11, 42 19 of 20 References 1. Markowitz, H. Portfolio Selection. J. Financ. 1952, 7, 77–91. 2. Markowitz, H.M. Foundations of Portfolio Theory. J. Financ. 1991, 46, 469–477. [CrossRef] 3. Mao, J.C.T. Models of Capital Budgeting, E-V Vs E-S. J. Financ. Quant. Anal. 1970, 4, 657. [CrossRef] 4. Fishburn, P.C. Mean-Risk Analysis with Risk Associated with Below-Target Returns. Source Am. Econ. Rev. 1977, 67, 116–126. 5. Fang, Y.; Lai, K.; Wang, S. Fuzzy Portfolio Optimization Theory and Methods; Springer: Berlin/Heidelberg, Germany, 2008. 6. Kalayci, C.B.; Ertenlice, O.; Akbay, M.A. A comprehensive review of deterministic models and applications for mean-variance portfolio optimization. Expert Syst. Appl. 2019, 125, 345–368. [CrossRef] 7. Doering, J.; Kizys, R.; Juan, A.A.; Fitó, À.; Polat, O. Metaheuristics for rich portfolio optimisation and risk management: Current state and future trends. Oper. Res. Perspect. 2019, 6, 100121. [CrossRef] 8. Zanjirdar, M. Overview of Portfolio Optimization Models. Adv. Math. Financ. Appl. 2020, 5, 419–435. 9. Dokeroglu, T.; Sevinc, E.; Kucukyilmaz, T.; Cosar, A. A survey on new generation metaheuristic algorithms. Comput. Ind. Eng. 2019, 137, 106040. [CrossRef] 10. Yu, L.; Wang, S.; Lai, K.K. Multi-Attribute Portfolio Selection with Genetic Optimization Algorithms. INFOR 2009, 47, 23–30. [CrossRef] 11. Seﬁane, S.; Benbouziane, M. Portfolio Selection Using Genetic Algorithm. J. Appl. Financ. Bank. 2012, 2, 143–154. 12. Hadi, A.S.; Naggar, A.A.E.; Bary, M.N.A. New model and method for portfolios selection. Appl. Math. Sci. 2016, 10, 263–288. [CrossRef] 13. Chen, B.; Zhong, J.; Chen, Y. A hybrid approach for portfolio selection with higher-order moments: Empirical evidence from Shanghai Stock Exchange. Expert Syst. Appl. 2020, 145, 113104. [CrossRef] 14. Pekár, J.; Cickov ˇ á, Z.; Brezina, I. Portfolio performance measurement using differential evolution. Central Eur. J. Oper. Res. 2016, 24, 421–433. [CrossRef] 15. García, S.; Quintana, D.; Galván, I.M.; Isasi, P. Multi-objective algorithms with resampling for portfolio optimization. Comput. Inform. 2013, 32, 777–796. 16. Zaheer, H.; Pant, M. Solving portfolio optimization problem through differential evolution. In Proceedings of the 2016 Inter- national Conference on Electrical, Electronics, and Optimization Techniques (ICEEOT), Chennai, India, 3–5 March 2016; pp. 3982–3987. 17. Liu, W.-H. Optimal computing budget allocation to the differential evolution algorithm for large-scale portfolio optimization. J. Simul. 2017, 11, 380–390. [CrossRef] 18. Ni, Q.; Yin, X.; Tian, K.; Zhai, Y. Particle swarm optimization with dynamic random population topology strategies for a generalized portfolio selection problem. Nat. Comput. 2016, 16, 31–44. [CrossRef] 19. Heidari, H.; Neshatizadeh, L. Stock Portfolio-Optimization Model by Mean-Semi-Variance Approach Using of Fireﬂy Algorithm and Imperialist Competitive Algorithm. Int. J. Bus. Dev. Stud. 2018, 10, 115–143. 20. Kalayci, C.B.; Polat, O.; Akbay, M.A. An efﬁcient hybrid metaheuristic algorithm for cardinality constrained portfolio optimization. Swarm Evol. Comput. 2020, 54, 100662. [CrossRef] 21. Gilli, M.; Këlezi, E. A Heuristic Approach to Portfolio Optimization; FAME Research Paper Series RP20; International Center for Financial Asset Management and Engineering, 2000; p. 14. Available online: https://ideas.repec.org/p/fam/rpseri/rp20.html (accessed on 3 January 2022). 22. Masese, J.M.; Othieno, F.; Njenga, C. Portfolio Optimization under Threshold Accepting: Further Evidence from a Frontier Market. J. Math. Finance 2017, 7, 941–957. [CrossRef] 23. Gilli, M.; Schumann, E. Heuristics for Portfolio Selection. Int. Ser. Oper. Res. Manag. Sci. 2017, 245, 225–253. [CrossRef] 24. Chang, T.-J.; Meade, N.; Beasley, J.; Sharaiha, Y. Heuristics for cardinality constrained portfolio optimisation. Comput. Oper. Res. 2000, 27, 1271–1302. [CrossRef] 25. Fogarasi, N.; Levendovszky, J. Sparse, mean reverting portfolio selection using simulated annealing. Algorithmic Financ. 2013, 2, 197–211. [CrossRef] 26. Salehpoor, I.B.; Molla-Alizadeh-Zavardehi, S. A constrained portfolio selection model at considering risk-adjusted measure by using hybrid meta-heuristic algorithms. Appl. Soft Comput. 2019, 75, 233–253. [CrossRef] 27. Kapiamba, J.N.; Ulungu, B.; Mubenga, P.K. Simulated Annealing vs Genetic Algorithm to Portfolio Selection. IJSIMR 2015, 3, 18–30. 28. Wang, X.; He, L.; Ji, H. Modiﬁed generalized simulated annealing algorithm used in data driven portfolio management. In Proceedings of the 2016 IEEE Information Technology, Networking, Electronic and Automation Control Conference, Chongqing, China, 20–22 May 2016; pp. 1014–1017. 29. John, C. High Speed Hill Climbing Algorithm for Portfolio Optimization. Tanzan. J. Sci. 2021, 47, 1236–1242. [CrossRef] 30. Sen, T.; Saha, S.; Ekbal, A.; Laha, A.K. Bi-objective portfolio optimization using Archive Multi-objective Simulated Annealing. In Proceedings of the 2014 International Conference on High Performance Computing and Applications (ICHPCA), Bhubaneswar, India, 22–24 December 2014; pp. 1–6. [CrossRef] 31. Chen, W.; Wang, Y.; Mehlawat, M.K. A hybrid FA–SA algorithm for fuzzy portfolio selection with transaction costs. Ann. Oper. Res. 2018, 269, 129–147. [CrossRef] Axioms 2022, 11, 42 20 of 20 32. Kumar, C.; Doja, M.N.; Baig, M.A. A Novel Framework for Portfolio Optimization Based on Modiﬁed Simulated Annealing Algorithm Using ANN, RBFN, and ABC Algorithms. In Towards Extensible and Adaptable Methods in Computing; Springer: Singapore, 2018; pp. 157–178. 33. Cohen, J.; Khan, A.; Alexander, C. Portfolio Optimization of 60 Stocks Using Classical and Quantum Algorithms. arXiv 2020, 1–19. 34. Sharpe, W.F. Mutual Fund Performance. J. Bus. 1966, 39, 119–138. [CrossRef] 35. Choueifaty, Y.; Coignard, Y. Toward Maximum Diversiﬁcation. J. Portf. Manag. 2008, 35, 40–51. [CrossRef] 36. Aneja, Y.P.; Chandra, R.; Gunay, E. A Portfolio Approach to Estimating the Average Correlation Coefﬁcient for the Constant Correlation Model. J. Financ. 1989, 44, 1435–1438. [CrossRef] 37. Salazar, J.R.; Tella, R. Supplement Portfolio Construction Based on Implied Correlation. EconoQuantum 2014, 12, 125–144. [CrossRef] 38. Holland, J.H. Adaptation in Natural and Artiﬁcial Systems, 1st ed.; University of Michigan Press: Ann Arbor, MI, USA, 1975. 39. Kadar, A.; Faruque, F.; Mohammad, S.; Iqdal, H. Solving the Vehicle Routing Problem using Genetic Algorithm. Int. J. Adv. Comput. Sci. Appl. 2011, 2, 126–131. [CrossRef] 40. Gen, M.; Choi, J.; Ida, K. Improved genetic algorithm for generalized transportation problem. Artif. Life Robot. 2000, 4, 96–102. [CrossRef] 41. Werner, F. A survey of genetic algorithms for shop scheduling problems. Math. Res. Summ. 2017, 2, 15. 42. Kirkpatrick, S.; Gelatt, C.D.; Vecchi, M.P. Optimization by simulated annealing. Science 1983, 220, 671–680. [CrossRef] [PubMed] 43. Metropolis, N.; Rosenbluth, A.W.; Rosenbluth, M.N.; Teller, A.H.; Teller, E. Equation of state calculations by fast computing machines. Equ. State Calc. Fast Comput. Mach. 1953, 21, 1087–1092. [CrossRef] 44. Dueck, G.; Scheuer, T. Threshold accepting: A general purpose optimization algorithm appearing superior to simulated annealing. J. Comput. Phys. 1990, 90, 161–175. [CrossRef] 45. Sánchez-Hernández, J.P.; Frausto-Solís, J.; González-Barbosa, J.J.; Soto-Monterrubio, D.A.; Maldonado-Nava, F.G.; Castilla-Valdez, G. A Peptides Prediction Methodology for Tertiary Structure Based on Simulated Annealing. Math. Comput. Appl. 2021, 26, 39. [CrossRef] 46. Frausto-Solis, J.; Hernández-Ramírez, L.; Castilla-Valdez, G.; González-Barbosa, J.J.; Sánchez-Hernández, J.P. Chaotic Multi- Objective Simulated Annealing and Threshold Accepting for Job Shop Scheduling Problem. Math. Comput. Appl. 2021, 26, 8. [CrossRef] 47. Frausto-Solis, J.; Román, E.F.; Romero, D.; Soberon, X.; Liñán-García, E. Analytically Tuned Simulated Annealing Applied to the Protein Folding Problem. Comput. Vis. 2007, 4488, 370–377. [CrossRef] 48. Frausto-Solis, J.; Sanvicente-Sánchez, H.; Imperial-Valenzuela, F. ANDYMARK: An Analytical Method to Establish Dynamically the Length of the Markov Chain in Simulated Annealing for the Satisﬁability Problem. Comput. Vis. 2006, 4247, 269–276. [CrossRef] 49. Purata, L.; Frausto, S.; Gonzalez, J.; Castilla, G. Genpo-Sharpe: Stock selection for investing portfolio using a genetic algorithm with sharpe ratio applied to mexican stock exchange. In Proceedings of the 8th International Workshop on Numerical and Evolutionary Optimization, Ciudad de Mexico, Mexico, 8–10 September 2020; p. 100. 50. Dopfel, F.E. Asset Allocation in a Lower Stock-Bond Correlation Environment. J. Portf. Manag. 2003, 30, 25–38. [CrossRef] 51. Myles Hollander, E.C.; Douglas, A. Wolfe, Nonparametric Statistical Methods, 3rd ed.; John Wiley & Sons, Inc.: Hoboken, NJ, USA, 2013.

Axioms – Multidisciplinary Digital Publishing Institute

**Published: ** Jan 21, 2022

**Keywords: **Investment Portfolio Optimization; genetic algorithm; Simulated Annealing and Threshold Accepting; Sharpe Ratio; Markowitz model

Loading...

You can share this free article with as many people as you like with the url below! We hope you enjoy this feature!

Read and print from thousands of top scholarly journals.

System error. Please try again!

Already have an account? Log in

Bookmark this article. You can see your Bookmarks on your DeepDyve Library.

To save an article, **log in** first, or **sign up** for a DeepDyve account if you don’t already have one.

Copy and paste the desired citation format or use the link below to download a file formatted for EndNote

Access the full text.

Sign up today, get DeepDyve free for 14 days.

All DeepDyve websites use cookies to improve your online experience. They were placed on your computer when you launched this website. You can change your cookie settings through your browser.