Subway route planning device and planning method thereof
The subway line planning device and method address the limitations of traditional methods by using a data structure, priority queue, and user interface to provide efficient and personalized route planning, enhancing user experience and adaptability across different cities.
Patent Information
- Application Number
- CN202510400146.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing subway route planning methods lack intelligent and personalized services, making it difficult to provide optimal route planning according to passengers' specific needs, and the user experience is poor.
The data structure is used to store subway site information, and the Dijkstra algorithm and priority queue combined with the path planning algorithm are used to provide a graphical user interface for path planning, supporting path calculations with the shortest distance, the least transfer, the shortest time and the lowest cost.
It realizes efficient and flexible subway route planning, improves user query efficiency and travel experience, supports subway route planning needs in different cities and regions, and has a friendly interface and simple operation process.
Smart Images

Figure CN120313626A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent planning, and particularly to a subway route planning device and its planning method. Background Art
[0002] Today, with the accelerating urbanization process, the subway, as an important part of urban transportation, is becoming increasingly prominent in terms of its convenience and efficiency. However, with the continuous expansion and complexity of the subway network, how to quickly and accurately provide subway route planning services for passengers has become an urgent problem to be solved.
[0003] Traditional subway route planning methods often rely on paper maps or simple electronic maps, and these methods have many deficiencies. For example, paper maps are not updated in a timely manner and it is difficult to reflect the latest subway line information; while simple electronic maps can provide basic route query functions, but in the face of complex transfers, multiple alternative routes and other situations, they often cannot provide the optimal route planning scheme for passengers.
[0004] In addition, most of the existing subway route planning systems lack intelligent and personalized services. They usually can only provide fixed route planning results and cannot be flexibly adjusted according to the specific needs of passengers (such as the shortest time, the least number of transfers, etc.). At the same time, these systems also often neglect the importance of user experience, with unfriendly interface designs and cumbersome operation processes, bringing inconvenience to passengers.
[0005] To solve the above problems, the applicant proposes a subway route planning device and its planning method. Summary of the Invention
[0006] The purpose of the present invention is to provide a subway route planning device and its planning method to solve the problems in the prior art.
[0007] To achieve the above purpose, the present invention provides the following technical solutions: A subway route planning device, comprising:
[0008] a. A data structure for storing the adjacency relationship, required time, and line information between subway stations;
[0009] b. A priority queue for selecting the next station to explore according to different planning goals (such as the shortest distance, the least number of transfers, the shortest time, or the minimum cost);
[0010] c. A path planning algorithm implementation module, including the Dijkstra algorithm and other optional algorithms, for finding the optimal path from the starting station to the target station through the priority queue and the data structure;
[0011] d. A file reading module for reading subway route map information and converting it into a data structure;
[0012] e. A user selection module for the user to select the goal of path planning (such as the shortest distance, the fewest transfers, the shortest time, or the minimum cost).
[0013] Optionally, the data structure is a dictionary structure, where each station is the key of the dictionary, and the corresponding value is a list containing neighbor stations, time, and the lines to which they belong.
[0014] Optionally, the priority queue is implemented using a heap to improve the algorithm efficiency.
[0015] Optionally, the path planning algorithm implementation module can output the station order, required time, number of stations, and transfer information of the optimal path according to different planning goals.
[0016] The subway route planning device according to claim 1, wherein the user selection module provides a graphical user interface to facilitate the user to select the goal of path planning.
[0017] A planning method using the subway route planning device according to claim 1, comprising the following steps:
[0018] a. Read the subway route map information through the file reading module and store it in the data structure;
[0019] b. The user selects the goal of path planning (such as the shortest distance, the fewest transfers, the shortest time, or the minimum cost) through the user selection module;
[0020] c. Input the names of two stations;
[0021] d. According to the planning goal selected by the user, use the path planning algorithm implementation module to calculate the optimal path between the input stations;
[0022] e. If there is no path between the two stations, output the information of "the two stations are unreachable";
[0023] f. If there is a path between the two stations, output the station order, required time, number of stations, and transfer information of the optimal path.
[0024] Optionally, the path planning algorithm implementation module includes the Dijkstra algorithm and other optional algorithms to adapt to different planning goals.
[0025] Optionally, the output includes one or more of the path length, time, station order, number of stations, and transfer information according to the planning goal selected by the user.
[0026] Optionally, the path planning algorithm implementation module uses a heap as a priority queue to improve the algorithm efficiency.
[0027] Optionally, the file reading module can process files containing station names, neighbor station time information, and line information to which they belong, and store the data in the subway route map data structure.
[0028] Beneficial effects: The subway route planning device and its planning method provided by the present invention have significant beneficial effects. First, by adopting the Dijkstra algorithm and combining the data structure of the priority queue (heap), the efficient planning of the subway route is realized. This method can quickly calculate the shortest path from the starting station to the target station, and at the same time provide the time and the number of stations required for the path, greatly improving the user's query efficiency and travel experience.
[0029] Secondly, through modular design, the present invention clearly divides functions such as the loading of subway route map data, the implementation of the path planning algorithm, and the output of results. This design not only makes the logic of each part clearer, easier to understand and maintain, but also provides convenience for future function expansion and optimization.
[0030] In addition, the present invention also has high flexibility and adaptability. By reading the subway route map information from a file, the user can easily update the subway station and line data according to actual needs without modifying the program code. This provides great convenience for the user and also enables the present invention to be widely applicable to the subway route planning needs of different cities and regions. Brief Description of the Drawings
[0031] Figure 1 is a schematic flowchart of an embodiment of the present invention; Detailed Embodiments
[0032] The following introduces the preferred embodiments of the present invention with reference to the accompanying drawings of the specification to make its technical content clearer and easier to understand. The present invention can be embodied in many different forms of embodiments, and the protection scope of the present invention is not limited to the embodiments mentioned in the text.
[0033] Embodiment 1
[0034] The present invention proposes a subway route planning device and its planning method. The device and method can not only calculate and output the shortest path from the starting station to the target station, but also realize the least transfer path planning, the shortest time path planning, and the minimum cost path planning that comprehensively considers time, distance, and stops according to the user's needs.
[0035] The subway route planning device of the present invention includes five parts: a data storage module, a data loading module, a path planning module, a user interface module, and a user selection module. Among them, the data storage module is used to store the subway route map information; the data loading module is used to read and load the subway route map information from a file, and convert it into an appropriate data structure for storage; the path planning module uses multiple algorithms (including but not limited to the Dijkstra algorithm) to calculate the optimal path and output relevant information; the user interface module is used to display the station information input by the user and the calculated optimal path and its relevant information; the user selection module is used for the user to select the goal of path planning.
[0036] The data storage module is one of the core parts of the device of the present invention and is used to store the subway route map information. In the present invention, the subway route map information is represented in the form of a weighted undirected graph, where the vertices represent the subway stations, the edges represent the roads between the stations, and the weights on the edges represent costs such as the distance or time between the stations. In addition, the data storage module also stores the numbers of each line and the station information to consider transfer situations when calculating the path.
[0037] To implement the function of the data storage module, the present invention uses a dictionary data structure to represent the adjacency relationship between subway stations and costs such as the required time. Specifically, the keys of the dictionary are the station names, and the values are lists containing neighbor stations, corresponding times, and the lines to which they belong. This data structure can clearly represent the relationship between stations and conveniently retrieve adjacent stations and corresponding costs.
[0038] The function of the data loading module is to read and load the subway route map information from a file and convert it into an appropriate data structure for storage. In the present invention, the data loading module first uses the open function to open the file storing the subway route map information, and then reads the file content line by line. For each line of content, the data loading module first extracts the station name, the time information of the neighbor station, and the line information to which it belongs, and then stores the data in a dictionary.
[0039] To ensure the accuracy and integrity of the data, the data loading module performs strict format verification and error handling when reading the file. If the file format is incorrect or the data is incomplete, the data loading module will output an error prompt message and terminate the operation of the program.
[0040] The path planning module is one of the core parts of the device of the present invention and is used to calculate the optimal path from the starting station to the target station. In the present invention, the path planning module uses multiple algorithms to calculate the optimal path under different planning goals. These algorithms include but are not limited to the Dijkstra algorithm, the A* algorithm, etc.
[0041] To calculate the optimal path under different planning goals, the path planning module first determines the corresponding algorithms and parameters according to the planning goals selected by the user (such as the shortest distance, the fewest transfers, the shortest time, or the minimum cost). Then, the path planning module uses a priority queue and data structures to perform iterative calculations to find the optimal path from the starting station to the target station.
[0042] When calculating the optimal path, the path planning module also takes into account transfer situations. To achieve this function, the present invention additionally stores subway line information in the data storage module. When calculating the optimal path, the path planning module adjusts the length, time, and cost of the path according to transfer situations and prompts the line information for transfers when outputting the path.
[0043] The function of the user selection module is to provide an interface for the user to select the path planning goal. In the present invention, the user selection module adopts the form of a graphical interface to facilitate user interaction. The user can determine the path planning goal (such as the shortest distance, the fewest transfers, the shortest time, or the minimum cost) by selecting the corresponding options.
[0044] The function of the user interface module is to display the station information input by the user and the calculated optimal path and its related information. In the present invention, the user interface module also adopts the form of a graphical interface. Specifically, the user interface module includes four parts: an input box, buttons, a display area, and a user selection area. The input box is used to input the names of the starting station and the target station; the buttons are used to trigger the path calculation operation; the display area is used to display the calculated optimal path and its related information (such as the order of stations on the path, the required time, the number of stations passed through, and transfer information, etc.); the user selection area is used for the user to select the path planning goal.
[0045] To implement the function of the user interface module, the present invention uses a Python GUI library (such as Tkinter) for development. By writing corresponding codes, the creation and layout of the input box, buttons, display area, and user selection area are realized, as well as the triggering of the path calculation function and the display of the results.
[0046] On the basis of implementing the above basic functions, the present invention also makes some optimizations and improvements to improve the performance and user experience of the subway line planning device. These optimizations and improvements include, but are not limited to, the following aspects:
[0047] Algorithm optimization: According to the characteristics of the subway network and user needs, the path planning algorithm is optimized and improved to improve the calculation efficiency and accuracy. For example, when using the Dijkstra algorithm, a heap data structure is used to implement the priority queue to reduce the time complexity of the algorithm.
[0048] User Interface Optimization: The user interface has been beautified to make it more aesthetically pleasing and user-friendly. At the same time, transfer prompt information and error handling functions have been added to enable users to more clearly understand transfer situations and perform correct operations.
[0049] Function Expansion: In addition to the basic path planning function, the present invention can also implement other functions according to user needs. For example, different weight coefficients can be set to comprehensively consider factors such as time, distance, and stop stations to achieve subway path planning with the lowest cost.
[0050] To verify the effectiveness and performance of the present invention, relevant experimental tests were conducted. The experimental tests included multiple test cases, which respectively tested path planning and output results under different planning objectives.
[0051] Test Case 1: Shortest Distance Path Planning
[0052] Test the shortest distance path planning from a certain starting station to a target station. After inputting the starting station and the target station, the program output information such as the order of stations passed, the shortest distance, and the number of stations passed. After verification, the output result was consistent with the expected result, proving the correctness of the present invention in shortest distance path planning.
[0053] Test Case 2: Least Number of Transfers Path Planning
[0054] Test the least number of transfers path planning from a certain starting station to a target station. After inputting the starting station and the target station, the program output information such as the order of stations passed, the shortest time, and the number of transfers, and prompted the transfer line information. After verification, the output result was consistent with the expected result, proving the correctness of the present invention in least number of transfers path planning.
[0055] Test Case 3: Shortest Time Path Planning
[0056] Test the shortest time path planning from a certain starting station to a target station. After inputting the starting station and the target station, the program output information such as the order of stations passed, the shortest time, and the number of stations passed. After verification, the output result was consistent with the expected result, proving the correctness of the present invention in shortest time path planning.
[0057] Test Case 4: Lowest Cost Path Planning
[0058] Test the minimum-cost path planning from a certain starting station to the target station. After entering the starting station and the target station, the user sets different weight coefficients through the user selection module to comprehensively consider factors such as time, distance, and stopping stations. The program outputs information such as the order of stations passed, the comprehensive cost, and the number of stations passed. After verification, the output results are consistent with the expected results, proving the correctness of the present invention in minimum-cost path planning.
[0059] Through the above experimental tests, the following conclusions can be drawn:
[0060] The subway line planning device and its planning method proposed by the present invention can effectively calculate and output the optimal path and its related information from the starting station to the target station according to different planning goals.
[0061] The present invention can correctly output the path planning and result information when dealing with path planning under different planning goals.
[0062] The priority queue and dictionary implemented by the heap data structure adopted by the present invention
[0063] The above shows and describes the basic principles, main features, and advantages of the present invention. For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic features of the present invention, the present invention can be implemented in other specific forms. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be regarded as limiting the claims involved.
[0064] In addition, it should be understood that although this specification is described according to embodiments, not every embodiment only contains an independent technical solution. This narrative way of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. An underground railway line planning device, characterized in that, Including: a. A data structure for storing the adjacency relationship, required time, and line information between subway stations; b. A priority queue for selecting the next station to explore according to different planning goals (such as shortest distance, fewest transfers, shortest time, or minimum cost); c. A path planning algorithm implementation module, including the Dijkstra algorithm and other optional algorithms, for finding the optimal path from the starting station to the target station through the priority queue and data structure; d. A file reading module for reading subway route map information and converting it into a data structure; e. A user selection module for the user to select the goal of path planning (such as shortest distance, fewest transfers, shortest time, or minimum cost).
2. The subway line planning device according to claim 1, characterized in that, The data structure is a dictionary structure, where each station is the key of the dictionary, and the corresponding value is a list containing neighbor stations, time, and the line to which it belongs.
3. The subway line planning device according to claim 1, characterized in that The priority queue is implemented using a heap to improve the algorithm efficiency.
4. The subway line planning device according to claim 1, wherein The path planning algorithm implementation module can output the station order, required time, number of stations, and transfer information of the optimal path according to different planning goals.
5. The subway line planning device according to claim 1, characterized in that, The user selection module provides a graphical user interface to facilitate the user to select the goal of path planning.
6. A planning method using the railway line planning device as described in claim 1, characterized in that, Including the following steps: a. Read subway route map information through the file reading module and store it in the data structure; b. The user selects the goal of path planning through the user selection module; c. Input the names of two stations; d. According to the planning goal selected by the user, use the path planning algorithm implementation module to calculate the optimal path between the input stations; e. If there is no path between the two stations, output the information "The two stations are unreachable"; f. If there is a path between the two stations, output the station order, required time, number of stations, and transfer information of the optimal path.
7. The planning method according to claim 6, wherein The path planning algorithm implementation module includes the Dijkstra algorithm and other optional algorithms to adapt to different planning goals.
8. The planning method according to claim 6, characterized in that, The output includes one or more of path length, time, station order, number of stations, and transfer information according to the planning goal selected by the user.
9. The planning method according to claim 6, wherein The path planning algorithm implementation module uses a heap as the priority queue to improve the algorithm efficiency.
10. The planning method according to claim 6, characterized in that The file reading module can process files containing station names, neighbor station time information, and line information, and store the data in the subway route map data structure.