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 randomweight 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.
Topology optimization is a rapidly expanding field of structural mechanics, which can result in greater savings than mere crosssection or shape optimization. Owing to its complexity, it is an intellectually challenging field (Rozvany and Olhoff 2001 [
The first paper on topology optimization was published over a century ago by the versatile Australian inventor Michell (1904 [
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 [
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 [
The Firefly Algorithm (FA, for short) developed recently by Yang (2009 [
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
The FA is a recent natureinspired metaheuristic algorithm developed by Yang (2009 [
(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
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
Inspired by (
Based on these, the firefly
A swarm of fireflies which contains
The FA has proven to be an effective metaheuristic search mechanism on continuous optimization problems (Fister et al. 2013 [
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.
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
With the strategies of randomweight and improved attractiveness, the improved position update formula is proposed:
In this section, the IFA is presented by discretizing the initial positions of fireflies and the position updating formula, embedding the randomweight 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.
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 crosssectional area of the remaining structural members. This optimization procedure seeks the minimum structural weight of the truss subject to stress and displacement constraints.
With the Ground Structure Approach, size and topology optimization can be transformed into size optimization, while the vector
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:
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
From (
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.
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
Flow chart of size and topology optimization of trusses with discrete variables based on the IFA.
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 of the algorithm (like the convergence of the algorithm). This is because it is not easy to determine an adequate number of maximum iterations if the reference solutions of problems are not known. In HoHuu et al.’s (2016 [
The size and topology optimization for a 25bar spatial truss is examined as the first example. The topology and nodal numbering of the 25bar spatial truss structure is shown in Figure
Allowable stress for each member.
Group  (1)  (2)  (3)  (4)  (5)  (6)  (7)  (8) 


−242.044  −79.941  −119.36  −242.044  −242.044  −46.619  −46.619  −76.437 

275.896  275.896  275.896  275.896  275.896  275.896  275.896  275.896 
Load cases of 25bar spatial truss.
Case  Node 




1  1  44.5  44.5  −22.25 
2  0  44.5  −22.25  
3  2.225  0  0  
6  2.225  0  0  


2  1  0  89.0  −22.25 
2  0  −89.0  −22.25 
Parameters for the different algorithm.
Algorithm 









FA  1.5  —  0.02  —  —  —  250  15 
IFA  1.5  0.15  0.02  0.9  1.1  50  250  15 
The 25bar spatial truss structure.
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 25bar spatial trusses are shown in Table
Optimum solutions of the 25bar spatial truss for the different algorithms.
Element group  Optimal crosssectional areas (cm^{2})  

RDQA  GATS  FA  IFA  
(Chai et al. 1999 [ 
(Luo 2006 [  
(1)  0  0  0  0 
(2)  12.671  10.839  10.839  10.839 
(3)  21.483  21.483  21.483  21.483 
(4)  0  0  0  0 
(5)  0  0  0  0 
(6)  6.452  7.742  6.452  6.452 
(7)  14.581  12.671  12.671  12.671 
(8)  14.581  14.581  14.581  14.581 
Weight (kg)  275.0  262.97  256.91  256.91 
Number of structural static analyses  —  750  1245  570 
Table
The statistical results of the optimum solutions for 25bar size and truss optimization problem.
Algorithm  Minimum  Maximum  Probability of the best solution  Average  Variance 

FA  256.91 kg  565.61 kg  93.3%  262.07 kg  1588.02 
IFA  256.91 kg  256.91 kg  100%  256.91 kg  0 
Best topology for the size and topology optimization of the 25bar spatial truss.
The convergence history of the average weight of the 60 times is shown in Figure
Convergence history of the average weight of the 60 times for the size and topology optimization problem of the 25bar spatial truss.
The second example is the size and topology optimization for a 72bar 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 randomweight (referred to as RWFA) are applied in this example.
The topology and nodal numbering of the 72bar spatial truss structure are illustrated in Figure
Load cases of 25bar spatial truss.
Node  Case 
Case 









(17)  22.25  22.25  −22.25  0.0  0.0  −22.25 
(18)  0.0  0.0  0.0  0.0  0.0  −22.25 
(19)  0.0  0.0  0.0  0.0  0.0  −22.25 
(20)  0.0  0.0  0.0  0.0  0.0  −22.25 
The available crosssection areas.
Number  mm^{2} 

(1)  71.613 
(2)  90.968 
(3)  126.451 
(4)  161.290 
(5)  198.064 
(6)  252.258 
(7)  285.161 
(8)  363.225 
(9)  388.386 
(10)  494.193 
(11)  506.451 
(12)  641.289 
(13)  645.160 
(14)  729.031 
(15)  792.256 
(16)  816.773 
(17)  939.998 
(18)  1008.385 
(19)  1045.159 
(20)  1161.288 
(21)  1283.868 
(22)  1374.191 
(23)  1535.481 
(24)  1690.319 
(25)  1696.771 
(26)  1858.061 
(27)  1890.319 
(28)  1993.544 
(29)  2180.641 
(30)  2238.705 
(31)  2290.318 
(32)  2341.931 
(33)  2477.414 
(34)  2496.769 
(35)  2503.221 
(36)  2696.769 
(37)  2722.575 
(38)  2896.768 
(39)  2961.284 
(40)  3096.768 
(41)  3206.445 
(42)  3303.219 
(43)  3703.218 
(44)  4658.055 
(45)  5141.925 
(46)  5503.215 
(47)  5999.988 
(48)  6999.986 
(49)  7419.430 
(50)  8709.660 
(51)  8967.724 
(52)  9161.272 
(53)  9999.980 
(54)  10322.560 
(55)  10903.204 
(56)  12129.008 
(57)  12838.684 
(58)  14193.520 
(59)  14774.164 
(60)  15806.420 
(61)  17096.740 
(62)  18064.480 
(63)  19354.800 
(64)  21612.860 
Parameters for the different algorithm.
Algorithm 









FA  1.5  —  0.01  —  —  —  500  35 
IAFA  1.5  0.15  0.01  —  —  —  500  35 
RWFA  1.5  —  0.01  0.8  1.2  200  500  35 
IFA  1.5  0.15  0.01  0.8  1.2  200  500  35 
The 72bar spatial truss structure.
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 72bar spatial truss are shown in Table
Optimum solutions of the 72bar spatial truss for the different algorithms.
Element group  Optimal crosssectional areas (mm^{2})  

FA  IAFA  RWFA  IFA  
(1)  2180.641  2180.641  1283.868  1283.868 
(2)  729.031  252.258  363.225  363.225 
(3)  729.031  0.000  0.000  0.000 
(4)  729.031  0.000  0.000  0.000 
(5)  494.193  792.256  792.256  792.256 
(6)  161.290  285.161  285.161  285.161 
(7)  729.031  0.000  0.000  0.000 
(8)  729.031  0.000  0.000  0.000 
(9)  729.031  729.031  363.225  363.225 
(10)  198.064  285.161  363.225  363.225 
(11)  0.000  729.031  0.000  0.000 
(12)  729.031  729.031  71.613  71.613 
(13)  71.613  90.968  126.451  126.451 
(14)  729.031  363.225  363.225  363.225 
(15)  729.031  729.031  285.161  285.161 
(16)  729.031  161.290  363.225  363.225 
Weight (kg)  197.80  220.84  167.04  167.04 
Number of analyses  12635  14875  14280  9520 
Best topology for the size and topology optimization of 72bar spatial.
All solutions of the FA, IAFA, RWFA, and IFA are shown in Figure
The statistical results of the optimum solutions for 72bar size and truss optimization problem.
Algorithm  Minimum  Maximum  Probability of available solution  Average  Variance 

FA  197.80 kg  390.12 kg  0%  273.44 kg  1499.634 
IAFA  220.84 kg  449.27 kg  0%  289.85 kg  1534.114 
RWFA  167.04 kg  237.34 kg  76%  170.26 kg  72.128 
IFA  167.04 kg  171.02 kg  95%  167.58 kg  0.507 
All solutions for the size and topology optimization of 72bar spatial truss.
The convergence curves of the average weight for 100 times and the best solution are shown in Figures
Convergence history of the average weight for the size and topology optimization of the 72bar spatial truss.
Convergence history of the best solution for the size and topology optimization of the 72bar spatial truss.
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.
As a whole, the strategies applied by the IFA have a remarkable effect in improving the exploitation and exploration capabilities, accuracy, convergence rate, and stability of the algorithm.
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:
By embedding the randomweight and enhancing the attractiveness, the performance of standard Firefly Algorithm is improved and thus the Improved Firefly Algorithm is proposed.
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.
The effectiveness of the IFA in size and topology optimization for trusses with discrete variables is demonstrated through the numerical examples of a 25bar spatial truss and a 72bar 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 randomweight 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.
The authors declare that they have no conflicts of interest.
The work has been supported by the National Natural Science Foundation of China (Grant no. 51378150 and Grant no. 51578186).