# Structural Topology Design Optimization Using the Binary Bat Algorithm
## 4 Topology Optimization Based on the BBA  
The design domain of the two-dimensional continuous structure is discretized into small and square elements in the finite element model (FEM), where each element represents either a material or a void. The binary string or bit-array is used to store the design information. In the string, the code \"0\" refers to a void element, while the code \"1\" represents a solid element in FEM. In this study, the stiffness of the void element is considered \(k_{void}=10^{-9}k_{solid}\) instead of zero stiffness to avoid the singularity of the global stiffness matrix in FEM. The decoding step of the binary string into a two-dimensional design domain (topology design) is simple, as shown in Figure 1. In particular, for a \(5\times 5\) design problem, a binary string of 25 bits is generated (Figure 1a). Then, a \(5\times 5\) matrix is organized as follows: the first five bits construct the first row, the bits from 6 to 10 contract the second row, and so on (Figure 1b). Finally, the code \"0\" is replaced by a void element, while the code \"1\" is replaced by a solid element (Figure 1c). If a matrix has \(m\) rows and \(n\) columns, the mathematical expression to map a string into a matrix is as follows:  
\[k=0,\;1,\;\ldots,\;n.m-1 \tag{19}\]  
\[i=k\;\mathbf{div}\;n \tag{20}\]  
\[j=k\;\mathbf{mod}\;n \tag{21}\]  
\[i=0,\;1,\ldots,\;m-1\;\text{and}\;j=0,\;1,\;\ldots,\;n-1 \tag{22}\]where \(k\) represents the location of the element in the binary string, _div_ is the integer division operation, and _mod_ is modulo division operation. During the optimization process, the BBA generates binary strings (designs) to be evaluated. These designs are mapped to the topology designs as described in the previous paragraph. Then, FE analyses are carried out to calculate each design's compliance to find the associated penalty function value (Equation (8)). The current iteration penalty function values are used to find the best design of the current iteration and to generate the next iteration designs (as briefly described in Section 3). This presentation method does not prevent the formation of the following issues ([PERSON] and Tai [4]):  
1. Disconnected structures. This happens when one or a group of solid elements are surrounded by voids elements. 2. Checkerboard patterns. It occurs when one or more solid elements are not adjacent to any other solid elements, but they are connected to other solid elements by their corners. For example, as shown in Figure 1c, the element in the first row and the second column are connected to the element in the second row and first column by their corners, but both are not adjacent to other solid elements. 3. Many scattered void elements. These types of elements prevent the optimization algorithm from converging to good designs; moreover, such configurations would be difficult to manufacture. Figure 2a shows the first design example topology at iteration 1000. Here, there are too many scattered void elements. This issue, which was observed in fine finite element meshes, is addressed and solved in this study. 4. Solid elements that share one edge with the continuous structure (see Figure 2a). It was observed that these types of elements will eventually be eliminated because they do not reduce the compliance while increasing the volume. This issue is addressed and solved in this study. Figure 1: Example of mapping topology optimization into a string. (**a**) Sting of the bit-array, (**b**) bit-array representation, and (**c**) topology design. Figure 2: (**a**) Scattered void elements and one edge elements issues (iteration 1000). (**b**) Topology design after using the proposed filtering algorithm (iteration 1000). Design connectivity must be handled properly in the structural topology design to ensure the success of the BBA. A connected structure is referred to as a group of solid elements, each of which shares at least two edges with its neighboring elements with the exception of support and load elements that can share one edge with neighboring elements.