3.1.1. Emergency Logistics Cellular Spatial Model Based on Neighborhood Topology Algorithm
Spatial cellular is one of the core models of intelligent GIS (Geographic Information Systems), and is used to simulate spatial neighborhood relationships and topological laws. In the emergency logistics geographic space, we construct the spatial relationship between the distribution centers, the delivery points, and the urban roads using spatial cellulars, and use it to construct the emergency logistics cellular space.
Definition 1. Distribution center  and delivery point . The geographic spatial location of the large warehouse for centralized storage of the emergency supplies in a city is defined as the distribution center, denoted as . If the city includes  number of distribution centers, then there are . When urban emergency events occur, the main gathering point for residents in need of material assistance is defined as the delivery point, denoted as . If the city includes  number of delivery points, then there are .
 Definition 2. Road node  and local space  of road node. The intersection point of two or more roads in a city is defined as a road node, denoted as . If the number of road nodes relating to the cellular space construction extracted from the city is set to , then there are . The total  number of road nodes constitutes the basic architecture of the entire urban cellular space. We select several road nodes  within the collection  in the neighborhood range of  and , with the distribution center  and delivery point  as the centers, respectively. If the neighborhood of  contains  number of road nodes , and the neighborhood of  contains  number of road nodes , then the neighborhood space composed of  and  number of road nodes  is defined as the local space  of road nodes for the distribution center , denoted as . The neighborhood space composed of  and  number of road nodes  is defined as the local space  of road nodes for delivery point , denoted as . Figure 2 shows the process of determining the local space  of distribution center  and delivery point  from the urban road node space . Figure 2a shows the positioning of the distribution center  and the delivery point . Figure 2b shows the set of road nodes. Figure 2c shows the spatial relationship between the distribution center, the delivery point, and the set of road nodes. Figure 2d shows the constructed local space  of the distribution center  and local space  of the delivery point .  Definition 3. The spatial cellular , the cellular control point , and the cellular boundary . The mathematical term “spatial cellular” originates from the concept of cellular automata in geographic information technology. It is used to describe the microscopic spatial structure that contains certain geographic entities. It divides the global geographic space in an orderly manner according to certain rules, realizing the quantification and regularization of the geographic space. According to the mathematical term, the closed micro-space containing the distribution center  or the delivery point  generated by searching for road nodes  in local space  is defined as a spatial cellular, denoted as , in which the cellular containing distribution center  is denoted as , and the cellular containing delivery point  is denoted as . Define the road node  that makes up the spatial cellular  as the cellular control point, denoted as , , . In the process of constructing a cellular model, the road connecting the adjacent control points  and  is defined as the cellular boundary, denoted as . According to the  number of control points , the corresponding number of cell boundaries  is ; that is, for the presence of , there is , .
 According to the definition, there are the following constraint relationships between the spatial cellulars, the control points and the cell boundaries:
(1) The number of the control points  meets  or , ;
(2) Point  or  does not intersect with any boundary ;
(3) There is only one nucleus  or  within the cellular;
(4) Send ray  in any direction from the point  or  outward, and the number of the intersection point between  and the cellular boundary  must be odd;
(5) The area  of the cellular region composed of control points  must be the minimum value ;
(6) The cellular  must be a convex polygon.
Definition 4. The cellular searching coordinate system , the cellular searching azimuth , and the closed micro-space searching area . The coordinate system  constructed by the cellular center point  or  as the coordinate origin is defined as the cellular searching coordinate system, which is used to search and determine the cellular control point  and the cellular boundary . Starting from the coordinate axis , rotate the direction line  clockwise according to the angular velocity . When a node  is searched, the angle between the direction line  and the coordinate axis  is defined as the cellular searching azimuth . Searching for the nodes , , …, , and the coordinate origin , the nodes , , …,  form a closed area, whose square measure is defined as the closed micro-space searching area, denoted as . To ensure that the cellular  is a convex polygon, it is determined that during the searching process, when , the  must be a convex polygon.
 Here we prove that the constructed cellular must be constrained by the convex polygon:
(1) The spatial cellular constructs the attribution relationship between the distribution center  or delivery point  with the surrounding roads and road nodes, and the road nodes close to the center point should be included in the cellular scope;
(2) Hypothesis 
: Allow a cellular to be a concave polygon, as shown in 
Figure 3a. The spatial layout contains both the convex polygon 
 and the concave polygon 
. 
Figure 3b shows the spatial relationship between the convex polygon 
 and the concave polygon 
 with the distribution center 
, distribution center 
, and delivery point 
, which is determined by the spatial cellular algorithm;
(3) Conclusion I: Judging from 
Figure 3b, there are three attribution relationships: 
, 
, 
. According to the definition, delivery point 
 belongs to the cellular 
, thus, it is closer to 
 in the spatial relationship;
(4) Conclusion II: According to the spatial accessibility calculation model, it can be concluded that the straight-line distances between points satisfy ; thus, delivery point  is closer to  in the spatial relationship;
(5) The above inference results indicate that there is a contradiction between Conclusion I and Conclusion II; therefore, hypothesis 
 is not valid. It proves that the constructed cellular must be constrained by the convex polygon. The correct cellular structure is shown in 
Figure 3c, and both cellular 
 and 
 are convex polygons.
Definition 5. Empty cellular . Use the spatial cellular searching algorithm to obtain  number of cellulars; if the  number of cellulars cannot occupy all the urban space, then a cellular  surrounded by the adjacent control points of a non-closed cellular that does not contain any point  or  is defined as an empty cellular, denoted as . Set the number of empty cellulars as . Empty cellulars play a role in filling space in the quantification and regularization process of the urban geographic space. When the cellulars containing distribution centers or delivery points cannot be fully connected by road edges, or when the cellulars extend to the city boundary, the research scope cannot be fully covered; the empty cellulars will be used to fill the areas without distribution centers or delivery points, as well as the areas which are not covered by the city boundary. The empty cellulars ensure that the entire research scope of the city is covered by cellulars.
 According to the definition, we construct an emergency logistics cellular space model based on the neighborhood topology algorithm.
Step 1: For the sample urban space, determine the main roads and  number of road nodes  of the city, and encode the main road nodes, . The urban spatial node set satisfies .
Step 2: Determine the  number of distribution centers  and  number of delivery points  of the sample city. Take the arbitrary point  or  as a sample, then determine the local space  of the sample point using the sets  or , and store the included nodes  of  in the Open List.
Step 3: Take the local space 
 of the distribution center 
 as an example: 
, as shown in 
Figure 4a. Build the cellular 
 where the distribution center 
 is located.
(1) Establish a coordinate system 
 as shown in 
Figure 4b;
(2) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4c. Determine that the 
 is feasible, store 
 in the Closed List of the cellular 
, and delete it from the Open List;
(3) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4d. Determine that the 
 is feasible, and 
 is a feasible closed area. Store 
 in the Closed List of 
 and delete it from the Open List;
(4) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4e. Determine that 
 is feasible, and 
 is a feasible closed area. Continue to determine 
, delete 
 from the Closed List, and retain 
. Store 
 in the Closed List of 
, and delete it from the Open List;
(5) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4f. Judge that 
 is a concave quadrilateral, meaning it is not feasible. Abandon 
, and continue searching;
(6) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4g. Judge that 
 is feasible, and 
 is a feasible closed area. Store 
 in the Closed List of 
 and delete it from the Open List;
(7) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4h. Judge that 
 is feasible, and 
 is a feasible closed area. Then, continue to determine the 
, delete 
 from the Closed List, and retain 
. Store 
 in the Closed List of 
, and delete it from the Open List;
(8) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4i. Judge that 
 and 
 are feasible, and 
 is a feasible closed area. Then, continue to determine the 
. Store 
 in the Closed List of 
, and delete it from the Open List;
(9) The direction line 
 searches at the angular velocity 
, and 
 is found at the azimuth angle 
, as shown in 
Figure 4j. Judge that 
 and 
 are feasible, and 
 is a feasible closed area. Then, continue to determine the 
. Store 
 in the Closed List of 
, and delete it from the Open List;
(10) The direction line  searches at the angular velocity , and when the  is found,  satisfies all the constraints of . It is feasible. Preserve the closed area  as the spatial cellular  of . At this time, the cellular contains the following:
① Cellular core: ;
② Cellular control points: {:|:|:|:|:};
③ Cell boundary: {:|:|:|:|:};
④ Cellular region: .
Step 4: Construct the spatial cellulars for  number of distribution centers and  number of delivery points in the urban space by using the same searching algorithm as in Step 3. After the searching is completed, there are  number of cellular  and  number of cellular  in the urban space. The cellular spatial region  satisfies Formula (1).
Step 5: When there is , search for the nearest control nodes  between the neighborhood cellular  and . Sequentially search and connect them to construct the empty cellular . Then, the cellular ,  and the empty cellular  satisfy Formula (2).
Step 6: Search the whole urban space till  meets Formula (2). When the searching ends, output the cellular space.
  3.1.2. Improved AGNES Clustering Algorithm Based on Cellular Space Model
The cellular space model constructs the spatial adjacency relationship between the distribution centers  and the delivery points , which includes the relationship with road nodes  and road boundaries . In the event of an emergency situation, determining the optimal distribution center  with the optimal spatial adjacency relationship is crucial for the points  that require material allocation, which can ensure the rapid delivery of materials to the designated locations . Based on the constructed cellular space model, the key issue is to determine the spatial neighborhood relationship between the distribution center cellular  and the delivery point cellular  in the cellular space. We use the decision tree algorithm to search for the spatially nearest neighborhood relationship and construct an improved AGNES clustering algorithm to determine the clustering relationship between the distribution centers  and the delivery points .
Definition 6. The clustering target cellular , the number  of clustering target cellular, and the clustering target path . Starting from arbitrary delivery point cellular , search towards the direction of arbitrary distribution center cellular , and sequentially search for the adjacent cellular  and  of the cellular  through the common edges  until the adjacent cellular to the distribution center cellular  is found. The connection path formed by the cellulars along the way during the searching process is defined as the clustering target path, denoted as . The adjacent cellular  and  on the clustering target path  are uniformly defined as the clustering target cellulars, denoted as . Due to the complex adjacent relationship among cellulars in the cellular space, there may be  number of paths  from the delivery point cellular  to the distribution center cellular . Therefore, the number of clustering target cellulars found on a path  is defined as , , . According to the definition, the clustering target cellular  on a path satisfies , . The clustering target cellular, the number of clustering target cellulars, and the clustering target path all describe the neighborhood relationship between the delivery point and the distribution center from the perspective of the cellular relationship that constitutes the spatial micro-structure. By determining the optimal target path and its corresponding target cellular number, the nearest path between the delivery point and the distribution center can be obtained, providing a data basis for constructing the clustering algorithm and the logistics route algorithm.
 Figure 5 is the schematic diagram of generating the clustering target paths 
 based on the distribution center 
, the delivery point 
, and the neighborhood cellular subspace. 
Figure 5a shows the spatial layout of the distribution center, the delivery point, and the road nodes. 
Figure 5b shows the generated distribution center cellular 
, the delivery point cellular 
, and the neighborhood cellular 
. 
Figure 5c shows the generated cellular spatial sub-area. 
Figure 5d shows the potential cellulars with the codes that form the clustering target paths 
 between the distribution center 
 and the delivery point 
. 
Figure 5e–h shows the four clustering target paths 
 for the 
 number of clustering target cellulars. 
Figure 5i–l shows the four clustering target paths 
 for the 
 number of clustering target cellulars.
 Definition 7. The clustering target adjacency index , the clustering target constraint factor , and the clustering objective function . Using arbitrary path  as the object, define the clustering target adjacency index as the reciprocal of the sum of the number  of clustering target cellulars on the path  and the zero-suppression value 1, denoted as , as shown in Formula (3). In the geographic spatial constraints, if the coordinates of the distribution center  are  and the coordinates of the delivery point  are , then the spatial accessibility constructed by Formula (4) is defined as the clustering target constraint factor, denoted as , in which  is the normalization factor. For the definition,  and  satisfy , , . The weighted mean of index  and factor  is defined as the clustering objective function, as shown in Formula (5), in which the index  takes the maximum value of the index  corresponding to the path  with the minimum number  of clustering target cellulars.
 The clustering target adjacency index quantifies the close relationship between the distribution center and the delivery point by using the micro spatial structure of adjacent cellulars between the two points. The index value is determined by the number of adjacent cellulars. The clustering target constraint factor calculates the straight-line distance between the distribution center and the delivery point from the perspective of geographic accessibility, determining the close relationship between the two points. The clustering target adjacency index and the clustering target constraint factor are the data basis for constructing the spatial clustering relationship model between distribution centers and delivery points. The clustering objective function constructed by the two values is the key constraint condition for determining whether a delivery point belongs to the cluster in which the distribution center is located.
Definition 8. AGNES clustering decision tree . Search for the clustering objective functions  between the specified delivery point  and the  number of distribution centers  in the cellular space, and store  number of function values  in an orderly manner in the tree structure according to the rules of the complete binary tree algorithm. The constructed complete binary tree is defined as the AGNES clustering decision tree, denoted as . The code  of the tree  corresponds to the code of the delivery point , that is, one delivery point  corresponds to the construction of one decision tree . A complete binary tree is a computationally efficient tree structure that consists of a parent node and several child nodes, with all levels (except for the last level) fully filled and the nodes of the last level arranged as far to the left side as possible. When integrating the heap sorting algorithm, the global optimal solution can be finally classified into the parent node according to the binary tree searching algorithm. The process of obtaining the optimal solution is simple and efficient.
 The tree node is defined as , in which  represents the layer of the tree and  represents the No.  child node of the No.  layer. Then the constructed decision tree  satisfies the following conditions:
(1) Arbitrary node  can have a maximum of two child nodes  and a minimum of 0 child nodes;
(2) Arbitrary row  of the  contains  number of child nodes, ~ must be stored in the previous  number of nodes, and then there is the following:
① The number of nodes that store  meets the requirement ,  representing the maximum row that can be stored currently;
② For any node  that stores , its left node  must meet ;
③ For any node  that stores , its right node  satisfies the following:
(i) If the last  is currently stored in , the right node  does not exist;
(ii) If the current node  is not the last , the right node continues to store, satisfying the condition .
④ If row  contains child nodes that store , then all nodes in the previous  rows satisfy the condition .
(3) For any node :  stores  The child nodes . and  store  and ; there must be .
Definition 9. AGNES clustering matrix . Construct a  dimensional matrix to store the delivery points  output by the clustering algorithm. Define this matrix as the AGNES clustering matrix, denoted as , in which  represents the number of rows and  represents the number of columns in the matrix, . To construct the AGNES clustering algorithm, we specify that the matrix  satisfies the following constraints:
 (1) Any row  corresponds to storing one cluster , with each distribution center  being the cluster center. Store it in the first element of the No.  matrix row.
(2) The number  of rows in the matrix is equal to the number of clusters, then there is the following:  corresponds to , , .
(3) The rows and columns of the matrix are full ranked, that is, , .
(4) For row , the No. 2 to No.  elements store the delivery points  of cluster . The number  of elements in the cluster  satisfies , .
Based on the above definitions, we construct an improved AGNES clustering algorithm based on the cellular space model as follows. 
Figure 6 shows the process of searching the AGNES clustering decision tree 
 by using the algorithm.
Step 1: Construct a  dimensional matrix . For the delivery point , take . Take the distribution center  in the cellular space :
(1) Take , search for all clustering target paths  and corresponding clustering target cellular number  between  and , and calculate the clustering target adjacency index ;
(2) Search for coordinates  of  and coordinates  of , and calculate the clustering target constraint factor ;
(3) Calculate the clustering objective function ;
(4) Repeat steps (1) to (3), take  and calculate ;
(5) The  traverses  and calculate . All  are recorded as , in which  represents the No.  distribution center , and number (1) represents .
Step 2: Construct a complete binary tree  with a total  number of nodes, corresponding to the delivery point , and denote the tree node as . Store  in the parent node . Take  and judge:
(1) If , store  in child node ;
(2) If , delete , store  in , store  in child node .
Step 3: Take  and judge:
(1) If :
① If , store  in child node ;
② If , delete , store  in , store  in child node ;
③ If , delete  and , store ,  and  in ,  and .
(2) If :
① If , store  in child node ;
② If , delete , store  in , store  in child node ;
③ If , delete  and , store ,  and  in ,  and .
Step 4: Take , traverse . Compare the , , …,  by the same algorithm in Steps 2 to 3. According to the constraint conditions of the decision tree, store the , , …,  to the previous  number of nodes in the tree . When ,  has been completely searched and output .
Step 5: Take the stored  in parent node , and its corresponding distribution center  is the optimal distribution center for the entire tree .
Step 6: Search for the row  corresponding to the distribution center  in the matrix , and store the delivery point  to the second element in the No.  row.
Step 7: Return to Step 1; for the delivery point , take . Build a complete binary tree  of the delivery point , search and output the optimal distribution center  corresponding to the parent node . Store the delivery point  to the No.  element in No.  row. At this time, the elements of No. 1 to No.  of the No.  row are all non-zero ones.
Step 8: Traverse the code  of the delivery points , . Construct a complete binary tree  of the delivery points  in sequence. For each tree, search and output the optimal distribution center  corresponding to the parent node . Store the delivery point  to the No.  element in No.  row. At this time, the elements of No. 1 to No.  of the No.  row are all non-zero ones. When the searching of  is completed, the algorithm ends. Output the AGNES clustering matrix  that meets the matrix constraint conditions.