# A Facility Layout Algorithm for Logistics Scenarios Driven by Transport Lines
## 3 Force-Directed Logistics Layout Algorithm
### Force-Directed Algorithm  
For a realistic industrial logistics scenario, the working facilities and the transport line in the workshop can be regarded as nodes and springs in the spring system, where other facilities and the workshop boundary have a repulsive effect on the working facilities and where the transport line has a attractive effect on the facilities connected at both ends. The solution contains the information of the center coordinates of all working facilities, the position of the nodes in the spring system is established based on the actual center coordinates of the facilities, and the attractive and repulsive forces within the system are employed to pull the facilities into the reasonable area of the workshop in order to optimize the current solution scheme. The coordinate information of the node is derived from the current solution, and its coordinate position affects the effect of the force in the spring system. With a directional weighted graph \(G=(V,E)\), the set of nodes is \(V\), and the set of directional weighted edges is \(E\). The length of the workshop is \(L\), and the width is \(W\). The natural length of the spring is \(d_{0}\); the repulsive and attractive elasticity coefficients are \(k_{r}\) and \(k_{t}\), respectively; and the coordinates of node \(i\) in the force-directed model are \((x_{i},y_{i})\). Assuming that nodes \(a\) and \(b\) belong to the set \(V\), \(dist(a,b)\) denotes the Euclidean distance between two nodes in a two-dimensional plane coordinate system, \(dist_{x}(a,b)\) denotes the difference in distance between node \(a\) and node \(b\) in the x-axis direction, and \(dist_{y}(a,b)\) denotes the difference in distance between node \(a\) and node \(b\) in the y-axis direction. Node \(a\) in the spring system generates repulsive forces to other nodes. In a realistic logistics scenario, facilities possess size characteristics in relation to nodes; the larger the floor area of a facility in a workshop, the more likely it is to violate the facility non-overlapping constraint, and the greater the repulsive force on other facilities should be. Therefore, when calculating the repulsive force exerted by node \(b\) on node \(a\), the length \(l_{b}\) and width \(w_{b}\) of the corresponding facilities of node \(b\) are considered. To ensure that the placement of facilities within the workshop adheres to the boundary constraint, it is necessary to consider the repulsive force exerted by the workshop boundary on node \(a\). Equations (16) and (17) represent the horizontal and vertical repulsive forces on node \(a\) in the system, where \(\alpha\) and \(\beta\) are the weight coefficients of the combined forces of other facilities and the boundary repulsive forces, respectively, which are calculated in a way improved by Coulomb's law. \[fr_{x}(a) = \alpha\sum_{b\in V}\frac{dist_{x}(a,b)}{dist(a,b)}\frac{k_{r}l_{b }w_{b}}{dist(a,b)^{2}}+\beta(\frac{k_{r}}{x_{a}{}^{2}}-\frac{k_{r}}{(L-x_{a} )^{2}}) \tag{16}\] \[fr_{y}(a) = \alpha\sum_{b\in V}\frac{dist_{y}(a,b)}{dist(a,b)}\frac{k_{r}l_{ b}w_{b}}{dist(a,b)^{2}}+\beta(\frac{k_{r}}{y_{a}{}^{2}}-\frac{k_{r}}{(W-y_{a} )^{2}}) \tag{17}\]  
The spring system exerts an attractive force on the two end nodes towards the transportation line. In a realistic logistics scenario, different facilities have different efficiencies in handling materials, resulting in different transportation costs per unit distance \(c_{ab}\) between different nodes \(a\) and \(b\). Therefore, the spring in the system adjusts the attractive effect on the nodes at both ends according to the cost weight \(c_{ab}\), and the spring with a larger weight factor has a higher attractive force on the nodes, and the material handling cost between facilities is lower. Assuming that nodes \(a\) and \(b\) are two points located along the same transport line, Equations (18) and (19) represent the horizontal and vertical attraction forces on node \(a\) in the system, which are calculated in a way that improves on [PERSON]'s law.