Using the ACS Approach to Solve Continuous Mathematical Problems in Engineering

Ant colony system (ACS) has been widely applied for solving discrete domain problems in recent years. In particular, they are efficient and effective in finding nearly optimal solutions to discrete search spaces. Because of the restriction of ant-based algorithms, when the solution space of a problem to be solved is continuous, it is not so appropriate to use the original ACS to solve it. However, engineeringmathematics in the real applications are always applied in the continuous domain.This paper thus proposes an extended ACS approach based on binary-coding to provide a standard process for solving problemswith continuous variables. It first encodes solution space for continuous domain into a discrete binary-coding space (searching map), and a modified ACS can be applied to find the solution. Each selected edge in a complete path represents a part of a candidate solution. Different from the previous antbased algorithms for continuous domain, the proposed binary coding ACS (BCACS) could retain the original operators and keep the benefits and characteristics of the traditional ACS. Besides, the proposed approach is easy to implement and could be applied in different kinds of problems in addition to mathematical problems. Several constrained functions are also evaluated to demonstrate the performance of the proposed algorithm.


Introduction
Ant colony systems (ACS) have been shown to have good performance in finding near-optimal solutions for NP-hard problems.An ACS adopts distributed computation and uses a constructive greedy strategy [1] with positive feedback to search for solutions.It is a powerful approach inspired by the behavior of ants, which deposit chemical trails (pheromone) on the ground to communicate with each other.This allows them to find the shortest paths between nests to destinations.ACS algorithms have thus been used to discover good solutions to many applications [2][3][4][5][6].They are also adopted to solve algebraic equations in mathematics [7].
Normally, ant-based algorithms are used in discrete solution space.Thus, they usually resolve the problems which need to find a trip as a solution due to the restriction of the encoding space.This kind of problems such as TSP (travelling salesman problem) provides a searching map to ACS for artificial ants to search for good trips.In other words, if the solution space of a problem can be transformed as a searching map, ACS would then be easily applied to it.
In the past, ACS was seldom used in continuous domain problems since the search space is hard to transfer to trips.Several ant-based methods were then proposed to support continuous solution space [8][9][10][11][12].However, these methods did not completely utilize the traditional ant process in continuous domains.Thus, they preserved few characteristics of the original ACS algorithm, losing some of its advantages.Hong et al. also designed an ACS algorithm with a specific binary coding to find appropriate membership functions in fuzzy data mining.Their experimental results showed the good performance of ACS for handling continuous values.The paper thus proposes a generalized version and a standard procedure of the ACS algorithm in order to easily apply it to other applications.The proposed method retains the process of the original ACS algorithm to preserve its good characteristics and recommends a simple encoding process for continuous variables.It encodes the continuous variables into a binary string and easily transforms the problem to be solved into a multistage searching map.After that, each ant selects an edge in each stage with an edge representing a part of the binary string for a continuous variable.Experiments on finding solutions to several constrained functions are also made, and the results show that the proposed approach works well in solving these continuous variables problems.

Review of Existing ACS Algorithms for Continuous Solution Space
The ant system was first introduced by Chang and Lin and Dorigo et al. [2,13] and then extended to the ant colony system (ACS) [14].ACS is based on observations of real ant colonies searching for food according to the pheromone density to solve complex problems.It uses the state transition rule, global updating rule, and local updating rule to choose nodes and change pheromone density.The state transition rule is used by an ant to probabilistically decide its next state according to the pheromone on the edge and the inverse of the distance (visibility).After all the ants have completed their tours, the pheromone density of the best tour passed is then updated by the global updating rule.There are two kinds of global updates.The first kind takes the best tour among the ones passed by the ants in all the so far executed iterations and then updates the amount of pheromone on the edges of the best tour.The other kind takes the best tour among the ones passed by the ants in each individual iteration.
Besides, when an ant chooses an edge between nodes  and , it immediately updates the pheromone density of the edge to avoid local optimum by the local updating rule.
An edge which is the local optima for an ant but not global optima for all the ants will decrease its pheromone, causing the ant to explore the other edges with higher probabilities and thus avoiding local optima.
Traditionally, ant-based algorithms are applied to discrete problems, which are represented as a graph with nodes and edges.When an ant finishes its trip from start to destination, a feasible solution is produced immediately.The advantage of an ACS algorithm is that it is a constructive algorithm, which is different from genetic algorithms (GAs).When antbased algorithms select an edge, they will refer to those which are selected before.The ants then choose better edges using heuristic functions designed according to the given problem.ACS algorithms seldom produce poor solutions and are thus suitable for problems in which good solutions (not necessarily optimal) can be found using local search algorithms.
In the past, it was difficult to use ant-based algorithms to solve problems with a continuous solution space due to the coding restriction.A common way to deal with this issue is to map a continuous solution space to its simplified discrete solution space.However, this creates the following two problems.Firstly, a continuous solution space cannot be totally mapped to a discrete solution space such that the global optimum may not exist in the encoded space.Secondly, if the minimal discrete distance scale of the encoded space is reduced, the coding length increases, and it lowers the performance of ant-based algorithms.
Nest-based algorithms were then proposed for applying an ant algorithm to a continuous solution space [9][10][11].The solution space is defined as a plane (2-dimentional solution space) and each point in the plane is a possible solution.A nest is a point in the plane and all the ants start their tours there.In each iteration, the population may or may not move its nest to a new place, depending on whether the new place approaches the global optimum.However, these methods are more similar to particle swarm optimization (PSO) than to the original ant algorithm.
Pourtakdoust and Nobahari then proposed an extended ACS algorithm to solve the math equation [7].Its process is similar to that of traditional ACS.However, it is not a general algorithm for all problems with a continuous solution space.The paper thus proposes a continuous ACS algorithm that retains benefits and characteristics of the original ACS algorithm and can be easily applied to problems with a continuous solution space.
Besides, Socha and Dorigo proposed a complicated ACO algorithm for continuous domains [12].Their method maintained a set of PDF (probability density functions) to record the information of pheromone.It defined some specific operators in order to apply ACO in continuous solution space.Karimi et al. proposed another well-defined continuous ACS algorithm with Tabu search [8].It could avoid bad regions and guide the population toward a better solution area.Their experimental results showed that the ant-based algorithm could also get good performance in the continuous domains.
Hong et al. proposed two methods based on the traditional ACS with multistages in order to find nearly optimal membership functions in fuzzy mining [15,16].Each membership function contains several parameters to adjust, and each parameter is encoded into a multistage code with two binary bits in each stage [15].Each stage thus contains four candidate nodes which represent (0, 0), (0, 1), (1, 0), and (1, 1), respectively.
A simple example for its searching map is shown in Figure 1.The trip for an ant from the start point to the destination represents a possible complete binary string for a solution.Hong et al. then improved it by hierarchical processing to increase the solution accuracy [3].In this paper, we proposed the generalized version and a standard procedure of the algorithm in order to apply it in more continuous domain problems.The proposed method in this paper has the following advantages.First, it is easy to implement since it follows the traditional ACS architecture.Second, it does not need to store extra information from traditional ACS; there is no need to design specific data structure.Finally, this algorithm is complied with traditional ACS algorithm, including the operators and the process.It means that it retains all of the characteristics and strong points from the original ACS algorithm.The details of the algorithm are described below.

Generalized Binary-Coding ACS Algorithm
This section describes the proposed generalized ACS-based algorithm for continuous solution space.It is called the binary-coding ant colony system (BCACS) and preserves all of the operators in the original ACS, including the state transition rule, the local updating process, and the global updating process.The details of the proposed algorithm are described below.

Encoding and Searching Map for BCACS.
In the traditional ACS, the resolved problems always provide a map for the population of ants to search.For example, in the TSP problem, the map for salesman to visit is exactly the one for the ACS approach.When an ant has finished a trip in the map, it produces a suitable solution for this problem.However, there is no such map which the ACS algorithm needs in a continuous domain problem.Thus, the proposed generalized ACS approach has to produce a multistage searching map for a continuous domain first in order to resolve this kind of problems.In BCACS, each continuous variable will be encoded into a binary string with length .If all of the bits in this string are 0, it means that the decoding value for this variable is the minimal value in the solution space.In other words, BCACS decodes the value for a continuous variable by the following formula: where  decoding is the decoding value of the variable ,  min is the minimal possible value of ,  max is the maximal value of ,  encoding is the decimal value of the current binary string of , and  is the length of .A simple example is shown in Figure 2.
In Figure 2, a variable is represented by four bits.Assume that the range of the continuous variable is from 0 to 1; then 1101 represents the value of 0 + (1 − 0) * 13/15, which is 13/15.Thus, a continuous variable is represented by a discrete number of candidates, and the length of its representation will affect the final precision.Assume that a problem includes  variables and the length of each variable is ; then BCACS will encode the whole solution into a binary string with × bits.An example with two variables is shown in Figure 3. BCACS then generates a multistage searching map in order to obtain a binary string as a possible good result.The length of each variable is further divided into several pieces with the same sublength.Let the sublength be .The number of nodes in each stage is, thus, 2  , and a node includes  bits as a substring of a solution.An ant then selects edges for its route to the destination, and all the bits in the nodes passed by the ant are concatenated together to form a solution.The transformed multistage searching map is shown in Figure 4.
By Figure 4, when an ant finishes its route from a starting point to a destination, it also produces an encoding discrete binary string for every continuous variable at the same time.After that, the binary strings can then be decoded to real values in the solution space according to formula (1).
In the ant-based algorithm, the phase number (not the fitness value) of the trip is an important factor to affect the performance.The ants hardly find appropriate solutions if the phase number of the trip is too big.Therefore, setting longer substrings for nodes can reduce the stage number of BCACS.It can also provide more information to the heuristic function because the encoding process can store more data in longer substrings.On the other hand, shorter substrings can help detailed search through pheromone.Thus, appropriate length for substrings should be set to provide a good trade-off between stored information and detailed search, thus guiding the population to move to better solutions.

Proposed BCACS Algorithm.
The proposed ACS is similar to the original ACS.They have similar characteristics and operators such as local update, global update, and edge selection.The details of the proposed BCACS algorithm are described as follows.

The BCACS Algorithm
Input.The input is as follows: a problem (of both continuous and discrete domain) to be solved, a number  of ants, an initial pheromone density  0 , a node bit number  in each stage,  stages for each continuous variable (it can also work for discrete variables), a maximum number  of iterations, the local updating ratio   , and the global updating radio   .
Output.The output is as follows: a nearly optimal solution to the problem.
Step 1. Generate the multistage searching map for the continuous solution space according to the principle in Section 3.1.
Step 2. Define an appropriate fitness function for evaluating paths passed by ants.
Step 3. Initially set the pheromone density  0 on each edge in the map and the current best solution   as empty.
Step 4. Set the initial generation number  = 1.
Step 5. Build a complete route for each artificial ant by the following substeps.
Step 5.1.Put the artificial ant at the starting point on the map.
Step 5.2.Select an edge from the 2  candidate edges to the next stage according to the pseudorandom proportional rule.In this step, we can design a suitable heuristic function for the problem to guide the population.
Step 5.3.Update the pheromone amount on the selected edge by the traditional local updating process to avoid the population visiting the same edge.
Step 5.4.If the next stage is not the destination, go to Step 5.2.
Step 6. Concatenate the bits on the nodes passed by each artificial ant to construct a solution, decode all the continuous variables, and evaluate the fitness value of the solution according to the fitness function defined in Step 2. If   is empty (the first generation) or the best solution in  the iteration is better than   , replace   with the current best solution.
Step 7. Update the pheromone amount on the trip of   by the traditional global updating process.
Step 8.If  < , then set the generation number  =  + 1 and repeat Steps 5 to 7.
Step 9. Find the one with the highest fitness value amount the  ants, and get the values of the variables for the best ant.

An Example.
In this section, an example is given to illustrate the proposed BCACS for solving a continuous mathematical problem.Assume that there is a formula  2 1 +  2  2 +  2 3 with each variable from −5.12 to 5.12.The BCACS is used to find the minimum value for the formula.The execution process is derived as follows.
Step 1.The multistage searching map for the three variables is first generated (Figure 5).Assume that the length of each substring is set as 3 and the coding length for a variable is 12.Each variable thus consists of four phases.The searching map is shown in Figure 6.
Step 2. The formula  2 1 +  2 2 +  2 3 is set as the fitness function for each artificial ant because it is to be minimized.
Step 3. The pheromone density  0 is initially set as 1.0 and the current best solution   is set as empty.
Step 4. The initial generation number  is set as 1 and the maximum number  of iterations is assumed to be 100.
Step 5.In this step, the ants construct their trips with 12 stages (4 × 3) through the node selection process.An ant selects a node in each stage and each node represents a 3-bit substring in a whole encoding string.For example, a selected trip (encoded string) may be {100 000 000 010 011 111 111 100 011 111 110 111}.In addition, BCACS will perform local updating process after selecting a node.
Step 7. The pheromone amount on the best trip of the current iteration is updated by the global updating process.
Step 8.If  < 100, then the generation number  is increased by 1 and Steps 5 to 7 are repeated.
Step 9.After 100 generations, the solution with the highest fitness value can be obtained, and the values of the three variables can be encoded.In the example,  1 is 0.000012,  2 is 0.000003, and  3 is 0.000011, very close to 0.

Experimental Results
Experiments were made to show the performance of the proposed BCACS.The experiments were implemented in Java on a personal computer with an Intel Core 2 Quad 6600 CPU and 4 GB of RAM.BCACS was compared to some existing approaches including API [11], GA, and CACS [7].CACS was a special-purpose ACS for resolving mathematical functions.It used some complex designs to approach the optimal solution to a function.For example, it applied a normal probability distribution function to calculate the content of pheromone and adjusted the parameters by using the current best fitness value.The GA approach adopted here was the traditional genetic algorithm and it decoded the solution space as binary strings.API was inspired by a primitive ant's recruitment behavior.The recruitment technique made the population proceed towards the optimum solution.The same parameter settings from tour previous experiments [15,16] were used.The seven test functions are listed as follows: (1)   (4) 1 + ∑ All of the above test functions had a minimum value of 0, which was to be found.Getting a function value closer to zero thus meant a better performance.The number of candidate edges in each stage was 2 ( = 1).The experimental results by the different approaches are summarized in Table 1.
From Table 1, it could be observed that BCACS and CACS could obtain satisfactory solutions for these test functions when compared to the others.For functions (1) and (2), since the functions were simple and the encoding spaces were discrete in GA and API, GA and API could obtain the minimum evaluation value (0) because of the optimal solutions being encoded in the encoding spaces.The encoding space in BCACS was also discrete.It used formula (1) as the decoding function, and there were no special parameters designed to guarantee the optimal solutions in the encoding spaces.Therefore, BCACS could not get the minimum evaluation value (0) in the first two functions.For the other complex functions, BCACS could obtain good and stable performance.In function (3), only BCACS can get a good result which is near the minimum value 0. CACS had shown its good performance in resolving function optimization problems [7].In contrast, BCACS was a general continuous ACS not only for the function optimization problems but also for other continuous domain problems in the same process.It not only was thus as flexible as the traditional ACS but could also achieve good performance for problems with continuous variables.
Experiments were then made to evaluate the effects of different node bit numbers () when the same encoding length is set on the solutions.The results averaged in 1000 runs for the seven test functions are shown in Table 2.
In Table 2, the results in each column were very similar but the performance for  = 1 was the best among the different bit numbers.If  is bigger, more information could be provided to heuristic functions to guide an ant in selecting the next edge and more appropriate solutions could be obtained.But, in the application of computing the minimum value of a function, we did not design any heuristic function to guide the ants to approach better results.Thus, we should choose a smaller number of  in order to do more precise searching.It is very important for BCACS to define an effective heuristic function and set an appropriate  value in real implementation.The execution times for different node bit numbers () under the same total encoding length, averaged in 1000 runs, for the seven test functions are shown in Table 3.
If the number of candidate edges was smaller (meaning the bit number was less) and the length of the whole encoded string is fixed, the distance from the start point to the destination would become longer.It would increase the computation time for an ant to finish its trip.However, if the number of candidate edges was bigger, BCACS would spend more computation time in the selection process.In the experiments, BCACS had the smallest computation time when the number was set as 4.
Figure 6 then shows the average results by BCACS along with different generations for the seven test functions with  = 1.In the early 300 generations, the populations of BCACS converged quickly to obtain good results.BCACS then shows its ability of seeking better results in the solution space in the next generations.BCACS thus has the same characteristics and benefits (like converging quickly and having good exploring ability) as the traditional ACS because it has the standard process of the traditional ACS.
In the past, we designed a specific version [15] of the proposed algorithm to find appropriate membership functions for the fuzzy data-mining problems.In that paper, the approach was compared with GA and could get good results from the experiments.In this paper, we propose a general version of the algorithm and conduct experiments for mathematical functions.The experimental results showed that it also obtained good enough results in this application.

Conclusion and Future Work
In this paper, a simple and standard ACS approach for solving problems in continuous domains is proposed.The algorithm adopts the traditional operators and process of ACS and thus retains its benefits and characteristics.It just encodes a solution space into a binary encoding space and transforms a problem into a map-searching problem.The ACS process can then be easily applied to it.The experimental results show that the proposed BCACS is very competitive to the existing ACS and some other evolutionary algorithms.
Even though the performance of BCACS is good enough and the process is very similar to the traditional ACS algorithm, there are still some issues to be further explored.First, there are more parameters in BCACS than in the traditional ACS.We will thus study how to set up these parameters in the future.Second, we will apply the BCACS algorithm to more applications with continuous solution space.The experimental results in [12] were not directly provided.They set the results from the best algorithm as 1 and from the other algorithms as its multiples, which caused the difficulties in

Figure 1 :
Figure 1: The searching map with 12 stages from previous work.

Figure 2 :Figure 3 :
Figure 2: A simple encoding example for a continuous variable with 4 bits.

Figure 5 :
Figure 5: A simple searching map for three variables.

Figure 6 :
Figure 6: The average results along with the number of generations.

Table 2 :
The average results for different node bit numbers ().

Table 3 :
The execution time (ms) for different node bit numbers () for the seven test functions.