Firefly Algorithm For Structural Optimization Using Ansys: Abstract
Firefly Algorithm For Structural Optimization Using Ansys: Abstract
ANSYS
1 Introduction
In the last twenty years, optimization techniques have reached a high degree of ma-
turity and they can be used in solving any engineering problem, in the automotive,
aeronautical and manufacturing fields. Thanks to the use of the latest computerized
design software and the integration with innovative optimization techniques, it is
possible to improve the conceptual design process of any engineering system [1-4].
Among the different optimization techniques, general-purpose heuristic approaches,
called metaheuristics, have gained increasing importance in recent years. Metaheuris-
tic algorithms are approximate solution methods that, by using appropriate properties
in the search mechanism, allow to find a good enough solution in reasonable times.
These algorithms can be traced back to approximating methods that allow you to ex-
plore the entire search space starting from a randomly generated set of feasible solu-
tions. Metaheuristic optimization techniques often draw inspiration upon physical
analogies with the nature: natural selection and survival of the fittest member in a
population constitute the basis of the technique.
2
2 Firefly algorithm
Like the other metaheuristic techniques, the Firefly Algorithm uses the same ideal and
robust searching mechanism: exploration (diversification) and exploitation (intensifi-
cation) [25]. For the first, it is responsible for searching in the best solution surround-
ed areas while the latter tends to invade new searching areas. The basic idea in the
initial formulation of the method proposed by Yang in 2009 [14] is that any firefly
will be attracted to the one that produces a higher light intensity (queen firefly), and
this attraction is stronger if the mutual distance is smaller. The algorithm is based on a
physical formulation of light intensity I (Eq. 1) and on the attractiveness β (Eq. 2) that
decrease as the value of distance d increases.
1
I 0 e d
2
I 2
(1)
d
In the Eq. 1, I0 is the light intensity at the source or initial light intensity, d is the
distance between the two considered fireflies and è the light absorption coefficient
that controls the light intensity. The attractiveness β is proportional to the light inten-
sity as described in Eq. 2:
0 e d
2
(2)
where β0=1 is the attractiveness when the distance d is equal to zero. Therefore, the
light intensity I and attractiveness β are in some way synonymous.
The distance dij between two fireflies (Euclidean distance) can be defined as fol-
lows:
3
ui,k u j,k 2
n
d ij ui u j (3)
k 1
uit 1 uit 0 e
dij2
u tj uit i (4)
where =0.2 and εi is a random number in the range [-1,1]. The parameter γ has a
crucial effect on the convergence speed and it depends on the specific optimization
problem. Typically, its value ranges from 0.1 to 10 [15]. In this study, the value of γ
was assumed to be 1. The operations carried out during the execution of the Firefly
Algorithm are described below:
1) Generate initial population of feasible fireflies xi (i=1, 2, ..., n);
2) Sort the n feasible fireflies according to the increasing Objective Function
Value (OFV). Consequently, the first firefly will be assumed as the “queen
firefly” of the initial population;
3) Determine the attractiveness β for xi by using Eq. (2) and (3);
4) Update the position of fireflies by using Eq. (4);
5) Compute the OFV for the new positions;
6) Sort the feasible fireflies according to the increasing OFV and redefine the
queen firefly;
7) Iterate starting from point 3). The cycle stops when the maximum number of
iterations or the convergence condition is reached.
3 Case study
Fig. 1. (A) Cad model of the assembled reducer; (B) cad model of the composite gear housing.
Considering a composite laminate with 68% by volume of carbon fiber and 32%
epoxy resin, a density of the carbon fiber equal to 1.79 g/cm3 and a density of the
epoxy resin equal to 1.20 g/cm3, it is possible to determine an average density of the
composite equal to 1.6 g/cm3.
As shown in Fig. 1(A), four helical gears are used to transmit motion between two
parallel shafts. The reducer is driven by an electric motor with a maximum power of
10 kW and a rotation speed of 900 rpm. The motor shaft runs in the anticlockwise
direction. Table 2 shows the geometric characteristics of the helical gears.
Tapered roller bearings were used to support the shafts. The reducer shafts are
made of 39NiCrMo3 steel with yield strength σs=735 MPa and ultimate tensile
5
strength σr=930 MPa. Fig. 2 shows the linear dimensions and the axial positioning of
main components of the gearbox.
Fig. 2. Dimensions and the axial positioning of main components of the gearbox.
Constraint A Constraint B
RAX [N] RAY [N] RAZ [N] RBX [N] RBY [N] RBZ [N]
1868.4 1629.2 2003.4 0 20.1 2003.4
Constraint C Constraint D
RCX [N] RCY [N] RCZ [N] RDX [N] RDY [N] RDZ [N]
2088.2 2076.9 1400.4 0 2939.8 5878.6
Constraint E Constraint F
REX [N] REY [N] REZ [N] RFX [N] RFY [N] RFZ [N]
6
na. The cad model was constrained to the base and loaded in the same way as de-
scribed in paragraph 3.1.
Fig. 4. (A) Surface cad model; (B) Detail of the discretization realized on the model.
In particular, an input file was created in order to determine, in each node and in
each layer of the composite laminate, the failure index IF defined as (Eq. 5):
stress
IF (5)
strength
Failure is predicted when IF1. In particular, using Tsai-Wu criterion the failure
index is defined as [31]:
1
2
B B 1
IF (6)
2A 2A A
where
11
2
2 2 2 2 2
A 22 33 232 132 122
F1t F1c F2t F2c F3t F3c F4 F5 F6
(7)
22 33 11 33 11 22
c4 c5 c6
F1t F1c F3t F3c F2t F2c F3t F3c F1t F1c F2t F2c
and
1 1 1 1 1 1
B 11
22
33
(8)
F1t F1c F2t F2c F3t F3c
Five Design Variables (DV), corresponding to the different angles i of the fibers
in the composite, according to the stacking sequence provided for the laminate [1,
2, 3, 4]2s. The fifth design variable corresponds to the thickness Tk of the single
composite layer. The thickness Tk is equal to a multiple of 0.05mm, with
0.35≤Tk≤1.10 mm.
Two State Variables (SV), corresponding to the value of the Tsai-Wu failure index
IF≤1 and the allowable displacement D in the composite gear housing which must
be less than Dmax=0.6 mm.
Two different optimization analyses were conducted by defining as OFV to be
minimized the weight and, in second analysis, the value of the maximum displace-
ment of the composite gear housing. The optimization study involves the determina-
tion of a first set of feasible fireflies through the execution of random simulations. In
fact, through the definition of randomly generated design variables, the analyses allow
to explore the entire search space. Specifically, in each individual analysis, the design
variables are defined as follows:
where RAND_i (i=1,2,3,4) is a random number in the range [0,1]. Moreover, a fifth
random variable RAND_5 allows the determination of the thickness of the single
composite layer. In more detail, the thickness of the single lamina
Tk=0.35+(0.75·RAND_5), a value that will be approximated in order to consider only
multiples of 0.05mm. Consequently, there is a one-to-one correspondence between
the values of RAND_i (i=1,2,3,4,5), the angles of the fibers i and the lamina thick-
ness Tk.
In subsequent iteration cycles, an ANSYS macro allows the automatic selection of
design variables, the parametric generation of the model, the definition and the posi-
tioning of constraints, the application of loads with directions shown in Fig.3 and
magnitudes shown in Table 3. At the end of each analysis, the routine determines the
Tsai-Wu failure index IF value, the displacement D and the weight of the gear hous-
ing. These values will be stored in an array of size nm, where n corresponds to the
number of iteration cycles and m=9. In more detail:
sponds to the first firefly of the initial population, the one that is currently the bright-
est (queen firefly).
The optimization routine that implements the firefly algorithm performs the opera-
tions described in paragraph 2.
An illustrative example is given below.
Tab. 4 shows, in each row, the input values and the numerical results following a
random iteration (maximum number of iterations equal to 200). In Tab. 4 only the
first ten feasible results are shown, sorted in ascending order of the objective function
value. Consequently, the first row of the Tab. 4 is the queen firefly (F1) of these first
random iterations.
The operations carried out by the numerical optimization macro following a single
iteration cycle are now described below. In Table 5, in the cells corresponding to the
RAND_i (i=1,2,3,4,5) columns the values of (ui,k-uj,k)2 have been calculated. These
values allow to determine the distances dij of a generic firefly from the queen firefly.
The attractiveness β (Eq. 3) and ·εi were also calculated.
In Table 6, the new values of the design variables RAND_i (i=1,2,3,4,5) are ob-
tained through Eq. 4; the new objective function values are determined (column 9). It
is possible to notice (first row of Table 6) that the new input data allowed to deter-
mine a weight of the composite gear housing lower than the initial one. In this itera-
tion, moreover, each analysis returned feasible results (IF≤1; D≤Damm).
10
At the end of each optimization cycle, the macro appends the feasible fireflies to
the initial array: the following Table 7 is an array that contains the results of Table 4
and Table 6.
The sorting of Table 7 in ascending order of the objective function value deter-
mines the new "queen firefly". For the same OFV value, the routine sorts the array in
ascending order of the displacement D. Table 8 shows the array after the sorting oper-
ation.
F13 0.2113745 0.7908504 0.9311605 0.9333855 0.6553964 0.1879179 0.5043504 4592.2 4592.2
F14 0.5050720 0.2199561 0.8960996 0.6211412 0.7371969 0.1070997 0.2931701 4862.4 4862.4
F15 0.5837277 0.8068294 0.8800984 0.9012568 0.7365613 0.1715606 0.3697350 4862.4 4862.4
F16 0.3939398 0.3836990 0.3201919 0.0978441 0.8017485 0.1440747 0.2694242 5132.5 5132.5
F17 0.6003254 0.8200814 0.2676649 0.6880717 0.7758316 0.1131954 0.2850681 5132.5 5132.5
F18 0.4940119 0.9350095 0.2514682 0.6804896 0.8669809 0.0847420 0.2352612 5402.6 5402.6
F19 0.3616264 0.5822884 0.6844370 0.6283517 0.8950771 0.1118792 0.1989810 5672.8 5672.8
F20 0.4294629 0.5073019 0.2689529 0.2057177 0.9819860 0.1049778 0.1780526 5942.9 5942.9
The optimization cycle ends when the convergence condition or the maximum
number of iterations is reached. Between one optimization cycle and the others, the
software eliminates fireflies that provide OFV values greater than a specified percent-
age from the OFV value of the queen firefly. For the study, 200 independent runs of
random analyses and two optimizations cycles were started using the firefly algo-
rithm. The analyses confirm that layup has a large effect on strength and that the val-
ue of the minimum weight of the composite gear housing is equal to 3511.7 g, corre-
sponding to a value Tk=0.65 mm of the thickness of the single layer. The optimal
results obtained from the analyses are shown in Table 9.
Table 11 shows the weight of the gear housing, considering to use as material:
12
Table 11. Comparison results for gear housing realized in different materials.
Total
Density D Weight
thickness IF
[g/cm3] [mm] [g]
[mm]
Optimized CFRP laminate 1.6 10.4 0.35805561 0.54321875 3511.7
Aluminum alloy Al6061-T6 2.7 9.76 0.39409420 0.60551490 5561.3
Steel AISI 1040 7.8 6.64 0.44256365 0.60573587 10930.2
It possible to assert that the use of a composite gear housing allows a weight reduc-
tion of about 37% if compared to an aluminum alloy case and of about 49% if com-
pared to a steel case.
4 Conclusions
The firefly algorithm uses the process of attraction based on the brightness in fire-
flies to optimize an objective function. Several literature studies have shown that the
algorithm can solve a large number of optimization problems in dominant subject
areas: computer science, engineering, electrical, robotic, mathematics, energy, physics
and astronomy. In this work, the firefly algorithm was implemented in ANSYS APDL
environment in order to solve structural optimization problems. In particular, the FA
algorithm has been tested to optimize the stacking sequence of a composite gear hous-
ing used to enclose the components of a mechanical reducer. The analysis allows to
evaluate, moreover, the weight reduction when the gear housing is realized in alumi-
num alloy or steel. With the same stress level, the weight reduction can be even close
to 50% in the case of gear housing realized in steel.
The numerical results confirm that the implementation of the firefly algorithm in
ANSYS environment allowed to determine a good enough solution in reasonable
times. In conclusion, FA proved to be an interesting alternative method for solving
complex optimization problems. Moreover, the implementation in an ANSYS envi-
ronment of the presented code has a perspective of extending to optimization of large
scale structures, considering linear or nonlinear effects.
References
1. Ingrassia, T., Nigrelli, V.: Design optimization and analysis of a new rear underrun protec-
tive device for truck. In: Proceedings of the 8th International Symposium on Tools and
Methods of Competitive Engineering, TMCE 2010, vol. 2, pp. 713-725 (2010).
13
2. Giallanza, A., Marannano, G., Pasta, A.: Structural optimization of innovative rudder for
HSC. In: NAV International Conference on Ship and Shipping Research, (2012).
3. Marannano, G., Pasta, A., Parrinello, F., Giallanza, A.: Effect of the indentation process on
fatigue life of drilled specimens. Journal of Mechanical Science and Technology 29(7),
2847-2856 (2015).
4. Marannano, G., Parrinello, F., Giallanza, A.: Effects of the indentation process on fatigue
life of drilled specimens: Optimization of the distance between adjacent holes. Journal of
Mechanical Science and Technology 30(3), 1119-1127 (2016).
5. S. Kirkpatrick, S., Gelatt Jr., C.D., Vecchi, M.P.: Optimization by Simulated Annealing.
Science 220(4598), 671-680 (1983).
6. Grossberg, S.: Nonlinear neural networks: Principles, mechanisms, and architectures. Neu-
ral networks 1(1), 17–61 (1988).
7. Holland, J.H.: Adaptation in natural and artificial systems: An introductory analysis with
applications to biology, control, and artificial intelligence University of Michigan Press
(1975).
8. Shi, Y., Eberhart, R.C. Parameter selection in particle swarm optimization. In: Evolution-
ary programming VII, pp. 591–600. Springer, Berlin (1998).
9. Shi, Y., Eberhart, R.C. Empirical study of particle swarm optimization. In: Proceedings of
the 1999 IEEE congress on evolutionary computation, pp. 1945–1950. IEEE, Washington
(1983).
10. Dorigo, M., Birattari, M., Stützle, T.: Ant colony optimization. IEEE Computational Intel-
ligence Magazine 1(4), 28–39 (2006).
11. Gao, W.F., Liu, S.Y.: A modified artificial bee colony algorithm. Computers & Operations
Research 39(3), 687–697 (2012).
12. Biswas, A., Dasgupta, S., Das, S., Abraham, A.: Synergy of PSO and bacterial foraging
optimization - A comparative study on numerical benchmarks. In: Innovations in hybrid
intelligent systems (pp. 255–263). Springer, Berlin Heidelberg (2007).
13. Bhandari, A.K., Singh, V.K., Kumar, A., Singh, G.K. Cuckoo search algorithm and wind
driven optimization based study of satellite image segmentation for multilevel thresholding
using Kapur’s entropy. Expert Systems with Applications 41(7), 3538–3560 (2014).
14. Yang, X.S.: Firefly algorithms for multimodal optimization. In: Stochastic algorithms:
Foundations and applications (pp. 169–178). Springer, Berlin Heidelberg (2009).
15. Yang, X.S.: Firefly algorithm, stochastic test functions and design optimisation. Interna-
tional Journal of Bio-Inspired Computation 2(2), 78–84 (2010).
16. La Scalia, G., Micale, R., Giallanza, A., Marannano, G.: Firefly algorithm based upon slic-
ing structure encoding for unequal facility layout problem. International Journal of Indus-
trial Engineering Computations 10, 349–360 (2019).
17. Micale, R., Marannano, G., Giallanza, A., Miglietta, P.P., Agnusdei, G.P., La Scalia, G.:
Sustainable vehicle routing based on firefly algorithm and TOPSIS methodology. Sustain-
able Futures 1, 100001 (2019).
18. Elbeltagi, E., Hegazy, T., Grierson, D.: A modified shuffled frog-leaping optimization al-
gorithm: Applications to project management. Structure and Infrastructure Engineering
3(1), 53–60 (2007).
19. Gandomi, A.H., Yang, X.S., Alavi, A.H., Talatahari, S.: Bat algorithm for constrained op-
timization tasks. Neural Computing and Applications 22 (6), 1239–1255 (2013).
20. Yang, X.S. Flower pollination algorithm for global optimization. In: Unconventional com-
putation and natural computation (pp. 240–249). Springer, Berlin Heidelberg (2012).
21. Bekdas, G., Nigdeli, S.M., Yang, X.S.: Sizing optimization of truss structures using flower
pollination algorithm. Applied Soft Computing 37, 322–331 (2015).
14
22. Cui, Z., Yang, H., Shi, Z.: Using artificial plant optimization algorithm to solve coverage
problem in WSN. Sensor Letters 10(8), 1666–1675 (2012).
23. Cui, Z., Cai, X.: Artificial plant optimization algorithm. In Swarm intelligence and bio-
inspired computation: Theory and applications (pp. 351–365) (2013).
24. He, S., Wu, Q.H., Saunders, J.R. A Novel Group Search Optimizer Inspired by Animal
Behavioural Ecology. 2006 IEEE Congress on Evolutionary Computation, CEC 2006.
Vancouver (2006).
25. Abdel-Basset, M., Abdel-Fatah, L., Sangaiah, A.K.: Chapter 10 - Metaheuristic Algo-
rithms: A Comprehensive Review. Intelligent Data-Centric Systems, Computational Intel-
ligence for Multimedia Big Data on the Cloud with Engineering Applications, pp. 185–
231. Editor(s): Arun Kumar Sangaiah, Michael Sheng, Zhiyong Zhang (2018).
26. Technical data sheet of CYCOM® 5320-1 Prepreg, https://www.solvay.com, 2020.
27. Ingrassia, T., Nigrelli, V., Ricotta, V., Tartamella, C.: Process parameters influence in ad-
ditive manufacturing. Lecture Notes in Mechanical Engineering, pp. 261-270 (2017).
28. Baron Saiz, C., Ingrassia, T., Nigrelli, V., Ricotta, V.: Thermal stress analysis of different
full and ventilated disc brakes, Frattura ed Integrita Strutturale 9(34), pp. 608-621 (2015).
29. Ingrassia, T., Nalbone, L., Nigrelli, V., Pisciotta, D., Ricotta, V.: Influence of the metaphy-
sis positioning in a new reverse shoulder prosthesis. Lecture Notes in Mechanical Engi-
neering, pp. 469-478 (2017).
30. Marannano, G., Pasta, A., Giallanza, A.: A model for predicting the mixed-mode fatigue
crack growth in a bonded joint. Fatigue and Fracture of Engineering Materials and Struc-
tures 37(4), (pp. 380–390) (2014).
31. Barbero E.J.: Finite Element Analysis of Composite Materials Using ANSYS®. 2nd edn.
CRC Press (2014).