Computational Intelligence and Metaheuristic Algorithms with ApplicationsView this Special Issue
Research Article | Open Access
Firefly Algorithm for Cardinality Constrained Mean-Variance Portfolio Optimization Problem with Entropy Diversity Constraint
Portfolio optimization (selection) problem is an important and hard optimization problem that, with the addition of necessary realistic constraints, becomes computationally intractable. Nature-inspired metaheuristics are appropriate for solving such problems; however, literature review shows that there are very few applications of nature-inspired metaheuristics to portfolio optimization problem. This is especially true for swarm intelligence algorithms which represent the newer branch of nature-inspired algorithms. No application of any swarm intelligence metaheuristics to cardinality constrained mean-variance (CCMV) portfolio problem with entropy constraint was found in the literature. This paper introduces modified firefly algorithm (FA) for the CCMV portfolio model with entropy constraint. Firefly algorithm is one of the latest, very successful swarm intelligence algorithm; however, it exhibits some deficiencies when applied to constrained problems. To overcome lack of exploration power during early iterations, we modified the algorithm and tested it on standard portfolio benchmark data sets used in the literature. Our proposed modified firefly algorithm proved to be better than other state-of-the-art algorithms, while introduction of entropy diversity constraint further improved results.
Since most real-life problems can be modeled as optimization tasks, many methods and techniques that could tackle such problems were developed. Thus, the optimization became one of the most applicable fields in mathematics and computer science.
The difficulty of an optimization problem depends on the mathematical relationships between the objective function, potential constraints, and decision variables. Hard optimization problems can be combinatorial (discrete) or continuous (global optimization), while continuous problems can be further be classified as constrained or unconstrained (bound constrained).
The optimization problem becomes even harder when some variables are real-valued, while others can take only integer values. Such mixed continuous/discrete problems usually require problem-specific search techniques in order to generate optimal, or near optimal solution.
One representative example of such hard optimization problems is portfolio optimization, a well-known issue in economics and finance. Many methods and heuristics were developed to optimize various models and formulations of the portfolio problem . Various portfolio optimization problem models may or may not include different constraints in their formulations. Also, to enhance the diversity of portfolio, some approaches include entropy in its formulations .
Unconstrained (bound constrained) optimization is formulated as -dimensional minimization or maximization problem: where represents a real vector with components and is hyper-rectangular search space with dimensions constrained by lower and upper bounds:
In (2), and are lower and upper bounds for the th problem component, respectively.
The nonlinear constrained optimization problem in the continuous space can be formulated in the same way as in (1), but in this case , where is -dimensional hyper-rectangular space as defined in (2) while represents the feasible region defined by the set of linear or nonlinear constraints: where is the number of inequality constraints, and is the number of equality constraints.
Fundamental versions of algorithms and metaheuristics for constrained numerical optimization problems do not include methods for dealing with constraints. Therefore, constraint handling techniques are usually added to these algorithms to improve and redirect the search process towards the feasible region of the search space. Equality constraints make optimization even harder by shrinking the feasible search space which becomes very small compared to the entire search space. To tackle such problem, equality constraints are replaced with the inequality constraints : where is some small violation tolerance, usually dynamically adjusted.
Since hard optimization problems are unsolvable in a reasonable amount of time, the exact methods which trace optimal solution cannot be applied. For such problems, it is more appropriate to employ nondeterministic metaheuristics.
Metaheuristics are iterative, population based, and stochastic approaches that do not guarantee finding the optimal solution, but they can obtain satisfying solution within acceptable time . In metaheuristics implementations, the processes of exploitation and exploration conduct the search process. Exploitation directs search around the current best solutions, while the exploration randomly discovers new regions of a search domain.
During the last few decades, we witnessed development of nature-inspired sophisticated intelligent systems that can be used as optimization tools for many complex and hard problems. Metaheuristics that incorporate and simulate natural principles and rules are called nature-inspired metaheuristics.
Nature-inspired metaheuristics  can roughly be divided into two categories: evolutionary algorithms (EA) and swarm intelligence. The most prominent representative of EA is genetic algorithms (GA). GA can obtain good results for many kinds of optimization problems .
Social behavior of swarms of ants, bees, worms, birds, and fish was an inspiring source for the emerge of swarm intelligence . Although swarm system consists of relatively unsophisticated individuals, they exhibit coordinated behavior that directs swarm towards the desired goal with no central component that manages the system as a whole.
Ant colony optimization (ACO) was founded on ant’s ability to deploy a substance called pheromone for marking the discovered path between the food source and ant’s nests. It is one of the oldest members of swarm intelligence family  but it is constantly being improved and applied to different problems [9–11].
Artificial bee colony (ABC) algorithm mimics the behavior of honey bee swarm. In this paradigm, three types of artificial bees perform search. Each type of bees has its particular role in the search process. ABC was originally proposed by Karaboga for problems of continuous optimization . This algorithm proves to be robust and capable of solving high dimensionality problems [13–15].
Cuckoo search (CS) is an iterative approach that models search process by employing Levy flights (series of straight flight paths with sudden 90 degrees turn). It was first proposed by Yang and Deb  and proved to be a robust optimization technique , obtaining satisfying results in real-life optimizations like image thresholding .
Also, swarm intelligence metaheuristics which mimic the human search process were developed. Seeker optimization algorithm (SOA) is established on human memory, reasoning, past experience, and social interactions. It has been proven that the SOA is a robust technique for solving global numerical and real-life optimization problems  and is continuously being improved .
As a result of the literature survey, it can be concluded that for portfolio optimization problem there are some genetic algorithm (GA) implementations. However, there are only few swarm intelligence algorithms adapted for this problem. There are papers which refer to solving portfolio problem with nondominating sorting genetic algorithm (NSGA) which was first proposed by Srinivas and Deb . Newer version NSGA-II improves the convergence and the spread of solutions in the population . Lin et al. presented NSGA-II based algorithm with integer encoding for solving MV portfolio model with minimum transaction lots (MTL), fixed transaction costs (TC), and linear constraints on capital investments. The optimization of MV portfolio problem with cardinality and holding weights constraints by GA is shown in . Soleimani et al.  presented GA with RAR crossover operator for solving MV portfolio problem where cardinality constraints, MTL, and constraints on sector capitalization are taken into account.
As mentioned, only few swarm intelligence metaheuristics exist for portfolio optimization. Deng and Lin presented ant colony optimization (ACO) for solving the cardinality constraints Markowitz MV portfolio model . Haqiqi and Kazemi  employed the same algorithm to MV portfolio model. We emphasize on one ACO implementation based on the average entropy for real estate portfolio optimization . This is one of the rare papers that incorporates entropy in portfolio model. Cura investigated PSO approach to cardinality constrained MV portfolio optimization . The test data set contains weekly prices from March 1992 to September 1997 from the following five indexes: Hang Seng in Hong Kong, DAX 100 in Germany, FTSE 100 in UK, S&P 100 in USA, and Nikkei in Japan. The results of this study are compared with those from genetic algorithm, simulated annealing, and tabu search approaches and showed that PSO has potential in portfolio optimization. Zhu et al.  presented PSO algorithm for nonlinear constrained portfolio optimization with multiobjective functions. The model is tested on various restricted and unrestricted risky investment portfolios and a comparative study with GA is showed. PSO demonstrated high computational efficiency in constructing optimal risky portfolios and can be compared with other state-of-the-art algorithms.
ABC algorithm for mixed quadratic and integer programming problem of cardinality constrained MV portfolio model was presented by Wang et al. . Some modifications of classical ABC algorithm for constrained optimization problems were adopted. The approach was tested on a standard benchmark data set and proved to be a robust portfolio optimizer.
One of the first implementations for portfolio optimization problem by the firefly algorithms was developed by Tuba et al. [30, 31]. Framework for solving this problem was devised. Metaheuristic was tested on standard five-asset data set. FA proved to be robust and effective technique for portfolio problem. Among other metaheuristics for portfolio problem, one approach based on neural networks (NN) should be distinguished .
In this paper, we propose a modified firefly algorithm (FA) for cardinality constrained mean-variance (CCMV) portfolio optimization with entropy constraint. FA was first introduced by Yang for unconstrained optimization . Later, it was adapted  for solving various numerical and practical optimization problems [35–37].
We modified pure FA algorithm to adjust it for constrained problems and to improve its performance. We intensified exploration during early phase and eliminated it during late iterations when the proper part of the search space has been reached. Details will be given in Section 4.
The implementation of metaheuristics for the CCMV portfolio model with entropy constraint was not found in the literature survey. Thus, we conducted three experiments.(i)First, we compared original FA with our modified mFA applied to portfolio optimization problem. We wanted to see what is the real improvement of our approach.(ii)Then, we compared results of our algorithm for the CCMV portfolio model with and without entropy constraint. In this test, we analyzed the influence of entropy constraint to portfolio diversification.(iii)Finally, in the third test, we made comparative analysis between our modified mFA and other state-of-the-art metaheuristics. We compared our proposed algorithm to Cura’s PSO  and also to GA, TS, and SA, indirectly from .
The rest of the paper is organized as follows. Section 2 presents mathematical formulations of variety portfolio optimization models. The presentation of the original FA is given in Section 3. Our proposed modified FA approach for the CCMV portfolio problem with entropy constraint is discussed in Section 4. Section 5 first shows algorithm parameter settings that are used in experiments. Then, we present three experiments which we conducted along with the comparative analyses with other metaheuristics. Finally, Section 6 gives conclusions and recommendations for future research.
2. Portfolio Optimization Problem Definitions
Portfolio optimization, as one of the most important issues in modern financial management, tackles the problem of distribution of financial resources across a number of assets to maximize return and control the risk.
When making financial decisions, investors follow the principle of diversification by investing their capital into different types of assets. By investment in portfolios, rather than in single assets, the risk is mitigated by diversification of the investments, without negative impact on expected returns.
The essential form of portfolio optimization is formulated as bicriterion optimization problem where the reward, which is measured by the mean of return, should be maximized, while the risk, measured by the variance of return, should be minimized . This problem deals with the selection of the portfolio of securities that minimizes the risk subject to the constraints, while guaranteeing a given level of returns .
By literature research many methods for solving portfolio problem can be found. Markowitz’s standard mean-variance (MV) model choses one important objective function that is subject to optimization, while the remaining objective functions are being threated as constraints . The key point in the MV formulation is to employ the expected returns of a portfolio as the investment return and the variance of returns of the portfolio as the investment risk . Its basic assumptions are that the investors are rational with either multivariate normally distributed asset returns or in the case of arbitrary returns, a quadratic utility function . This approach is widely adapted and plays an important role in the modern portfolio theory.
Markowitz’s MV model considers the selection of risky portfolio as objective function, and the mean return of an asset as one of the constraints . This model can mathematically be defined as subject to where is the total number of available assets, is the mean return on asset , and is covariance of returns of assets and , respectively. Constraint defined in (7) guarantees that the whole disposable capital is invested. Weight variable has a role of control parameter that determines the proportion of the capital that is placed in asset . Weight variable has a real value in the range .
In the presented MV formulation, the objective is to minimize the portfolio risk , for a given value of portfolio expected return .
Efficient frontier model, which is often called single-objective function model, constructs only one evaluation function that models portfolio optimization problem. In this model, the desired mean return is varying for the purpose of finding different objective function values. Risk aversion indicator controls this process .
Efficient frontier definition is subject to
In the presented formulation is critical parameter. It controls the relative importance of the mean return to the risk for the investor. When the value of is set to 0, mean return of portfolio is being maximized without considering the risk. Alternatively, when has a value of 1, risk of the portfolio is minimized regardless of the mean return. Thus, when the value of increases, the relative importance of the risk to the mean return for the investor rises, and vice versa.
Each value generates different objective function value which is composed of the mean return and the variance (risk). By tracing the mean return and variance intersections for different , a continuous curve can be drawn which is called an efficient frontier in the Markowitz’s modern portfolio theory.
Another model worth mentioning is Sharpe ratio (SR) which uses the information from mean and variance of an asset . In this model, the measure of mean return is adjusted with the risk and can be described by where denotes portfolio, is the mean return of the portfolio , and is a test available rate of return on a risk-free asset. is a measure of the risk in portfolio (standard deviation of ). By adjusting the portfolio weights , portfolio’s Sharpe ratio can be maximized.
However, all three models: the MV, efficient frontier, and Sharpe ratio were constructed under strict and simplified assumptions that do not consider real-world parameters and limitations and as such are not always suitable for real applications. For these reason extended MV model is devised.
Extended MV formulation takes into account additional constraints such as budget, cardinality, transaction lots, and sector capitalization. These constraints model real-world legal and economic environment where the financial investments are being done . Budget constraint controls the minimum and maximum total budget proportion that can be invested in particular asset. Cardinality constraint controls whether a particular asset will be included in the portfolio. The minimum transaction lots constraint ensures that each security can only be purchased in a certain number of units. Sector capitalization constraint directs the investments towards the assets that belong to the sectors where higher value of market capitalization can be accomplished. The review of this constraint is given in .
When all the above-mentioned constraints are being applied to the basic portfolio problem formulation, the problem becomes a combinatorial optimization problem whose feasible region is not continuous. Thus, the extended MV model belongs to the group of quadratic mixed-integer programming models. Its formulation is where subject to where In (11)–(18) represents the number of selected assets among possible assets. is the total disposable budget, and and are lower and upper limits of the budget that can be invested in asset , respectively. represents the number of sectors in the market where the investment is being placed, is the size of transaction lot for asset , and denotes the number of such lots (of asset ) that is purchased.
Decision variable is used to apply cardinality constraint: is equal to 1 if an asset is present in the portfolio, otherwise its value is 0. Equation (17) models sector capitalization constraint. Despite the fact that a certain sector has high capitalization, security from this sector that has low return and/or high risk must be excluded from the final portfolio’s structure. To make such exclusion, variable is defined and it has a value of 1 if the corresponding sector has at least one selected asset, and 0 otherwise. In (17) is a set of assets which can be found in sector . Sectors are sorted in descending order by their capitalization value.
Entropy was introduced by Jaynes  for wide application in optimization, crystallography in the beginning, networks , and so forth, but it also becomes an important tool in portfolio optimization and asset pricing. Entropy is widely recognized measure of portfolio diversification . In multiobjective portfolio optimization models, the entropy can be used as an objective function. Here, we will address entropy as diversity constraint in portfolio models, because we employed it in portfolio model that is used for testing of our modified FA approach.
The entropy constraint defines lower bound of entropy of portfolio according to the following equation : where is the number of assets in portfolio and is weight variable of the security .
In one extreme, when the weigh variable of only one asset in portfolio is 1, and for the rest of the assets is 0, reaches its minimum at . This is the least diverse scenario. Contrarily, in the most diverse condition that, for , , obtains its maximum in . According to this, is in the range . Greater value of entropy denotes better portfolio’s diversity, and is used to make sure that the diversity of is not too low.
As shown previously, , which implicates that . Then, the condition holds. Thus, the range of upper-bound constraint is .
In this paper, for testing purposes, we used model which employs some of the constraints that can be found in the extended MV formulation. In the experimental study, we implemented modified FA for optimizing cardinality constrained mean-variance model (CCMV) which is derived from the standard Markowitz’s and the efficiency frontier models.
We were inspired by Usta’s and Kantar’s multiobjective approach based on a mean-variance-skewness-entropy portfolio selection model (MVSEM) that employs Shannon’s entropy measure to the mean-variance-skewness portfolio model (MVSM) to generate a well-diversified portfolio [50, 51]. Thus, we added entropy measure to the CCMV portfolio formulation to generate well-diversified portfolio.
Formulation of the CCMV model with entropy constraint is subject to
As already mentioned in this section, is the number of potential securities that will be included in portfolio, is risk aversion parameter, and are weight variables of assets and , respectively, is their covariance, and is th asset’s return. is the desired number of assets that will be included in the portfolio. Decision variable controls whether the asset will be included in portfolio. If its value is 1, asset is included, and if the value is 0, asset is excluded from the portfolio. and are lower and upper bounds of the asset that is included in portfolio and they make sure that the asset’s proportion in the portfolio is within the predefined range.
We applied entropy constraint equation (25) with lower bounds, as in (19), to ensure that the diversity of portfolio is not too low. is lower bound of the entropy in the range . In (25), ensures that only assets that are included in portfolio are taken into account.
From the CCMV formulation with entropy constraint it can be seen that this problem belongs to the group of mixed quadratic and integer programming problems. It employs both real and integer variables with equity and inequity constraints.
3. Presentation of the Original FA
Firefly algorithm (FA) was originally proposed by Yang in 2008 , with later improvements . It was applied to continuous , discrete , and mixed  optimization problems. The emergence of this metaheuristic was inspired by the social and flashing behavior of fireflies.
Fireflies inhabit moderate and tropical climate environments all around the word. Their flashing behavior has many different roles. Synchronized flashing by males is unique in the animal world and involves a capacity for visually coordinated, rhythmically coincident, and interindividual behavior. Also, flashing is used to alleviate communication for mating and to frighten the predators. These flashing properties can be incorporated into swarm intelligence metaheuristic in such a way that they are associated with the objective function which is subject to optimization.
With respect to the facts that the real firefly system is sophisticated and that the metaheuristics are approximations of real systems, three idealized rules are applied with the goal to enable algorithm’s implementation : (1) all fireflies are unisex, so the attractions between fireflies do not depend on their sex; (2) attractiveness of a firefly is directly proportional to their brightness, and the less brighter firefly will move towards the brighter one. Brightness increases as the distance between fireflies decreases; (3) the brightness of a firefly is determined by the value of objective function. For minimization problems, brightness increases as the objective function value decreases. There are also other forms of brightness which can be defined similar to fitness function in genetic algorithms (GA) .
In the implementation of FA, one of the most important issues that should be considered is the formulation of attractiveness. For the sake of simplicity, a good approximation is that the attractiveness of a firefly is determined by its brightness which depends on the encoded objective function.
In the case of maximization problems, the brightness of a firefly at a particular location can be chosen as , where is the attractiveness and is the value of objective function at this location. Otherwise, if the goal is to minimize function, the following expression can be used:
The variations of light intensity and attractiveness are monotonically decreasing functions because as the light intensity and the attractiveness decrease, the distance from the source increases, and vice versa. This can be formulated as  where is the light intensity, is distance, and is the light intensity at the source. Besides that, the air also absorbs part of the light, and the light becomes weaker. Air absorption is modeled by the light absorption coefficient .
In most FA implementations that can be found in the literature survey, the combined effect of both the inverse square law and absorption can be approximated using the following Gaussian form:
Attractiveness of a firefly is relative because it depends on the distance between the firefly and the beholder. Thus, it varies with the distance between fireflies and . The attractiveness is direct proportional to fireflies light intensity (brightness), as shown in the following: where is the attractiveness at . Equation (29) determines a characteristic distance over which the attractiveness changes significantly from to .
But, in practical applications, the above expression is usually replaced with
The movement of a firefly (its new position in iteration ) towards the brighter, and thus more attractive firefly is calculated using where is attractiveness at , is randomization parameter, is random number drawn from uniform or Gaussian distribution, and is distance between fireflies and . The positions of fireflies are updated sequentially by comparing and updating each pair of them at every iteration.
The distance between fireflies and is calculated using Cartesian distance form : where is the number of problem parameters. For most problems, and are adequate settings.
The parameter has crucial impact on the convergence speed of the algorithm. This parameter shows the variation of attractiveness and in theory it has a value of , but in practice it is determined by the characteristic distance of the system that is being optimized. In most implementations parameter varies between 0.01 and 100.
There are two special cases of the FA, and they are both associated with the value of as follows :(i)if , then . That means that the air around firefly is completely clear. In this case, is always the largest it could possibly be, and fireflies advance towards other fireflies with the largest possible steps. The exploration-exploitation is out of balance because the exploitation is maximal, while the exploration is minimal;(ii)if , then . In this case, there is a thick fog around fireflies and they could not see each other. The movement is performed in a random steps, and exploration is more intensive with practically no exploitation at all.
The pseudocode for the original FA is given as Algorithm 1.
In the presented pseudocode, is total number of fireflies in the population, is total number of algorithm’s iterations, and is the current iteration.
4. Proposed mFA for the CCMV Portfolio Problem with Entropy Constraint
As mentioned in Section 1, we propose a modified firefly algorithm for cardinality constrained mean-variance portfolio optimization with entropy constraint.
By analyzing FA we noticed that, as most other swarm intelligence algorithms, the pure version of the algorithm, developed for unconstrained problems, exhibits some deficiencies when applied to constrained problems. In the early cycles of algorithm’s execution established balance between exploitation and exploration is not completely appropriate for this class of problems. During early phase exploration is not intensive enough. However, during late cycles when FA was able to discover the right part of the search space, the exploration is no longer needed. To control whether the exploration will be triggered or not, we introduced exploration breakpoint control parameter.
In this section, we show implementation details of our modified FA algorithm which we named mFA.
4.1. Initialization Phase and Fitness Calculation
At the initialization step, FA generates random population of fireflies (artificial agents) using where is the weight of the th portfolio’s asset of the th agent, is random number uniformly distributed between 0 and 1, and and are upper and lower weight bounds of the th asset, respectively.
If the initially generated value for the th parameter of the th firefly does not fit in the scope , it is being modified using the following expression:
Moreover, in the initialization phase, decision variables are also initialized for each firefly agent . is the number of potential assets in portfolio. According to this, each firefly is modeled using dimensions. is a binary vector, with values 1, when an asset is included in portfolio, and 0, when it is excluded from it.
Decision variables are generated randomly by applying where is random real number between 0 and 1.
To guarantee the feasibility of solutions, we used similar arrangement algorithm as proposed in . The arrangement algorithm is applied first time in the initialization phase.
In the arrangement algorithm, is the current solution that consists of the distinct set of assets in the th solution, is the decision variable of asset , and is the weight proportion for asset . Arrangement algorithm pseudocode is shown as Algorithm 2.
For the constraint we set and put for all assets that satisfy . The same approach for satisfying this constraint was used in . To make sure that each asset’s proportion is within predefined lower and upper bounds, and , respectively, we used then and then .
We did not apply -value based approach for adding and removing assets from the portfolio as in . According to our experiments, using -value does not improve FA performance. It only increases computational complexity.
In modified FA, the fitness is employed to model the attractiveness of the fireflies. Attractiveness is directly proportional to the fitness.
After generating number of agents, fitness value is calculated for each firefly in the population. Fitness (brightness) is calculated as in the original FA implementation (26).
In the initialization phase, for each firefly in the population, constraint violation is being calculated. is a measure of how much the agents violate constraints in the problem definition:
4.2. Firefly Movement
The movement of a firefly towards the firefly that has a higher fitness is calculated as in the original FA implementation : where is new solution generated in iteration , is attractiveness at , is randomization parameter, is random number drawn from uniform or Gaussian distribution, and is distance between fireflies and .
Also, when moving a firefly, new decision variables are calculated: where is decision variable for the th asset of the new solution, is a decision variable of the th parameter of the old solution, and is decision variable of th parameter of the brighter firefly .
It should be noticed that the decision variables in the employed bee phase are generated differently than in the initialization phase equation (35).
As mentioned before, we noticed insufficient exploration power in the original FA implementation, particularly in early iterations of algorithm’s execution. In this phase of algorithm’s execution, exploitation-exploration balance is not well established for this type of problems. This balance was also discussed in . Thus, we adopted mechanism similar to scout bee with parameter from the ABC metaheuristic.
We introduced parameter abandonment threshold () that represents the allowed predetermined number of unsuccessful tries to improve particular solution. When a potential solution (firefly) is stagnating (not being improved) for iterations, it is replaced by a new, random one using (33), (34), and (35). Hence, fireflies that exploited exhausted solutions are transformed into scouts that perform the exploration process. The value of is empirically determined and will be shown in the experimental section.
Also, during late iterations, with the assumption that the right part of the search space has been found, the intensive exploration is not needed any more. In that case, the exploration is not being triggered. For this purpose, we introduce new control parameter, exploration breakpoint () which controls whether the exploration will be triggered. The discussion of this parameter is also given in experimental section.
Also, we should note that the parameter for FA search process is being gradually decreased from its initial value according to where is the current iteration and is the maximum number of iterations.
Pseudocode of mFA is given as Algorithm 3. Some implementation’s details are omitted for the sake of simplicity.
In the pseudocode, is total number of fireflies in the population, is total number of algorithm’s iterations, and is the current iteration. As explained, is the maximum number of unsuccessful attempts to improve particular solution after which it will be considered exhausted and replaced by a new, random solution.
5. Algorithm Settings and Experimental Results
In this section, we first present parameter settings which were adjusted for testing purposes of our proposed mFA. Then, we show experimental results, discussion, and comparative analysis with other state-of-the-art algorithms.
5.1. Parameter Settings
To test the performance and robustness of our modified FA, we set algorithm parameters similar to . Number of firefly agents in the population is calculated by employing the following expression: where is the number of potential assets in portfolio.
The value of maximum number of iterations in one algorithm’s run is set according to
As mentioned in Section 4, to improve the exploration power of the original FA, we introduced parameter with corresponding counters that count how many times a particular firefly agent unsuccessfully tried improvement. When the value of reaches predetermined abandonment threshold , corresponding agent is being replaced by a random agent. is determined by the values of and , like in :
Exploration breakpoint controls whether or not the exploration will be triggered. According to our experimental tests, modified FA generates worse results if the exploration is triggered during late iterations. In most of the runs, the algorithm is able to find a proper part of the search space during early cycles, and exploration during late cycles is not useful. To the contrary, it just relaxes the exploitation. is empirically set to .
FA search process parameter is set to start at 0.5, but it is being gradually decreased from its initial value according to (39).
The promising approaches for handling equality constraints include dynamic, self-adaptive tolerance adjustment . When this tolerance is included, the exploration is enhanced by exploring a larger space.
In modified FA implementation, besides the adoption of arrangement algorithm we used (4) and violation limit for handling constraints. Good experimental results are obtained by starting with a relatively large value, which is gradually decreasing through the algorithm’s iterations. It is very important to chose the right value for . If the chosen value is too small, the algorithm may not find feasible solutions, and otherwise the results may be far from the feasible region .
We used the following dynamic settings for the : where is the current generation and is a value slightly larger than 1. For handling equality constraints, we set initial value for to 1.0, to 1.001 and the threshold for to 0.0001 like in .
For generating heuristics efficient frontier, we used different values. Thus, we set to 0.02 because in the first algorithm’s run is 0 and in the last is 1.
We also set number of assets that will be included in portfolio to 10, lower asset’s weight to 0.01, and upper asset’s weight to 1.
Since the entropy lower bound depends on the number of assets that will be included in portfolio, we set in the range of .
We present again short modified FA pseudocode as Algorithm 4, but this time with the emphasis on the parameter settings.
For making better distinction between parameters, we divided algorithm parameters into four groups: modified FA global control parameters, FA search parameters, portfolio parameters, and constraint-handling parameters.
Parameters are summarized in Table 1.
5.2. Experimental Results and Comparative Analysis
In this subsection, we show the results obtained when searching the general efficient frontier that provides the solution for the problem formulated in (21)–(25). The test data were downloaded from http://people.brunel.ac.uk/~mastjjb/jeb/orlib/portinfo.html.
Benchmark data refers to the weekly stock prices from March 1992 to September 1997 for the indexes: the Hong Kong Hang Seng with 31 assets, the German Dax 100 with 85 assets, the British FTSE 100 with 89 assets, the US S&P 100 with 98 assets, and the Japanese Nikkei with 225 assets.
We adapted test data and stored it in Excel spreadsheets. For all indexes, we used the following data: mean return, standard deviation of return for each asset, and correlation for each possible pair of assets. Also, for generating standard efficiency frontier, we used mean return and variance of return for each security.
Since , , and parameters depend on the problem size (number of securities in the test), we show exact values used for all indexes (tests) in Table 2. Formula results are rounded to the closest integer values.
Lower bound for entropy for all benchmarks set is in the range between and , because is set to for all test cases.
We conducted tests on Intel CoreTM i7-4770 K processor @4 GHz with 16 GB of RAM memory, Windows 7 x64 Ultimate 64 operating system and Visual Studio 2012 with NET 4.5 Framework.
When sets of Pareto optimal portfolios obtained with modified FA are taken, heuristic efficient frontier can be traced. In this paper, we compare the standard efficient frontiers for five real-world benchmark sets mentioned above with the heuristic efficient frontier for the same data set. For comparison of standard and heuristic efficiency frontier, we use mean Euclidean distance, variance of return error, and mean return error as in . We also give the execution time of modified FA for each benchmark on our computer system platform.
For calculation purposes of mean Euclidean distance, let the pair denote the variance and mean return of the point in the standard efficient frontier, and the pair represents the variance and mean return of the point in the heuristic efficient frontier. Then, the index of the closest standard efficiency frontier point to the heuristic efficiency frontier point, denoted as , is calculated using Euclidean distance by
Using (44), mean Euclidean distance is defined as
In addition to mean Euclidean distance, we used two other measures to test modified FA, variance of return error and mean return error.
Variance of return error is defined as
Mean return error is calculated as
For testing purposes, we conducted three experiments. In the first experiment, we compared mFA with the original FA for CCMV problem with entropy constraint. Second experiment refers to comparative analysis between mFA for CCMV problem with and without entropy constraint. Finally, in the third experiment, we perform comparative analysis between our modified mFA and other state-of-the-art metaheuristics. We compared our proposed algorithm to Cura’s PSO  and also to GA, TS, and SA, indirectly from .
We first wanted to analyze how our mFA compares to the original FA when optimizing CCMV portfolio model with entropy constraint. Thus, we also implemented original FA for this purpose. We compared mean Euclidean distance, variance of return error, and mean return error. These performance indicators were described above. We also calculated computational time for both algorithms. This time is comparable since the same computer platform was used for testing both original FA and mFA. This comparison is shown in Table 3. For better distinction between indicator values, we marked better results in bold.
As can be seen from Table 3, mFA obtains better results for almost all benchmarks. Only for variance of return error and mean return error indicators for index test, original FA managed to achieve better values. For this benchmark, exploration in early iterations is unnecessary because the algorithm quickly converges to the right part of the search space, and the firefly agents are being wasted on exploration.
All three indicators, mean Euclidean distance, variance of return error, and mean return error, are significantly better for mFA tests for , DAX100, S&P100, and indexes. Since mFA utilizes exploration at early cycles, computation time for all tests is worse (higher) than for the original FA implementation.
In the second experiment, we compared our mFA for CCMV problem with and without entropy constraint to show how the entropy constraint influences the results. CCMV formulation without entropy constraint is defined in (21)–(24).
According to the results presented in Table 4, it is clear that the entropy constraint slightly effects the portfolio’s performance. In the CCMV optimization with entropy constraint, for and S&P tests, mean Euclidean distance is slightly better, so the portfolio is better diversified. For other three tests, the results obtained for this indicator are the same. Also, for , DAX100, , and S&P100 indexes, optimization of the model with entropy gains better variance of return error and mean return error values. Only for tests, those indicators have better value for CCMV model optimization without entropy constraint. Since the algorithm takes extra time to calculate the entropy constraint, execution time for CCMV with entropy is higher for all tests except because this benchmark incorporates less securities than the other benchmarks.
The implementation of metaheuristics for CCMV portfolio model with entropy constrained could not be found in the literature. Thus, in the third experiment, we compared our mFA approach with metaheuristics for CCMV portfolio formulation which did not employ entropy. This model is defined by (21)–(24). We note that this test is not objective indicator of mFA’s effectiveness compared to the other algorithms.
We compared mFA with tabu search (TS), genetic algorithm (GA), simulated annealing (SA), from , and PSO from  for the same set of benchmark data. As in the first two experiments, for performance indicators, we used mean Euclidean distance, variance of return error, and mean return error. Parameter settings for our mFA are given in Tables 1 and 2 and are comparable to parameters for other four compared algorithms that can be found in [1, 23]. We also give computational time for mFA, but those results are incomparable with results for other metaheuristics because we used different computer platform and portfolio model. In experiments in , Pentium M 2.13 GHz computer with 1 GB RAM was used. In the results table, best obtained results of all five heuristics are printed bold.
If we consider that the optimization of CCMV with entropy constraint obtains only slightly better results than optimization of CCMV model without entropy in Table 4, the experimental results in Table 5 could be used for comparison of the performance of mFA with other metaheuristics in some sense.
The experimental results presented in Table 5 prove that none of the four algorithms which we used for comparisons has distinct advantages but that on average, mFA is better approach than other four metaheuristics.
mFA obtains better (smaller) mean Euclidean distance for all five benchmark sets. In and benchmarks, mFA is better than all four algorithms for all three indicators, mean Euclidean distance, variance of return error, and mean return error. For those benchmarks, mFA was able to approximate the standard efficient frontier with the smallest mean return and variance of return error, and under the same risk values.
Second best algorithm shown in Table 5 is GA which obtains best mean return error and variance of return error in and tests, respectively. TS shows best performance for mean return error indicator in benchmark, SA for mean return error in test, while PSO proves to be most robust for variance of return error in index.
From the presented analysis it can be concluded that our approach obtained results for CCMV portfolio optimization problem that can be more valuable for the investors: mFA’s results are more accurate and the generated investment strategy is able to more efficiently diversify the risk of the portfolio.
In this paper we presented modified firefly algorithm (mFA) for cardinality constrained mean-variance portfolio optimization problem with entropy constraint. We adopted from the ABC algorithm parameter that controls and directs the exploration process. Original firefly algorithm suffers from low exploration power at early iterations of algorithm’s execution for this type of problems. By introducing exploration into this phase of execution, we overcome this deficiency. However, during late cycles when the right part of the search space was reached, the exploration is no longer needed. To control whether the exploration will be triggered or not, we introduced exploration breakpoint control parameter.
Since swarm intelligence implementations for the CCMV portfolio model with entropy constraint could not be found in the literature, we conducted three experiments. In the first experiment, to measure the enhancement gained by our modifications, we compared our proposed mFA with the original FA for CCMV model. Test results show that our modifications completely rectified original FA deficiencies. To show how the entropy constraint affects the CCMV portfolio model, in the second experiment we compared results of the mFA for CCMV models with and without entropy constraints. Test results proved that inclusion of the entropy constraint is justified since it ensures portfolio diversification and, consequently, quality of results enhancement. Finally, to test the performance and robustness of our algorithm, we compared it with four other state-of-the-art algorithms from  (and indirectly ). Our proposed algorithm proved almost uniformly better compared to genetic algorithm, tabu search, simulated annealing, and particle swarm optimization. This all establishes modified firefly algorithm as a usable tool for cardinality constrained mean-variance portfolio optimization problem with entropy constraint.
Future research may include application of the proposed mFA to other portfolio optimization models and formulations with different constraints. Also, additional modifications of the FA algorithm can be investigated for possible further improvement of results.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
This research was supported by the Ministry of Science of Republic of Serbia, Grant no. III-44006.
- T. Cura, “Particle swarm optimization approach to portfolio optimization,” Nonlinear Analysis: Real World Applications, vol. 10, no. 4, pp. 2396–2406, 2009.
- R. Zhou, R. Cai, and G. Tong, “Applications of entropy in finance: a review,” Entropy, vol. 15, no. 11, pp. 4909–4931, 2013.
- E. Mezura-Montes, Ed., Constraint-Handling in Evolutionary Optimization, vol. 198 of Studies in Computational Intelligence, Springer, 2009.
- T. El-Ghazali, Metaheuristics: From Design To Implementation, Wiley, 2009.
- X.-S. Yang, Nature-Inspired Optimization Algorithms, Elsevier, 2014.
- K. Tang, J. Yang, H. Chen, and S. Gao, “Improved genetic algorithm for nonlinear programming problems,” Journal of Systems Engineering and Electronics, vol. 22, no. 3, pp. 540–546, 2011.
- X.-S. Yang, “Swarm intelligence based algorithms: a critical analysis,” Evolutionary Intelligence, vol. 7, no. 1, pp. 175–184, 2014.
- M. Dorigo and L. M. Gambardella, “Ant colonies for the travelling salesman problem,” Biosystems, vol. 43, no. 2, pp. 73–81, 1997.
- R. Jovanovic and M. Tuba, “An ant colony optimization algorithm with improved pheromone correction strategy for the minimum weight vertex cover problem,” Applied Soft Computing Journal, vol. 11, no. 8, pp. 5360–5366, 2011.
- R. Jovanovic and M. Tuba, “Ant colony optimization algorithm with pheromone correction strategy for the minimum connected dominating set problem,” Computer Science and Information Systems, vol. 10, no. 1, pp. 133–149, 2013.
- M. Tuba and R. Jovanovic, “Improved ACO algorithm with pheromone correction strategy for the traveling salesman problem,” International Journal of Computers, Communications & Control, vol. 8, no. 3, pp. 477–485, 2013.
- D. Karaboga, “An idea based on honey bee swarm for numerical optimization,” Tech. Rep., 2005.
- I. Brajevic and M. Tuba, “An upgraded artificial bee colony (ABC) algorithm for constrained optimization problems,” Journal of Intelligent Manufacturing, vol. 24, no. 4, pp. 729–740, 2013.
- N. Bacanin and M. Tuba, “Artificial bee colony (ABC) algorithm for constrained optimization improved with genetic operators,” Studies in Informatics and Control, vol. 21, no. 2, pp. 137–146, 2012.
- M. Subotic and M. Tuba, “Parallelized multiple swarm artificial bee colony algorithm (MS-ABC) for global optimization,” Studies in Informatics and Control, vol. 23, no. 1, pp. 117–126, 2014.
- X.-S. Yang and S. Deb, “Cuckoo search via Lévy flights,” in Proceedings of the World Congress on Nature and Biologically Inspired Computing (NABIC '09), pp. 210–214, December 2009.
- X.-S. Yang and S. Deb, “Engineering optimisation by cuckoo search,” International Journal of Mathematical Modelling and Numerical Optimisation, vol. 1, no. 4, pp. 330–343, 2010.
- I. Brajevic and M. Tuba, “Cuckoo search and firefly algorithm applied to multilevel image thresholding,” in Cuckoo Search and Firey Algorithm: Theory and Applications, X.-S. Yang, Ed., vol. 516 of Studies in Computational Intelligence, pp. 115–139, Springer, 2014.
- C. Dai, W. Chen, Y. Song, and Y. Zhu, “Seeker optimization algorithm: a novel stochastic search algorithm for global numerical optimization,” Journal of Systems Engineering and Electronics, vol. 21, no. 2, pp. 300–311, 2010.
- M. Tuba, I. Brajevic, and R. Jovanovic, “Hybrid seeker optimization algorithm for global optimization,” Applied Mathematics & Information Sciences, vol. 7, no. 3, pp. 867–875, 2013.
- N. Srinivas and K. Deb, “Multiobjective optimization using nondominated sorting in genetic algorithms,” Evolutionary Computation, vol. 2, no. 3, pp. 221–248, 1994.
- K. Deb, A. Pratap, S. Agarwal, and T. Meyarivan, “A fast and elitist multiobjective genetic algorithm: NSGA-II,” IEEE Transactions on Evolutionary Computation, vol. 6, no. 2, pp. 182–197, 2002.
- T.-J. Chang, N. Meade, J. E. Beasley, and Y. M. Sharaiha, “Heuristics for cardinality constrained portfolio optimisation,” Computers and Operations Research, vol. 27, no. 13, pp. 1271–1302, 2000.
- H. Soleimani, H. R. Golmakani, and M. H. Salimi, “Markowitz-based portfolio selection with minimum transaction lots, cardinality constraints and regarding sector capitalization using genetic algorithm,” Expert Systems with Applications, vol. 36, no. 3, pp. 5058–5063, 2009.
- G.-F. Deng and W.-T. Lin, “Ant colony optimization for Markowitz mean-variance portfolio model,” Swarm, Evolutionary, and Memetic Computing, vol. 6466, pp. 238–245, 2010.
- K. F. Haqiqi and T. Kazemi, “Ant colony optimization approach to portfolio optimization—a lingo companion,” International Journal of Trade, Economics and Finance, vol. 3, no. 2, pp. 148–153, 2012.
- Y. Li, B. Heng, S. Zhou, R. Chen, and S. Liu, “A novel ACO algorithm based on average entropy for real estate portfolio optimization,” Journal of Theoretical and Applied Information Technology, vol. 45, no. 2, pp. 502–507, 2012.
- H. Zhu, Y. Wang, K. Wang, and Y. Chen, “Particle Swarm Optimization (PSO) for the constrained portfolio optimization problem,” Expert Systems with Applications, vol. 38, no. 8, pp. 10161–10169, 2011.
- Z. Wang, S. Liu, and X. Kong, “Artificial bee colony algorithm for portfolio optimization problems,” International Journal of Advancements in Computing Technology, vol. 4, no. 4, pp. 8–16, 2012.
- M. Tuba, N. Bacanin, and B. Pelevic, “Artificial bee colony algorithm for portfolio optimization problems,” International Journal of Mathematical Models and Methods in Applied Sciences, vol. 7, no. 10, pp. 888–896, 2013.
- M. Tuba and N. Bacanin, “Artificial bee colony algorithm hybridized with firefly metaheuristic for cardinality constrained mean-variance portfolio problem,” Applied Mathematics & Information Sciences, vol. 8, no. 6, pp. 2809–2822, 2014.
- A. Fernández and S. Gómez, “Portfolio selection using neural networks,” Computers and Operations Research, vol. 34, no. 4, pp. 1177–1191, 2007.
- X.-S. Yang, Nature-Inspired Metaheuristic Algorithms, Luniver Press, 2008.
- S. Yu, S. Yang, and S. Su, “Self-adaptive step firefly algorithm,” Journal of Applied Mathematics, vol. 2013, Article ID 832718, 8 pages, 2013.
- X.-S. Yang, “Multiobjective firefly algorithm for continuous optimization,” Engineering With Computers, vol. 29, no. 2, pp. 175–184, 2013.
- A. Galvez and A. Iglesias, “Firefly algorithm for explicit B-spline curve fitting to data point,” Mathematical Problems in Engineering, vol. 2013, Article ID 528215, 12 pages, 2013.
- R. K. Moghadas, A. Garakani, and M. Kalantarzadeh, “Optimum design of geometrically nonlinear double-layer domes by firefly metaheuristic algorithm,” Journal of Applied Mathematics, vol. 2013, Article ID 169823, 13 pages, 2013.
- K. P. Anagnostopoulos and G. Mamanis, “Multiobjective evolutionary algorithms for complex portfolio optimization problems,” Computational Management Science, vol. 8, no. 3, pp. 259–279, 2011.
- L. di Gaspero, G. di Tollo, A. Roli, and A. Schaerf, “Hybrid metaheuristics for constrained portfolio selection problems,” Quantitative Finance, vol. 11, no. 10, pp. 1473–1487, 2011.
- H. Markowitz, “Portfolio selection,” The Journal of Finance, vol. 7, no. 1, pp. 77–91, 1952.
- Z. Wang, R. Ouyang, and X. Kong, “A hybrid artificial bee colony for portfolio optimization,” Journal of Theoretical and Applied Information Technology, vol. 49, no. 1, pp. 94–100, 2013.
- K. P. Anagnostopoulos and G. Mamanis, “Multiobjective evolutionary algorithms for complex portfolio optimization problems,” Computational Management Science, vol. 8, no. 3, pp. 259–279, 2011.
- H. R. Golmakani and M. Fazel, “Constrained portfolio selection using particle swarm optimization,” Expert Systems with Applications, vol. 38, no. 7, pp. 8327–8335, 2011.
- W. F. Sharpe, “Mutual fund performance,” The Journal of Business, vol. 39, no. 1, pp. 119–138, 1966.
- M. Corazza and D. Favaretto, “On the existence of solutions to the quadratic mixed-integer mean-variance portfolio selection problem,” European Journal of Operational Research, vol. 176, no. 3, pp. 1947–1960, 2007.
- E. T. Jaynes, “Information theory and statistical mechanics,” Physical Review, vol. 106, no. 4, pp. 620–630, 1957.
- M. Tuba, “Asymptotic behavior of the maximum entropy routing in computer networks,” Entropy, vol. 15, no. 1, pp. 361–371, 2013.
- X. Huang, “An entropy method for diversified fuzzy portfolio selection,” International Journal of Fuzzy Systems, vol. 14, no. 1, pp. 160–165, 2012.
- J.-L. Lin, “On the diversity constraints for portfolio optimization,” Entropy, vol. 15, no. 11, pp. 4607–4621, 2013.
- I. Usta and Y. M. Kantar, “Mean-variance-skewness-entropy measures: a multi-objective approach for portfolio selection,” Entropy, vol. 13, no. 1, pp. 117–133, 2011.
- J. Xu, X. Zhou, and D. D. Wu, “Portfolio selection using λ mean and hybrid entropy,” Annals of Operations Research, vol. 185, no. 1, pp. 213–229, 2011.
- X.-S. Yang, “Firey algorithm, stochastic test functions and design optimisation,” International Journal of Bio-Inspired Computation, vol. 2, no. 2, pp. 78–84, 2010.
- X.-S. Yang, “Multiobjective firefly algorithm for continuous optimization,” Engineering With Computers, vol. 29, no. 2, pp. 175–184, 2013.
- M. K. Sayadia, A. Hafezalkotobb, and S. G. J. Nainia, “Firefly-inspired algorithm for discrete optimization problems: an application to manufacturing cell formation,” Journal of Manufacturing Systems, vol. 32, no. 1, pp. 78–84, 2013.
- A. H. Gandomi, X.-S. Yang, and A. H. Alavi, “Mixed variable structural optimization using firefly Algorithm,” Computers and Structures, vol. 89, no. 23-24, pp. 2325–2336, 2011.
- X.-S. Yang, “Firefly algorithms for multimodal optimization,” Stochastic Algorithms: Foundations and Applications, vol. 5792, pp. 169–178, 2009.
- K. Deb, “An efficient constraint handling method for genetic algorithms,” Computer Methods in Applied Mechanics and Engineering, vol. 186, no. 2–4, pp. 311–338, 2000.
- K. Deb, Optimization For Engineering Design: Algorithms and Examples, PHI, 2012.
- E. Mezura-Montes and C. A. Coello, “Constraint-handling in nature-inspired numerical optimization: past, present and future,” Swarm and Evolutionary Computation, vol. 1, no. 4, pp. 173–194, 2011.
Copyright © 2014 Nebojsa Bacanin and Milan Tuba. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.