Size and Topology Optimization for Trusses with Discrete Design Variables by Improved Firefly Algorithm

Firefly Algorithm (FA, for short) is inspired by the social behavior of fireflies and their phenomenon of bioluminescent communication. Based on the fundamentals of FA, two improved strategies are proposed to conduct size and topology optimization for trusses with discrete design variables. Firstly, development of structural topology optimization method and the basic principle of standard FA are introduced in detail. Then, in order to apply the algorithm to optimization problems with discrete variables, the initial positions of fireflies and the position updating formula are discretized. By embedding the random-weight and enhancing the attractiveness, the performance of this algorithm is improved, and thus an Improved Firefly Algorithm (IFA, for short) is proposed. Furthermore, using size variables which are capable of including topology variables and size and topology optimization for trusses with discrete variables is formulated based on the Ground Structure Approach. The essential techniques of variable elastic modulus technology and geometric construction analysis are applied in the structural analysis process. Subsequently, an optimization method for the size and topological design of trusses based on the IFA is introduced. Finally, two numerical examples are shown to verify the feasibility and efficiency of the proposed method by comparing with different deterministic methods.


Introduction
Topology optimization is a rapidly expanding field of structural mechanics, which can result in greater savings than mere cross-section or shape optimization. Owing to its complexity, it is an intellectually challenging field (Rozvany and Olhoff 2001 [1]). Generally, the objective of topology optimization is to reduce the structural weight by adjusting the design variables under a set of predefined constraints imposed according to a selected code of design practice. As for topology optimization problems, the cross-sectional areas of structural members, shape parameters, and topology parameters can be treated as design variables. These variables can be divided into two categories as continuous variables and discrete variables. Actually, in practical engineering applications, discrete variables are used commonly as design or optimization variables, cross-sectional areas of the structural members, for instance. Therefore, size and topology optimization for trusses with discrete design variables is discussed in this study.
The first paper on topology optimization was published over a century ago by the versatile Australian inventor Michell (1904 [2]), who determined the first truss solutions of least weight and developed a general theory, which is a milestone in the theoretical research of structural topology optimization, for deriving them based on the work of Maxwell (1872 [3]). Several decades after that, many scholars joined in the field of optimization and a large number of papers were published. However, during that time, the research mainly focused on the development of optimization algorithms for continuous topology optimization. Typically, Dorn (1964 [4]) proposed the Ground Structure Approach, in which firstly 2 Mathematical Problems in Engineering they formed the ground structure containing all (or almost all) possible member connections among all nodes of the structure for a bridge truss, and then they applied the linear programming technique to optimize the structure subject to stress constraints and single loading case. Based on the Ground Structure Approach, Dobbs and Felton (1969 [5]) used a steepest descent-alternate mode algorithm to minimize the weight of the ground structure of truss subject to stress constraints and multiple loading cases. Kirsch and Topping (1992 [6]) applied a very attractive two-stage design approach, which evaluates an approximate solution at the first stage and modifies it at the second stage to achieve the final optimum, to optimize topologically the trusses subject to the constraints of stress and displacement.
Compared with topology optimization with continuous variables, the researches on topology optimization of trusses with discrete variables are much less. It is not easy to use the mathematical optimization methods to solve topology optimization problems with discrete variables. Lipson and Gwin (1977 [7]) adopted member areas and joint coordinates as design variables to minimize the cost of three-dimensional indeterminate truss structures subject to multiple loading conditions and design constraints, in which the constraints include Euler buckling and specified limits on member stresses, member sizes, and joint displacements. In their work, the design process was separated into two parts as geometry modifications and suboptimization. The complex method is applied in the geometry modifications part, and an analogous scaling procedure for displacement which constrains with the stress ratio method is applied in the suboptimization part. For each geometry change, discrete member sizes were selected from a table of allowable values. However, this method has the drawback of readily becoming trapped at a local optimum (Sun et al. 1995 [8]).
Over the last decade, the emergence of a new class of optimization methods, called metaheuristics, has marked a great revolution in the optimization field (Jarraya and Bouri 2012 [9]). These methods, which include the simulated annealing method, genetic algorithms, taboo search method, the Ant Colony Algorithms, and particle swarm optimization (PSO), are applicable to almost all types of combinatorial optimization problems. They also have been devised to topology optimization problems with discrete variables and to overcome the drawbacks of mathematical optimization methods. For example, Genetic Algorithm was researched by Wang and Tai (2005 [10]), Zhou (2010 [11]), Balamurugan et al. (2008 [12], 2011 [13]), Jain and Saxena (2010 [14]), and Madeira et al. (2010 [15]). Besides, Artificial Immune Algorithm was researched by Luh and Chueh (2004 [16]). Taboo Search method was researched by Bennage and Dhingra (2005 [17]). Ant Colonies Algorithm was researched by Kaveh et al. (2008 [18]) and Luh and Lin (2009 [19]) and Particle Swarm Optimization (PSO) was researched by Luh et al. (2011 [20]). Simulated Annealing method was researched by Shim and Manoochehri (1997 [21]), while Harmony Search was researched by Lee and Geem (2004 [22]). Differential Evolution schemes were researched by Wu and Tseng (2010 [23]). Some of these metaheuristics like Ant Colonies Algorithms and Particle Swarm Optimization may actually converge to reasonable designs within an acceptable number of iterations if combined with some kind of filtering algorithms (Sigmund 2011 [24]).
The Firefly Algorithm (FA, for short) developed recently by Yang (2009 [25]) is one of the newest nature-inspired metaheuristic algorithms (2013 [26]). It has been verified that FA is more accurate and efficient than Genetic Algorithm and Particle Swarm Optimization algorithm when solving continuous optimization problems, combinatorial optimization problems, constrained optimization problems, multiobjective optimization problems, and dynamic and noisy optimization problems. The FA has been applied in almost all areas of optimization, as well as in structural engineering practice (Fister et al. 2013 [26]). Size and topology optimization of trusses with discrete variables can be regarded as a kind of combinatorial optimization problem, because its solution space is disjoint and nonconvex, and feasible solution set is discrete. Therefore, it can be solved by FA as well (Miguel et al. 2013 [27]). However, the standard FA shows a slow rate of convergence towards the optimum and needs a high number of structural analyses.
The aim of this paper is to propose a modified Improved Firefly Algorithm (IFA, for short) based on the randomweight and improved attractiveness to solve the size and topology optimization of trusses with discrete design variables. In this method, the topology variables are included in size variables, unstable topologies are disregarded as possible solutions by the measure of geometric construction analysis, and the singular optimal problem can be avoided by the technique of variable elastic modulus. The IFA can speed up the convergence and then obtain a reasonable result, and the effectiveness of the IFA is demonstrated through a selection of benchmark examples.
The remainder of this paper is structured as follows. Section 2 describes the fundamentals of the FA and IFA. Section 3 presents a general framework of the size and topology optimization of trusses with discrete design variables. Additionally, two numerical examples are presented in Section 4. Finally, the paper ends in Section 5 with main conclusions.

Firefly Algorithm (FA) and Improved
Firefly Algorithm (IFA) The FA is a recent nature-inspired metaheuristic algorithm developed by Yang (2009 [25]) which is inspired by the flashing behavior of fireflies. The FA has the following three idealized assumptions. (a) All fireflies are unisex, so that one firefly can be attracted to other fireflies regardless of their sexes.
(b) Attractiveness is proportional to brightness; thus for any two flashing fireflies, the less bright firefly will move towards the brighter one. Both attractiveness and brightness decrease as the distance between fireflies increases. If there is no firefly brighter than a particular firefly, that firefly will move randomly.
(c) The brightness of a firefly is affected or determined by the landscape of the objective function.
Based on these three assumptions, there are two essential components of the FA, the variation of the light intensity and the formulation of the attractiveness. The latter one is assumed to be determined by the brightness of a firefly which in turn is related to the objective function of the problem being studied. Based on the idealized assumption (c), the original light intensity of firefly is the objective function value of the optimization problem: where (x ) is the objective function of the problem being studied, and x is a vector which represents the position of the firefly . As light intensity transmitting in nature, the light intensity decreases as the distance from the light source increases. Therefore, a monotonically decreasing function can express the variation of light intensity. For a given medium with a fixed light absorption coefficient , the light intensity of firefly seen by firefly whose distance from firefly is can be where the distance between fireflies and at x and x can be defined as the Cartesian distance = ‖x − x ‖. Inspired by (2), the attractiveness also decreases as the distance from the light source increases. Since a firefly's attractiveness is proportional to the light intensity seen by other fireflies, the variation of attractiveness should be a monotonically decreasing function as well. Therefore, the attractiveness of firefly to attract firefly whose distance from firefly is can be defined by where 0 is the attractiveness; when = 0 it is commonly set to 1. Based on these, the firefly is attracted to another more attractive (brighter) firefly and its next iteration position is determined by where is the iteration number, is a random vector (e.g., the standard Gaussian random vector in which the mean value is 0 and the standard deviation is 1), and is the randomization parameter. The second term of (4) represents the attraction between the fireflies and the third term is the random movement. Equation (4) can be called the position update formula. A swarm of fireflies which contains n fireflies is generated in the preliminary stage of optimization process. A firefly whose position is a multidimensional vector containing multiple design variables corresponds to a candidate solution of optimization problem. Under the effect of attraction, new candidate solutions are chosen in the process in which fireflies update their position constantly.

Improved Firefly Algorithm (IFA)
2.2.1. Discretization of FA. The FA has proven to be an effective metaheuristic search mechanism on continuous optimization problems (Fister et al. 2013 [26]). Clearly, the standard FA cannot be applied directly to deal with size and topology optimization with discrete design variables as their positions are real numbers. There are many different techniques proposed to solve this problem, such as (1) utilizing a binary-coded technique to handle discrete variables (Datta and Figueira 2011 [30], Datta and Figueira 2013 [31]), (2) replacing the continuous variables by the closest discrete variables, (3) transforming the design variable to log 10 and carrying out the algorithm operation on log 10 , (4) representing each discrete variable by an integer in ascending order and performing the algorithm operation on the integer (Ho-Huu et al. 2015 [32]), and (5) forming a linking relationship between the integers and discrete variables as in technique (4) and carrying out the algorithm operation on the integer by a series of formulas (T. Y. Chen and H. C. Chen 2009 [33]).
In this study, the discrete variables are arranged in ascending order. Represent each discrete variable by an integer in ascending order. Perform the algorithm operation on the integer. In addition, the initial positions of fireflies and the position updating formula are discretized to avoid the appearance of noninteger.
(1) Discretization of Initial Positions of the Fireflies. Initial positions of the fireflies, which consist of continuous real variables in standard FA, demand to be discretized so that they can be composed of discrete integer variables. The modified initial position of firefly can be where is the th element of position of firefly , is the number of optimization variables, and the product round means integer conversion.
(2) Discretization of the Position Updating Formula. As the second term and third term of position update formula may be nonintegers, these terms need to be discretized to ensure the updated positions of fireflies are integers. The modified position updates formula can be The above two parts of discretization can ensure that the initial and updated positions of each firefly are discrete integer variables, and then the FA can be applied to optimization problems with discrete design variables.

Improved Strategies of IFA.
There is a drawback that the standard FA algorithm performs in a slow speed and with a high risk of falling in one of the poor local optima when solving a large solution space optimization problem. The reason is obviously that the initial individuals widely distributed in the large solution space lead to larger distances among each individual and smaller attractiveness. As a result, the moving distance of each individual is too small to find better solutions. To make up the defect which is difficult to be solved by tuning the parameters of 0 and , the IFA is proposed by adding the linear attractiveness and improving the original attractiveness.
(1) Random-Weight. In order to enhance the global exploration in the initial stage of the search process in which fireflies move in a large space, the strategy of random-weight is embedded in the proposed algorithm. The strategy of random-weight can be where max and min are upper and lower limit of randomweight , respectively, determined based on plenty of trial calculation.
(2) Improved Attractiveness. To improve the local exploration (the ability of escaping from poor local optima accurately and fast), avoid excessive pace for location updating, and lead to repeated oscillation in the last stage of the search process where the algorithm depends mainly on the local search, the attractiveness is improved as follows: where can be called basic attractiveness which is a constant value and fixed in 0.15 in this paper. 0 and are commonly set to 1 and (0.5 * * ∑ 2 ) −1/2 , respectively, where is the length of position vector of firefly, and is the range of th element of firefly.
With the strategies of random-weight and improved attractiveness, the improved position update formula is proposed: where is the number of iteration step which embeds the strategy of random-weight. In this section, the IFA is presented by discretizing the initial positions of fireflies and the position updating formula, embedding the random-weight and improving the attractiveness. This algorithm will be applied in the size and topology optimization for trusses with discrete design variables with an enhanced performance based on the Ground Structure Approach. Some essential techniques will be introduced in the next section.

Size and Topology Optimization for Trusses
The Ground Structure Approach is followed in the proposed methodology. This scheme, initially proposed by Dorn et al., starts with a universal truss containing all (or almost all) possible member connections among all nodes in the structure. Afterwards, the topology optimization procedure is applied to discard the unnecessary members. Simultaneously, the size optimization for the trusses is performed by changing the cross-sectional area of the remaining structural members. This optimization procedure seeks the minimum structural weight of the truss subject to stress and displacement constraints.
where A is a candidate solution of the optimization problem, is the cross-sectional area of the th member, is the structural weight, is the specific weight of the th member material, is the length of th member, , and max are the stress and the maximum allowable stress of the th member under th load case, respectively, , and max are the displacement and maximum allowable displacement of the node under th load case, respectively, S = ( 1 , 2 , . . . , ) is the discrete set of member cross-section, 1 → 0 means that the member is deleted, and is the number of elements of S. It should be mentioned here that A, , and are equivalent to the location of firefly, the th element of location of firefly, and the light intensity of firefly, respectively, in IFA. In the optimization process, the member's cross-section and structural topology are adjusted by changing the crosssection number of each member which represents a crosssection area arranged in the discrete set S with the order from small to large.
In this methodology, the penalty function method, one of the most common constraint handling approaches, is employed to handle the constraints. The penalty function is defined as follows: where ( ) is the th constraint of the optimization problem; is the allowable value of th constraint; ] denotes the sum of the violated constraints; is the number of constraints in the problem; is chosen considering the exploration and the exploitation rates of the search space. In this study, the parameter starts from 1 and then linearly increases to 5. Then, the objective function is defined as follows:

Variable Elastic Modulus Technique.
Researchers are apt to be confronted with singular optimums when using Ground Structure Approach to solve topology optimization problems.
The singular optimums problems are caused by replacing the section of canceled member with a smaller value for the purpose of changing the topology. They may cause great difficulties of member removal or insertion during the process of optimization. Essentially, the measure using a smaller value to replace the section of canceled member may cause its stress (which is supposed to be zero) to be greater than the allowable stress. Therefore, we can set the stress of canceled member to zero to avoid the singular optimums problems.
In the static analysis by Finite Element Method, the displacement of structure can be obtained by where [ ] is the structure global or total stiffness matrix, { } is the vector of nodal displacement, and { } is the vector of global nodal force. Then, the internal forces of the structural elements can be obtained by where { } ( ) , [ ] ( ) , [ ], and { } ( ) are the vector of internal forces, the stiffness matrix, transfer matrix, and the vector of nodal displacement of th element, respectively. From (13) and (14), there are two measures to set the axial forces of canceled members to zero in the static analysis with Finite Element Method. One is setting the displacement of nodes connected to the canceled members to be zero, and the other is setting the element stiffness matrix of the canceled members to null matrix. However, observing from (13), the displacement of nodes connected to many members including canceled ones is difficult to be set to zero in practice; this is because as long as retained members are connected, the displacement of nodes cannot be set to zero. Thereupon, from (14), the measure of variable modulus of elasticity by which the element stiffness matrix of canceled member is set to null matrix is the only feasible method to set the axial forces of canceled members to zero and avoid the singular optimum problems.

Geometric Construction Analysis.
Because structural topology is randomly generated by the IFA, the geometric construction analysis is implemented as a necessary measure to disregard the presence of unstable systems. This measure is applied by checking the positive definiteness of the global stiffness matrix of structure. After geometric construction analysis, a static analysis is performed for each structure and a large value is assigned to unstable systems to reduce unnecessary computation cost. And then, the penalty function whose value has the function of reflecting the degree of a structure in violation of the constraint is applied to the stable structures. It is notable that, in the process of geometric composition analysis, useless nodes will turn up without connected member in the structure. There is no doubt that the useless nodes should be deleted. In this paper, these nodes are treated as fixed hinge bearing to avoid causing the singular global stiffness matrix of the structure if these nodes were deleted.

Truss Size and Topology Optimization Process.
A size and topology optimization framework of trusses with discrete variables based on the IFA is put forward in this section. Its flow chart is shown in Figure 1, where means the iteration number. And the optimization will stop when the iteration number reaches the maximum number of iterations which is set artificially.

Numerical Examples
To investigate the effectiveness of the proposed IFA for size and topology optimization of trusses with discrete variables, two benchmark examples are illustrated in this section. The results are compared with the solutions of FA or other algorithms. In order to investigate the stability of the IFA which is caused by the stochastic nature of the algorithm, each example is run several times independently, and the average values and variance are presented along with the optimal results.
For structural optimization problems, the stopping condition should be set to have a relation with the search ability   [34], 2016 [35]) research, they finish the searching progress either when the absolute value of deviation of the objective function of the best individual and the whole population is less than or equal to the previously assigned value of the tolerance or when the maximum number of iterations is achieved. However, the stopping condition is set to reach the maximum iteration in this study. This is because the required iteration using these algorithms to solve the benchmark examples which have been studied by many scholars can be estimated and plenty of trial calculation has been done.

The 25-Bar Spatial Truss
Example. The size and topology optimization for a 25-bar spatial truss is examined as the first example. The topology and nodal numbering of the 25-bar spatial truss structure is shown in Figure 2 Table 1. Maximum displacement limitation of 0.899 cm is imposed on node 1 and node 2 in and directions. In this example, the structure is subject to two load cases listed in  Table 3. This example is run 60 times independently. The best solution vectors, the corresponding weights, and the required number of analyses obtained by the present and some other algorithms for the size and topology optimization of 25-bar spatial trusses are shown in Table 4. The IFA is more efficient than others for the reason that the weight of best  solution obtained by the IFA is the lightest, and the number of required analyses by the IFA is the least. Table 5 shows the statistical results of the optimum solutions for the FA and IFA which include the minimum weight (the best solution), the maximum weight (the worst solution), the probability of the best solution, the average weight, and the variance. Both the FA and IFA can find the best solution of 256.91 kg whose topology is shown in Figure 3. However, the IFA has a better performance for the reason that the IFA has a higher probability to find the best solution, and the maximum weight and the average weight    obtained by the IFA are lighter than the FA. Besides, the variance of the IFA is lower than the FA. Therefore, it is further proved that the IFA is more stable.
The convergence history of the average weight of the 60 times is shown in Figure 4. Comparison of the convergence curves above provides some useful points about the differences of the two algorithms. In the initial stage of the search process in which the fireflies move in a larger solution space, the IFA has a higher convergence rate than the FA. It proves that the IFA performs an excellent global exploration in that stage. In the last stage, the IFA performs a slighter higher convergence rate to reach the final result than FA. It should be noted that the structure found by the IFA at any iteration is much lighter than that found by the FA at the same iteration. Above performances can be interpreted as the improvement strategies improve the exploration capabilities and convergence rate of the standard algorithm.

The 72-Bar Spatial Truss Example.
The second example is the size and topology optimization for a 72-bar spatial truss. In order to investigate the function of improved attractiveness in the search process of IFA for large solution space of the size and topology optimization problem, the FA only improve attractiveness (referred to as IAFA) and the FA only with random-weight (referred to as RWFA) are applied in this example.
The topology and nodal numbering of the 72-bar spatial truss structure are illustrated in Figure 5 (10) (2)  2767.990 kg/m 3 and the modulus of elasticity is taken as 68,950 MPa. The members are subject to the stress limits of ±172.375 MPa. The nodes are subject to the displacement limits of ±0.635 cm. In this example, the structure is subject to two load cases listed in Table 6. The discrete cross-sectional areas are displayed in Table 7. The parameters of different algorithms used in this example are listed in Table 8. This example is run 100 times independently. The best solution vectors, the corresponding weights, and the required number of analyses obtained by four different algorithms for the size and topology optimization of the 72-bar spatial truss are shown in Table 9. The IFA is more efficient because the IFA obtains the best solution with the least number of analyses. Moreover, Figure 6 illustrates two typical topologies of the available solutions obtained by IFA. It should be noted that the topology in Figure 6(a) achieves the best weight. Figure 6(b) shows that the topology consists of fewer members.
All solutions of the FA, IAFA, RWFA, and IFA are shown in Figure 7, and Table 10 demonstrates the statistical results of these solutions. It should be mentioned that an available solution means the error between the obtained solution and the best solution is less than 2.0 kg. Only RWFA and IFA can find the best solution of 167.04 kg which is meaningfully lighter than that of the FA and IAFA. Moreover, all statistical results of the IFA are better than other algorithms. It is proved that the IFA has a remarkable performance in solving size and topology optimization problem of trusses with discrete variables in such a large search space. It should be noted that the variances of IFA and RWFA which obtain the strategy of random-weight are obviously reduced. It can be concluded that the strategy of random-weight has the function to enhance the stability and improve the accuracy. This effect can be reflected intuitively in Figure 7.
The convergence curves of the average weight for 100 times and the best solution are shown in Figures 8 and 9, respectively. Comparison of the average convergence curves above provides some useful information about the differences of the two algorithms. In the initial stage of the search process, the IFA has the highest convergence rate, followed by RWFA, IAFA, and FA. This explains that the strategy of random-weight owns the superior global search ability and the strategy of improved attractiveness can further increase the global search ability of algorithm if it is combined with (1) (2)   the strategy of random-weight. However, the solo strategy of improved attractiveness only performs the limited search ability for the large search space. In the last stage in which the algorithm depends mainly on the local search, the IFA performs a slighter higher convergence rate to reach the final result than RWFA. It indicates that the strategy of improved attractiveness can enhance the local exploration.
Besides, the FA and IAFA converge to unavailable solutions, which is the phenomenon of suffering the premature convergence problem. Despite the IAFA with the solo strategy of improved attractiveness which is supposed to gain a better solution, the convergence curve shows that the convergence of IAFA is worse than that of the FA. It indicates that the solo strategy of improved attractiveness cannot improve the FA and even leads to fall in an unavailable local optimal solution much earlier.

Conclusions
Based on the Firefly Algorithm, an Improved Firefly Algorithm is proposed to conduct the size and topology optimization for trusses with discrete design variables in this paper. The main conclusions are as follows: (1) By embedding the random-weight and enhancing the attractiveness, the performance of standard Firefly Algorithm is improved and thus the Improved Firefly Algorithm is proposed.
(2) Based on the Ground Structure Approach, size and topology optimization for trusses with discrete design variables is formulated using the single size variables which are capable of including topology variables. And with two essential techniques of variable elastic modulus technology and geometric construction analysis, an optimization method for the topological design of trusses based on the Improved Firefly Algorithm is proposed.   (3) The effectiveness of the IFA in size and topology optimization for trusses with discrete variables is demonstrated through the numerical examples of a 25-bar spatial truss and a 72-bar spatial truss. The solutions of these problems using IFA are compared to those obtained using different optimization algorithms. The numerical results reveal that the strategies of random-weight and improved attractiveness have a remarkable effect in improving the exploitation and exploration capabilities, accuracy, convergence rate, and stability of the algorithm. Last but not least, the remarkable performance of IFA in solving these problems also proves that IFA owns a stronger robustness.

Conflicts of Interest
The authors declare that they have no conflicts of interest.