Garden path planning method and device based on improved firefly algorithm

By introducing adaptive step size and local search strategies into the firefly algorithm and punishing individuals who do not meet the necessary point constraints, the problem of difficult to effectively optimize garden path planning in the existing technology is solved, and the convergence speed and solution quality of the algorithm is improved.

CN119885374AActive Publication Date: 2025-04-25HUBEI UNIV OF EDUCATION
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411966284.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

When using the firefly algorithm for garden path planning, it is difficult to effectively map the firefly individual location to the garden path spatial layout, and it is difficult to optimize the path layout under various constraints, resulting in slow convergence speed and low resolution quality.

Method used

By adopting an improved optimization algorithm with adaptive step size and local search strategies, and punishing individuals who do not meet the necessary point constraints when the firefly individual position is updated, the population is guided to search in the direction of feasible solutions, thereby improving the convergence speed and solution quality.

Benefits of technology

The convergence speed and solution quality of the algorithm are improved, the efficiency and accuracy of garden path layout are optimized, and various constraints such as terrain, vegetation, and landscape zoning are met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885374A_ABST
    Figure CN119885374A_ABST
Patent Text Reader

Abstract

The invention discloses a garden path planning method based on an improved firefly algorithm, and the method comprises the steps: obtaining a garden landscape design drawing, extracting the space coordinate information of garden path nodes and road sections, and constructing a garden path network topology model; designing a firefly individual coding scheme, coding a garden path node coordinate and a topology connection relationship in the network topology model, and establishing a mapping relationship between the position of the firefly individual and the garden path space layout; carrying out garden path layout optimization solution by utilizing an improved firefly algorithm according to garden constraint conditions; and when the algorithm converges or reaches a preset maximum number of iterations, outputting a garden path layout scheme corresponding to the current optimal firefly individual. The invention further discloses a garden path planning device and equipment based on the improved firefly algorithm and a medium. According to the method, the optimized garden path layout scheme can be generated under the constraint conditions of terrain, vegetation, landscape partition and the like, and the garden landscape design efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of garden path planning and design, and more specifically, to a garden path planning method, a computer device, a computer equipment, a computer storage medium and a computer program product based on an improved firefly algorithm. Background Art

[0002] In garden landscape design, the layout of the garden path system has an important impact on tourists' experience and the rational use of garden space. Traditional garden path design mainly relies on the designer's experience and intuition, lacking quantitative analysis and optimization. In order to improve the scientificity and efficiency of garden path layout, there are currently a variety of methods for garden path modeling using computer algorithms to optimize and improve the planning and design of garden paths.

[0003] In the prior art, the use of firefly algorithm to optimize and improve the planning of garden paths has appeared. However, in practical applications, the following technical difficulties are encountered: First, it is not easy to map the position of individual fireflies to the spatial layout of garden paths. Garden paths are composed of many nodes and sections. The distances between nodes are unequal and the connectivity is different. The length, width, slope, paving material and other attributes of the sections are also diverse, which is difficult to characterize with a unified mathematical model. Secondly, the evaluation of the comprehensive quality of a garden path requires consideration of convenience, landscape vision, fit with the terrain, paving cost and other factors, and there may be contradictions between different factors. For example, a path is the shortest and most convenient, but the landscape experience may be poor, or the construction is difficult and the cost is high. How to quantify, weight and comprehensively judge the brightness value of the path of various indicators is a major challenge. Third, the layout of the garden path should be coordinated with the topography, vegetation and water system, landscape division, tour route and other factors of the garden. It is constrained by terrain conditions, landscape layout, design concepts, etc., and it will become difficult to find the best in a small and irregular area. In addition, differences in the search capabilities of individual fireflies and local optimal traps also pose challenges to the algorithm's convergence and global optimization capabilities.

[0004] The inventor of this application has also studied the design and optimization of garden paths using the firefly algorithm in a previously published paper. However, this method only demonstrates the feasibility and possibility of the algorithm in theoretical principles, and does not mention solutions to problems such as garden modeling, constraint optimization, and algorithm complexity in the firefly algorithm based on the characteristics of the garden path layout problem. The existing design method based on the firefly algorithm still has many technical defects that need to be solved. Summary of the invention

[0005] In response to at least one defect or improvement need in the prior art, the present invention provides a garden path planning method, a computer device, a computer equipment, a computer storage medium and a computer program product based on an improved firefly algorithm. By adopting an improved optimization algorithm with adaptive step size and local search strategy, and by penalizing individuals that do not meet the constraints, the population is guided to search in the direction of feasible solutions, thereby improving the convergence speed and solution quality, and solving at least one of the above defects in the current path planning using the firefly algorithm.

[0006] To achieve the above object, according to a first aspect of the present invention, a garden path planning method based on an improved firefly algorithm is provided, comprising:

[0007] Obtain garden landscape design drawings, extract spatial coordinate information of garden path nodes and sections, and construct a garden path network topology model;

[0008] Design a coding scheme for fireflies, and establish a mapping relationship between the location of fireflies and the spatial layout of garden paths by encoding the coordinates of garden path nodes and the topological connection relationship in the network topology model;

[0009] According to the topography, vegetation and water system of the garden, landscape zoning, and garden movement line constraints, the improved firefly algorithm is used to optimize the layout of the garden path. In the improved firefly algorithm, when the position of the firefly individual is updated, the individual that does not meet the constraint of the necessary point is punished, and the population is guided to search in the direction of a feasible solution. The constraint of the necessary point is combined with the generation of the garden path, and the path connection relationship in the individual code is adjusted to ensure that the optimization result meets the requirements of scenic spot coverage.

[0010] When the algorithm converges or reaches the preset maximum number of iterations, the garden path layout plan corresponding to the current optimal firefly individual is output.

[0011] As a preferred technical solution of the present invention, the construction of the garden path network topology model includes:

[0012] Read the garden landscape design drawing file, identify and parse all layers containing garden path information in the drawing, obtain the graphic data and attribute information of all garden path objects, and obtain the initial garden path graphic set;

[0013] According to the initial garden path graph set, the garden path graph is simplified, and redundant nodes in the graph data are removed to obtain a simplified garden path graph set;

[0014] According to the simplified garden path graph set, the garden path node and section information is extracted to construct the garden path network topology model.

[0015] As a preferred technical solution of the present invention, the design of the firefly individual coding scheme includes:

[0016] Using real number coding, each firefly individual is represented by a set of real number codes, including the two-dimensional coordinates of the garden path nodes and the connection relationship between the nodes;

[0017] Initialize the firefly population and randomly generate a certain number of firefly individuals using uniform distribution in the problem search space. Each individual represents a garden path layout plan.

[0018] The individual fitness function of fireflies is constructed based on the evaluation indicators of garden path layout.

[0019] As a preferred technical solution of the present invention, the method of optimizing the garden path layout by using the improved firefly algorithm includes:

[0020] Obtain the basic constraint information of the garden, including topography, vegetation and water system, landscape division, and tourist routes, and establish a mathematical model for optimizing the layout of garden paths;

[0021] For important scenic spots and tourist nodes in the garden landscape, at least one of them is selected and set as a must-go point as an optimization constraint condition to optimize the mathematical model;

[0022] The improved firefly algorithm is used to solve the above-mentioned mathematical model of optimization, including: according to the fitness value of the current optimal solution, the step size of the firefly is adaptively adjusted, when the fitness value of the optimal solution is higher than the preset value, the step size is reduced to perform a fine search, when the fitness value of the optimal solution is lower than the preset value, the step size is increased to expand the search range; a local search strategy is introduced, for the current optimal solution, several new solutions are generated near it, and the fitness values ​​of these solutions are evaluated. If the new solution is better than the current optimal solution, the current optimal solution is replaced by the new solution to jump out of the local optimum;

[0023] As a preferred technical solution of the present invention, when updating the position of individual fireflies, the individuals that do not meet the constraint of the necessary points are punished, specifically including:

[0024] According to the preset must-pass point constraint conditions, determine whether the position of each firefly individual meets the constraint requirements. If it does not meet the must-pass point constraint, the fitness value of the individual is penalized to reduce its probability of being selected;

[0025] In the process of updating individual positions, the coding information of the current individual is obtained. According to the constraint requirements of the necessary points, it is determined whether the scenic spot connection relationship in the coding covers all the necessary points. If not, the individual coding is corrected by insertion or replacement operation to obtain a feasible solution that meets the constraint conditions.

[0026] As a preferred technical solution of the present invention, the outputting of the garden path layout plan corresponding to the current optimal firefly individual specifically includes:

[0027] Extract node coordinates, link connection relations and link attribute parameters in the optimal individual;

[0028] Generate a two-dimensional plan of the garden path layout based on the node coordinates, and perform three-dimensional modeling on each section based on the section attribute parameters;

[0029] The generated two-dimensional plan is spatially matched with the three-dimensional model to output the garden path layout plan, including node coordinates, section connection relationships, section attribute parameters, and visualized two-dimensional plan and three-dimensional model.

[0030] According to another aspect of the present invention, a garden path planning device based on a firefly algorithm is provided, comprising:

[0031] A model building module, which is configured to obtain garden landscape design drawings, extract spatial coordinate information of garden path nodes and sections, and build a garden path network topology model;

[0032] A coding module is configured to design a coding scheme for individual fireflies, and to establish a mapping relationship between the positions of individual fireflies and the spatial layout of the garden paths by encoding the coordinates of the garden path nodes and the topological connection relationship in the network topology model;

[0033] The solution module is configured to use the improved firefly algorithm to optimize the layout of garden paths according to the topography, vegetation and water system of the garden, landscape zoning, and garden movement line constraints; when the individual positions of fireflies are updated, the individuals that do not meet the constraints of the necessary points are punished, and the population is guided to search in the direction of feasible solutions, and the constraints of the necessary points are combined with the generation of garden paths. By adjusting the path connection relationship in the individual code, it is ensured that the optimization result meets the requirements of scenic spot coverage;.

[0034] The output module is configured to output the garden path layout plan corresponding to the current optimal firefly individual when the algorithm converges or reaches a preset maximum number of iterations.

[0035] According to another aspect of the present invention, there is provided a computer device comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of the above method.

[0036] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores a computer program executable by an access authentication device, and when the computer program runs on the access authentication device, the access authentication device executes the steps of the above method.

[0037] According to another aspect of the present invention, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0038] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0039] (1) The present invention provides a garden path layout optimization method for garden landscape based on an improved firefly algorithm. The method extracts a garden path network topology model from a garden design drawing, including node coordinates and road section attributes, and establishes a mapping between individual firefly positions and garden path layout by encoding garden path nodes and topological relationships. The necessary point constraints are introduced to ensure that the optimization results cover important scenic spots. The necessary point constraints are combined with the generation of tour routes, and the scenic spot coverage requirements are met by adjusting the path connection relationship. The present invention can automatically generate an optimized garden path layout plan under the constraints of terrain, vegetation, landscape zoning, etc., thereby improving the efficiency and quality of garden landscape design.

[0040] (2) In the improved firefly algorithm provided by the present invention, the adaptive step size and local search strategy are adopted, which can greatly improve the convergence speed and solution quality of the algorithm and greatly optimize the efficiency of path planning.

[0041] (3) In the improved firefly algorithm provided by the present invention, when the position of individual fireflies is updated, the individuals that do not meet the constraint of the necessary points are punished, and the population is guided to search for feasible solutions, thereby greatly improving the accuracy of the firefly algorithm and the accuracy of path planning. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flow chart of a method for optimizing the layout of garden paths in a landscape garden based on an improved firefly algorithm provided in one embodiment of the present application;

[0044] Figure 2A schematic diagram of a process of constructing a garden path network topology model in a garden path layout optimization method for a garden landscape based on an improved firefly algorithm provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of a flow chart for constructing and designing a firefly individual coding scheme in a garden landscape garden path layout optimization method based on an improved firefly algorithm is provided for one embodiment of the present application;

[0046] Figure 4 A schematic diagram of a flow chart of optimizing and solving a garden path layout in a garden landscape garden path layout optimization method based on an improved firefly algorithm provided in an embodiment of the present application; DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0048] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0049] like Figure 1 A specific embodiment of the present application provides a method for optimizing the layout of garden paths based on an improved firefly algorithm, comprising the following steps:

[0050] Step S100, extracting spatial coordinate information of garden path nodes and sections from the garden landscape design drawings, and constructing a garden path network topology model.

[0051] Nodes represent the starting point, end point and intersection of garden paths, and sections represent the paths connecting nodes. The length, width, slope and other attribute parameters of each section are recorded.

[0052] Specifically, the garden landscape design drawing file can be read through the computer-aided design software interface, all layers containing garden path information in the drawing can be identified and parsed, the graphic data and attribute information of all garden path objects can be obtained, and the initial garden path graphic set can be obtained.

[0053] According to the initial garden path graphic set, the graphic data is preprocessed, and the garden path graphics are simplified using, for example, the Douglas-Peucker algorithm, and redundant nodes in the graphic data are removed to obtain a simplified garden path graphic set. Then, according to the geometric relationship of the graphics, using, for example, a line segment intersection algorithm, if the simplified garden path graphics intersect with other garden path graphics, the simplified garden path graphics are interrupted at the intersection and the garden path graphic set is updated. The number of overlaps between the endpoints of all line segments in the updated garden path graphic set and the endpoints of other line segments is determined. If the number of overlaps is 0, this endpoint is the starting point or the end point of the garden path; if the number of overlaps is 1, this endpoint is the starting point or the end point of the garden path, and the line segment connected to it is a valid segment. If the number of overlaps is greater than or equal to 2, this endpoint is a cross node.

[0054] Obtain the coordinate information of all garden path starting points, garden path end points and intersection nodes to obtain a garden path node set.

[0055] For the garden path node set, extract the road section information connected by each garden path node. If both endpoints of a road section belong to the garden path node set, then this road section is a valid road section, and obtain the graphic data of all valid road sections to obtain a valid road section set.

[0056] According to the valid road section set, the length attribute of each valid road section is extracted, and the length attribute parameter of the valid road section is obtained by calculating the Euclidean distance between the starting point coordinates and the end point coordinates of the valid road section. For the valid road section set, the width attribute of each valid road section is extracted, and the width values ​​at the starting point and the end point of the original garden path graphic corresponding to the valid road section are identified, and the average value is taken as the width attribute parameter of the valid road section. For the valid road section set, the slope attribute of each valid road section is extracted, and the elevation values ​​of the corresponding positions of the starting point and the end point of the garden path are obtained by analyzing the contour layer in the design drawing. If there is an elevation difference between the starting point and the end point of the valid road section, the slope is calculated according to the elevation difference and the horizontal distance to obtain the slope attribute parameter of the valid road section.

[0057] A garden path network topology model is constructed based on the garden path node set and the valid road segment set, as well as the length, width and slope attribute parameters of the valid road segments.

[0058] The model is represented by a directed graph, for example. The nodes in the graph correspond to garden path nodes and contain the coordinate information of the nodes. The edges in the graph correspond to valid road sections and contain the information of the connected starting and ending nodes, as well as the length, width, slope and other attributes or parameters of the road sections.

[0059] In a specific embodiment, generally, a garden landscape design drawing usually includes multiple layers, of which garden path information is an important component. By reading the drawing file through a computer-aided design software interface, the graphic data and attribute information of the garden path layer can be identified and extracted. For example, a typical garden path layer may include multiple paths composed of curves and straight lines, and each path has corresponding attributes such as width and material. It is necessary to simplify the initial garden path graphics because the original data often contains a large number of redundant nodes.

[0060] In one embodiment, simplification is performed using the Douglas-Peucker algorithm. The Douglas-Peucker algorithm is an effective line simplification method that reduces the number of nodes by recursively deleting intermediate points whose distance is less than a threshold. For example, a winding garden path originally composed of 100 points may only retain 20 key points after simplification, but still maintain the original shape characteristics.

[0061] The simplified garden path graph may have intersections, and needs to be split at the intersection. The purpose of this step is to ensure that each segment is independent, which is convenient for the subsequent construction of the network model. For example, two intersecting garden paths will be split into four independent segments at the intersection. By analyzing the connection relationship of the endpoints, the starting point, end point and intersection nodes of the garden path can be identified. These nodes constitute the skeleton of the garden path network. For example, a complex garden path system may contain 5 starting and ending points and 10 intersection nodes, and the coordinate information of these nodes is the basis for building the network model. Valid segments refer to the segments that connect two garden path nodes. Extracting the geometric and attribute information of these segments is the key to building the network model. For example, a valid segment may be 30 meters long, 2 meters wide, and have a slope of 3%. These parameters are crucial for subsequent path planning and analysis. The width and slope attributes of the segment need to be obtained through additional processing. The width can be determined by analyzing the width values ​​at the starting and ending points of the original graph, while the slope needs to be calculated in combination with the contour layer information. These attributes provide important references for the actual use of the garden path. For example, a segment with a large slope may not be suitable for the elderly or wheelchair users. The final garden path network topology model is a directed graph, in which nodes represent key points of the garden path and edges represent valid sections. This model can effectively represent the spatial structure and attribute characteristics of the garden path system. For example, in this model, the shortest path between two points can be easily calculated, or the connectivity of the entire garden path system can be analyzed. This model provides a powerful tool support for the planning, optimization and management of garden landscapes.

[0062] Step S200, designing a firefly individual coding scheme for the garden path layout problem, wherein each firefly individual represents a possible garden path layout scheme, and by encoding the garden path node coordinates and the topological connection relationship in the network topology model, a mapping relationship is established between the position of the firefly individual and the garden path spatial layout.

[0063] According to the coordinates and topological connection relationship of the garden path nodes, a firefly individual coding scheme is designed to map the firefly position with the garden path layout. Each firefly individual is represented by a set of real number codes, including the two-dimensional coordinates of the garden path nodes and the connection relationship between the nodes.

[0064] Initialize the firefly population and randomly generate a certain number of firefly individuals in the problem search space using uniform distribution. Each individual represents a garden path layout scheme. The number of individuals is set according to the problem scale and computing resources.

[0065] According to the evaluation index of the garden path layout, the fitness function of the firefly individual is constructed to calculate the fitness value of each firefly individual. The fitness function comprehensively considers factors such as the total length and connectivity of the garden path. The shorter the length and the better the connectivity, the higher the fitness value of the layout scheme. In an optional scheme, the fitness value can be calculated using a weighted summation method.

[0066] According to the fitness value of the individual fireflies, the position update formula of the firefly algorithm is used to update the position of the fireflies so that they move towards the individuals with higher fitness values ​​to achieve layout optimization.

[0067] In a preferred embodiment, a random disturbance term is introduced into the update formula to jump out of the local optimum. Specifically, the current optimal fitness value is calculated. If the optimal value does not change significantly after several consecutive iterations, or reaches a preset maximum number of iterations, the algorithm is determined to have converged and the current optimal garden path layout solution is output. Otherwise, the algorithm returns to the previous step to continue iterative optimization.

[0068] Furthermore, by encoding the coordinates of the garden path nodes and the topological connection relationship in the network topology model, a mapping relationship is established between the position of the individual fireflies and the spatial layout of the garden path.

[0069] According to the constructed network topology model, the particle swarm optimization algorithm is used to encode the position of each individual firefly into a particle. The dimension of the particle is equal to the number of garden path nodes. Each dimension indicates whether the firefly passes through the corresponding garden path node. By calculating the Euclidean distance between the particle and the node coordinates in the network topology model, the position of the particle is mapped to the corresponding node in the spatial layout of the garden path, and the actual position of the firefly on the garden path is obtained.

[0070] According to the edge information in the network topology model, it is determined whether the node sequence passed by the fireflies meets the topological connection relationship of the garden path. If not, the position of the particles is adjusted to meet the topological constraints. The position of the particles is iteratively updated through the optimization algorithm, so that the fireflies can cover as many garden path nodes as possible while satisfying the topological connection relationship, and the optimal garden path spatial layout plan is obtained.

[0071] Furthermore, according to the position information of the optimal particle, the specific path of the individual fireflies in the garden path spatial layout is determined, and each dimension of the particle is mapped to the coordinates of the corresponding node to form the trajectory of the fireflies moving on the garden path. Optionally, the movement trajectory of the fireflies is smoothed to eliminate the sharp angles and mutations caused by the node mapping, so as to obtain a more natural and continuous garden path spatial layout, and complete the establishment of the mapping relationship between the firefly position and the garden path layout.

[0072] Specifically, in a preferred embodiment, for example, a park has four scenic spots A, B, C, and D, which are connected by roads, A is connected to B and C, B is connected to C and D, and C is connected to D. Then in the network topology model, A, B, C, and D are four nodes, and the lines between them are edges, indicating that there is a direct connection relationship between the nodes.

[0073] The position of each individual firefly is encoded into a particle, and the dimension of the particle is equal to the number of garden path nodes, and each dimension indicates whether the firefly has passed the corresponding garden path node. For example, suppose a park has 5 nodes, numbered 1 to 5. The position of a particle can be represented as (1,0,1,0,1), which means that the firefly has passed through nodes 1, 3, and 5. The purpose of this is to establish a corresponding relationship between the abstract position of the firefly and the garden path node.

[0074] Euclidean distance is a common method for calculating the straight-line distance between two points. In the optimization of garden path layout, by calculating the Euclidean distance between the particle and the node coordinates in the network topology model, the position of the particle can be mapped to the corresponding node in the garden path space layout. For example, assuming that the coordinates of node A are (10,20) and the position of particle P is (11,21), then the Euclidean distance between particle P and node A is the square root of the sum of the squares of their coordinate differences. The result of the calculation is a specific value that represents the proximity between the particle and the node. By calculating the Euclidean distance between each particle and all nodes, the node closest to each particle can be found, thereby mapping the particle to a specific garden path node. The purpose of this is to convert the abstract numerical position of the particle into an actual position in the garden path space.

[0075] After mapping particles to nodes, it is also necessary to determine whether the node sequence that the firefly passes through satisfies the topological connection relationship of the garden path based on the edge information in the network topology model. For example, if a firefly particle indicates that it passes through nodes 1, 3, and 5, but there is no direct edge connection between nodes 1 and 3, then this node sequence is illegal. At this time, the position of the particle needs to be adjusted, such as replacing node 3 with node 2 connected to node 1, so that it meets the topological constraints. Doing so can ensure that the generated garden path layout plan is feasible and there will be no situation where it cannot be connected.

[0076] The particle swarm optimization algorithm iteratively updates the positions of particles so that individual fireflies can cover as many garden path nodes as possible while satisfying the topological connection relationship. For example, in each iteration, each particle will adjust its speed and position according to its own historical optimal position and the global optimal position. Assuming that the current position of a particle is (1,0,1,0,1), its historical optimal position is (1,1,1,0,0), and the global optimal position is (1,1,0,1,1), then the particle will update its position according to certain rules, taking into account these two optimal positions, for example, updating it to (1,1,1,0,1), so that more nodes may be covered.

[0077] Through continuous iteration, we can eventually find an optimal particle position so that the firefly individual covers as many garden path nodes as possible, forming a good garden path layout plan. According to the position information of the optimal particle, the specific path of the firefly individual in the garden path spatial layout can be determined. For example, if the position of the optimal particle is (1,1,0,1,1), it means that the firefly passes through nodes 1, 2, 4 and 5. By mapping each dimension of the particle to the coordinates of the corresponding node, we can get the trajectory of the firefly moving on the garden path. For example, if the coordinates of node 1 are (10,20), the coordinates of node 2 are (20,30), the coordinates of node 4 are (40,50), and the coordinates of node 5 are (50,60), then the movement trajectory of the firefly is from (10,20) to (20,30) to (40,50) and then to (50,60). In this way, the abstract particle position can be restored to a specific garden path.

[0078] Since node mapping may cause sharp angles or mutations in the path, it is preferred to smooth the movement trajectory of the fireflies. For example, methods such as curve fitting can be used to turn the original broken line path into a smooth curve, making the garden path layout more natural and beautiful. For example, the original broken line path from (10,20) to (20,30) and then to (40,50) may become a smooth arc after smoothing, eliminating sharp angles and making the garden path look smoother. This can improve the aesthetics and practicality of the garden path layout.

[0079] Step S300, according to the garden constraint conditions, using the improved firefly algorithm to optimize the garden path layout.

[0080] Among them, the basic constraints of the garden include at least one of the topography, vegetation and water system, landscape zoning, and tourist routes.

[0081] Step 301 obtains the topography, vegetation and water system, landscape division, and tourist routes of the garden as basic constraint information, and establishes a mathematical model for optimizing the layout of garden paths based on the above information, thereby converting the garden path layout problem into an optimization problem.

[0082] Constraints such as garden topography, vegetation and water system, landscape zoning and tourist routes are the basis for optimizing garden path layout. For example, in a mountain garden, the terrain is undulating, and slope and elevation changes need to be considered; the water system includes streams and lakes, and the garden paths need to arrange bridges reasonably; the landscape zoning includes gardens, bamboo forests and viewing platforms, and the garden paths should connect various scenic spots; the tourist routes need to consider the walking paths and stay time of tourists. Incorporating these factors into the mathematical model can transform the garden path layout problem into a multi-objective optimization problem.

[0083] Step 302: For important scenic spots and sightseeing nodes in the garden landscape, at least one of them can be selected as a must-go point, and it can be introduced into the firefly algorithm as an optimization constraint to further optimize the above mathematical model. In the coding of the firefly individual, the must-go points are used as fixed points to ensure that the generated garden path layout plan must pass through these points to meet the needs of sightseeing.

[0084] Step 303 uses an improved firefly algorithm to solve the garden path layout optimization problem.

[0085] In the firefly algorithm, each firefly represents a possible garden path layout plan. Through information exchange and survival of the fittest among individual fireflies, the garden path layout is continuously updated and optimized. The position encoding of each firefly contains the coordinates and connection relationships of the garden path nodes. Fireflies communicate information through brightness, and brighter fireflies attract lower brightness fireflies to move toward them. For example, a garden path layout plan with a higher fitness value indicates that the plan performs better in terms of total length, connectivity, etc., and the corresponding firefly has a higher brightness, which will attract other fireflies to move closer to it, thereby optimizing the layout plan.

[0086] The improved firefly algorithm includes adaptive adjustment of the iteration step size in the firefly algorithm and selection of a local search strategy as the search strategy. By improving in this way, the convergence speed of the algorithm and the quality of the solution can be improved by using adaptive step size adjustment and local search strategy. In addition, in the optimization and improvement, the firefly algorithm is introduced by setting the necessary points as supplementary constraints for important scenic spots and tourist nodes in the garden landscape to further optimize the accuracy and efficiency of the algorithm.

[0087] Specifically, during the iteration process of the firefly algorithm, the step size of the firefly is adaptively adjusted according to the fitness value of the current optimal solution. When the fitness value of the optimal solution is high, the step size is reduced to perform a fine search; when the fitness value of the optimal solution is low, the step size is increased to expand the search range and improve the convergence speed of the algorithm. Secondly, according to the fitness value of the current optimal solution, the step size of the firefly is adaptively adjusted. When the fitness value of the optimal solution is higher than the preset value, the step size is reduced to perform a fine search; when the fitness value of the optimal solution is lower than the preset value, the step size is increased to expand the search range;

[0088] Δs=s0·e -λt

[0089] In the formula, Δs represents the adaptive step size of the firefly algorithm, s_0 represents the initial step size, λ represents the attenuation coefficient, and t represents the current number of iterations. This formula describes the adaptive adjustment strategy of the step size in the firefly algorithm.

[0090] The adaptive step size adjustment strategy can improve the convergence efficiency of the algorithm. When the fitness value of the optimal solution is high, it means that the current solution is close to the optimal solution. At this time, the step size should be reduced for fine search. For example, when the total length of the garden path layout plan is already short and the connectivity is good, the step size can be reduced to half of the original one so that fine-tuning can be performed in a local range. On the contrary, when the fitness value of the optimal solution is low, the step size is increased to expand the search range to avoid falling into the local optimum.

[0091] In addition, preferably, in order to avoid the algorithm falling into the local optimum, a local search strategy is introduced in the iterative process of the firefly algorithm. For the current optimal solution, several new solutions are generated near it, and the fitness values ​​of these solutions are evaluated. If the new solution is better than the current optimal solution, the current optimal solution is replaced by the new solution to jump out of the local optimum.

[0092] For the current optimal garden path layout plan, several new plans can be generated near it. For example, the coordinates of the garden path nodes are slightly randomly perturbed, or the connection relationship between some nodes is changed to generate 5 new layout plans. The fitness values ​​of these new plans are evaluated, and if there is a better plan, it is used to replace the current optimal plan. The must-pass point constraint ensures that the garden path layout meets the needs of the tour. For example, in a garden, there are 3 important attractions that need to be included in the garden path system. The coordinates of these 3 attractions are used as fixed points and remain unchanged in the firefly individual coding to ensure that the generated garden path layout plan must pass through these points. This ensures that tourists can easily reach these important attractions.

[0093]

[0094] In the above formula, P(x new ) represents the probability of accepting a new solution, f(x new ) and f(x current ) represent the fitness values ​​of the new solution and the current solution respectively, and T represents the temperature parameter. This formula is used to calculate whether to accept the newly generated solution to escape from the local optimum.

[0095] In a preferred embodiment, the optimization and improvement of the firefly algorithm also includes: when the individual positions of fireflies are updated, the individuals that do not meet the must-pass point constraints are penalized to guide the population to search in the direction of feasible solutions. The must-pass point constraints are combined with the tour route generation, and the path connection relationship in the individual code is adjusted to ensure that the optimization result meets the scenic spot coverage requirements.

[0096] The penalty function is designed as: F penalty =C×(1-N covered / N required ), where C is the penalty coefficient, N covered is the number of points that the individual currently covers, N required is the total number of preset required points. The value of the penalty coefficient C is adjusted according to the degree of constraint of the problem. The stronger the constraint, the greater the penalty.

[0097] Specifically, according to the preset must-pass point constraints, it is determined whether the position of each firefly individual meets the constraint requirements. The individual position information is represented in the form of sequence coding. Each element in the code corresponds to a scenic spot, and the order of the elements represents the order of visiting the scenic spots. By analyzing the connection relationship of the scenic spots in the individual code, it is determined whether all the must-pass points are covered. If the must-pass point constraints are not met, the fitness value of the individual is penalized to reduce its probability of being selected, and guide the population to search in the direction of feasible solutions.

[0098] In the process of updating the individual position, the current individual coding information is obtained, and according to the constraint requirements of the necessary points, it is determined whether the scenic spot connection relationship in the coding covers all the necessary points. If not, one of the following two correction strategies is adopted: insertion operation, inserting the missing necessary points at the appropriate position of the individual code, and deleting some non-necessary points at the same time to ensure that the code length remains unchanged; replacement operation, replacing some non-necessary points in the individual code with the missing necessary points until the coverage requirements are met. The corrected individual code is a feasible solution that meets the constraints.

[0099] In the firefly light attraction stage, the degree of coverage of the individual's must-pass points is calculated based on the order of scenic spots in the individual's current code.

[0100] In a preferred embodiment, in order to further improve the search efficiency of the algorithm, a taboo search strategy can also be used to optimize the individual position update process. The scenic spot connection relationships that do not meet the must-go point constraints are added to the taboo table to avoid repeated visits to these invalid solutions in subsequent searches. The taboo table records a certain number of invalid connection relationships and is updated according to the first-in-first-out principle. At the same time, combined with the problem domain knowledge, the recommended tour order between the must-go points is pre-constructed and used as the optimized prior information to guide the generation of scenic spot connection relationships in the individual encoding, thereby reducing the search space and improving the quality of the solution and the convergence speed of the algorithm.

[0101] Step S400: When the algorithm converges or reaches the preset maximum number of iterations, the garden path layout plan corresponding to the current optimal firefly individual is output, which includes the optimized garden path node coordinates, the road segment connection relationship and the attribute parameters of each road segment.

[0102] According to the maximum number of iterations of the firefly algorithm, it is judged whether the current algorithm has converged or reached the maximum number of iterations. If so, the garden path layout plan corresponding to the current optimal firefly individual is obtained, and the node coordinates, road section connection relationship and road section attribute parameters are extracted; otherwise, iterative optimization is continued until the convergence condition is met or the maximum number of iterations is reached.

[0103] Using the extracted node coordinate data, a drawing software such as AutoCAD is used to generate a two-dimensional plan of the garden path layout according to the node coordinate position. By analyzing the connection relationship of the road sections, a graph theory algorithm such as depth-first search or breadth-first search is used to determine whether the generated garden path plan is a connected graph, that is, whether the topological structure of the garden path meets the preset connectivity requirements. If not, return to the previous step, adjust the node coordinates and connection relationship, and regenerate the plan until the connectivity requirements are met.

[0104] According to the extracted road section attribute parameters, 3D modeling software such as 3ds Max is used to perform 3D modeling on each road section based on the generated 2D plane map. According to the width parameter of the road section, a 3D road surface of the corresponding width is stretched out at the position of the corresponding road section on the plane map; according to the height parameter of the road section, the relative height of the road surface is determined; according to the road surface material parameter, the corresponding material map is applied to the 3D model. The generated 2D plane map of the garden path is imported into the 3D modeling software, and the spatial position is matched and aligned with the built 3D model so that the two correspond correctly in the spatial coordinate system. Then, the attribute data such as the map and material of the 3D model are copied to the corresponding 2D plane map so that the plane map also has the corresponding material expression. Finally, the fused 2D plane map and 3D model data are output together to obtain a complete garden path layout plan, including node coordinates, road section connection relationship, road section attribute parameters, and visualized 2D plane map and 3D model for subsequent landscape design and construction reference.

[0105] Another embodiment of the present application provides a garden path planning device based on the firefly algorithm, comprising:

[0106] A model building module, which is configured to obtain garden landscape design drawings, extract spatial coordinate information of garden path nodes and sections, and build a garden path network topology model;

[0107] A coding module is configured to design a coding scheme for individual fireflies, and to establish a mapping relationship between the positions of individual fireflies and the spatial layout of the garden paths by encoding the coordinates of the garden path nodes and the topological connection relationship in the network topology model;

[0108] The solution module is configured to use the improved firefly algorithm to optimize the layout of garden paths according to the topography, vegetation and water system of the garden, landscape zoning, and garden movement line constraints; when the individual positions of fireflies are updated, the individuals that do not meet the constraints of the necessary points are punished, and the population is guided to search in the direction of feasible solutions, and the constraints of the necessary points are combined with the generation of garden paths. By adjusting the path connection relationship in the individual code, it is ensured that the optimization result meets the requirements of scenic spot coverage;.

[0109] The output module is configured to output the garden path layout plan corresponding to the current optimal firefly individual when the algorithm converges or reaches a preset maximum number of iterations.

[0110] Yet another embodiment of the present application provides a computer device, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of the method described in any one of claims 1 to 6.

[0111] Another embodiment of the present application provides a computer-readable storage medium, characterized in that it stores a computer program executable by an access authentication device, and when the computer program is run on the access authentication device, the access authentication device executes the steps of the above method. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0112] Another embodiment of the present application provides a computer program product, including a computer program, characterized in that the steps of the above method are implemented when the computer program is executed by a processor.

[0113] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0114] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0115] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0116] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0117] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0118] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program code.

[0119] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0120] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0122] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A garden path planning method based on an improved firefly algorithm, characterized in that: include: Obtain garden landscape design drawings, extract spatial coordinate information of garden path nodes and sections, and construct a garden path network topology model; Design a coding scheme for fireflies, and establish a mapping relationship between the location of fireflies and the spatial layout of garden paths by encoding the coordinates of garden path nodes and the topological connection relationship in the network topology model; According to the topography, vegetation and water system of the garden, landscape division and garden movement line constraints, the improved firefly algorithm is used to optimize the layout of the garden path. In the improved firefly algorithm, when the position of the firefly individual is updated, the individual that does not meet the constraint of the necessary point is punished, and the population is guided to search in the direction of feasible solutions. The constraint of the necessary point is combined with the generation of the garden path, and the path connection relationship in the individual code is adjusted to ensure that the optimization result meets the requirements of scenic spot coverage. When the algorithm converges or reaches the preset maximum number of iterations, the garden path layout plan corresponding to the current optimal firefly individual is output.

2. The garden path planning method according to claim 1, characterized in that: The construction of the garden path network topology model comprises: Read the garden landscape design drawing file, identify and parse all layers containing garden path information in the drawing, obtain the graphic data and attribute information of all garden path objects, and obtain the initial garden path graphic set; According to the initial garden path graph set, the garden path graph is simplified, and redundant nodes in the graph data are removed to obtain a simplified garden path graph set; According to the simplified garden path graph set, the garden path node and section information is extracted to construct the garden path network topology model.

3. The garden path planning method according to claim 1, characterized in that: The firefly individual coding scheme is designed to include: Using real number coding, each firefly individual is represented by a set of real number codes, which include the two-dimensional coordinates of the garden path nodes and the connection relationship between the nodes; Initialize the firefly population and randomly generate a certain number of firefly individuals using uniform distribution in the problem search space. Each individual represents a garden path layout plan. The individual fitness function of fireflies is constructed based on the evaluation indicators of garden path layout.

4. The garden path planning method according to claim 1, characterized in that: The method of optimizing the garden path layout by using the improved firefly algorithm includes: Obtain the basic constraint information of the garden, including topography, vegetation and water system, landscape division and tourist routes, and establish a mathematical model for optimizing the layout of garden paths; For important scenic spots and tourist nodes in the garden landscape, at least one of them is selected and set as a must-go point as an optimization constraint condition to optimize the mathematical model; An improved firefly algorithm is used to solve the above-mentioned optimized mathematical model, including: adaptively adjusting the step size of the firefly according to the fitness value of the current optimal solution, reducing the step size for fine search when the fitness value of the optimal solution is higher than a preset value, and increasing the step size to expand the search range when the fitness value of the optimal solution is lower than a preset value; introducing a local search strategy, generating several new solutions near the current optimal solution, and evaluating the fitness values ​​of the several new solutions, if the new solution is better than the current optimal solution, replacing the current optimal solution with the new solution to jump out of the local optimum.

5. The garden path planning method according to claim 4, characterized in that: When the individual positions of fireflies are updated, the individuals that do not meet the constraints of the necessary points are punished, specifically including: According to the preset must-pass point constraint conditions, determine whether the position of each firefly individual meets the constraint requirements. If it does not meet the must-pass point constraint, the fitness value of the individual is penalized to reduce its probability of being selected; In the process of updating individual positions, the coding information of the current individual is obtained. According to the constraint requirements of the necessary points, it is determined whether the scenic spot connection relationship in the coding covers all the necessary points. If not, the individual coding is corrected by insertion or replacement operation to obtain a feasible solution that meets the constraint conditions.

6. The garden path planning method according to claim 1, characterized in that: The outputting of the garden path layout plan corresponding to the current optimal firefly individual specifically includes: Extract node coordinates, link connection relations and link attribute parameters in the optimal individual; Generate a two-dimensional plan of the garden path layout based on the node coordinates, and perform three-dimensional modeling on each section based on the section attribute parameters; The generated two-dimensional plan is spatially matched with the three-dimensional model to output the garden path layout plan, including node coordinates, section connection relationships, section attribute parameters, and visualized two-dimensional plan and three-dimensional model.

7. A garden path planning device based on firefly algorithm, characterized in that: include: A model building module, which is configured to obtain garden landscape design drawings, extract spatial coordinate information of garden path nodes and sections, and build a garden path network topology model; A coding module is configured to design a coding scheme for individual fireflies, and to establish a mapping relationship between the positions of individual fireflies and the spatial layout of the garden paths by encoding the coordinates of the garden path nodes and the topological connection relationship in the network topology model; A solution module is configured to use an improved firefly algorithm to optimize the layout of garden paths according to the topography, vegetation and water system, landscape division and garden movement line constraints of the garden; when the individual positions of fireflies are updated, the individuals that do not meet the constraints of the necessary points are punished, and the population is guided to search in the direction of feasible solutions, and the constraints of the necessary points are combined with the generation of garden paths. By adjusting the path connection relationship in the individual code, it is ensured that the optimization result meets the requirements of scenic spot coverage; The output module is configured to output the garden path layout plan corresponding to the current optimal firefly individual when the algorithm converges or reaches a preset maximum number of iterations.

8. A computer device, characterized in that: The method comprises at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: It stores a computer program executable by an access authentication device. When the computer program runs on the access authentication device, the access authentication device executes the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Robot path planning method based on improved multi-target firefly algorithm

    CN109297498A

  • Path planning method, device and equipment and storage medium

    CN112731961A

  • Landscape garden design method

    CN114528621A

  • Path planning method based on fusion of improved firefly algorithm and dynamic window method

    CN115129064A

  • Optimal path planning for a navigation system for mobile robots

    DE202023104093U1