A tourist route planning method based on improved ant colony algorithm
By improving the ant colony algorithm, combining hierarchical modeling and multiple optimization strategies, the ant colony algorithm has solved the problem of slow convergence speed and easy to fall into local optimality in large-scale tourism route planning, and achieved efficient and high-quality tourism route planning , improves the user experience.
Patent Information
- Application Number
- CN202410752411.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-06-12
AI Technical Summary
The existing ant colony algorithm converges slowly when solving the problem of large-scale tourism route planning, which is easy to fall into local optimality and it is difficult to effectively plan the optimal route between multiple points.
The improved ant colony algorithm is adopted, combining hierarchical modeling, multiple optimization strategies, comprehensive pheromone update, dynamic candidate solution set management, parameter initialization and adjustment, parallel computing and global optimization, and by introducing normal distribution and simulated annealing algorithm, it uses 2-opt algorithm optimizes paths to improve search efficiency and path planning quality.
It significantly improves the efficiency and effectiveness of tourism route planning, reduces the computational complexity, ensures the quality and diversity of generated candidate solutions, provides better tourism route planning services, and enhances user experience.
Smart Images

Figure CN118627712B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of tourist route planning, and in particular relates to a tourist route planning method based on an improved ant colony algorithm. Background Art
[0002] During the travel, two problems will be encountered. One is how to determine the destination attractions, and the other is how to reasonably plan a tour route to minimize the expenditure of time and money and provide a better travel experience. Research on tourism route planning issues has become crucial to promoting the development of urban tourism and improving tourists' experience.
[0003] Currently, there are many tourism service products such as Qunar Travel APP, which can provide relevant information of scenic spots, hotel services, transportation information, etc., but they often do not support complex optimal route planning between multiple points. Therefore, it is necessary to plan the tourism routes between multiple points more intelligently. Tourism route planning is essentially a traveling salesman problem, that is, a tour route starting from a certain point, visiting the remaining attractions once, and then returning to the starting point.
[0004] At present, the ant colony algorithm is commonly used to solve this type of problem. The ant colony algorithm is an optimization algorithm that simulates ants looking for food paths. It is a distributed computing method with good parallel processing capabilities and adaptability. However, when solving large-scale tourism route planning problems, it has problems such as slow convergence and easy falling into local optimality. Summary of the invention
[0005] In order to overcome the above problems in the prior art, the purpose of the present invention is to provide a tourist route planning method based on an improved ant colony algorithm, which has the characteristics of hierarchical modeling, combination of multiple optimization strategies, comprehensive pheromone update, dynamic candidate solution set management, parameter initialization and adjustment, parallel computing and global optimization, etc. The method can efficiently solve complex tourist route planning problems and improve the algorithm's search efficiency and route planning quality.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is:
[0007] A travel route planning method based on an improved ant colony algorithm comprises the following steps:
[0008] Step 1: Use an automated method to batch obtain the latitude and longitude information of scenic spots, and the information of highways and ordinary roads between scenic spots;
[0009] Step 2: According to the administrative division of scenic spots, establish the scenic spot tourism network model at the provincial level, urban area level and scenic spot level based on the hierarchical automaton;
[0010] Step 3: Initialize the parameters of the ant colony algorithm: the number of ants m, the pheromone factor α, and the maximum number of iterations N max, and place the ants at the departure point (the tourist's permanent residence) and add them to the taboo table; optimize the parameters of the normal distribution: initialization standard deviation σ, mean value μ; optimize the parameters of the simulated annealing algorithm: initial temperature T start , temperature attenuation coefficient λ; the maximum number of iterations is used as the termination condition;
[0011] Step 4: Ant k calculates the state transition probabilities of all points in the candidate list of the current node by calculating the tourism network model established by the hierarchical automaton in step 2 and the data in step 1, and selects the next target point using the roulette wheel method;
[0012] Step 5: Repeat step (4) until all scenic spots are traversed and all ants have completed the path search;
[0013] Step 6: Based on the Metropolis criterion, the pheromone update phase is improved, and a certain probability is used to decide whether to accept the new solution and add it to the candidate solution set; the candidate solution set refers to a set of possible solutions obtained through continuous updating and optimization during multiple iterations. These solutions are based on the best path found in the current iteration. The candidate solution set includes the order of province tours, the order of city tours, and the order of scenic spot tours;
[0014] Step 7: Optimize the candidate solution set by 2-opt algorithm, that is, use 2-opt algorithm to locally optimize the routes between the provincial level and the urban level;
[0015] Step 8: Update the pheromone concentration on the path according to the candidate solution set; the pheromone concentration is updated on the entire planned path;
[0016] Step 9: When the maximum number of iterations Nmax is reached, the travel route that takes the least time and the specific driving arrangements for each year are obtained.
[0017] In the entire travel plan, the tourists' permanent residence is taken as the departure city, and they travel through the scenic spots in the prescribed order. Each scenic spot is visited only once. Taking into account all the above restrictions, it takes at least how many years to complete the trip and the specific itinerary for each day.
[0018] Convert 1km of expressway to 2.25km of ordinary road. It represents the ordinary road distance between scenic spot i and scenic spot j, and is used represents the ordinary road distance between scenic spot i and scenic spot j, i, j∈{1,2,…,n}, n is the number of scenic spots contained in the urban node, so the driving time between two scenic spots is:
[0019]
[0020] Among them, v1 is the average speed of ordinary roads, which is 40; v2 is the average speed of highways, which is 90. Calculate in hours, and let the visiting time of scenic spot j be t j , so the objective function for visiting an urban attraction in the shortest time is:
[0021]
[0022] Among them, x ij is a decision variable, indicating whether tourists go from attraction i to attraction j, ensuring that all must-visit attractions are included in the entire itinerary, that is:
[0023]
[0024] The network model in step 2 is a hierarchical tourism network model constructed based on the administrative division of scenic spots. This model divides all scenic spots and the roads connecting them into different levels to facilitate more efficient route planning. Specifically, the network model consists of the following three levels:
[0025] 1. Provincial level
[0026] Node: Each node represents a province;
[0027] Edge: The edge connecting two provinces represents the inter-provincial highway or main traffic artery;
[0028] 2. Urban area
[0029] Node: Each node represents a city area;
[0030] Edge: The edge connecting two urban areas represents the highway or main traffic artery between urban areas;
[0031] 3. Attractions layer
[0032] Node: Each node represents a specific scenic spot;
[0033] Edge: An edge connecting two attractions represents a road or walking route between the attractions.
[0034] In the above step 3 of the present invention, in the ant colony algorithm, the pheromone factor α, the heuristic factor β and the pheromone volatility factor ρ are key parameters affecting the algorithm performance, so the grid search method and multi-threading technology are used to find the optimal parameter combination.
[0035] In the above step 4 of the present invention, the traditional ant colony algorithm selects the next scenic spot to be visited by calculating the state transition probability of all points in the candidate list, and the formula is:
[0036]
[0037] d ij = R arccos(sin y i ·sin y j +cos y i ·cos y j ·cos(x i -x j )
[0038] Among them, τ ij (t) is the pheromone left by ants on the path between city i and city j at time t; η ij (t) is a heuristic function, usually d ij The reciprocal of ij (i,j=1,2,...,n) represents the distance between city i and city j, R is the radius of the earth, which is approximately 6371km; x i and j is the longitude and latitude of city i, x j and j is the longitude and latitude of city j; allow k It is used to store the cities that ant k can currently select; α is the information heuristic factor, which indicates the importance of pheromone, and its value range is [0,5]; β is the expected heuristic factor, which indicates the importance of heuristic information, and its value range is [1,5].
[0039] Although it is possible to search for effective solutions globally, the algorithm is difficult to converge and is prone to falling into local optimal solutions and stagnation. One of the reasons for these problems is that when ants choose the next path, they rely on the design of state transition probabilities, which mainly depends on two parts: pheromone concentration and heuristic information. Heuristic information reflects the quality or feasibility of the path, such as the inverse of the distance between cities. When the heuristic information is too high, it means that when ants choose the next path, they tend to choose those paths that appear to be shorter or better based on the heuristic information, but it may cause the ant colony algorithm to focus on certain paths too early and ignore exploring other potentially better paths, causing the algorithm to fall into a local optimal solution; when the heuristic information is too low, it will reduce the possibility of ants choosing a specific path, making the path selection more balanced and random, which helps ants explore more different paths, but may cause the algorithm to converge slowly. By introducing the normal distribution N(μ,σ 2)Add random disturbances to the heuristic information of the ant colony algorithm to increase the randomness of the search process, so that the random disturbances can be dynamically adjusted during the operation of the algorithm to better adapt to the search at different stages. Therefore, for the selection of the next province and city, due to the restrictions on the number of travel days and the number of trips per year and the number of days per trip, tourists will return to the departure place after visiting some attractions and visit again next year. Therefore, in the hierarchical automaton model, it is necessary to stop the conversion between levels and nodes. Therefore, in order to plan the tourist route more flexibly and efficiently, the conversion between levels and nodes is selected through the following improved state transition probability calculation formula:
[0040]
[0041]
[0042] in:
[0043] τ ij (t) is the pheromone left by ants on the path between city i and city j at time t;
[0044] η ij '(t) is a heuristic function, usually d ij The reciprocal of ij (i,j=1,2,...,n) represents the distance between city i and city j;
[0045] allow k Used to store the cities that ant k can currently select;
[0046] α is the information heuristic factor, which indicates the importance of pheromone and is used to control the influence of pheromone concentration when ants choose paths. The larger α is, the more obvious the preference of ants for pheromone concentration when choosing paths.
[0047] β is the expected heuristic factor, which represents the importance of heuristic information and is used to control the influence of the heuristic function when ants choose paths. The larger β is, the more obvious the preference of ants for the heuristic function when they choose paths.
[0048] In order to make the random number ξ adaptively adjusted as the number of iterations increases, the x in the heuristic information formula is set to the current number of iterations t and the maximum number of iterations N max The ratio of, that is:
[0049]
[0050] Due to the restrictions on the number of days and number of trips per year and the number of days per trip, tourists will return to their starting point after visiting some attractions and visit again next year. Therefore, in the hierarchical automaton model, it is necessary to stop the conversion between levels and nodes.
[0051] In order to plan travel routes more flexibly and efficiently, the conversion between levels and nodes, the specific conversion rules are as follows:
[0052] The control mode T of the automaton is determined by the Boolean function The value of γ∈T is used to determine which controlled events are allowed to occur in a given control mode. If γ(σ)=0, the control mode does not allow event σ to occur; if γ(σ)=1, event σ is allowed to occur.
[0053] Admissible control mode, a control mode γ defined on the entire alphabet Σ is called admissible if this control mode γ satisfies the condition: for the uncontrolled event set Σ u , the Boolean function γ(Σ u )=1, in the automaton monitoring problem, only admissible control modes are achievable.
[0054] The controlled automaton of the present invention can be represented by a five-tuple G c =(Y,T×Σ,η c ,y0,Y m ) is used to represent it. Among them, Y, y0∈Y, Y m ∈Y and Σ are interpreted the same as in G, η c is the state transfer function with control mode, that is
[0055]
[0056] If an event σ is allowed to occur, that is, γ(σ) = 1, then conversion between levels or nodes is allowed. If an event σ is prohibited from occurring, that is, γ(σ) = 0, then conversion between levels or nodes is prohibited.
[0057] In the above step 6 of the present invention, the main function of pheromones is to record the path information of historical searches and guide the subsequent path selection of ants. The update of pheromone concentration is one of the core mechanisms of the algorithm, which affects the search direction and search efficiency of the ant colony. When the pheromone concentration on the path is too high, it will over-attract ants and ignore the exploration of other better solutions, which may cause the search to stagnate and the algorithm to converge to the local optimal solution prematurely. Therefore, the Metropolis acceptance criterion mechanism of the simulated annealing algorithm is introduced in the pheromone update stage of the ant colony algorithm to decide whether to accept a new solution that is worse than the current optimal solution with a certain probability, to expand the diversity of solutions and obtain a candidate solution set. The formula of this criterion is:
[0058]
[0059] Among them, ΔD is the current solution D i Compared with the currently known optimal solution D best The difference between the two, namely ΔD = D i -D best ; T is the current temperature, a control parameter. As the number of iterations increases, the temperature T is gradually reduced. Usually linear cooling or exponential cooling is used, that is, the temperature is updated to T next =λT current , the current temperature T until the final temperature T is reached final Or the algorithm stops searching when other stopping conditions are met. A random number r is randomly generated in the range (0,1). If r≤P k Or if ΔD<0, the new path is added to the candidate solution set.
[0060] In the above step 7 of the present invention, the 2-opt algorithm is a local search algorithm for optimizing paths. The specific steps of optimizing the candidate solution set by the 2-opt algorithm are as follows:
[0061] 1. Initialize the path: Select a path from the candidate solution set obtained in step 6 as the initial path.
[0062] 2. Randomly select two nodes on the path: Randomly select two non-adjacent nodes in the current path, denoted as nodes i and j.
[0063] 3. Reverse some nodes in the path: Reverse the path between nodes i and j to get a new path.
[0064] 4. Calculate the length of the new path: Calculate the length of the new path, that is, the sum of the distances between all nodes on the traversal new path.
[0065] 5. Compare path lengths: Compare the length of the new path with the length of the original path.
[0066] 6. Update the path: If the new path is shorter, use the new path as the current path; otherwise, keep the original path unchanged;
[0067] Repeat optimization: Repeat steps 2 to 6 until a stopping condition is reached (for example, the maximum number of iterations is reached or the path length does not change after a certain number of iterations).
[0068] By optimizing the candidate solution set through such a 2-opt algorithm, the path can be gradually improved to obtain a better travel route.
[0069] Although the ant colony algorithm can explore many potential solutions, it sometimes produces poor initial solutions or intermediate solutions containing multiple path intersections, which make the total journey unnecessarily long. The 2-opt algorithm is a common type of optimization algorithm in local search algorithms, which can be used to improve the situation of path intersections. Therefore, after using the normal distribution and simulated annealing algorithm to improve the heuristic information and pheromone update rules, the 2-opt algorithm is used for further optimization.
[0070] Beneficial effects of the present invention:
[0071] The present invention significantly improves the efficiency and effect of scenic spot path planning through multiple improvements such as innovative multi-level network model, combination of ant colony algorithm and simulated annealing algorithm, improved Metropolis criterion, application of 2-opt algorithm and comprehensive pheromone update mechanism. The hierarchical structure makes path planning in large-scale networks more organized and operational, reduces the computational complexity and improves the efficiency of the algorithm. The improved Metropolis criterion accepts new solutions with a certain probability when updating pheromones, increases the diversity of solutions, effectively prevents the algorithm from converging prematurely, ensures that the generated candidate solution set has higher quality and diversity, and lays a good foundation for subsequent optimization steps. The 2-opt algorithm significantly improves the rationality and efficiency of the final path by repeatedly exchanging two edges in the path, reducing the path length, optimizing the total travel distance and time. When updating the pheromone concentration on the path, the tour order of the provincial layer, urban layer and scenic spot layer in the candidate solution set is comprehensively considered, and the pheromone update mechanism at different levels is used to guide the selection of subsequent ants in the search process, further optimizing the path planning results.
[0072] In general, compared with the existing technology, the present invention not only makes breakthroughs in algorithm complexity and accuracy, but also provides better services and support when solving large-scale tourism route planning problems, thereby enhancing user satisfaction and experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 It is a three-layer automaton model of the scenic spot tourism network.
[0074] Figure 2 It is a flowchart of the ant colony algorithm improved based on hierarchical automata. DETAILED DESCRIPTION
[0075] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0076] The present invention is attached Figure 1 ,When building the tourism network model, it is divided into three layers according to the ,provinces and urban areas where the scenic spots are located.
[0077] The first layer is the province layer, with provinces as nodes and numbered yp1 ,y p2 ,y p3 ..., build a high-level structure, using G hi =(Y hi ,Σ hi ,η hi ,y hi0 ,Y him ) represents; the second layer is the urban area layer, with the urban area as the node, numbered y c1 ,y c2 ,y c3 ..., construct the intermediate hierarchy, using G mi =(Y mi ,Σ mi ,η mi ,w,y mi0 ,Y mim ) represents; the third layer is the scenic spot layer, and the scenic spots are taken as nodes, numbered as y1, y2, y3..., and G lo =(Y lo ,Σ lo ,η lo ,w,y lo0 ,Y lom ) represents; for the edges in the graph, the routes between provinces, urban areas, and scenic spots are taken as edges. The edges between different levels represent the urban areas included in the province and the 5A scenic spots included in the urban areas. Therefore, the total routes studied are G = (G lo ,...,G mi ,...,G hi ,...).
[0078] Based on the above ideas, the tourism network established by the hierarchical method of automata is as follows Figure 1 As shown. A ,y B ,y C They are the capital cities of three provinces, and the urban areas where the scenic spots of the provinces are located are connected with the provincial capital cities as the centers; the right side of the picture shows the urban area of a province and its scenic spots.
[0079] like Figure 2 The figure shows the algorithm flow of a travel route planning method using an improved ant colony algorithm proposed by the present invention. The steps and features of the flowchart are as follows:
[0080] Step 1: Use automated methods to obtain the latitude and longitude information of scenic spots and traffic road information;
[0081] Step 2: Establish a hierarchical automaton model for the tourism network. According to the location and administrative division of the scenic spots, the tourism network of the scenic spots is established as a province layer (high-level G hi ), urban area (middle level G mi) and scenic spot layer (lower level G lo )’s three-layer automaton model;
[0082] Step 3: Set the algorithm parameters, the number of ants m is 200, the maximum number of iterations is 500, the initial temperature is 1000, the maximum number of iterations is used as the algorithm end condition, and the objective function of the minimum time spent on urban tour is set as:
[0083]
[0084] Step 4: Let each ant search in the hierarchical automaton model. Ant k starts from the province and city where the departure point is located. After visiting the attractions in the province, it goes to the next province to visit the attractions. For the selection of the next province and city, the state transition probability of all points in the candidate list is calculated by the following formula, and the next target point is selected by the roulette method. The shortest route is found in the attraction layer by the exhaustive method. Under the constraints of limited travel days and the number of trips, the control mode of the controlled automaton is used to determine whether to switch between levels and nodes.
[0085]
[0086] Step 5: Repeat step 4 until all scenic spots are traversed and all ants have completed the path search;
[0087] Step 6: Improve the pheromone update phase based on the Metropolis criterion, that is, use the following formula to decide with a certain probability whether to accept the new solution to be added to the candidate solution set; the candidate solution set includes the order of province tours, the order of city tours, and the order of scenic spot tours;
[0088]
[0089] Step 7: Optimize the candidate solution set by 2-opt algorithm, that is, use 2-opt algorithm to locally optimize the routes between the provincial level and the urban level;
[0090] Step 8: Update the pheromone concentration on the path according to the candidate solution set according to the following formula;
[0091]
[0092]
[0093] in, represents the pheromone left by ant k on the way from city i to city j, ρ is the pheromone volatility coefficient, and its value range is [0,1]; Q represents the total amount of pheromone carried by the ant in each cycle, which is a constant value.
[0094] Step 9: When the maximum number of iterations N is reached maxFinally, we get the travel route that takes the least time and the specific itinerary for each year.
[0095] Through steps 4, 6, and 7, the ant colony algorithm is improved, and the improved ant colony algorithm is used to find the optimal travel route in the hierarchical automaton model. First, the normal distribution N(μ,σ 2 );
[0096] Secondly, the Metropolis criterion is introduced into the pheromone update rule to obtain the candidate solution set;
[0097] Finally, the local optimization technology of the 2-opt algorithm is used to further optimize the candidate solution set and improve the quality of the algorithm solution. The search route of the improved ant colony algorithm in the hierarchical automaton model is to first find the target province, then search the urban layer of the province and the scenic spot layer of each urban area. Under the constraint of travel time, multiple Hamiltonian circuits are obtained, and finally the overall travel route is obtained. Since the number of scenic spots in most urban areas is small, the exhaustive method is used to find the shortest route in the scenic spot layer, and the improved ant colony algorithm is used to search in the province layer and urban layer.
[0098] As a formal model, automaton is one of the important tools for describing formal languages. It uses the reachability of state subsets to define languages. The behavior of the system can be simulated by defining a series of states and transition rules between states, where each state transition is triggered by a corresponding event. There are many types of automata, which can be divided into finite state automata and infinite state automata according to the number of states of the system. Finite state automata are the most basic automata models, which can be deterministic or non-deterministic. Deterministic automata indicate that each combination of state and event can result in a unique successor state, while uncertainty allows multiple possible successor states.
[0099] Therefore, a deterministic automaton G is represented by a five-tuple as follows
[0100] G=(Y,Σ,η,y0,Y m )
[0101] Among them: each state of G is represented by y, and the state set Y is used to store all y; Σ is a finite input symbol alphabet, that is, an event set; η is the transfer function, which is a mapping η:Y×Σ→Y, which defines the transition rule from one state to another; y0∈Y is the initial state; Y m ∈Y is the set of accepting states.
[0102] For an automaton G and any initial state y0∈Y, where Σ is a set of input symbol strings, the language L(G) generated by the automaton G is defined as a set of input symbol strings σ∈∑ that define the state transition function η(σ,y0), that is,
[0103] L(G)={σ|η(σ,y0)!}
[0104] The markup language L defined by the automaton G m (G) is a set of strings that start from the initial state y0, and finally reach any accepting state through the state transition function η(σ,y0) triggered by the input symbol σ∈∑.
[0105] L m (G)={σ|η(σ,y0)∈Y m}.
[0106] Example
[0107] A travel route planning method based on an improved ant colony algorithm comprises the following steps:
[0108] Step 1: Use an automated method to batch obtain the latitude and longitude information of scenic spots, and the information of highways and ordinary roads between scenic spots;
[0109] Step 2: According to the administrative division of scenic spots, establish the scenic spot tourism network model at the provincial level, urban area level and scenic spot level based on the hierarchical automaton;
[0110] Step 3: Initialize the parameters of the ant colony algorithm: the number of ants m, the pheromone factor α, and the maximum number of iterations N max etc., and place the ants at the departure point (the tourist’s permanent residence) and add them to the taboo table; optimize the parameters of the normal distribution: initialization standard deviation σ, mean value μ; optimize the parameters of the simulated annealing algorithm: initial temperature T start , temperature attenuation coefficient λ; the maximum number of iterations is used as the termination condition;
[0111] Step 4: Ant k calculates the state transition probabilities of all points in the candidate list and selects the next target point using the roulette wheel method;
[0112] Step 5: Repeat step (4) until all scenic spots are traversed and all ants have completed the path search;
[0113] Step 6: Based on the Metropolis criterion, the pheromone update phase is improved, and a certain probability is used to decide whether to accept the new solution and add it to the candidate solution set; the candidate solution set includes the order of province tours, the order of city tours, and the order of scenic spot tours;
[0114] Step 7: Optimize the candidate solution set by 2-opt algorithm, that is, use 2-opt algorithm to locally optimize the routes between the provincial level and the urban level;
[0115] Step 8: Update the pheromone concentration on the path according to the candidate solution set;
[0116] Step 9: When the maximum number of iterations Nmax is reached, the travel route that takes the least time and the specific driving arrangements for each year are obtained.
[0117] In step 1, taking the 318 5A scenic spots in China as an example, there are only 30 days for travel each year and a maximum of 4 trips, each trip lasting a maximum of 15 days. The daily driving time is limited to 7 am to 7 pm, and the continuous driving time shall not exceed 8 hours;
[0118] The roads between scenic spots include expressways and ordinary roads. The average speed is 90km / h on expressways and 40km / h on ordinary roads. The scenic spots are open to tourists from 8:00 to 18:00 every day. In the entire travel plan, the tourists' permanent residence in Xi'an is used as the departure city, and they visit 318 5A-level scenic spots in the prescribed order. Each scenic spot is visited only once. Considering all restrictions, the minimum number of years required to complete the journey and the specific itinerary for each day. In order to facilitate the calculation of driving time, 1km of expressway is converted into 2.25km of ordinary road; It represents the ordinary road distance between scenic spot i and scenic spot j, and is used represents the ordinary road distance between scenic spot i and scenic spot j, i, j∈{1,2,…,n}, n is the number of scenic spots contained in the urban node, so the driving time between two scenic spots is:
[0119]
[0120] Among them, v1 is the average speed of ordinary roads, which is 40; v2 is the average speed of highways, which is 90. In order to solve the shortest travel time, the calculation is performed in hours, and the visit time of scenic spot j is t j , so the objective function for visiting an urban attraction in the shortest time is:
[0121]
[0122] Among them, x ij is a decision variable, indicating whether tourists go from attraction i to attraction j, ensuring that all must-visit attractions are included in the entire itinerary, that is:
[0123]
[0124] In the above step 3 of the present invention, in the ant colony algorithm, the pheromone factor α, the heuristic factor β and the pheromone volatility factor ρ are key parameters affecting the algorithm performance. Therefore, the grid search method and multi-threading technology are used to find the optimal parameter combination.
[0125] In the above step 4 of the present invention, the traditional ant colony algorithm selects the next scenic spot to be visited by calculating the state transition probability of all points in the candidate list, and the formula is:
[0126]
[0127] d ij = R arccos(siny i ·siny j +cosy i ·cosy j ·cos(x i -x j )
[0128] Among them, τ ij (t) is the pheromone left by ants on the path between city i and city j at time t; η ij (t) is a heuristic function, usually d ij The reciprocal of ij (i,j=1,2,...,n) represents the distance between city i and city j, R is the radius of the earth, which is approximately 6371km; x i and j is the longitude and latitude of city i, x j and j is the longitude and latitude of city j; allow k It is used to store the cities that ant k can currently select; α is the information heuristic factor, which indicates the importance of pheromone, and its value range is [0,5]; β is the expected heuristic factor, which indicates the importance of heuristic information, and its value range is [1,5].
[0129] When solving large-scale scenic spot route planning, although the ant colony algorithm can search for effective solutions in a global scope, it is difficult for the algorithm to converge and is prone to falling into local optimal solutions and stagnation. One of the reasons for these problems is that when ants choose the next path, they rely on the design of state transition probability, which mainly depends on two parts: pheromone concentration and heuristic information. Heuristic information reflects the quality or feasibility of the path, such as the inverse of the distance between cities. When the heuristic information is too high, it means that when ants choose the next path, they tend to choose those paths that appear to be shorter or better according to the heuristic information, but it may cause the ant colony algorithm to focus on certain paths too early and ignore exploring other potentially better paths, causing the algorithm to fall into a local optimal solution; when the heuristic information is too low, it will reduce the possibility of ants choosing a specific path, making the path selection more balanced and random, which helps ants explore more different paths, but may cause the algorithm to converge slowly. By introducing the normal distribution N(μ,σ 2) Add random perturbations to the heuristic information of the ant colony algorithm to increase the randomness of the search process, and let the random perturbations be dynamically adjusted during the operation of the algorithm to better adapt to the search at different stages. Therefore, for the selection of the next province and city, the following improved state transition probability calculation formula is used for selection.
[0130]
[0131] In order to make the random number ξ adaptively adjusted as the number of iterations increases, the x in the heuristic information formula is set to the current number of iterations t and the maximum number of iterations N max The ratio of, that is:
[0132]
[0133] Due to the restrictions on the number of days tourists travel each year, the number of trips, and the number of days each trip, tourists will return to their starting point after visiting some attractions and visit again next year. Therefore, in the hierarchical automaton model, it is necessary to stop the conversion between levels and nodes. Under the constraints of travel time, in order to plan travel routes more flexibly and efficiently, the conversion between levels and nodes is determined by the control mode of the controlled automaton. The specific conversion rules are as follows:
[0134] The control mode T of the automaton is determined by the Boolean function The value of γ∈T is used to determine which controlled events are allowed to occur in a given control mode. If γ(σ)=0, the control mode does not allow event σ to occur; if γ(σ)=1, event σ is allowed to occur.
[0135] Admissible control mode, a control mode γ defined on the entire alphabet Σ is called admissible if this control mode γ satisfies the condition: for the uncontrolled event set Σ u , the Boolean function γ(Σ u )=1, in the automaton monitoring problem, only admissible control modes are achievable.
[0136] A controlled automaton can be represented by a quintuple G c =(Y,T×Σ,η c ,y0,Y m ) is used to represent it. Among them, Y, y0∈Y, Y m ∈Y and Σ are interpreted the same as in G, η c is the state transfer function with control mode, that is
[0137]
[0138] If an event σ is allowed to occur, that is, γ(σ) = 1, then conversion between levels or nodes is allowed. If an event σ is prohibited from occurring, that is, γ(σ) = 0, then conversion between levels or nodes is prohibited.
[0139] In the above step 6 of the present invention, the update of pheromone concentration is one of the core mechanisms of the algorithm, which affects the search direction and search efficiency of the ant colony. The main function of pheromones is to record the path information of historical searches and guide the path selection of subsequent ants. When the pheromone concentration on the path is too high, it will over-attract ants and ignore the exploration of other better solutions, which may cause the search to stagnate and the algorithm to converge to the local optimal solution prematurely. Therefore, the Metropolis acceptance criterion mechanism of the simulated annealing algorithm is introduced in the pheromone update stage of the ant colony algorithm to decide whether to accept a new solution that is worse than the current optimal solution with a certain probability, to expand the diversity of solutions and obtain a candidate solution set. The formula of this criterion is:
[0140]
[0141] Among them, ΔD is the current solution D i Compared with the currently known optimal solution D best The difference between the two, namely ΔD=D i -D best ; T is the current temperature, a control parameter. As the number of iterations increases, the temperature T is gradually reduced. Usually linear cooling or exponential cooling is used, that is, the temperature is updated to T next =λT current , the current temperature T until the final temperature T is reached final Or the algorithm stops searching when other stopping conditions are met. A random number r is randomly generated in the range (0,1). If r≤P k Or if ΔD<0, the new path is added to the candidate solution set.
[0142] In the above step 7 of the present invention, although the ant colony algorithm can explore many potential solutions, it sometimes produces poor initial solutions or intermediate solutions containing multiple path intersections, which may cause the total journey to become unnecessarily long. The 2-opt algorithm is a commonly used optimization algorithm in local search algorithms and can be used to improve the situation of path intersections. Therefore, after improving the heuristic information and pheromone update rules using the normal distribution and simulated annealing algorithm, the 2-opt algorithm is further optimized.
[0143] The initial parameters of the improved ant colony algorithm are shown in Table 1:
[0144] Table 1 Experimental parameter settings
[0145]
[0146]
[0147] Table 1 sets the initial parameters of the improved ant colony algorithm.
[0148] Number of ants (m): The total number of ants used for path search. A larger number of ants can improve the coverage of path search, but it will also increase the amount of calculation.
[0149] The initial value of pheromone concentration (τ0): It is usually set evenly so that at the beginning of the search process, the pheromone concentration on each path is the same, avoiding the impact of uneven initial pheromone distribution on the search efficiency and effect of the algorithm.
[0150] Total pheromone amount (Q): is the sum of the initial pheromones on all paths
[0151] Maximum number of iterations (N max ): The maximum number of iterations executed by the algorithm determines the termination condition of the algorithm.
[0152] Initial standard deviation (σ start ): It is used to control the search range and solution diversity in the initial stage. It affects the algorithm's exploration ability in the search space. By setting the initial standard deviation reasonably, the extensive exploration and local optimization of the solution space can be effectively balanced, thereby improving the overall performance of the algorithm and the quality of the solution.
[0153] Attenuation coefficient (k): used to control the volatilization speed of pheromones, that is, the degree of attenuation of pheromone concentration over time. By setting the attenuation coefficient reasonably, the volatilization speed of pheromones can be effectively adjusted, the global search and local search can be balanced, and the search efficiency and quality of the algorithm can be improved.
[0154] Initial temperature (T start ): The initial temperature of the simulated annealing algorithm, which affects the initial search range of the algorithm. Temperature decay coefficient (λ): The decay ratio of the temperature in each iteration, which controls the cooling speed during the simulated annealing process.
Claims
1. A tourist route planning method based on an improved ant colony algorithm, characterized in that: The steps include: Step 1: Use an automated method to batch obtain the latitude and longitude information of scenic spots, and the information of highways and ordinary roads between scenic spots; Step 2: According to the administrative division of scenic spots, establish the scenic spot tourism network model at the provincial level, urban area level and scenic spot level based on the hierarchical automaton; Step 3: Initialize the parameters of the ant colony algorithm: the number of ants m, the pheromone factor α, and the maximum number of iterations N max , and place the ant at the starting point and add it to the taboo table; optimize the parameters of the normal distribution: initialization standard deviation σ, mean value μ; optimize the parameters of the simulated annealing algorithm: initial temperature T start , temperature attenuation coefficient λ; the maximum number of iterations is used as the termination condition; Step 4: Ant k calculates the state transition probabilities of all points in the candidate list of the current node by calculating the tourism network model established by the hierarchical automaton in step 2 and the data in step 1, and selects the next target point using the roulette wheel method; Step 5: Repeat step 4 until all scenic spots are traversed and all ants have completed the path search; Step 6: Based on the Metropolis criterion, the pheromone update phase is improved to decide whether to accept the new solution to be added to the candidate solution set with a certain probability; Step 7: Optimize the candidate solution set by 2-opt algorithm, that is, use 2-opt algorithm to locally optimize the routes between the provincial level and the urban level; Step 8: Update the pheromone concentration on the path according to the candidate solution set; the pheromone concentration is updated on the entire planned path; Step 9: When the maximum number of iterations Nmax is reached, the travel route that takes the least time and the specific driving arrangements for each year are obtained; In the above step 4, the selection is made by using the following improved state transition probability calculation formula: in: τ ij (t) is the pheromone left by ants on the path between city i and city j at time t; η ij ′(t) is the heuristic function, d ij (i,j=1,2,...,n) represents the distance between city i and city j; allow k Used to store the cities that ant k can currently select; α is the information heuristic factor, which indicates the importance of pheromone and is used to control the influence of pheromone concentration when ants choose paths. The larger α is, the more obvious the preference of ants for pheromone concentration when choosing paths. β is the expected heuristic factor, which represents the importance of heuristic information and is used to control the influence of the heuristic function when ants choose paths. The larger β is, the more obvious the preference of ants for the heuristic function when they choose paths. In order to make the random number ξ adaptively adjusted as the number of iterations increases, the x in the heuristic information formula is set to the current number of iterations t and the maximum number of iterations N max The ratio of, that is: Due to the restrictions on the number of travel days and the number of trips per year and the number of days for each trip, tourists will return to their departure point after visiting some attractions and visit again next year. Therefore, in the hierarchical automaton model, it is necessary to stop the conversion between levels and nodes.
2. The method for planning a travel route based on an improved ant colony algorithm according to claim 1, characterized in that: In step 1, in the entire travel plan, the tourist's permanent residence is used as the departure city, and the scenic spots are visited in the prescribed order, and each scenic spot is visited only once. Taking all the above restrictions into consideration, the minimum number of years required to complete the plan and the specific itinerary for each day are calculated; Convert 1km of expressway to 2.25km of ordinary road. It represents the ordinary road distance between scenic spot i and scenic spot j, and is used represents the ordinary road distance between scenic spot i and scenic spot j, i, j∈{1,2,…,n}, n is the number of scenic spots contained in the urban node, so the driving time between two scenic spots is: Among them, v1 is the average driving speed on ordinary roads; v2 is the average driving speed on highways, calculated in hours. Let the visiting time of scenic spot j be t j , so the objective function for visiting an urban attraction in the shortest time is: Among them, x ij is a decision variable, indicating whether the tourist goes from attraction i to attraction j, ensuring that all must-visit attractions are included in the entire itinerary, that is:
3. The tourist route planning method based on the improved ant colony algorithm according to claim 1, characterized in that: The network model in step 2 refers to a hierarchical tourism network model constructed based on the administrative division of scenic spots. The network model consists of the following three levels:
1. Provincial level Node: Each node represents a province; Edge: The edge connecting two provinces represents the inter-provincial highway or main traffic artery; 2. Urban area Node: Each node represents a city area; Edge: The edge connecting two urban areas represents the highway or main traffic artery between urban areas; 3. Attractions layer Node: Each node represents a specific scenic spot; Edge: An edge connecting two attractions represents a road or walking route between the attractions.
4. The tourist route planning method based on the improved ant colony algorithm according to claim 1, characterized in that: In the above step 3, in the ant colony algorithm, the pheromone factor α, the heuristic factor β and the pheromone volatility factor ρ are the key parameters affecting the algorithm performance. The grid search method and multi-threading technology are used to find the optimal parameter combination.
5. The tourist route planning method based on improved ant colony algorithm according to claim 1, characterized in that: The specific conversion is as follows: The control mode T of the automaton is determined by the Boolean function T = {0,1} Σc Set, use the value of γ∈T to determine which controlled events are allowed to occur in a given control mode. If γ(σ)=0, the control mode does not allow event σ to occur; if γ(σ)=1, event σ is allowed to occur; Admissible control mode, a control mode γ defined on the entire alphabet Σ is called admissible if this control mode γ satisfies the condition: for the uncontrolled event set Σ u , the Boolean function γ(Σ u )=1, in the automaton monitoring problem, the admissible control mode is achievable; Five-tuple G for controlled automata c =(Y,T×Σ,η c ,y0,Y m ), where Y, y0∈Y, Y m ∈Y and Σ are interpreted the same as in G, η c is the state transfer function with control mode, that is If an event σ is allowed to occur, that is, γ(σ) = 1, then conversion between levels or nodes is allowed. If an event σ is prohibited from occurring, that is, γ(σ) = 0, then conversion between levels or nodes is prohibited.
6. The method for planning a travel route based on an improved ant colony algorithm according to claim 1, characterized in that: In step 6 above, the role of pheromone is to record the path information of historical search and guide the subsequent path selection of ants. The Metropolis acceptance criterion mechanism of the simulated annealing algorithm is introduced in the pheromone update phase of the ant colony algorithm to decide whether to accept a new solution that is worse than the current optimal solution with a certain probability, to expand the diversity of solutions and obtain a candidate solution set. The formula of this criterion is: Among them, ΔD is the current solution D i Compared with the currently known optimal solution D best The difference between the two, namely ΔD=D i -D best ; T is the current temperature, a control parameter. As the number of iterations increases, the temperature T is gradually reduced. Usually linear cooling or exponential cooling is used, that is, the temperature is updated to T next =λT current , the current temperature T until the final temperature T is reached final Or when other stopping conditions are met, the algorithm stops searching and randomly generates a random number r in the range (0,1). If r≤P k Or if ΔD<0, the new path is added to the candidate solution set.
7. The method for planning a travel route based on an improved ant colony algorithm according to claim 1, characterized in that: In step 7 above, the specific steps of optimizing the candidate solution set by the 2-opt algorithm are as follows: Step (1). Initialize the path: select a path from the candidate solution set obtained in step 6 as the initial path; Step (2). Randomly select two nodes on the path: Randomly select two non-adjacent nodes in the current path, denoted as nodes i and j; Step (3). Reverse some nodes in the path: Reverse the path between nodes i and j to obtain a new path; Step (4). Calculate the length of the new path: Calculate the length of the new path, that is, the sum of the distances between all nodes on the new path; Step (5). Compare path lengths: compare the length of the new path with the length of the original path; Step (6). Update the path: If the length of the new path is shorter, use the new path as the current path; otherwise, keep the original path unchanged; Repeat optimization: Repeat steps (2) to (6) until the stopping condition is reached.
