Path planning method and computer equipment
By constructing a multi-layer graph model to filter the minimum map hop count and global switching count, and calculating the total physical distance, the problem of cross-map and cross-floor path planning in digital twin scenarios is solved, achieving efficient path planning.
Patent Information
- Application Number
- CN202511083919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-18
AI Technical Summary
Existing pathfinding algorithms are not suitable for cross-map and cross-floor path planning in digital twin scenarios, especially navigation grid technology, which cannot navigate between maps without navigation data.
By constructing a multi-layer graph model, the path with the minimum number of map jumps is selected, the global switching count and total physical distance are calculated, and finally the path with the minimum total physical distance is selected as the target path.
It enables efficient route planning across maps and floors, allowing users to reach their destinations at low cost.
Smart Images

Figure CN120960779A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a path planning method and a computer device. BACKGROUND
[0002] With the development of games, the automatic path finding technology has gradually developed from using some simple path finding algorithms to using Dijkstra algorithm, A* algorithm, navigation grid and the like. Among them, the navigation grid divides the virtual world into a plurality of polygonal regions, the character can only move within these passable polygons, and the character is guided to move by calculating the shortest path on the navigation grid. Compared with other algorithms, the navigation grid can better handle irregular terrains and obstacles, making the movement of the character more natural and smooth.
[0003] In the digital twin scene, complex building structures and interconnection of multiple maps are usually involved, which requires path planning across maps and floors. However, the existing path finding algorithms cannot be applied to complex scenarios across maps and floors. For example, the navigation grid technology can only calculate the navigation path in the current map and cannot realize path planning across maps. Moreover, the map data in the digital twin scene is large, and it is impossible to load all the navigation grid data of the sub-maps. If the navigation grid technology is used, the character cannot be navigated from the start position to the end position if the map through which the character passes does not load the navigation grid data. Therefore, there is an urgent need to provide a new path planning method to meet the demand for path planning across maps and floors in complex scenarios such as digital twin scenes. SUMMARY
[0004] To solve the above problems, the present application provides a path planning method and a computer device.
[0005] According to an aspect of an embodiment of the present application, a path planning method is disclosed, which comprises:
[0006] Based on the start map where the start position is located and the end map where the end position is located, a plurality of first paths with the minimum number of map jumps are selected to form a first candidate path set, the minimum number of map jumps representing the minimum number of maps through which the character passes from the start map to the end map, and the first path representing a walkable map route between the start map and the end map;
[0007] The global switching times of each first path are calculated, and a plurality of paths with the minimum global switching times are selected to form a second candidate path set, the global switching times being obtained by summing the floor switching times within each map through which the first path passes, and the floor switching times representing the number of transfers required from the starting floor to the destination floor within the map;
[0008] Calculate the physical total distance of each path in the second candidate path set, and select the one with the minimum physical total distance as the target path.
[0009] In some embodiments, the calculation of the physical total distance of each path in the second candidate path set comprises: traversing each path combination of sub-paths in the second candidate path set, the sub-path being a local path segment from the current node to its neighbor node; calculating the Euclidean distance of each sub-path, and accumulating the Euclidean distances of the sub-paths contained in each sub-path combination to obtain the physical total distance of the sub-path combination; and selecting the path corresponding to the one with the minimum physical total distance as the target path.
[0010] In some embodiments, the calculation of the Euclidean distance of each sub-path comprises: calculating the horizontal distance component and the vertical distance component of the current node to the neighbor node of each sub-path; and obtaining the Euclidean distance of the sub-path based on the horizontal distance component and the vertical distance component.
[0011] In some embodiments, the calculation of the Euclidean distance of each sub-path comprises: obtaining the Euclidean distance of the sub-path based on the relationship In some embodiments, the calculation of the Euclidean distance of each sub-path comprises: obtaining the Euclidean distance of the sub-path based on the relationship In some embodiments, the calculation of the Euclidean distance of each sub-path comprises: obtaining the Euclidean distance of the sub-path based on the relationship
[0012] In some embodiments, the filtering of the first candidate path set comprising a plurality of first paths with the minimum number of map jumps based on the start map where the start position is located and the end map where the end position is located comprises: taking the start map where the start position is located as the search start point, performing breadth-first search traversal, and synchronously constructing a map parent node set and recording the minimum number of map jumps from the start map to the end map where the end position is located, the map parent node set recording the predecessor map information of the visited maps in the path from the start map to the end map; based on the map parent node set, starting from the end map, backtracking the predecessor maps corresponding to the minimum number of map jumps until the start map is reached, obtaining a plurality of first paths with the minimum number of map jumps, and constituting the first candidate path set.
[0013] In some embodiments, the breadth-first search is performed starting from a starting map where the start position is located, and a set of map parent nodes and a minimum map hop number from the starting map to an ending map where the end position is located are constructed synchronously, including: creating a first-in-first-out queue for storing maps to be visited, and adding the starting map where the start position is located to the first-in-first-out queue as the first element in the first-in-first-out queue, and using a distance function to represent the minimum number of maps passed from the starting map to any map; when the first-in-first-out queue is not empty, iteratively performing: taking a current map from the head of the first-in-first-out queue, performing a conditional judgment on each neighbor map of the current map: if the distance function value of the neighbor map is greater than the sum of the distance function value from the starting map to the current map and 1, updating the distance function value of the neighbor map to be the sum of the distance function value from the starting map to the current map and 1, and adding the current map as a predecessor map to the map parent node set of the neighbor map, wherein the initial value of the distance function of an unvisited neighbor map is infinity; and taking the distance function value of the ending map where the end position is located as the minimum map hop number from the starting map to the ending map where the end position is located. The first candidate path set is obtained by starting from the ending map, backtracking the predecessor maps corresponding to the minimum map hop number, and backtracking to the starting map, including: starting from the ending map, finding the predecessor map set of the ending map; iteratively performing the step of finding the map parent node set of the predecessor map corresponding to the minimum map hop number until the starting map is found; and performing reverse time sorting on all the predecessor maps obtained by finding the map parent node set to obtain a plurality of first paths of the minimum map hop number, constituting the first candidate path set.
[0014] In some embodiments, the global switching number of each first path is calculated, and a plurality of first paths with the minimum global switching number are screened out to constitute a second candidate path set, including: for each first path, calculating the minimum floor switching number within each map, and adding the minimum floor switching numbers within the maps passed by the first path to obtain the global switching number, the minimum floor switching number representing the minimum number of transfers required from a starting floor to a destination floor within the map; and screening out a plurality of first paths with the minimum global switching number to constitute the second candidate path set.
[0015] In some embodiments, the calculating, for each of the first paths, the minimum number of floor switches within each of the map interiors comprises: for each of the first paths, performing a breadth-first search traversal with a starting floor within each of the map interiors as a search starting point, and synchronously constructing a floor parent node set and recording a minimum number of floor switches from the starting floor to a destination floor, the floor parent node set recording predecessor floor information of a visited floor in a floor path from the starting floor to the destination floor. The screening of the first paths with the minimum number of global switches to form the second candidate path set comprises: based on the floor parent node set, backtracking from the destination floor to trace the predecessor floor corresponding to the minimum number of floor switches until the starting floor is reached, to obtain the paths with the minimum number of floor switches within the map; and based on the paths with the minimum number of floor switches within the map, constructing the second candidate path set.
[0016] In some embodiments, before the screening of the first paths with the minimum number of map jumps based on the starting map where the starting position is located and the destination map where the destination position is located, the method further comprises: constructing a multi-layer graph model comprising a global map layer, a floor topology layer, and a physical coordinate layer; wherein the global map layer comprises a plurality of maps, the maps are connected by a preset space shuttle point across the maps, the floor topology layer comprises a plurality of floors within the same map, the floors are connected vertically by a moving channel across the floors, and the physical coordinate layer is configured with three-dimensional coordinates of the space shuttle point, three-dimensional coordinates of entrances and exits of the moving channel, and three-dimensional coordinates of a plurality of position points within the map.
[0017] According to an aspect of some embodiments of the present application, a computer device is disclosed, which comprises one or more processors, a memory, the memory being configured to store one or more computer programs, when the one or more computer programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0018] The technical solutions provided by the embodiments of the present application have at least the following beneficial effects:
[0019] The scheme disclosed in this application first selects several first paths that have the fewest cumulative map traversals from the starting map to the ending map, forming a first candidate path set. Then, it selects several paths from the first candidate path set that have the fewest global switching times, forming a second candidate path set. Finally, it calculates the total physical distance for each path in the second candidate path set and selects the path with the smallest total physical distance as the target path. This application achieves path planning in complex scenarios involving cross-map and cross-floor navigation. It prioritizes map hop count as the highest priority, followed by the number of global floor switching times, and finally compares the total physical distances. The path that satisfies the minimum number of map hops, the fewest global floor switching times, and the shortest total physical distance is selected as the target path. The resulting target path has low movement costs, allowing users to reach their destination efficiently. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the principles of this application.
[0021] Figure 1 A flowchart of a path planning method according to an embodiment of this application is shown;
[0022] Figure 2 A schematic diagram of a global map layer according to an embodiment of this application is shown;
[0023] Figure 3 A schematic diagram of a floor topology layer according to an embodiment of this application is shown;
[0024] Figure 4 An embodiment of this application is shown. Figure 1 Detailed flowchart of step S102;
[0025] Figure 5 An embodiment of this application is shown. Figure 4 Detailed flowchart of step S401;
[0026] Figure 6 An embodiment of this application is shown. Figure 4 Detailed flowchart of step S402;
[0027] Figure 7 Another embodiment of this application is shown. Figure 4 Detailed flowchart of step S401;
[0028] Figure 8 An embodiment of this application is shown. Figure 1 Detailed flowchart of step S103;
[0029] Figure 9 Another embodiment of this application is shown. Figure 1A detailed flow chart of step S103 is shown in the following;
[0030] Figure 10 An embodiment of the present application is shown Figure 9 A detailed flow chart of step S901 is shown in the following;
[0031] Figure 11 An embodiment of the present application is shown Figure 9 A detailed flow chart of step S902 is shown in the following;
[0032] Figure 12 Another embodiment of the present application is shown Figure 9 A detailed flow chart of step S901 is shown in the following;
[0033] Figure 13 An embodiment of the present application is shown Figure 1 A detailed flow chart of step S104 is shown in the following;
[0034] Figure 14 A schematic diagram of a navigation path of an embodiment of the present application is shown;
[0035] Figure 15 A block diagram of a computer device of an embodiment of the present application is shown;
[0036] Figure 16 A block diagram of a computer system structure for implementing some embodiments of the present application is shown.
[0037] The reference signs are explained as follows:
[0038] 1500, computer device; 1501, processor; 1502, memory; 1600, computer system; 1601,
[0039] CPU; 1602, ROM; 1603, RAM; 1604, bus; 1605, I / O interface; 1606, input part; 1607, output part; 1608, storage part; 1609, communication part; 1610, drive; 1611, removable medium. DETAILED DESCRIPTION
[0040] Example implementations will now be described more fully with reference to the accompanying drawings. Example implementations may, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these example implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example implementations to those skilled in the art. Like reference numerals may refer to like elements throughout.
[0041] The terms "first", "second", etc. are used only for the purpose of description and do not indicate or imply relative importance or a number of indicated technical features. Thus, the features defined with "first", "second", etc. can explicitly or implicitly include one or more features.
[0042] In addition, the described features, structures or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a sufficient understanding of the embodiments of the application. However, one skilled in the relevant art will recognize that the application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations or operations are not shown or described in detail to avoid obscuring aspects of the application.
[0043] The flowcharts shown in the drawings are only exemplary descriptions and do not necessarily include all contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be further divided, and some operations / steps can be combined or partially combined, so the actual execution order can be changed according to the actual situation.
[0044] In the early development of games, such as some early adventure games and role-playing games, users need to manually control the moving direction and path of the character, and there is no automatic pathfinding function in the game. Users rely on their own observation and judgment to plan the route, which requires high spatial cognitive ability and game familiarity of the user, but at that time it can also increase the challenge and interest of the game.
[0045] With the development of games, some simple pathfinding algorithms began to appear. For example, breadth-first search, which treats the map as a graph structure, starts from the starting point and traverses the nodes layer by layer until the target node is found. Its advantage is that it can find the shortest path, but the time and space complexity is high, suitable for games with small map size and low pathfinding efficiency requirements.
[0046] With the development of technology, Dijkstra algorithm is introduced into game navigation and pathfinding, which enables the character to find the shortest path to the target on a weighted map, with a time complexity of O(n 2 ), the calculation time will be longer when there are more maps, but it performs well in some games with high pathfinding accuracy requirements and medium map size, and some early versions of strategy games use Dijkstra algorithm.
[0047] Later, large MMORPGs used the A* algorithm, which combined the advantages of Dijkstra's algorithm and the greedy best-first search algorithm. By introducing a heuristic function to estimate the cost from the current node to the target node, it prioritizes nodes that are more likely to be close to the target, greatly improving pathfinding efficiency and being widely used in games.
[0048] In the UE5 engine, a navigation mesh (NavMesh) is introduced, which divides the virtual world into multiple polygonal regions, and the character can only move within these passable polygons. By calculating the shortest path on the navigation mesh, the character's movement is guided. Compared to the pathfinding method based on the A* algorithm, the navigation mesh can better handle irregular terrain and obstacles, making the character's movement more natural and smooth.
[0049] From early manual pathfinding to the use of breadth-first search, Dijkstra's algorithm, and then the A* algorithm widely used in large MMORPG games, the efficiency and accuracy of pathfinding have been continuously improved. However, when these technologies are transplanted to the field of digital twins, problems begin to emerge. Digital twin scenarios often involve complex building structures and interconnection between multiple maps, making it difficult for these pathfinding algorithms to effectively handle the connection between different maps and the floor switching logic, thus failing to provide accurate path planning. In addition, the pathfinding model and logic of traditional pathfinding algorithms do not match the complexity of digital twin scenarios, making it difficult to directly apply and effectively work in the face of the multi-source heterogeneous data fusion pathfinding requirements of digital twin scenarios. For example, navigation mesh-based pathfinding can only calculate navigation paths within the current map and cannot achieve cross-map path planning, making it difficult to meet the cross-floor, cross-map navigation path calculation requirements of digital twin scenarios.
[0050] To this end, the present application provides a path planning method, which first filters out a number of first paths that have the least number of maps to pass through from the starting map to the ending map, forming a first candidate path set, then filters out a number of paths with the least number of global switching times from the first candidate path set, forming a second candidate path set, and finally calculates the physical total distance of each path in the second candidate path set and selects the one with the smallest physical total distance as the target path. This method realizes path planning in complex scenarios across maps and floors, prioritizes map jumps, followed by global floor switching times, and finally compares physical total distances. The path that meets the minimum number of map jumps, the least number of global floor switching times, and the shortest physical total distance is selected as the target path, resulting in a target path with low movement cost, allowing users to efficiently reach their destination.
[0051] First, several terms involved in the present application are explained:
[0052] Digital Twin: A technology that creates a "full life cycle mirror" of a physical entity (or system) in virtual space through digital means. It realizes the two-way mapping, dynamic synchronization and intelligent collaboration between the physical world and the digital world through real-time data interaction and simulation analysis.
[0053] Unreal Engine 5 (UE5): A cutting-edge game engine developed by Epic Games, widely used in game development, virtual reality (VR), augmented reality (AR), film production, architectural visualization and other fields. UE5 engine has made significant improvements and innovations in graphics rendering, physics simulation, animation systems, etc., providing more efficient and realistic visual effects and interactive experiences.
[0054] Massive Multiplayer Online Role-Playing Game (MMORPG): A game that uses a client-server structure, divided into client and server parts. Players play a virtual world through client software, while the server side manages the virtual world they are in. The server side is usually provided by the game operator, while the player's data is saved on the server side. Players connect to the server through the Internet from the client side to log in and play the game.
[0055] Breadth-First Search (BFS): An algorithm for traversing or searching trees or graphs, its core idea is "first visit the nearest node from the starting point, then gradually expand to further nodes", similar to the "wave effect" of expanding layer by layer. BFS starts from the starting node, first visits all directly adjacent nodes, then visits the adjacent nodes of these adjacent nodes, and so on, until the target node is found or the entire graph is traversed.
[0056] Dijkstra's algorithm: proposed by Dutch computer scientist Edsger Dijkstra in 1956, is an algorithm for finding the shortest path from a starting node to all other nodes in a weighted graph. The algorithm maintains a distance array that records the current shortest distance estimate from the starting node to each node. Initially, the distance from the starting node to itself is 0, and the distance to all other nodes is set to infinity (representing unknown). Then, the algorithm repeatedly selects a node u from the nodes whose shortest distance has not yet been determined, with the smallest distance estimate, as the current node, and updates the distance estimates of all its neighboring nodes v. For each neighboring node v, if the path distance from the starting node through u to v is shorter than the currently known shortest distance, update the distance estimate of v. This process continues until the shortest distances of all nodes are determined.
[0057] A* algorithm: is a pathfinding strategy used in graph-based games with branches and multiple paths, which uses heuristic search to improve search efficiency, and is used for pathfinding from a specific starting point to a specific ending point. A* algorithm combines the breadth-first search feature of Dijkstra's algorithm and the advantages of greedy best-first search algorithm. It defines an evaluation function f(n) for each node, usually represented as f(n) = g(n) + h(n), where g(n) is the actual cost from the starting node to the current node n, and h(n) is a heuristic estimate function that estimates the cost from the current node n to the target node. The algorithm always chooses the node with the smallest evaluation function f(n) value for expansion until the target node is found or the search space is exhausted.
[0058] Navigation Mesh (NavMesh): is an important technology for character pathfinding in 3D game development. It divides the game world into polygonal regions, which represent passable places and contain the connection relationship between regions, forming a navigation network. Its working principle is to first map the starting and ending points of the character to the NavMesh, and then use A* algorithm and other algorithms to search the shortest path on the NavMesh, so that the character can move along this path. NavMesh has many advantages, such as efficient handling of irregular terrain and complex obstacles, making character movement more natural and smooth; it also has strong flexibility, which can be customized according to the game scene and adapt to different terrain obstacles. It is widely used in 3D game character pathfinding, game AI pathfinding, and multiplayer online game server-side pathfinding scenarios. Compared with traditional pathfinding methods, NavMesh has obvious advantages. Compared with pathfinding based on A* algorithm, it has stronger adaptability to irregular terrain and more natural character movement; compared with flow field pathfinding, it can provide more accurate path planning for single or small-scale character groups when dealing with complex terrain and obstacles.
[0059] Space Shuttling Point: A virtual point in game design that allows players or game objects to move quickly and switch locations. It usually appears as a specific marker in the game scene, such as a teleportation gate, magic circle, or marker. Players can instantly move from the current location to the target location or level by triggering the space shuttling point, such as entering the range or interacting. Its main functions include: 1) fast movement, saving long walking time, such as returning to the explored area in open world games to continue adventure; 2) level switching, connecting different game levels or scenes, maintaining the coherence of the process, such as level transition in platform jumping games. The triggering method of space shuttling point is various, which can be activated by active interaction or automatically triggered after entering the range. Its design aims to optimize the player experience and build a smooth game world structure. In this digital twin project, this function is designed as a space shuttling point. Users enter the space shuttling point range (usually a 5-meter radius ball) to trigger the destination map selection actively. After selecting any destination map, the user will be immediately shuttled to the destination map point. For example: Shenzhen digital twin high-speed north station space shuttling point, after entering, the user will pop up digital twin Shanghai, digital twin Wuhan, etc. If the user selects the digital twin Wuhan map, the user will be immediately transferred to the digital twin Wuhan map.
[0060] Euclidean Distance: The "straight line" distance between two points in Euclidean space. It satisfies the three basic properties of distance measurement:
[0061] Non-negativity: The distance value is always non-negative, and is zero when the two points coincide;
[0062] Symmetry: The distance from point A to point B is equal to the distance from point B to point A;
[0063] Triangle Inequality: The distance between any three points satisfies the sum of the two sides greater than the third side;
[0064] The calculation formula in different dimensions is as follows:
[0065] Two-dimensional space: The distance between two points P1(x1, y1) and P2(x2, y2) is:
[0066]
[0067] Three-dimensional space: The distance between two points P1(x1, y1, z1) and P2(x2, y2, z2) is:
[0068]
[0069] n-dimensional space: The distance between two points A(a1, a2,.....,a n ) and B(b1, b2,.....,b nThe distance between the two points is:
[0070]
[0071] World Coordinate System: In UE5, the world coordinate system is a global coordinate system used to describe the positions and orientations of all objects in the scene relative to a common origin point. This origin point is usually located at the center of the scene (0, 0, 0 point), and the positions of all objects are calculated based on this origin point. The world coordinate system in UE5 follows the left-hand coordinate system rule:
[0072] X-axis: positive direction forward (usually pointing forward in the scene towards the user);
[0073] Y-axis: positive direction to the right (perpendicular to the X-axis in the scene, pointing to the right of the user);
[0074] Z-axis: positive direction upward (perpendicular to the X-axis and Y-axis in the scene, pointing to the sky or above).
[0075] The world coordinate system of UE5 is a global coordinate system system used to describe the positions and orientations of all objects in the scene. By precisely controlling the coordinate transformation operations of objects and reasonably utilizing the relationship between the world coordinate system and the local coordinate system, developers can efficiently complete scene building and object layout work.
[0076] The implementation details of the technical solutions of the embodiments of the present application are described in detail as follows:
[0077] Figure 1 The flowchart of the path planning method of an embodiment of the present application is shown, referring to Figure 1 The path planning method at least includes a multi-layer graph model construction step, a map hop pruning step, a floor switching frequency pruning step, a physical distance optimization step, etc., corresponding to steps S101 to S104 respectively, which are introduced in detail as follows:
[0078] In step S101, a multi-layer graph model containing a global map layer, a floor topology layer and a physical coordinate layer is constructed.
[0079] The global map layer contains multiple maps, and the maps are connected through pre-set space shuttle points. The global map layer focuses on path planning between different maps to minimize the number of map hops, that is, the cumulative number of maps passed from the starting map to the ending map is minimized.
[0080] Each map has a unique map ID (MapID), and each space shuttle point has a unique space shuttle point ID (TPID). For example, Figure 2As shown, the global map layer contains map MapA, map MapB, map MapC, map MapD, map MapE, map MapA and map MapB are connected through teleport point TP1, that is, teleport point TP1 can be used to transfer from map MapA to map MapB, map MapB and map MapC are connected through teleport point TP3, that is, teleport point TP3 can be used to transfer from map MapB to map MapC, map MapC and map MapE are connected through teleport point TP4, that is, teleport point TP4 can be used to transfer from map MapC to map MapE, map MapA and map MapD are connected through teleport point TP2, that is, teleport point TP2 can be used to transfer from map MapA to map MapD, and map MapD and map MapE are connected through teleport point TP5, that is, teleport point TP5 can be used to transfer from map MapD to map MapE.
[0081] The floor topology layer contains multiple floors in the same map, and the floors are vertically connected through inter-floor moving channels, and the moving channels have inter-floor passing ability. The moving channel can be an elevator, and multiple floors in the same map can be vertically connected through multiple elevators, and different elevators can connect the same floor or different floors. In addition, the floors can also be vertically connected through stairs at the same time.
[0082] The floor topology layer is used for path planning between different floors in the same map to minimize the number of floor switching and avoid unnecessary vertical movement.
[0083] Each floor has a unique floor ID (MapID, Floor), which represents a specific floor inside a certain map, such as (MapA-1) representing the 1st floor inside map MapA, and (MapA-2) representing the 2nd floor inside map MapA. Each elevator or stair has a unique elevator or stair ID, such as elevator D2 (MapA-1)→(MapA-3), which means elevator E1 can go from the 1st floor inside map MapA to the 3rd floor inside map MapA.
[0084] For example, as shown in FIG. 2, the global map layer contains map MapA, map MapB, map MapC, map MapD, and map MapE. Map MapA and map MapB are connected through teleport point TP1, that is, teleport point TP1 can be used to transfer from map MapA to map MapB, map MapB and map MapC are connected through teleport point TP3, that is, teleport point TP3 can be used to transfer from map MapB to map MapC, map MapC and map MapE are connected through teleport point TP4, that is, teleport point TP4 can be used to transfer from map MapC to map MapE, map MapA and map MapD are connected through teleport point TP2, that is, teleport point TP2 can be used to transfer from map MapA to map MapD, and map MapD and map MapE are connected through teleport point TP5, that is, teleport point TP5 can be used to transfer from map MapD to map MapE. Figure 3As shown, MapA-1, MapA-7, MapA-20, and MapA-28 represent the 1st floor, 7th floor, 20th floor, and 28th floor inside the map MapA respectively, the arrow lines represent the elevators, and the elevator IDs are marked, such as low-zone elevator D1, mid-zone elevator M1, and high-zone elevator E1. Among them, the low-zone elevator D1 can go from MapA-1 to MapA-7, the mid-zone elevator M1 can go from MapA-1 to MapA-20, and the high-zone elevator E1 can go from MapA-1 to MapA-28, from MapA-7 to MapA-28, and from MapA-20 to MapA-28.
[0085] The physical coordinate layer is configured with three-dimensional coordinates of the space shuttle points, three-dimensional coordinates of the entrances and exits of the moving channels, and three-dimensional coordinates of multiple position points in the map. In the embodiment where the floors are also vertically connected through the stairs, the physical coordinate layer can also be configured with three-dimensional coordinates of the entrances and exits of the stairs.
[0086] The physical coordinate layer is the final refinement layer of the multi-layer map model. Based on the three-dimensional coordinates recorded in the physical coordinate layer, the specific moving cost from the starting position to the ending position can be calculated, and the actual moving distance is minimized under the premise of satisfying the constraints of the global map layer and the floor topology layer.
[0087] The multi-layer map model containing the global map layer, the floor topology layer, and the physical coordinate layer is constructed through the above multi-layer map model construction steps to support the realization of cross-map and cross-floor path planning.
[0088] In step S102, based on the starting map where the starting position is located and the ending map where the ending position is located, a number of first paths with the minimum number of map jumps are screened out to constitute a first candidate path set.
[0089] Among them, the first path represents a walkable map route between the starting map and the ending map, and the minimum number of map jumps represents the minimum number of maps that are cumulatively passed through from the starting map to the ending map.
[0090] In some embodiments, the number of passed space shuttle points is taken as the number of map jumps. That is, each time a map is crossed, the jump number is 1, and the total jump number (n is the number of maps passed in the path), that is, the minimum number of map jumps is the number of maps that are cumulatively passed through from the starting map to the ending map minus 1.
[0091] As shown in the global map layer, Figure 2 the minimum number of map jumps from the map MapA to the map MapC is the path of map MapA→map MapB→map MapC (jump number=2), and the minimum number of map jumps from the map MapA to the map MapE is the path of map MapA→map MapD→map MapE (jump number=2).
[0092] In step S102, the global map layer is traversed to find the path corresponding to the minimum map jump number, i.e., the first path. As shown in the global map layer, if the user is currently at the map MapA and wants to go to the map MapE, there are two possible routes: Figure 2
[0093] Path 1: MapA->MapB->MapC->MapE (jump number 3);
[0094] Path 2: MapA->MapD->MapE (jump number 2).
[0095] Since the jump number of path 2 is: 2 < the jump number of path 1: 3, path 2 will be selected, and path 1 will be pruned and discarded because it has more map jumps.
[0096] In step S102, the first candidate path set is quickly filtered out by taking the minimum map jump number as the target, so as to perform the subsequent floor switching number pruning step and physical distance optimization step.
[0097] In some embodiments, as shown in Figure 4 The map jump pruning step includes steps S401-S402, which are described in detail as follows:
[0098] In step S401, the starting map where the starting point is located is taken as the search starting point, and breadth-first search is performed to simultaneously construct a map parent node set and record the minimum map jump number from the starting map to the ending map where the ending point is located.
[0099] The map parent node set records the predecessor map information of the visited map in the path from the starting map to the ending map.
[0100] In some embodiments, as shown in Figure 5 Step S401 includes steps S501-S503, which are described in detail as follows:
[0101] In step S501, a first-in-first-out queue is created for storing the maps to be visited, and the starting map where the starting point is located is added to the first-in-first-out queue as the first element in the first-in-first-out queue. The distance function represents the minimum number of map jumps from the starting map to any map.
[0102] In step S502, the following is iteratively performed: taking the current map from the head of the first-in-first-out queue, performing a conditional judgment on each neighbor map of the current map: if the distance function value of the neighbor map is greater than the sum of the distance function value from the start map to the current map and 1, updating the distance function value of the neighbor map to be the sum of the distance function value from the start map to the current map and 1, and adding the current map as a predecessor map to the map parent node set of the neighbor map, wherein the initial value of the distance function of an unvisited neighbor map is infinite.
[0103] When the first-in-first-out queue is empty, the above iteration is stopped, and step S503 is entered.
[0104] In step S503, the distance function value of the end map in which the end position is located is taken as the minimum map hop from the start map to the end map in which the end position is located.
[0105] Through steps S501-S503, the minimum map hop is found, and the map parent node set corresponding to the minimum map hop is constructed.
[0106] In step S402, based on the map parent node set, the end map is taken as a starting point, the predecessor maps corresponding to the minimum map hop are traced back, until the start map is reached, a plurality of first paths of the minimum map hop are obtained, and a first candidate path set is constructed.
[0107] In some embodiments, as shown in FIG. 6, step S402 includes steps S601-S603, which are described in detail as follows. Figure 6
[0108] In step S601, the map parent node set is found from the end map, and a predecessor map set thereof is obtained.
[0109] In step S602, for the predecessor maps corresponding to the minimum map hop, the step of finding the map parent node set thereof is iteratively performed until the start map is found.
[0110] In step S603, all the predecessor maps obtained by finding the map parent node set are performed in reverse chronological order, a plurality of first paths of the minimum map hop are obtained, and a first candidate path set is constructed.
[0111] In the foregoing embodiments, in the process of performing the breadth-first search traversal, the first path from the starting map to the end map is recorded by using the set of map parent nodes, the predecessor map information of each visited map is recorded, and then the complete first path is constructed step by step from the end map to the starting map by using the predecessor map information in the reverse backtracking. For some maps, there can be multiple predecessor maps, which means that there are multiple path options for reaching the map from the starting map, and the reverse backtracking can traverse all possible path combinations to ensure that all first paths with the minimum number of map jumps are found. Compared with constructing the path from the starting map to the end map in the forward direction, the reverse backtracking does not need to verify and compare each branch sub-path one by one, and can quickly and efficiently construct all possible first paths, thereby improving the efficiency of path planning.
[0112] In some embodiments, the multi-layer graph model construction step constructs a global map layer containing a set of maps M = {M1, M2,..., M s ,..., M e ,..., M N}, and N is the total number of maps.
[0113] The set of spatial teleportation points That is, the set of spatial teleportation points E is a subset of the Cartesian product of the set of maps M and itself. Therefore, the elements in the set of spatial teleportation points E are ordered pairs (M i , M j ), where M i and M j both belong to the set of maps M, and each ordered pair represents a spatial teleportation relationship between maps. Specifically, if there is a spatial teleportation point TP ij that can be teleported from map M i to map M j , then (M i , M j ) ∈ E.
[0114] For example, assuming that there is a set of maps M = {MapA, MapB, MapC}, if there is a spatial teleportation point that can be teleported from map MapA to map MapB, from map MapB to map MapC, and from map MapA to map MapC, then the set of spatial teleportation points E can be represented as: E = {(MapA, MapB), (MapB, MapC), (MapA, MapC)}. Obviously, the elements in E are all ordered pairs in M × M, and therefore
[0115] Assuming that the starting map is M s and the end map is M e , in the map jump pruning step, a distance function d(M) is defined to represent the distance from the starting map Ms The minimum number of map hops to any map M is given by the distance function, which takes elements of the map set M as input and has a range of N∪{∞}, where N is the set of natural numbers including 0, and ∞ indicates that map M has not been visited or is unreachable. The initial value of d(M) is:
[0116]
[0117] Meanwhile, in the map hop count pruning step, the set of map parent nodes is defined as Parent(M), where Parent(M) is a subset of the map set M, and Parent(M) -> 2. M , represents all possible predecessor maps, where 2 M Let Parent(M) represent the power set of the map set M, containing all possible subsets of the map. Parent(M) records the map starting from the originating map M. s The set of predecessor maps for the first path with the minimum number of map jumps to map M. Map M may have multiple predecessor maps because there may be multiple shortest paths to map M.
[0118] For example, if the map set M = {A, B, C, D}, then Assume the starting point is map M. s =A, destination map M e =D, and there are two first paths from A to D with the minimum number of map jumps: A→B→D and A→C→D. Then, Parent(B) = {A}, Parent(C) = {A}, Parent(D) = {B, C}, where Parent(B) = {A}, Parent(C) = {A}, and Parent(D) = {B, C} are each a subset of map set M, belonging to 2 M That is, Parent(B)∈2 M Parent(C)∈2 M Parent(D)∈2 M .
[0119] In some embodiments, M s M represents the starting point map. e M represents the destination map. current M represents the currently accessed map. neighbor Indicates with M current Neighboring neighbor map, such as Figure 7 As shown, step S401 of the map hop count pruning process includes the following steps:
[0120] a. Create a first-in-first-out queue Q to store the map to be accessed.
[0121] b. Move the starting map Ms Enqueue(M s ) to Q as the first element of Q, indicating that M s is the starting map
[0122] c. While Q is not empty, perform the following steps:
[0123] Dequeue the head node from Q as M current ;
[0124] For each neighbor map M current of M neighbor , perform the following operations:
[0125] If d(M neighbor ) > d(M current ) + 1, update d(M neighbor ) = d(M current ) + 1;
[0126] Set the map parent set of M neighbor to contain only M current : Parent(M neighbor ) = {M current} and enqueue M neighbor to Q;
[0127] If d(M neighbor ) = d(M current ) + 1, add M current to the map parent set of M neighbor : Parent(M neighbor ) = Parent(M neighbor ) U {M current}.
[0128] d. When Q is empty, the iteration terminates.
[0129] At this point, if d(M e ) = ∞, it indicates that there is no feasible path from M s to M e ; otherwise, d(M e ) is the minimum map hop count H min from M s to M e .
[0130] It can be understood that d(M neighbor ) > d(M current)+1, indicating that if the current recorded map hop count of the neighbor map M current )+1, because the hop count from the start map to M s _current is d(M e _current), and from M e _current to M H _neighbor is a new hop, so the hop count is added by 1, ensuring that the recorded is the minimum map hop count from the start map to each map.
[0131] After finding the minimum map hop count from M s _start to M e _target by the above steps a-d, all possible minimum map hop count sets P e are backtracked from the target map M H _target in reverse. s e min e
[0132] Correspondingly, the step S402 of the map hop pruning step can include the following steps:
[0133] e. Starting from the target map M e _target, find its set of map parent nodes Parent(M e _target).
[0134] f. Select one of the parent nodes M parent , and then continue to find Parent(M parent ).
[0135] g. Repeat this process until the start map M s _start is reached.
[0136] h. Arrange all the maps in this process in reverse order, and the specific path from the start map M s _start to the target map M e _target is obtained.
[0137] Exemplarily, a map set M = {A, B, C, D}, a start map M s _start = A, a target map M e _target = D, and a set of space teleportation points E = {(A, B), (B, C), (B, D), (C, D)}, according to the calculation process of the above steps a-h, then:
[0138] Initialization:
[0139] d(A) = 0, d(B) = d(C) = d(D) = ∞.
[0140] Queue Q = [A].
[0141]
[0142] First iteration:
[0143] Queue Q is not empty, take the head node M of Queue Q current = A; iterate through all neighbor maps M of A neighbor Then for neighbor map B: d(B) = ∞ > d(A) + 1 = 0 + 1 = 1;
[0144] Update d(B) = 1;
[0145] Set Parent(B) = {A};
[0146] Add B to Queue Q:
[0147] Queue Q = [B].
[0148] Second iteration:
[0149] Queue Q is not empty, take the head node M of Queue Q current = B; iterate through all neighbor maps M of B neighbor i.e. C and D;
[0150] For neighbor map C:
[0151] d(C) = ∞ > d(B) + 1 = 1 + 1 = 2;
[0152] Update d(C) = 2;
[0153] Set Parent(C) = {B};
[0154] Add C to Queue Q:
[0155] Queue Q = [C];
[0156] For neighbor map D:
[0157] d(D) = ∞ > d(B) + 1 = 1 + 1 = 2;
[0158] Update d(D) = 2;
[0159] Set Parent(D) = {B};
[0160] Add D to Queue Q, Queue Q = [C, D].
[0161] Third iteration:
[0162] Queue Q is not empty, take the head node M of Queue Q current = C; iterate through all neighbor maps M of Cneihhbor i.e. D;
[0163] For neighbor map D:
[0164] d(D) = 2 < d(C) + 1 = 2 + 1 = 3;
[0165] The update condition is not met, but the parent node can be added;
[0166] Update Parent(D) = {B, C}.
[0167] Fourth iteration:
[0168] The queue Q is not empty, and the head node M of the queue Q is taken out current = D;
[0169] All neighbor maps of D are traversed, and no neighbor map is found because D is the terminal map.
[0170] The queue Q is now empty, satisfying the termination condition, and the iteration is terminated.
[0171] Therefore, d(D) = 2, indicating that the minimum map jump number from A to D is 2.
[0172] Through the map parent node set Parent(D) = {B, C}, the path can be traced back:
[0173] Starting from D, the parent node is B or C;
[0174] If B is selected:
[0175] Parent(B) = {A};
[0176] The complete path is: A→B→D;
[0177] If C is selected:
[0178] Parent(C) = {B};
[0179] Parent(B) = {A};
[0180] The complete path is: A→B→C→D;
[0181] Since the minimum map jump number is 2, the minimum map jump number path A→B→D is selected.
[0182] That is, the minimum map jump number path from the starting map A to the terminal map D is successfully found through the above steps, and the specific path is obtained by tracing back through the map parent node set, i.e. the first path.
[0183] In step S103, the global switching times of each first path are calculated, and several paths with the minimum global switching times are screened out to form a second candidate path set.
[0184] The global switching times are obtained by summing up the floor switching times of each map interior through which the first path passes, and the floor switching times represent the minimum number of transfers required from the starting floor to the destination floor in the map interior.
[0185] In some embodiments, the minimum floor switching times of each map interior are first calculated, and then the minimum floor switching times of all map interiors through which the first path passes are summed up to obtain the global switching times, which can simplify the calculation process of the global switching times. Of course, in other embodiments, the total floor switching times of each first path can be calculated for all sub-path combinations, and the minimum total floor switching time is taken as the global switching time; wherein the sub-path is a local path segment from the current node to the neighbor node in the map interior.
[0186] As shown in FIG. 8, Figure 8 The floor switching time pruning step includes the following steps S801-S802, which are described in detail as follows:
[0187] In step S801, for each first path, the minimum floor switching times of each map interior are calculated, and the minimum floor switching times of each map interior through which the first path passes are summed up to obtain the global switching times.
[0188] The minimum floor switching times represent the minimum number of transfers required from the starting floor to the destination floor in the map interior. The starting floor refers to the floor on which the starting point in the map interior is located. For the starting map, the starting floor is the floor on which the starting point is located. For other maps other than the starting map, the starting floor is the floor corresponding to the space shuttle point. The destination floor refers to the floor on which the destination point in the map interior is located. For the terminal map, the destination floor is the floor on which the terminal point is located. For other maps other than the terminal map, the destination floor is the floor corresponding to the space shuttle point.
[0189] As shown in FIG. 9, Figure 3 The floor topology layer needs to pass through MapA-1 to MapA-28, and there are the following three paths:
[0190] Path 1: MapA-1->MapA-28: directly take the high area elevator E1 from 1F to 28F, and the floor switching times are 1;
[0191] Path 2: MapA-1->MapA-20->MapA-28: take the middle area elevator M1 from 1F to 20F, and then take the high area elevator E1 from 20F to 28F, and the floor switching times are 2;
[0192] Path 3: MapA-1->MapA-7->MapA-28: from the low area of the 1st floor to the 7th floor by elevator D1, and then change to the high area of the 28th floor by elevator E1, and the number of floor switching is 2.
[0193] Because the number of floor switching of path 1: 1 < the number of floor switching of path 2: 2 = the number of floor switching of path 3: 2, the minimum number of transfer is 1.
[0194] In step S802, a plurality of first paths with the minimum number of global switching are screened out to form a second candidate path set.
[0195] The plurality of first paths with the minimum number of global switching screened out can be map information containing only walkable map routes, without containing map internal sub-path information, that is, part of the first paths directly selected from the first candidate path set, for example, MapA->MapD->MapE. The plurality of first paths with the minimum number of global switching screened out can also contain map internal sub-path information, that is, containing map routes and sub-paths with the minimum number of floor switching, for example, MapA-1->MapA-28->MapD-28->MapE-28->MapE-1.
[0196] In some embodiments, as shown in FIG. 9, the floor switching pruning step includes steps S901-S903, which are described in detail as follows: Figure 9
[0197] In step S901, for each first path, the breadth-first search is performed with each map internal starting floor as a search starting point, and the floor parent node set and the minimum number of floor switching from the starting floor to the destination floor are constructed synchronously.
[0198] The floor parent node set records the predecessor floor information of the visited floor in the floor path from the starting floor to the destination floor.
[0199] In some embodiments, as shown in FIG. 10, step S901 includes steps S1001-S1003, which are described in detail as follows: Figure 10
[0200] In step S1001, a first-in-first-out queue for storing the to-be-visited floors is created, and each map internal starting floor is added to the first-in-first-out queue as the first element in the first-in-first-out queue, and the distance function is used to represent the minimum number of floor switching from the starting floor to any floor.
[0201] In step S1002, the following is iteratively performed: taking the current floor from the head of the first-in-first-out queue, performing a conditional judgment on each neighbor floor of the current floor: if the distance function value of the neighbor floor is greater than the sum of the distance function value from the start floor to the current floor and 1, updating the distance function value of the neighbor floor to be the sum of the distance function value from the start floor to the current floor and 1, and adding the current floor as a predecessor floor to the floor parent node set of the neighbor floor, wherein the initial value of the distance function of an unvisited neighbor floor is infinite.
[0202] When the first-in-first-out queue is empty, the above iteration process is stopped, and step S1003 is entered.
[0203] In step S1003, the distance function value of the destination floor is taken as the minimum floor switching number from the start floor to the destination floor.
[0204] Through steps S1001-S1003, the minimum floor switching number is found, and the floor parent node set corresponding to the minimum floor switching number is constructed.
[0205] In step S902, based on the floor parent node set, the minimum floor switching number corresponding predecessor floors are traced back from the destination floor until the start floor is reached, and a number of paths with the minimum floor switching number inside the map are obtained.
[0206] In some embodiments, as shown in FIG. 11, step S902 includes steps S1101-S1103, which are described in detail as follows: Figure 11
[0207] In step S1101, the floor parent node set is found from the destination floor, and its predecessor floor set is obtained.
[0208] In step S1102, for the minimum floor switching number corresponding predecessor floors, the step of finding its floor parent node set is iteratively performed until the start floor is found.
[0209] In step S1103, all floors obtained by finding the floor parent node set are performed in reverse chronological order, and a number of paths with the minimum floor switching number inside the map are obtained.
[0210] In the foregoing embodiments, in the process of performing the breadth-first search traversal, the predecessor floor information of each visited floor in the floor path from the start floor to the destination floor is recorded by using the floor parent node set, and then the complete path is constructed step by step from the destination floor to the start floor by using the predecessor floor information in the reverse backtracking. For some floors, there can be multiple predecessor floors, which means that there are multiple path options from the start floor to the floor, and the reverse backtracking can traverse all possible path combinations to ensure that all paths with the minimum number of floor switching times are found. Compared with constructing the path from the start floor to the destination floor in the forward direction, the reverse backtracking does not need to verify and compare each branch sub-path one by one, and can quickly and efficiently construct all possible paths, thereby improving the efficiency of path planning.
[0211] In step S903, a second candidate path set is constituted based on a plurality of paths with the minimum number of internal floor switching times in the map.
[0212] In some embodiments, the floor topology layer constructed in the floor switching number pruning step contains a floor set F M ={f1,f2,...,f k} , and the total number of floors is k.
[0213] The elevator / stair set is That is, the set E M is a subset of the Cartesian product of the floor set F M and itself. Therefore, the elements in the set E M are in the form of ordered pairs (f i , f j ), where f i and f j both belong to the floor set F M , and each ordered pair represents a vertical connection relationship between floors. Specifically, if there is an elevator / stair connecting the floor f i to f j , then (f i , f j ) ∈ E M .
[0214] Exemplarily, if the floor path P M =[f in ,f k1 ,f k2 ,...,f out ] from the start floor to the destination floor in the map M, then the floor switching number F(P M )=|P M |-1, where f in represents the start floor and f out represents the destination floor.
[0215] Assume the start floor is f in , the destination floor is f out , define a set E M to represent the vertical connection relationship between the current floor and other floors, in the floor switching number pruning step, define a distance function d f to represent the minimum floor switching number from the start floor f in to the current floor f, the input of the distance function is the element in the set E M , the value domain is N∪{∞}, where N is a natural number set including 0, and ∞ represents that the floor f has not been visited or is not reachable, initialize d f (f) as follows:
[0216]
[0217] At the same time, in the floor switching number pruning step, define a floor parent node set Parent f : to record the predecessor floor set of each floor, initialize the floor parent node set of all floors as empty:
[0218] In some embodiments, f in represents the start floor, f out represents the destination floor, f current represents the current floor being visited, f neighbor represents the neighbor floor adjacent to f current , as shown in FIG. 7, the step S901 of the floor switching number pruning step includes the following steps: Figure 12
[0219] a’. Create a first-in-first-out queue H to store the floors to be visited.
[0220] b’. Add the start floor f in to the queue H to make it the first element in the queue H, indicating that the search starts from f in : Q←Enqueue(f in ).
[0221] c’. When the queue H is not empty, execute the following steps:
[0222] Take the head node from the queue H as f current ;
[0223] For each neighbor floor f current of f neighbor , execute the following operations:
[0224] If d f (fneighbor )>d f (f current If )+1, then update d. f (f neighbor )=d f (f current +1;
[0225] Set f neighbor The set of parent nodes of the floors contains only f current Parent f (f neighbor )={f current}, and f neighbor Add to queue H;
[0226] If d f (f neighbor )=d f (f current If f + 1, then f current Add to f neighbor In the set of parent nodes of the floor: Parent f (f neighbor =Parent f (f neighbor )∪f current}
[0227] d'. The iteration terminates when queue H is empty.
[0228] At this time, if d f (f out If ) = ∞, then it means from floor f in Go to floor f out No elevator is available; otherwise, d f (f out That is, from floor f in Go to floor f out Minimum number of floor switching times F min .
[0229] Understandably, d f (f neighbor )>d f (f current +1 indicates that if the neighboring floor is f neighbor The current recorded number of floor changes is greater than the number of times the floor has changed from the starting floor to the next floor. current Then f neighbor The jump count needs to be updated. Update it to d. f (f current +1, because from the starting floor to f current The number of jumps is d f (f current ), and then from fcurrent to f neighbor is a new jump, so the floor switching times are added by 1, ensuring that the minimum floor switching times from the starting floor to each floor are recorded.
[0230] After finding the minimum floor switching times from the starting floor f in to the destination floor f out by the above steps a'-d', the reverse trace of all possible minimum floor switching times sets is performed from the destination floor f out .
[0231] Correspondingly, the step S902 of the floor switching times pruning step can include the following steps:
[0232] e'. Starting from the destination floor f out , find its floor parent node set Parent f .
[0233] f'. Select one of the parent nodes f parent , and continue to find Parent f (f parent ).
[0234] g'. Repeat this process until the starting floor f in is reached.
[0235] h'. Arrange all the floors in this process in reverse order, and the specific path from the starting floor f in to the destination floor f out is obtained.
[0236] Exemplarily, the current map contains a floor set F M ={1, 2, 3}, the starting floor f in =1, the destination floor f out =3, the neighbor floor relationship E M ={(1, 2), (2, 3)}, and according to the calculation process of the aforementioned steps a'-h', then:
[0237] Initialization:
[0238] d f (1)=0, d f (2)=d f (3)=∞.
[0239] Queue H=[1].
[0240] First iteration:
[0241] The queue H is not empty, and the head node f current =1 of the queue H is taken out;
[0242] Traverse neighbor floor f of floor 1 neighbor = 2, then for neighbor floor 2:
[0243] d f (2) = ∞ > d f (1) + 1 = 0 + 1 = 1;
[0244] Update d f (2) = 1;
[0245] Set Parent f (2) = {1};
[0246] Add f neighbor = 2 to queue H:
[0247] P = [2].
[0248] Second iteration:
[0249] Queue H is not empty, take the head node f current = 2 from queue H;
[0250] Traverse all neighbor floors f neighbor of floor 2, i.e. floor 3;
[0251] For neighbor floor 3:
[0252] d f (3) = ∞ > d f (2) + 1 = 1 + 1 = 2;
[0253] Update d f (3) = 2; Set Parent f (3) = {2};
[0254] Add f neighbor = 3 to queue H:
[0255] P = [3].
[0256] Third iteration:
[0257] Queue H is not empty, take the head node f current = 3 from queue H;
[0258] Traverse neighbor floors of floor 3, result is no neighbor floor because floor 3 is the destination floor.
[0259] Queue H is now empty, meet the termination condition, iteration terminates.
[0260] Therefore, the distance d f (3) = 2, indicating the minimum floor switching times is 2.
[0261] Through the floor parent node set Parent f (3) = {2}, the path can be traced back:
[0262] From the destination floor f out = 3,
[0263] Parent f (3) = {2};
[0264] Parent f (2) = {1};
[0265] Therefore, the complete path is: 1→2→3.
[0266] In the above embodiment, on the basis of the first candidate path set obtained in the map jump pruning step, the sub-path with the minimum number of floor switching times is found for each map inside each path, and the path with the minimum global switching times is selected, so that the target path obtained subsequently has the minimum map jump number and the minimum global switching times.
[0267] In step S104, the physical total distance of each path in the second candidate path set is calculated, and the one with the minimum physical total distance is selected as the target path.
[0268] In some embodiments, as shown in Figure 13 , the calculation of the physical total distance of each path in the second candidate path set includes steps S1301-S1303, which are described in detail as follows:
[0269] In step S1301, each path combination in the second candidate path set is traversed.
[0270] The sub-path is a local path segment from the current node to a neighbor node. For each path in the second candidate path set, there can be multiple sub-path combinations, for example, the path MapA->MapD->MapE, the sub-path combination can be MapA-1->MapA-28->MapD-28->MapE-28->MapE-1, can also be MapA-1->MapA-20->MapA-28->MapD-28->MapE-28->MapE-1, can also be MapA-1->MapA-20->MapA-28->MapD-28->MapE-28->MapE-20->MapE-1, and the like. Different sub-path combinations correspond to different global switching times. As described above, each path in the second candidate path set can be map information containing only walkable map routes, or can be map internal sub-path information, that is, containing map paths and minimum floor switching times. For the former, there are multiple sub-path combinations in step S1301, which include the sub-path combination with the minimum global switching time and other sub-path combinations. For the latter, there is only one sub-path combination with the minimum global switching time in step S1301.
[0271] In step S1302, the Euclidean distance of each sub-path is calculated, and the Euclidean distances of the sub-paths included in each sub-path combination are accumulated to obtain the physical total distance of the sub-path combination.
[0272] In step S1303, the path corresponding to the minimum physical total distance is taken as the target path.
[0273] In the foregoing embodiment, the physical total distance of the path is determined by the Euclidean distance, and the calculation method is simple.
[0274] In some embodiments, calculating the Euclidean distance of each sub-path includes: calculating the horizontal distance component and the vertical distance component of each sub-path from the current node to the neighbor node; and obtaining the Euclidean distance of the sub-path based on the horizontal distance component and the vertical distance component.
[0275] Specifically, the Euclidean distance of each sub-path is calculated based on the relationship wherein, is the horizontal distance component, |z2-z1| is the vertical distance component, μ is the vertical distance correction coefficient, μ is set to be smaller in the elevator scene than in the staircase scene, x1, y1, z1 are the three-dimensional coordinates of the current node, and x2, y2, z2 are the three-dimensional coordinates of the neighbor node.
[0276] By using a vertical distance correction factor, the actual cost of cross-floor paths can be quantified more accurately, which helps in finding efficient target paths.
[0277] by Figure 14 Taking the path shown as an example, the coordinates of the starting point S are (0, 0, 0), the coordinates of point A at the elevator entrance E1 on the first floor of the starting map MapA (50, 50, 0), the coordinates of point B at the exit on the second floor of MapA (50, 50, 6), the coordinates of point C at the spatial shuttle point TP1 in MapA (80, 80, 6), the coordinates of point D at the shuttle point in MapD (20, 20, 9), and the coordinates of point E at the destination point in MapD (100, 100, 9). The elevator scene is set to μ = 0.1, and the staircase scene is set to μ = 0.5. The distance from the starting point to the destination is calculated based on the aforementioned relationship:
[0278] Starting point → Elevator E1 entrance (purely horizontal movement):
[0279]
[0280] Elevator E1 moves across floors (with vertical correction):
[0281]
[0282] Elevator Exit E1 → Space Shuttle Point TP1 (pure horizontal movement):
[0283]
[0284] Space travel point TP1 → destination position (pure horizontal movement):
[0285]
[0286] The total physical distance D = D1 + D2 + D3 + D4 = 70.71 + 0.6 + 42.43 + 113.14 = 226.88.
[0287] It should be noted that the above embodiments use an elevator scenario as an example to illustrate the path planning method of this application. This application is also applicable to staircase scenarios.
[0288] In summary, the application solves the path planning problem in the cross-map and cross-floor scene through the three-stage collaborative mechanism of map jump number priority pruning, floor switching number secondary pruning and physical distance final optimization. By constructing a multi-layer graph model, accurate cross-floor and cross-map navigation guidance can be obtained in complex multi-floor buildings or multiple map scenes, reducing the time of getting lost and exploration and improving the user experience. The algorithm takes the minimum map jump number, the minimum floor switching number and the shortest physical distance as the optimization goal to ensure that the user can reach the destination in an efficient way, which is particularly important in emergency situations or scenarios that require quick positioning, and can save valuable time for the user. The characteristics of vertical transportation tools such as elevators and stairs are also considered, and the Euclidean distance is corrected to make the path more consistent with the actual moving cost. In addition, based on the breadth-first search algorithm and the joint pruning strategy, the path that meets the conditions can be quickly searched, and the user's navigation request can be responded in time, so the user does not need to wait for a long time for the path planning result, improving the real-time performance and interactivity. By constructing a "map-floor-coordinate" three-dimensional hash table and a composite index mechanism, relevant node information can be quickly retrieved, avoiding the traversal of the global map and reducing the consumption of computing resources. At the same time, the memory occupation and data transmission amount are also reduced, improving the overall performance of the system.
[0289] Next, referring to Figure 15 The embodiment provides a computer device 1500, which comprises one or more processors 1501 and a memory 1502 for storing one or more programs, when the one or more programs are executed by the one or more processors 1501, the computer device 1500 realizes the path planning method of the application.
[0290] Figure 16 A structural block diagram of a computer system for implementing some embodiments of the application is shown. It should be noted that Figure 16 The computer system shown is only an example and should not limit the function and use range of the embodiments of the application.
[0291] As Figure 16As shown, the computer system 1600 includes a CPU (Central Processing Unit) 1601 which can perform various appropriate actions and processes in accordance with a program stored in the ROM (Read-Only Memory) 1602 or a program loaded into the RAM (Random Access Memory) 1603 from the storage section 1608, such as the path planning method in the above-described embodiments. In the RAM 1603, various programs and data required for the operation of the system are also stored. The CPU 1601, the ROM 1602, and the RAM 1603 are connected to each other through a bus 1604. An I / O (Input / Output) interface 1605 is also connected to the bus 1604.
[0292] Connected to the I / O interface 1605 are an input section 1606 including a keyboard, a mouse, etc.; an output section 1607 including a display such as a CRT (Cathode Ray Tube), an LCD (Liquid Crystal Display), etc., and a speaker, etc.; a storage section 1608 including a hard disk, etc.; and a communication section 1609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to the I / O interface 1605 as necessary. A removable recording medium 1611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 1610 as necessary, so that a computer program read therefrom is installed in the storage section 1608 as necessary.
[0293] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing computer programs for executing all or part of the steps shown in the flowcharts in the path planning method. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 1609, and / or installed from the removable recording medium 1611. When the computer program is executed by the CPU 1601, various functions defined in the system of the present application are performed.
[0294] It should be noted that the computer-readable medium in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In this application, the computer-readable signal medium can include a data signal carrying computer-readable computer programs in a baseband or as a part of a carrier wave. Such a propagated data signal can take on various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium that can transmit, propagate or transport programs for use by or in connection with an instruction execution system, device or apparatus. The computer programs contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination thereof.
[0295] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In the flowcharts or block diagrams, each block can represent a module, a program segment or a part of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0296] The units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The units described can also be located in a single processor. In some cases, the names of the units do not limit the units themselves.
[0297] As another aspect, the present application provides a computer readable medium, which can be included in the computer device described in the above embodiments, or can exist separately without being assembled into the computer device. The computer readable medium carries one or more programs, which, when executed by the computer device, cause the computer device to implement the method described in the above embodiments.
[0298] It should be noted that although several modules or units for performing actions are mentioned in the above detailed description, the division into the modules or units is not mandatory. In fact, according to the embodiments of the present application, features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0299] From the above description of the embodiments, those skilled in the art will readily appreciate that the example embodiments described herein can be implemented by software and / or by hardware coupled with software. Accordingly, the technical solutions of the embodiments of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, or the like) or on a network, and includes a number of instructions for causing a computing device (which can be a personal computer, a server, a terminal, or a network device, etc.) to perform the methods according to the embodiments of the present application.
[0300] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples given are considered exemplary only, and the true scope and spirit of the application is indicated by the appended claims.
Claims
1. A path planning method, characterized in that, include: Based on the starting map where the starting point is located and the ending map where the ending point is located, several first paths with the minimum number of map jumps are selected to form a first candidate path set. The minimum number of map jumps means that the cumulative number of maps traversed from the starting point map to the ending point map is the minimum. The first path means the walkable map route from the starting point map to the ending point map. Calculate the global switching count for each of the first paths, and filter out several paths with the smallest global switching count to form a second candidate path set. The global switching count is obtained by summing the floor switching counts within each map traversed by the first path. The floor switching count represents the number of transfers required from the starting floor to the destination floor within the map. Calculate the total physical distance of each path in the second candidate path set, and select the path with the smallest total physical distance as the target path.
2. The method according to claim 1, characterized in that, The calculation of the total physical distance of each path in the second candidate path set includes: Iterate through the sub-path combinations of each path in the second candidate path set, where each sub-path is a local path segment from the current node to its neighboring nodes. Calculate the Euclidean distance of each sub-path and sum the Euclidean distances of the sub-paths included in each sub-path combination to obtain the total physical distance of the sub-path combination. The path corresponding to the one with the smallest total physical distance is taken as the target path.
3. The method according to claim 2, characterized in that, The calculation of the Euclidean distance for each of the sub-paths includes: Calculate the horizontal and vertical distance components from the current node to the neighboring nodes of each sub-path; The Euclidean distance of the sub-path is obtained based on the horizontal distance component and the vertical distance component.
4. The method according to claim 3, characterized in that, The calculation of the Euclidean distance for each of the sub-paths includes: Based on relational Calculate the Euclidean distance for each of the sub-paths; in, Let |z2-z1| be the horizontal distance component, |z2-z1| be the vertical distance component, μ be the vertical distance correction coefficient, and μ be set to be smaller in elevator scene than in stair scene. Let x1, y1, and z1 be the three-dimensional coordinates of the current node, and x2, y2, and z2 be the three-dimensional coordinates of the neighboring nodes.
5. The method according to claim 1, characterized in that, Based on the starting map where the starting point is located and the ending map where the ending point is located, several first paths with the minimum map hop count are selected to form a first candidate path set, including: Starting from the starting map, a breadth-first search is performed, and a set of parent nodes is constructed and a record is made of the minimum number of map jumps from the starting map to the ending map. The set of parent nodes records the predecessor map information of the visited maps in the path from the starting map to the ending map. Based on the set of parent nodes of the map, starting from the destination map, backtracking in reverse, tracing back to the predecessor map corresponding to the minimum map hop count, until backtracking to the starting map, to obtain several first paths of the minimum map hop count, forming a first candidate path set.
6. The method according to claim 5, characterized in that, The process of using the starting map where the starting point is located as the search starting point, performing a breadth-first search traversal, and simultaneously constructing a set of parent nodes for the map and recording the minimum map hop count from the starting map to the ending map where the ending point is located includes: Create a first-in-first-out queue to store the maps to be visited, and add the starting map where the starting point is located to the first-in-first-out queue as the first element in the first-in-first-out queue. Use a distance function to represent the minimum number of maps traversed from the starting map to any map. When the first-in-first-out queue is not empty, iterative execution is performed as follows: the current map is taken from the head of the first-in-first-out queue, and a conditional judgment is performed on each neighboring map of the current map: if the distance function value of the neighboring map is greater than the sum of the distance function value from the starting map to the current map and 1, then the distance function value of the neighboring map is updated to the sum of the distance function value from the starting map to the current map and 1, and the current map is added as the predecessor map to the set of map parent nodes of the neighboring maps. The initial value of the distance function of the unvisited neighboring maps is infinity. The distance function value of the endpoint map where the endpoint is located is used as the minimum map hop count from the starting map to the endpoint map where the endpoint is located; Based on the set of parent nodes of the map, the process involves backtracking from the endpoint map to the predecessor map corresponding to the minimum map hop count, until the starting map is reached, to obtain several first paths with the minimum map hop count, forming a first candidate path set, including: Starting from the endpoint map, find the set of parent nodes of the map to obtain its predecessor map set; For the predecessor map corresponding to the minimum map hop count, iteratively execute the step of finding its map parent node set until the starting map is found; All predecessor maps obtained by searching the set of parent nodes of the map are sorted in reverse time order to obtain several first paths with the minimum map hop count, forming a first candidate path set.
7. The method according to claim 1, characterized in that, The calculation of the global switching count for each of the first paths, and the selection of several paths with the minimum global switching count to form a second candidate path set, includes: For each of the first paths, calculate the minimum number of floor changes within each map, and sum the minimum number of floor changes within each map traversed by the first path to obtain the global number of changes. The minimum number of floor changes represents the minimum number of transfers required to travel from the starting floor to the destination floor within the map. Several first paths with the fewest global switching times are selected to form a second candidate path set.
8. The method according to claim 7, characterized in that, For each of the first paths, the minimum number of floor transitions within each map is calculated, including: For each of the first paths, a breadth-first search traversal is performed with the starting floor within each map as the search starting point. Simultaneously, a set of parent nodes for each floor is constructed and the minimum number of floor switches from the starting floor to the destination floor is recorded. The set of parent nodes for each floor records the predecessor floor information of the visited floors in the floor path from the starting floor to the destination floor. The first path, which has the fewest global switching times, is selected to form a second candidate path set, including: Based on the set of parent nodes of the floors, starting from the destination floor, backtracking backwards to trace the predecessor floor corresponding to the minimum number of floor switching, until backtracking to the starting floor, to obtain several paths with the minimum number of floor switching within the map; A second set of candidate paths is formed based on the paths with the fewest floor changes within the map.
9. The method according to any one of claims 1 to 8, characterized in that, Before selecting several first paths with the minimum map jump count based on the starting map where the starting point is located and the ending map where the ending point is located, the process also includes: Construct a multi-layer graph model that includes a global map layer, a floor topology layer, and a physical coordinate layer; The global map layer contains multiple maps, which are connected across the map via preset spatial shuttle points. The floor topology layer contains multiple floors within the same map, which are vertically connected across the floor via cross-floor movement channels. The physical coordinate layer is configured with the three-dimensional coordinates of the spatial shuttle points, the three-dimensional coordinates of the entrances and exits of the movement channels, and the three-dimensional coordinates of multiple location points within the map.
10. A computer device, characterized in that, include: One or more processors; A memory for storing one or more computer programs, which, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1 to 9.