Cash balance management : A comparison between genetic algorithms and particle swarm optimization

This work aimed to apply genetic algorithms (GA) and particle swarm optimization (PSO) in cash balance management using Miller-Orr model, which consists in a stochastic model that does not define a single ideal point for cash balance, but an oscillation range between a lower bound, an ideal balance and an upper bound. Thus, this paper proposes the application of GA and PSO to minimize the Total Cost of cash maintenance, obtaining the parameter of the lower bound of the Miller-Orr model, using for this the assumptions presented in literature. Computational experiments were applied in the development and validation of the models. The results indicated that both the GA and PSO are applicable in determining the cash level from the lower limit, with best results of PSO model, which had not yet been applied in this type of problem.


Introduction
Manage the available cash balance is a constant problem in all organizations.This due to the daily inand outflows of cash, whether by the activities of the company or financial transactions that it had negotiated.Thus, there is need to control financial resources to obtain the best result for the organization.
In this way, the function of cash management has responsibilities such as mobilize, control and plan the financial resources of the companies (SRINIVASAN; KIM, 1986).With this, the use of models to support the decision-making with the application of metaheuristics becomes pertinent, since they can provide a comprehensive and optimization view of something that hardly can be obtained without using methodologies (VOβ, 2001).
So, the use of models in the problem of defining the ideal level of available cash balance has arisen from the studies of Baumol (1952) and Tobin (1956), where the authors start with the assumption that the available cash can be defined as a commodity in inventory, i.e., a standardized-good, whose control can be done daily, weekly, monthly, etc., depending on the level of temporal details of the company.
For these authors, defining the optimal cash balance follows the standard of the inventory lot size models, where it is considered the available financial resource as an inventory, which has some costs associated with its origin and maintenance, but that also generates indispensable benefits for the organization.Meantime, the application of the models of Baumol and Tobin is not possible for comparative purposes, due to the limitation of the models.
Considering this, the definition of the cash balance start having a quantitative approach to promote the optimization of this financial stock in order to minimize the costs associated with the maintenance or lack of cash.Posteriorly, Miller and Orr (1966) defined the cash balance as having an uneven fluctuation, characterizing a random variable, and proposed a stochastic model for the cash balance management.
Thus, understanding the reasons why the organizations have the need to keep cash resources is essential for a better financial management.Following this reasoning, Brealey and Myers (2005) pointed out four reasons for the maintenance of cash balance: 1. Transactions -financial funds held in cash to meet commitments in view of the time lag between the outflow (payment) and inflow (receipt) of cash; 2. Precaution -resources held in cash to maintain a safety reserve for contingencies; 3. Speculation -funds held in cash to take advantage of opportunities to obtain discounts or favorable applications; and 4. Bank reciprocity -resources held in current accounts to meet the requirements of some banks as consideration.Nevertheless, defining the amount of money to be maintained in cash is not easy to understand or perform.Another relevant factor in the policy management of cash balance management depends on constraint factors.
In Brazilian case, data from Economática for the period from 2004 to 2008 indicate that Brazilian companies (non-financial assets) with shares traded in stock exchange, had a weighted average balance of availability of 8.85% in the period (Table 1).In this way, this study aims to present a comparison between two computational methods for determining the optimal level of cash, using as basis the model proposed by Miller and Orr, defining the lower value of cash.
As the Miller-Orr model does not define the variable lower bound (LB), any arbitrary definition of this variable will impact the cash cost, remaining a gap in the definition of cash policy.
In order to meet the proposed problem, the general goal of the research is to develop a policy for available cash balance management, based on the assumptions of cost minimization, applying the Miller and Orr model, using genetic algorithms (GA) and particle swarm optimization (PSO) for its parameterization.
The following methodology is used to achieve the proposed objective: -Simulate historical series of cash flows, based on assumptions observed in literature about the subject; -Develop the model of genetic algorithms and particle swarm optimization that have as objective function to minimize the cost of maintaining a cash balance; -Perform experimentations with the models developed in the simulations of the cash flows and comparatively analyze their results, observing advantages and perspectives.Besides that, a control algorithm that tests all the possibilities of lower bound of cash will serve as basis to verify the quantitative level of benefit of employed models.
The present study focused the qualitative methodology of financial management.For this are used the techniques of genetic algorithms and particle swarm optimization in the development of cash balance model of Miller and Orr, requiring introduce the concepts applied to the addressed problem, as well as the method proposed for its elucidation.Hereafter are presented the theories that support this study, first of all, by reviewing the concepts of cash balance management and the models of genetic algorithms and particle swarm optimization.

Cash management models
The cash management models were originated from the work of Baumol (1952).In this study, the author draws a parallel between the cash and the other of the companies.
In the case of the inventories in general, the most common approach according to Slack et al. (1997), when it is needed to define the stock replenishment is the economic order quantity (EOQ), which aims to find the better positioning between advantages and disadvantages of owning inventory.
Despite that, the EOQ has restrictions when using the assumptions of fixed and predictable demand, as well as instant deliveries when requested the stock replenishment (SLACK et al., 1997).
According to Baumol (1952), the cash balance can be seen as an inventory of a means of exchange.In this model, adapted from the EOQ for the cash optimization, the optimal configuration is obtained as a function of the relationship between the opportunity cost and transaction cost.In the model, the transaction cost increases when the company needs to sell bonds to accumulate cash; and the opportunity costs increase with the existence of cash balance, since it is an application without revenue (ROSS et al., 2002).
The model analyzes the cost associated with the maintenance of cash balance, i.e., the cost of opportunity determined by the interest that the company does not receive by not applying the resources, and the cost of obtaining cash by the conversion of investments into cash (ROSS et al., 2002).The transaction cost represents the expenditure incurred in the application or redemption of financial resources, such as fees and taxes.Posteriorly, Miller and Orr (1966) presented a model that meet the randomness of cash flows, despite still considering the existence of only two actives, cash and investment, the latter represents a low risk option with high liquidity (Figure 1).
In this model, two bounds are defined for the level of cash balance: the lowest and the highest, so that, when achieving the maximum level (time T1), represented by the higher bound (H), it is performed the application of resources, in an amount that provides the cash balance back to the optimal level (Z).And, when reaching the minimum level (time T2) in the lower bound (LB) it should be made a ransom to obtain an optimal level of cash (ROSS et al., 2002).
Thus, when working the liquid cash flows (inflows minus outflows), the Miller-Orr model allows optimizing the cash, based on the transaction costs (represented by F) and opportunity (represented by K), obtaining the following equation (ROSS et al., 2002): The "*" denotes optimal values and σ 2 is the variance of liquid cash flows.Even with the gain in relation to the Baumol model, by considering the unpredictability of cash flow, the Miller-Orr model requires the definition of the lower bound (LB), i.e., the risk of cash shortage, associated with a minimum safety margin, depends on the administration choice and it is not treated in the model.
Therefore, the definition of the lower bound (LB) impacts the cash cost and the risk associated with cash shortage, since the lack of LB indicates a company that does not maintain a minimal precautionary background.
At this point lies the problem addressed in this study, once the Miller-Orr model does not define the lower bound, so it is necessary to use the GA and PSO for this problem in order to find the optimal lower bound (LB*) able to minimize the cost.
The use of the computational methods for the problem resolution is observed in some cases, such as the proposal of Yao et al. (2006) that approaches fuzzy systems, as well as Gormley and Meade (2007) on the utilization of genetic algorithms, not observed in literature the application of PSO in this type of problem.

Genetic algorithms and Particle Swarm Optimization
The evolutionary computation was originated in the study of the theory of natural evolution, being algorithms models that seek to achieve the defined objective functions.For this, they start from possibilities of random resolutions and according to their development algorithm evolve to obtain better results in search of the goal established (REZENDE, 2005).
In order to become useful, the traditional algorithms for finding the most appropriate solutions, or optimization algorithms, employ a series of suppositions or hypotheses about how validate the fitness of a solution.Another traditional way of optimization, based on downward gradients depends on the occurrence of low oscillations in the response variable of the problem, under penalty of obtaining a local optimization, non-global.
However, the evolutionary algorithms do not depend on this type of assumption.Basically, the performance measurement should be able to ordinate two comparative solutions and determine one that somehow is better than another (FOLEY et al., 2007).
In the genetic algorithms (Figure 2) the population is the set of possible solutions to a given problem, being each individual of this population with a structure similar to the chromosomes.

GA Algorithm (Genetic Algorithm)
1:T = 0; 2:Generate Initial Population P(0); 3:For every each individual i of the current population P(t) do 4: Evaluate the fitness of the individual i; 5:End for 6:while Stopping criterion is not met do 7: t = t + 1; 8: Select population P(t) from P(t-1); 9: Apply crossover operators on P(t); 10: Apply mutation operators on P(t); 11: Evaluate P(t); 12:End while The possibility of survival of each individual is evaluated by a cost function, to be optimized, being the result of this function the fitness of each individual as better result to the problem, functioning as selection for reproduction.Finally the evolution is provided by the application of genetic operators as selection, crossover and mutation (MARTÍNEZ et al., 2009).
The selection operators seek to ascertain how able each individual is to be considered as the best solution for the problem, after this, the individuals are crossed, i.e., through the junction of parts of each one of the individuals able is formed a new population of individuals and, eventually some of these individuals undergo random mutations, following a certain probability of occurrence.
The model of particle swarm optimization has been presented more recently in literature, and differs from genetic algorithms by the fact that each possible solution (particle) has a random velocity, fluctuating through a hyperspace.Thus, each particle of the swarm is evaluated by a fitness function, being stored the better solution of the particle, called pbest, and it is also stored the better overall solution, gbest.
So, from the current position of the particle (x i ) that corresponds to the current solution, its current velocity (v i ), its best past position (pbest i ) and its best overall position of all swarm particles (gbest), each particle is interactively updated (Figure 3) according to previous attributes (TSAI et al., 2010).

PSO Algorithm (Particle Swarm Optimization)
1:Procedure -objective function (f) 2:Initialize the swarm of m particles 3:While the stopping criterion is not met do 4: Evaluate each particle 5: for particle i, i = 1, 2, . . ., m do (update the best positions) 6: if f(x i ) < f (pbest i ) then 7: End if 11: End if 12: End to 13: for particle i, i = 1, 2, . . ., m do (generate the next generation) 14: x i (t + 1) = x i (t) + v i (t + 1) 16: End to 17:End while 18:End of procedure There are implications for the outcome of the models according to the parameters and techniques of these operators.In the GA case, the selection function that ordinates the most able individuals ensures that the best alternatives found to the problems are always maintained; in the PSO the function of inertia that maintain the solution in its original way, as well as the social and cognitive trends, try to direct the solution toward the best results already achieved in its history, aiming the evolution of the response and its convergence to an optimal result.

Material and methods
The methodology is dedicated to the development of the models of GA and PSO that are able to seek the definition of the lower bound (LB) of cash.In this way, it is necessary the development of experimentations at different scenarios for the obtaining series of liquid cash flows that allow validating the developed models.
In the specific case of the addressed issue, abovementioned authors stand out that the cash balance as a random variable with normal distribution.In this way, for the experiment it was used parameters of mean and standard-deviation of samples at three different levels (low, intermediate and high) empirically defined in partial tests with extreme values.
Thus totaling nine groups of cash flows, so that for each group of cash flows, it was generated randomly ten samples, called "Problems", with 500 values each (Table 2).Afterwards, all the problems (90 samples of 500 values each) were tested regarding the normal distribution by the Chi-Square Test (χ 2 ), with 5% significance level, and those that have not achieved the normality assumption were replaced before the experimentation.The goal was to validate the model according to the flows with means and variances distinct, obtaining flows with higher or lower probability of presenting negative values in the net cash balance.
The models GA and PSO were applied to the problems and programmed to minimize the cash cost based on the definition of the lower bound of cash (LB).
The parameters defined for the algorithms were the followings: -Initial cash balance: all the series of cash balance started from an initial balance of $1,000.00,added to each moment with the value generated in the series of cash flows.The determination of a fixed initial balance does not interfere on the relevance of the flows, since it is adjusted soon after the calculation of the first cash flow; -The cost of transaction (F) was set at a fixed value of $2.85 per transaction, be it investment (cash outflow for investment) when the balance reaches the upper bound, or disinvestment (investment outflow for the cash) when the balance reaches the minimum limit set.It was not considered percentage values relative to taxes on financial operation; -The opportunity cost, assumed by the financial cost of getting cash when there is shortage of the cash, with the organization getting borrowed resource, such as 1% on this value.The definition of the opportunity cost was empirical, based on the expected profitability considered for the problem; -The value of the lower bound (LB) to be defined by the GA and PSO should be in a sample space between $0 and $50,000.This value has the objective to create a protection fund, as a minimum stock, ranging from zero (null protection) to a limit of $50,000, empirically defined for testing the models; -100 individuals were generated for each response value (LB) in each experiment, with 500 iterations for each (GA and PSO), obtaining the Cost of each cash flow and the total cost of the series; For the GA the following parameters were set: -Values: binary, transformed from the series of cash balance; -Crossing: roulette method between 2 parents generating 2 children, with 70% of occurrence, as experimental tests indicated better results; -Mutation: mutation rate of 1%, changing a random bit, also based on experimental tests; For the PSO the following parameters were set: -Values: nominal, from the simulated cash flows; -Inertia Rate: 10%, according to experimental tests, obtaining better results; -Learning rate: local optimum (cognitive behavior) and overall optimum (social behavior) at 20% each, also defined based on experimental tests.
Considering that both GA and PSO use random components, in order to enable a better result in defining the parameter LB, in each problem, the experiment was performed 10 times maintaining for comparative purposes the best result.Thus, 900 experimentations were accomplished with the GA and 900 experimentations with the PSO.
The parameters used in this methodology were ascribed empirically, based on unit and partial tests, aiming to observe the composition of result of the LB values (lower bound), once it was not found in the literature the parameters that could base the structuration of this given problem.
For comparative end, a control algorithm was developed, which alters the LB values from 0 to $50,000, in integer values, in order to minimize the computational time, and calculate for each LB the Total Cost at each one of the 90 problems.
The algorithms were developed using MATLAB ® 2009 and employed in a computer with a processor Core2Quad Q8300 with 2.5 GHz and 4GB RAM, using Windows 7™ 64-bit.
Hereafter the results are presented and analyzed.

Results and discussion
The results obtained with the function of minimizing the Total Cost of cash maintenance, based on the lower bound (LB) from the Miller-Orr model, using the GA and PSO models, with the mean values calculated on the 1 problems used in the experimentation in each group, are presented in Table 3.
The results showed that the two algorithms can determine the parameter LB relative to LB*, with a mean standard deviation (MSD) between the Total Cost of GA and PSO of 0.21%.Besides that, the PSO algorithm achieved a Total Cost with difference lower than 0.10% of the Total Cost of the Control Algorithm in 100% of the problems.
In general, the PSO model had better results than the GA model in all problems, but the difference between the results of GA in relation to the Control Algorithm is only 0.21%, indicating the GA is fit for use in this type of problem.
The factor average processing time for each experiment was: -Genetic Algorithm: 7.92 seconds; -Particle Swarm Optimization: 4.81 seconds; -Control Algorithm: 151.74 seconds; As the control algorithm is not a metaheuristic algorithm but an exhaustive algorithm that tests all the possibilities of value for LB, its longer computational time was expected.
The factor time is not a restrictive factor in this application, since each problem represents a company, the difference between five seconds and five minutes is irrelevant in the definition of cash balance management.Nevertheless, such measure is kept as a comparison of computational efficiency between the models.Thus, it is demonstrated that the PSO algorithm had results of minimization in the cost of cash maintenance, also presenting greater speed, i.e., higher efficiency and accuracy.It is important to emphasize that the Control Algorithm used only integer numbers, in order to reduce its computational time, and due to this, in two problems the result of the PSO algorithm was better at 0.01%.
The obtained results pointed out for the obtaining an optimal lower bound (LB*) able to reduce the Total Cost of maintaining a cash balance.In this way, analyze the groups of problem is also valid.By observing the groups, it is verified that the LB obtained is prone to rise as increases the average of cash flow in greater proportion than in relation to the increased standard deviation.
Furthermore, the Group 1 has higher costs of cash maintenance as a function of the greater probability of cash shortage (negative net balance), once the mean of this group is zero.

Conclusion
The study is limited to the definition of a single factor of cash balance management policy, being the results similar to those of control algorithm, with time advantage, but the difference in the obtained times is not a constraint factor.
Therefore, the merit of the study lies on the feasibility of applying the models GA and PSO in this type of problem, as an exploratory study.
With the evolution of the models, including the variables Z and H, it would be impractical the use of exhaustive algorithm because of the optimization of three variables.Thus, the GA and PSO models showed to be viable, motivated by the present study.

Figure 2 .
Figure 2. General diagram of the life cycle of a genetic algorithm (REZENDE, 2005).

Table 1 .
Contribution of the availabilities in the total of actives -Brazilian companies (elaborated by the author, Source: Economática).

Table 2 .
Generation of random numbers.

Table 3 .
Average comparative results per group between GA and PSO and control algorithm.