## 3 Optimization Method
### Encoding and Decoding  
The encoding and decoding scheme is the first and most important step to solving the optimization problem [30]. In this paper, the bat position, \(x_{i,t}=[x_{LevelOne,i,t},x_{LevelTwo,i,t}]\), contains both the information of the cable connection layout of the wind farm (\(x_{LevelOne,i,t}\in[1,2,\ \ldots,W]\)) and the  
Figure 1: The flow chart of the bat algorithm (BA). OWFCCLP: offshore wind farm cable connection layout problem. available cable sectional areas (\(x_{LevelTwo,i,t}[1,2,\ldots,H]\)), where W is equal to \(M\) + \(K\)-1 and \(H\) equal to \(M\) + \(N\)-2 respectively. To illustrate the encoding process, an example is shown below. In this example, it is assumed that there are 6 WTs in total which can be connected by a maximum of 4 feeder lines. There are 5 different types of cables in store and \(W\) = 9, \(H\) = 10. Assuming the first generation of bat positions,\(x_{1,1}\) = \([x_{LevelOne,1,1},\)\(x_{LevelTwo,1,1}]\); then, the encoding of bats could be \(x_{LevelOne,1,1}\) = [2,5,3,1,7,6,4,8,9], \(x_{LevelTwo,1,1}\) = [1,7,6,2,5,8,4,9,3,10]. Then, the decoding process of the example is shown in the following:  
1. In \(x_{LevelOne,1,1}\), 1 to 6 represent the sequence number of WTs while 7 to 9 show the separators, which are illustrated in Figure 2.  
In Figure 2, \(x_{LevelOne,1,1}\) is divided into 4 sections by the separators, which shows that 6 WTs are unevenly arranged into each feeder line. WT \([2,5,3,1]\) belong to feeder line one while WT \([6,4]\), \(\phi\), and \(\phi\) belong to feeder line 2 to 4, respectively. \(\phi\) means the null set: in other words, we do not need feeder line 3 and 4 in this design. In this work, zero indicates the OS. One possible cable connection layout--(0,2), (2,5), (5,3), (3,1), (0,6), and (6,4)--is shown in Figure 3.  
According to the cable's current carrying limitation, the thinnest cable sectional area (type) will be selected in the first layer. As shown in Figure 3, the selected cable types are 3, 2, 2, 1, 2, and 1, respectively, in this example. Therefore, the cable connection layout based on the minimum cable type selection criterion is decided. 1. Decoding \(x_{LevelTwo,1,1}\) based on the \(x_{LevelOne,1,1}\). In \(x_{LevelTwo,1,1}\), 1 to 6 represent the output cables connected to WT 1 to 6 while 7 to 10 represent the separators, as shown in Figure 4.  
As can be seen in Figure 4, \(x_{LevelTwo,1,1}\) was divided into 5 sections by the separators. The number of the separator is decided according to the available number of cable types. By doing so, the 6 WTs  
Figure 4: The diagram of bat positions in the second layer. Figure 3: The cable connection layout via the minimum cable type selection criterion. Figure 2: The diagram of the bat position at the first layer. were divided into 5 groups: that is, \(\{(3,1)\}\), \(\{(0,6),\ (0,2),\ (2,5)\}\), \(\{(6,4)\}\), \(\{(5,3)\}\), and \(\phi\). The cables in the same group will be updated by the randomly generated number in this layer, which is called the cable type incremental number (CTIN) in this work. In order to update the cable type for each branch, the numbers in this layer represent the increased value compared to the cable type selected in the first layer. For instance, if the previous cable type is 1 and the number in this layer is 4, then the final selected cable type is 5. In Figure 5, it can be seen that the cable connection layout is the same as in Figure 3. However, the cable type of branch (3,1), (0,2), (5,3), (6,4), (2,5), and (0,6) has been changed from 1, 3, 2, 1, 2, 2 into 1, 4, 5, 3, 3, 3. Besides this, the practical feeder line used in the cable connection layout is usually limited by the substation transformer. It is assumed that the maximum number of feeder lines is no more than \(K\). In this case, as long as \(K\) is big enough, there is no need to specify the number of feeder lines, and BA can converge and obtain a better cable connection layout.