Intelligent path planning method and system based on large language model

By building a multi-level collaborative optimization framework and genetic algorithm based on a large language model and combining it with the MCP protocol, we have achieved intelligent transformation from natural language to mathematical models and algorithms, solving the problems of reliance on expert knowledge and insufficient adaptability in path planning, and improving the efficiency and flexibility of path planning.

CN120450571BActive Publication Date: 2025-09-12HEFEI UNIV OF TECH

Patent Information

Application Number
CN202510956238.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-11
Publication Date
2025-09-12
Estimated Expiration
2045-07-11

AI Technical Summary

Technical Problem

Existing path planning technologies are highly dependent on expert knowledge and lack adaptability, making it difficult to achieve efficient and flexible path optimization in complex environments.

Method used

A multi-level collaborative optimization framework based on a large language model is constructed, combining genetic algorithms and the Model Context Protocol (MCP) to achieve intelligent transformation from natural language descriptions to mathematical models and algorithms, and automatically process takeout delivery route planning through a self-correction mechanism.

Benefits of technology

It improves the scenario adaptability and decision-making efficiency of path planning, can provide optimized solutions in dynamically changing environments, and improve resource utilization and cost-effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120450571B_ABST
    Figure CN120450571B_ABST
Patent Text Reader

Abstract

The present invention provides an intelligent path planning method and system based on a large language model, which relates to the field of path planning. In the present invention, a multi-level collaborative optimization framework based on LLM optimizes the original mathematical model and algorithm strategy for the new requirements described in natural language by integrating the semantic understanding ability of LLM, and realizes that on the basis of the first mathematical model and the first genetic algorithm that have been constructed, the optimized second mathematical model and the second genetic algorithm are generated in combination with the new requirements of the changes. This can not only overcome the expressive limitations of engineering modeling directly using LLM prompts and the insufficient domain adaptability of generating metaheuristic algorithms, but also improve the adaptability of traditional frameworks to scenarios. In addition, a code agent based on MCP is constructed, and its hierarchical and progressive self-correction mechanism is combined with the standardized scheduling of the MCP protocol to achieve all-round automated processing from surface code errors to deep mathematical model problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of path planning, and in particular to an intelligent path planning method and system based on a large language model. Background Art

[0002] As one of the important applications in the field of artificial intelligence, path planning is of great significance for realizing intelligent transportation systems and logistics distribution.

[0003] Traditional mathematical models and solution frameworks for path planning problems rely heavily on expert knowledge and have limited adaptability to changing requirements. This often requires manual adjustments by experts to the model architecture and solution strategy to meet new requirements. To address this, research has proposed using large language models (LLMs) to improve the intelligence of path planning solutions. For example, the paper (Liu F, Tong X, Yuan M, et al. Evolution of heuristics: Towards efficient automatic algorithm design using large language model[J]. arXiv preprint arXiv:2401.02051, 2024.) proposes a heuristic evolution approach that utilizes LLMs and evolutionary computation methods to automatically design heuristics. Heuristic evolution expresses heuristic ideas in natural language, which are then translated into executable code by the LLM. This approach enables the automated design of heuristic methods with minimal manual design and without the need for domain model training. For example, the paper (Ahmed T, Choudhury S. LM4OPT: Unveiling the potential of Large Language Models in formulating mathematical optimization problems[J]. INFOR: Information Systems and Operational Research, 2024, 62(4): 559-572.) explores a generative task in the field of natural language processing, focusing on generating mathematical formulas for optimization problems from text descriptions. It uses the LM4OPT framework to fine-tune smaller models to improve the performance of mathematically expressing optimization problems using natural language descriptions.

[0004] However, on the one hand, there are expressive limitations in directly using LLM to prompt word engineering modeling. This expressive limitation makes it difficult for LLM to fully understand the implicit relationship between constraints and cannot achieve the accuracy of traditional mathematical optimization modeling. On the other hand, directly using large language models to generate metaheuristic algorithms has insufficient domain adaptability and cannot compete with professional algorithms that have undergone years of iterative optimization. The defects are especially obvious in complex environments where real-time decision-making and changes in external demand need to be considered. Summary of the Invention

[0005] (1) Technical problems solved

[0006] In response to the shortcomings of the existing technology, the present invention provides an intelligent path planning method and system based on a large language model, which solves the technical problem of how to deal with the dynamic, large-scale and uncertain challenges of combinatorial optimization problems in real scenarios.

[0007] (2) Technical solution

[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0009] An intelligent path planning method based on a large language model, comprising:

[0010] For the takeaway delivery route planning problem, a first mathematical model is constructed and a first genetic algorithm is designed to solve the model;

[0011] Obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and their complete codes;

[0012] Based on a pre-built MCP-based code agent, the code is automatically executed. When an abnormality in the code operation is detected, a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model is automatically called to ultimately output an optimal solution for food delivery route planning that meets the new requirements.

[0013] Preferably, the first mathematical model is a mixed integer programming model, including a first objective function and a first constraint; wherein the optimization goal of the first objective function is to minimize the total cost, and the total cost is composed of the total travel time cost, early arrival penalty cost, late penalty cost, cluster splitting penalty, capacity overload penalty and path familiarity reward, and the first constraint includes order allocation constraint, path continuity constraint, rider capacity constraint and time sequence constraint.

[0014] Preferably, the first genetic algorithm is a two-layer genetic optimization algorithm, including an outer genetic algorithm and an inner genetic algorithm; wherein the outer genetic algorithm is used for global search of order clustering and rider allocation, and the inner genetic algorithm is used for path planning for each rider's order set.

[0015] Preferably, the LLM-based multi-level collaborative optimization framework includes:

[0016] The deep model analysis and demand understanding layer is used to parse the mathematical expression of the first objective function, evaluate the completeness of the first constraint condition, identify the two-layer genetic characteristics of the algorithm framework of the first genetic algorithm, and, based on the results of the first three analyses, deeply analyze the changes in the new requirements and analyze the optimization potential, and output the problem analysis results in standard JSON format;

[0017] An optimization and reconstruction layer based on an existing mathematical model, configured to integrate the mathematical expression of the new requirement based on the problem analysis results and the first objective function, improve the first constraint conditions, and expand decision variables to output the mathematical reconstruction results in a standard JSON format;

[0018] An algorithm strategy adaptation layer, configured to design a genetic strategy for the model reconstruction result based on the problem analysis result and the mathematical reconstruction result, using the first genetic algorithm as a basis, and improving initialization, selection, crossover, and mutation strategies to output an algorithm upgrade plan in a standard JSON format;

[0019] A complete solution generation layer is used to transform and adjust the first mathematical model, the first genetic algorithm and the original codes of the two based on the mathematical reconstruction results and the algorithm upgrade plan, so as to output the second mathematical model, the second genetic algorithm and the complete codes of the two in standard JSON format.

[0020] Preferably, based on the MCP-based code agent, the communication mechanism of the entire system includes:

[0021] User request phase: receiving new requirements or code-related requests submitted by users to the system;

[0022] In the code agent processing phase, after receiving the user request, it is responsible for understanding the user's intention and determining the various execution tools that need to be called during the entire execution process;

[0023] MCP protocol conversion: encapsulating the user request into a unified message format through the MCP protocol to achieve message encapsulation, interface adaptation, call distribution and status management;

[0024] During the tool execution phase, standardization requests are distributed to the most suitable execution tools through the MCP protocol.

[0025] Preferably, the workflow of the MCP-based code agent specifically includes:

[0026] After receiving the user request, obtaining the code output by the LLM-based multi-level collaborative optimization framework;

[0027] Put the code into the sandbox and execute it using the execution tool to determine whether the execution is successful. If successful, output the optimal solution for the takeaway delivery route planning that meets the new requirements, including the order allocation result and the shortest delivery route; otherwise

[0028] If execution errors occur continuously for less than a preset number of times, the self-correction mechanism is invoked, and the code correction tool is used to analyze the error information of the code, output the error solution, correct the code, and execute the corrected code again in the sandbox. If successful, the optimal solution for the takeaway delivery route planning is output;

[0029] If a preset number of execution errors occur consecutively, the self-verification mechanism is called, and a mathematical verification tool is used to recheck to determine the logical correctness and implementation deviation of the mathematical reconstruction result. Based on the inspection result, the optimized code is regenerated and put into the sandbox again for execution. If successful, the optimal solution for the takeaway delivery route planning is output.

[0030] An intelligent path planning system based on a large language model, comprising:

[0031] A mathematical modeling and algorithm solving module is used to construct a first mathematical model and design a first genetic algorithm for solving the takeaway delivery route planning problem;

[0032] An intelligent optimization module is used to obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in a standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and the complete code of both;

[0033] The standardized execution module is used to automatically execute the code based on a pre-built MCP-based code agent, and when an abnormality in the code operation is detected, automatically call a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model to ultimately output an optimal solution for food delivery route planning that meets the new requirements.

[0034] A storage medium stores a computer program for intelligent path planning based on a large language model, wherein the computer program enables a computer to execute the intelligent path planning method described above.

[0035] An electronic device, comprising:

[0036] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including a method for executing the intelligent path planning method as described above.

[0037] (3) Beneficial effects

[0038] The present invention provides an intelligent path planning method and system based on a large language model. Compared with the existing technology, it has the following advantages:

[0039] In this invention, a multi-level collaborative optimization framework based on LLM optimizes the existing mathematical model and algorithm strategy based on new requirements described in natural language by integrating LLM's semantic understanding capabilities. This framework generates an optimized second mathematical model and second genetic algorithm based on the existing first mathematical model and first genetic algorithm, combined with the new requirements. This framework overcomes the expressive limitations of engineering modeling directly using LLM prompts and the lack of domain adaptability of the generated metaheuristic algorithm, while also improving the adaptability of traditional frameworks to different scenarios. Furthermore, an MCP-based code agent is constructed, whose hierarchical and progressive self-correction mechanism, combined with the standardized scheduling of the MCP protocol, enables comprehensive automated processing from surface-level code errors to deep-level mathematical model problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A block diagram of an intelligent path planning method based on a large language model provided by an embodiment of the present invention;

[0042] Figure 2 A flow chart of an inner and outer layer genetic algorithm provided by an embodiment of the present invention;

[0043] Figure 3 A workflow diagram of a multi-level collaborative optimization framework based on LLM provided in an embodiment of the present invention;

[0044] Figure 4 A flowchart of a code proxy based on MCP is provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0046] The embodiments of the present application solve the technical problem of how to cope with the dynamic, large-scale and uncertain challenges of combinatorial optimization problems in real scenarios by proposing an intelligent path planning method and system based on a large language model.

[0047] The technical solution in the embodiments of the present application is to solve the above technical problems, and the overall idea is as follows:

[0048] On the one hand, the complex dynamics of the real world dictate that optimization problems involve multidimensional decision variables and their nonlinear interactions, and textual prompts struggle to effectively capture the full picture of these relationships. As the decision space expands and the number of variables increases, the complexity of prompts grows exponentially, leading to limited context windows and fragmented attention mechanisms, significantly reducing the reasoning power and solution quality of LLMs. These expressive limitations make it difficult for LLMs to fully understand the implicit connections between constraints, failing to achieve the precision of traditional mathematical optimization modeling.

[0049] On the other hand, the metaheuristic algorithm is directly generated through LLM. Since the takeout delivery path planning problem that the embodiment of the present invention focuses on has highly domain-specific characteristics, involves a large amount of structured data and specific rules, and needs to process large-scale structured data, multi-level constraints and dynamic environmental variables, the algorithm designed for a specific scenario using LLM may not be able to match the professional algorithm that has undergone years of iterative optimization in terms of solving ability, computational efficiency and robustness. The defects are more obvious in complex environments where real-time decision-making and external demand changes need to be considered.

[0050] In addition, traditional mathematical models and solution frameworks have limited adaptability to new demands, and experts are usually required to manually adjust the model architecture and solution strategy to meet new demands.

[0051] To address the dynamic, large-scale, and uncertain challenges of combinatorial optimization problems in real-world scenarios, an embodiment of the present invention constructs a multi-level collaborative optimization framework. By integrating the semantic understanding capabilities of large-scale language models, the precise solution capabilities of traditional algorithms, and the standardized implementation capabilities of the Model Context Protocol (MCP), it can handle external changes and adaptively adjust, helping enterprises improve their agile response and strategic decision-making efficiency in dynamically changing environments. This method first constructs a mixed integer optimization model and designs a two-layer genetic optimization algorithm for solution. Secondly, a multi-level collaborative optimization framework based on LLM is constructed to achieve intelligent transformation from natural language to dynamic reconstruction of mathematical models and algorithms. Based on the first-level mathematical model and solution algorithm, the original mathematical model and algorithm are optimized in combination with new requirements. Finally, the MCP engineering framework is used to implement the complete process of automated code execution, correction, and ultimately returning the optimal solution.

[0052] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.

[0053] Example 1:

[0054] like Figure 1 As shown, an embodiment of the present invention provides an intelligent path planning method based on a large language model, including:

[0055] S1. Constructing a first mathematical model and designing a first genetic algorithm for solving a takeout delivery route planning problem;

[0056] S2. Obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and their complete codes;

[0057] S3. Based on the pre-built MCP-based code agent, the code is automatically executed. When an abnormality in the code operation is detected, a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model is automatically called to ultimately output an optimal solution for food delivery route planning that meets the new requirements.

[0058] The embodiment of the present invention not only retains the analytical reasoning capabilities of LLM, but also ensures the quality of solution through professional mathematical models and algorithm frameworks. It significantly improves resource utilization and cost-effectiveness in large-scale, multi-constrained, and dynamically changing enterprise scenarios, completes the transition from surface phenomena to essential insights, and realizes a complete intelligent optimization process with standardized and executable decision-making, helping enterprises effectively respond to changes in the external environment and continuously optimize business operations.

[0059] The following sections describe the various steps of the above solution in detail:

[0060] In step S1, for the takeaway delivery route planning problem, a first mathematical model is constructed and a first genetic algorithm for solving the model is designed.

[0061] In this step, the food delivery route planning problem is abstracted into a mixed integer programming model. That is, the first mathematical model is a mixed integer programming model, including a first objective function and a first constraint. The optimization goal of the first objective function is to minimize the total cost, which is composed of the total travel time cost, early arrival penalty cost, late arrival penalty cost, cluster splitting penalty, capacity overload penalty, and route familiarity reward. The first constraint includes order allocation constraint, route continuity constraint, rider capacity constraint, and time sequence constraint.

[0062] Exemplarily, a feasible first mathematical model is provided here as follows:

[0063] The first objective function:

[0064]

[0065] Among them, min is the minimization function; Z is the total cost; Assemble for the riders; is a set of orders (each order corresponds to a pickup point and a delivery point); is the set of order clusters; The set of all nodes.

[0066] Z1 is the total travel time cost; α is the unit time cost coefficient; Decision variable for path selection (1 means rider j goes from node i to node k, 0 means not to take this path); is the distance from node i to node k (unit: kilometers); is the basic speed of rider j (unit: km / h); is the maximum improvement ratio of familiarity to speed (e.g. 0.3 means a 30% improvement in speed); is rider j’s familiarity with route (i, k) (1 indicates complete familiarity). This is the total time cost for all riders to complete a delivery, taking into account the speed boost brought by the rider’s familiarity with the route.

[0067] Z2 is the penalty cost for early arrival; β is the penalty coefficient for early arrival; E h is the early arrival time of order h (unit: hour).

[0068] Z3 is the delay penalty cost; γ is the delay penalty coefficient; D h is the delay time of order h (unit: hour), that is, the penalty cost for exceeding the promised delivery time, which affects customer satisfaction and platform reputation.

[0069] Z4 cluster split penalty; δ is the cluster split penalty coefficient; Is the decision variable, representing the cluster group Is there an order assigned to rider j? That is, orders within the same cluster are best delivered by the same rider; splitting up will reduce efficiency; the penalty is proportional to the square of the number of participating riders.

[0070] Z5 is the capacity overload penalty; is the capacity overload penalty coefficient; is the maximum cargo capacity of rider j; is the real-time cargo capacity of rider j at node i. This penalty for exceeding the rider’s loading capacity is proportional to the square of the overload capacity, ensuring practical feasibility.

[0071] Z6 is the route familiarity bonus; ω is the familiarity bonus coefficient. That is, the more familiar the route is to the rider, the easier it is to deliver efficiently. This bonus is deducted from the total cost.

[0072] The first constraint is:

[0073] (1) Allocation constraints:

[0074]

[0075] in, is a decision variable, an indicator variable indicating whether order h is assigned to rider j (1 if the order is assigned to rider j; otherwise, 0); the purpose of this constraint is to ensure that each order is uniquely assigned.

[0076] (2) Path continuity constraint:

[0077]

[0078] The purpose of this constraint is to ensure the path continuity of each rider.

[0079] (3) Capacity constraints:

[0080]

[0081] in, is the order quantity at node i (positive for pickup and negative for delivery). The purpose of this constraint is to ensure that during the delivery process, the order load of the rider at any node must be non-negative and does not exceed the capacity limit.

[0082] (4) Time sequence constraints:

[0083]

[0084] If rider j goes directly from node i to node k, it takes time t to reach node k kj This constraint must be satisfied. ij is the time to reach node i; s i is the service time at node i; This constraint is used to ensure the order of pickup and delivery, ensuring that the pickup is done before the delivery.

[0085] Furthermore, to solve the first mathematical model, a two-layer genetic algorithm structure was designed in this step. That is, the first genetic algorithm is a two-layer genetic optimization algorithm, comprising an outer genetic algorithm and an inner genetic algorithm. The outer genetic algorithm is used for global search of order clustering and rider assignment, while the inner genetic algorithm is used for path planning for each rider's order set, thereby achieving layer-by-layer optimization from coarse-grained to fine-grained.

[0086] For example, in order to solve the above given model example, a feasible two-layer genetic algorithm is provided here:

[0087] The outer genetic algorithm is responsible for assigning orders to riders: Each chromosome in the outer genetic algorithm represents a specific order assignment scheme. The population of order assignment schemes is initialized by combining a heuristic (order clusters are assigned to the nearest, least loaded rider) and a randomized approach. Tournament selection is used to screen for superior assignments. A crossover operation (single-point crossover) combines parent assignments. Mutation involves randomly reallocating a small number of orders and a local improvement strategy (trying to assign the worst rider's orders to a better rider).

[0088] Fitness function of the outer genetic algorithm Evaluate the quality of the order-rider allocation plan:

[0089]

[0090] It should be noted that the above outer fitness function evaluates the quality of the overall order allocation plan.

[0091] The inner genetic algorithm optimizes the routes for each rider's order set, as determined by the outer layer. Each path chromosome in the inner genetic algorithm represents a specific rider's route. Its population initialization utilizes a combination of strategies, including a quasi-nearest neighbor heuristic, a simple ordering heuristic (merchant order followed by customer order), and a randomized approach. A proportional allocation strategy is used, ensuring legal permutations of pickup before delivery and load constraints. Tournament selection is used, and partial matching crossover (PMX) is used for crossover to maintain route legitimacy. Mutations include swap mutations (exchanging two nodes in a route) and reversal mutations (reversing a subsegment in a route).

[0092] Inner fitness function For path optimization evaluation:

[0093]

[0094] It should be noted that the above inner fitness function evaluates the quality of a single rider's path, and the smaller the value, the better the path.

[0095] like Figure 2 As shown in Figure 2, the specific optimization process of the inner and outer layer genetic algorithm is as follows:

[0096] First, the initial order allocation population is generated based on the clustering results, and then the order allocation population is initialized, and the algebraic counter of the outer genetic algorithm is set to 0.

[0097] Entering the iterative process of the outer genetic algorithm, the fitness values ​​of all individuals in the population are calculated in each generation, and then individuals with high fitness are selected for crossover and mutation operations to generate offspring and combine them with the parent generation to form a new population.

[0098] Check whether the maximum number of generations has been reached. If not, increase the number of generations by 1 and continue iterating. If the maximum number of generations has been reached, enter the inner optimization. For the optimal order allocation solution obtained by the outer genetic algorithm, it is necessary to run the inner genetic algorithm for each rider to optimize the delivery route.

[0099] The inner algorithm also starts by initializing the path population, setting the inner generation counter to 0, and then entering the iterative process. In each generation, the fitness of the path population is calculated, and excellent individuals are selected for crossover and mutation operations to generate a new population.

[0100] Check whether the convergence conditions of path optimization are met. If not, continue to iterate. If the maximum number of generations is reached, output the optimal delivery path for the rider.

[0101] When all riders' paths are optimized, the final order allocation results and the shortest delivery path for each rider are output, and the algorithm ends.

[0102] It can be understood that the optimization framework combining the mixed integer optimization model and the two-layer genetic algorithm designed in the embodiment of the present invention takes into account the high specificity of the food delivery scenario and ensures the ability to accurately solve problems in complex environments.

[0103] In step S2, new requirements described in natural language are obtained, and based on the pre-built LLM-based multi-level collaborative optimization framework, the first mathematical model and the first genetic algorithm are optimized and reconstructed, and output in standard JSON format at each level to obtain the converted second mathematical model, the second genetic algorithm and the complete codes of the two.

[0104] This step constructs a multi-level collaborative optimization framework based on the Large Language Model (LLM). Based on the first objective function and first genetic algorithm constructed in step S1, this framework, through specialized hierarchical design and structured information transfer, guides the LLM to intelligently transform external changes described in natural language (such as changes in the external environment and new business requirements) into fully optimized mathematical models and algorithms. The framework adopts a hierarchical design, with each layer having specialized roles and responsibilities. Standard JSON output ensures information integrity and structured transfer.

[0105] In summary, if Figure 3 As shown, the LLM-based multi-level collaborative optimization framework includes:

[0106] The first layer (experts in business requirements analysis, mathematical models, and algorithm architecture analysis): This layer is used for deep model analysis and requirements understanding. It is responsible for parsing the mathematical expression of the first objective function, evaluating the completeness of the first constraint, identifying the dual-layer genetic characteristics of the algorithm framework of the first genetic algorithm, and, based on the results of the first three analyses, conducting in-depth analysis of changes in the new requirements and analyzing optimization potential, ultimately outputting problem analysis results in standard JSON format.

[0107] The second layer (mathematical modeling and optimization theory experts): an optimization reconstruction layer based on existing mathematical models, used to integrate the mathematical expression of the new requirements based on the problem analysis results and the first objective function, improve the first constraint conditions, and expand the decision variables to output the mathematical reconstruction results in a standard JSON format;

[0108] The third layer (algorithm design and intelligent optimization experts): the algorithm strategy adaptation layer is used to design a genetic strategy for the model reconstruction results based on the problem analysis results and the mathematical reconstruction results, using the first genetic algorithm as the basis, and improving the initialization, selection, crossover, and mutation strategies to output the algorithm upgrade plan in standard JSON format;

[0109] The fourth layer (code generation expert): a complete solution generation layer, which is used to transform and adjust the first mathematical model, the first genetic algorithm, and the original codes of the two based on the mathematical reconstruction results and the algorithm upgrade plan, so as to output the second mathematical model, the second genetic algorithm, and the complete codes of the two in a standard JSON format.

[0110] Specifically:

[0111] The first layer: deep model analysis and demand understanding

[0112] Core function: Diagnose existing model capabilities and demand gaps

[0113] Input: First mathematical model + First genetic algorithm code + New requirements

[0114] Key points of processing: 1) Analyze the mathematical expression of the objective function of the first mathematical model; 2) Evaluate the completeness of the constraints of the first mathematical model (allocation, path, time, capacity, logic); 3) Identify the two-layer genetic characteristics of the algorithm framework (outer layer allocation + inner layer path); 4) Based on the results of the first three analyses, conduct an in-depth analysis of demand changes and analyze the optimization potential.

[0115] Still continuing with the model and algorithm example in step S1, here is a feasible prompt word as the first layer input:

[0116] “#RoleDefinition

[0117] You are an expert in business needs analysis and mathematical model and algorithm architecture analysis. Your professional analysis tasks are:

[0118] ##{model_analysis}: Input the original mathematical model and the inner and outer genetic algorithms (i.e., the mathematical model and inner and outer genetic algorithms constructed in the first module), and analyze the mathematical expression of the objective function based on this input; evaluate the integrity of the constraints (allocation, path, time, capacity, logic); and identify the two-layer genetic characteristics of the algorithm framework (outer layer allocation + inner layer path)

[0119] ##{user_input}: User enters new requirement description

[0120] For example, we need to consider the official launch of the "anti-fatigue mechanism". If a "rider" is online for 4 consecutive hours to take orders, he will be reminded to take a 20-minute break.

[0121] Based on the above detailed analysis of existing models, please conduct the following in-depth analysis: ##1. Mathematical model evaluation: - Analyze the rationality of the mathematical structure of the objective function - Evaluate the integrity and consistency of the constraint system - Identify the advantages and theoretical basis of the mathematical model ##2. Algorithm architecture evaluation: - Analyze the design rationality of the multi-layer algorithm - Evaluate the effectiveness of the genetic algorithm components - Identify the technical advantages of the algorithm implementation ##3. In-depth analysis of demand changes: - The impact of new demands on the mathematical model - The challenges of new demands on the algorithm structure - The mathematical theoretical basis of the optimization direction ##4. Optimization potential analysis: - Room for improvement in the mathematical model - Potential for improving the efficiency of the algorithm - Opportunities for optimization of the implementation technology

[0122] Please ensure the professionalism and depth of your analysis, paying particular attention to the theoretical correctness of the mathematical model and the technological advancement of the algorithm implementation."

[0123] At the same time, since the LLM-based multi-level collaborative optimization framework outputs data in the standard JSON format, the following format constraints are also imposed on the output of the first layer:

[0124] "Please return the professional analysis results in the following JSON format: ```json{{"mathematical_model_evaluation": {{

[0125] "objective_function_analysis": {{"structure_rationality": "Evaluate the rationality of the objective function structure","multi_objective_balance": "Multi-objective balance analysis","mathematical_foundation": "Mathematical theoretical foundation","optimization_direction": "Mathematical basis for optimization direction"}},"constraint_system_analysis": {{"completeness_assessment": "Constraint system completeness","consistency_check": "Constraint consistency check","mathematical_correctness": "Mathematical correctness","practical_feasibility": "Practical feasibility"}},}},"algorithm_architecture_evaluation": {{"multi_layer_design": {{"layer_separation_rationality": "Rationality of layer separation","inter_layer_coordination": "Inter-layer coordination mechanism","optimization_efficiency": "Optimization efficiency analysis"}},"genetic_algorithm_components": {{"chromosome_design": "Chromosome design evaluation","operator_effectiveness": "Genetic operation effectiveness","fitness_function_design": "Fitness function design"}},"implementation_strengths": ["Technical advantages of algorithm implementation"],"architectural_advantages": ["Architectural design advantages"]}},"requirement_change_analysis": {{"mathematical_impacts": {{"objective_function_changes": "Objective function change requirements","constraint_modifications": "Constraint modification requirements","variable_extensions": "Variable extension requirements"}},"critical_gaps": ["Critical gap analysis"],"adaptation_priorities": ["Adaptation priorities"]}},"optimization_potential_analysis": {{"mathematical_improvements": {{"objective_function_enhancements": "Objective function optimization potential","constraint_system_optimization": "Constraint system optimization potential","model_generalization": "Model generalization potential"}},"algorithmic_enhancements": {{"efficiency_improvements": "Efficiency improvement potential","convergence_optimization": "Convergence optimization potential","parallelization_opportunities": "Parallelization opportunities"}},}}”,

[0126] After setting the above input and output format restrictions, the corresponding output results of the first layer are:

[0127] ""layer_1_result": {"mathematical_model_evaluation": {"objective_function_analysis": {"structure_rationality": "The objective function has a reasonable structure, covering time cost, early arrival and late arrival penalties, cluster splitting penalty, capacity overload penalty, and route familiarity reward, which can fully reflect the multi-faceted needs of logistics route optimization. ","multi_objective_balance": "The multi-objective balance is good. The weight coefficients (α, β, γ, δ, ε, ω) of each objective function can be adjusted according to actual business needs to achieve a balance between different optimization objectives. ","mathematical_foundation": "Based on linear programming and combinatorial optimization theory, the design of the objective function and constraints conforms to the mathematical foundation of logistics route optimization. ","optimization_direction": "The optimization direction is clear. By adjusting the weight coefficients and constraints, different optimization objectives such as time minimization and cost minimization can be achieved. "},"constraint_system_analysis": {"completeness_assessment": "The constraint system is complete, covering multiple aspects such as order allocation, routing, time, capacity, and pickup and delivery sequence. ","consistency_check":"The constraints are consistent, there is no conflict between the various constraints, and the solution space can be effectively restricted. ","mathematical_correctness": "The mathematical correctness is high, and the design of the constraints meets the actual needs and mathematical theory of logistics path optimization. ","practical_feasibility": "The practical feasibility is strong, and the constraints can effectively guide rider path planning and order allocation in practical applications. "},"algorithm_architecture_evaluation":{"multi_layer_design": {"layer_separation_rationality": "The layer separation is reasonable, the outer layer is responsible for order allocation, and the inner layer is responsible for rider path optimization, which can effectively decompose complex problems. ","inter_layer_coordination": "The inter-layer coordination mechanism is good, and the outer and inner layers interact effectively through fitness functions and genetic operations. ","optimization_efficiency": "The optimization efficiency is high, and the two-layer genetic algorithm can effectively explore the solution space and find the approximate optimal solution."},"genetic_algorithm_components": {"chromosome_design":"The chromosome design is reasonable and can effectively represent order allocation and rider paths. ","operator_effectiveness":"Effective genetic operations, including selection, crossover, and mutation operations, can effectively explore the solution space. ","fitness_function_design": "The fitness function is reasonably designed and can effectively evaluate the quality of the solution. "},"implementation_strengths": ["The algorithm implementation has a good modular design. ", "The genetic algorithm components are reasonably designed and can effectively explore the solution space. ","The two-layer structure can effectively decompose complex problems. "],"architectural_advantages": ["The modular design improves the maintainability of the algorithm. ","The two-layer structure improves the optimization efficiency of the algorithm. ","The genetic algorithm component design improves the robustness of the algorithm. "]},"requirement_change_analysis": {"mathematical_impacts": {"objective_function_changes": "It is necessary to add penalties or rewards for riders' rest time to the objective function to reflect new requirements. ","constraint_modifications": "It is necessary to add constraints on the rider's continuous working time to implement the anti-fatigue mechanism. ","variable_extensions": "It may be necessary to add new variables to represent the rider's rest time and status. "},"critical_gaps": ["The current model does not take into account the rider's rest time and status. ","The objective function and constraints need to be adjusted to adapt to new requirements. "],"adaptation_priorities": [ "Prioritize adjusting the objective function to reflect the impact of the rider's rest time. ","Prioritize adding constraints on the rider's continuous working time. "]},"optimization_potential_analysis":{"mathematical_improvements": "objective_function_enhancements": "The objective function can be optimized by adjusting the weight coefficients and adding new objective function components. ","constraint_system_optimization": "The constraint system can be optimized by adding new constraints. ","model_generalization": "The generalization ability of the model can be improved by adding new variables and constraints."},"algorithmic_enhancements": {"efficiency_improvements": "The efficiency of the algorithm can be improved by optimizing the parameters and operations of the genetic algorithm. ","convergence_optimization": "The convergence of the algorithm can be improved by adjusting the fitness function and genetic operations. ","parallelization_opportunities": "The performance of the algorithm can be improved through parallel computing. "}".

[0128] The second layer: Optimization and reconstruction layer based on existing mathematical models

[0129] Core functions: The main task of this layer is to optimize and reconstruct the first mathematical model based on the analysis results of the first layer, including reconstruction of the first objective function, optimization of the first constraint conditions, expansion of decision variables, etc., to ensure that the mathematical model can meet new requirements and maintain rigor and integrity in mathematical theory.

[0130] Input: Detailed information of the first mathematical model: including the first objective function structure, mathematical expression, first constraint conditions, etc.; detailed analysis results of the first layer (layer_1_result): including information such as existing model evaluation, demand change analysis, and optimization potential.

[0131] Key points: 1) Objective Function Reconstruction: Building on the primary objective function, integrate the mathematical representation of new requirements (such as the rider rest time penalty) while ensuring the balance and mathematical rigor of the multi-objective approach. 2) Constraint System Optimization: Improve the primary constraint conditions, ensuring the integrity and consistency of the mathematical representation, especially ensuring the compatibility of new constraints (such as the rider continuous work time constraint) with existing constraints. 3) Variable Expansion: Optimize the definition of decision variables, expand new parameters (such as the rider fatigue coefficient), and clarify the relationship between the domain and variables.

[0132] Continuing with the above example, here is a feasible prompt word as the second layer input:

[0133] “#RoleDefinition

[0134] You are an expert in mathematical modeling and optimization theory: Your core task is to optimize and reconstruct the existing mathematical model layer. Based on the analysis results of the first layer (layer_1_result), optimize and reconstruct the mathematical model (including the objective function, constraints, and decision variables) according to the direction of improvement required:

[0135] ##1. Mathematical reconstruction of the objective function: - Preserve the existing mathematical model - Integrate the mathematical expression of new requirements

[0136] - Ensure the mathematical rigor of multi-objective balancing##2. Mathematical Optimization of Constraint Systems: - Improve the mathematical integrity of constraint systems - Optimize the mathematical expression of constraint conditions - Ensure the mathematical consistency of constraint systems##3. Mathematical Extension of Variable Systems: - Optimize the mathematical definition of decision variables - Extend the mathematical expression of parameter systems - Ensure the mathematical correctness of variable relationships

[0137] Please ensure the rigor and correctness of all mathematical expressions, paying special attention to the mathematical basis of multi-objective optimization."

[0138] Similarly, since the LLM-based multi-level collaborative optimization framework outputs data in the standard JSON format, the following format constraints are also imposed on the output of the second layer:

[0139] "Please return the math reconstruction results in the following JSON format:

[0140] ```json{{"mathematical_structure": {{"primary_function": "Complete mathematical expression of the main objective function","component_decomposition": {{"Z_ ": {{"mathematical_expression": "Complete mathematical expression of Z_","optimization_enhancements": "Mathematical optimization improvement","parameter_refinements": "Parameter refinement"}},

[0141] "Z_new_objectives": {{"mathematical_expression": "Mathematical expression of the new objective","integration_method": "Mathematical description of the integration method"}}

[0142] "weight_optimization": {{"dynamic_weighting": "Mathematical formula for dynamic weighting","balance_mechanism": "Mathematical description of the balance mechanism","convergence_guarantee": "Mathematical proof of convergence guarantee"}}}},

[0143] "mathematical_improvements": {{"theoretical_enhancements": ["Theoretical mathematical improvements"], "computational_optimizations": ["Computational mathematical optimizations"], "robustness_improvements": ["Robust mathematical enhancements"]}}

[0144] "constraint_system_optimization": {{"enhanced_constraints": {{"assignment_constraints": {{"mathematical_formulation": "Optimized mathematical formulation of assignment constraints",

[0145] "…"}},"new_constraints": {{"mathematical_formulation": "Mathematical expression of new constraints","integration_proof": "Mathematical constraints for integration correctness"}}}},"constraint_interactions": {{"mathematical_relationships": "Mathematical relationships between constraints","consistency_analysis": "Mathematical analysis of consistency","optimization_impact": "Mathematical impact on optimization"}}}},

[0146] "variable_system_enhancement": {{"decision_variables": {{"enhanced_definitions": "Enhanced mathematical definitions of decision variables","domain_specifications": "Mathematical specifications of variable domains","relationship_matrix": "Mathematical matrix of variable relationships"}},

[0147] "enhanced_mathematical_model": {{"complete_formulation": "Complete optimization mathematical model formulation","improvement_summary": "Mathematical improvement summary","implementation_guidance": "Mathematical description of implementation guidance"}}

[0148] }}”

[0149] After setting the above input and output format restrictions, the corresponding output results of the second layer are:

[0150] “"layer_2_result": { "enhanced_objective_function": {"mathematical_structure": {"primary_function": "min Z = Z1 + Z2 + Z3 + Z4 + Z5 - Z6 + Z7","component_decomposition": {"Z1_travel_cost": {"mathematical_expression": "Z1= \\alpha\\sum_{j\\in\\mathcal{J}}\\sum_{i\\in\\mathcal{N}}\\sum_{k \\in \\mathcal{N}} \\frac{x_{ijk} \\cdot d_{ik}}{v_j (1 + \\rho f_{ijk})}","optimization_enhancements": "Optimize the path cost by adjusting the speed and familiarity parameters. ","parameter_refinements": "Refine the parameter estimates for speed v_j and familiarity f_{ijk}. "},"Z2_time_penalty": {"mathematical_expression": "Z2 = \\beta \\sum_{i \\in \\mathcal{P}\\cup \\mathcal{D}} E_i","enhancement_description": "Increase the penalty mechanism for rider rest time. "},"Z3_capacity_penalty":{"mathematical_expression":"Z3=\\gamma\\sum_{i\\in\\mathcal{P}\\cup\\mathcal{D}} D_i","enhancement_description": "Optimize capacity overload penalty by dynamically adjusting capacity limits. "},"Z4_clustering_penalty": {"mathematical_expression": "Z4 = \\delta \\sum_{g\\in\\mathcal{G}} \\left( \\sum_{j \\in\\mathcal{J}} z_{gj} - 1 \\right)^2","enhancement_description": "Optimize clustering penalty to ensure reasonable order clustering."},"Z5 _objectives": {"mathematical_expression": "Z5 =\\epsilon\\sum_{j\\in\\mathcal{J}} \\max \\left( 0, \\sum_{i \\in \\mathcal{I}}q_i\\cdot y_{ij} - Q_j \\right)^2","integration_method": "Integrate capacity overload targets through a square penalty mechanism. "},"Z6_familiarity_reward": {"mathematical_expression": "Z6 =\\omega \\sum_{j \\in \\mathcal{J}} \\sum_{i \\in \\mathcal{N}} \\sum_{k \\in\\mathcal{N}} x_{ijk} \\cdot f_{ijk}","enhancement_description": "Familiarity reward mechanism, which encourages riders to choose familiar path areas. ","integration_method": "The familiarity parameter f_{ijk} is used to quantify the rider's familiarity with a specific route and provide positive incentives. "}"Z7_rest_penalty": {"mathematical_expression": "Z7 = \\theta \\sum_{j \\in \\mathcal{J}} R_j","integration_method": "Introduce a penalty mechanism for riders' rest time to ensure reasonable working hours. "}},"weight_optimization": {"dynamic_weighting": "Weight parameters: α(path cost), β(time penalty), γ(capacity penalty), δ(clustering penalty), ε(overload penalty), ω(familiarity reward), θ(rest penalty)", "balance_mechanism": "Multi-objective balance is achieved by dynamically adjusting seven weight parameters, where ω is the positive incentive weight. ","convergence_guarantee": "Ensure the reasonable value range of all weight parameters to ensure the convergence of the algorithm."}},"mathematical_improvements": {"theoretical_enhancements": ["Increase the consideration of riders' rest time"],"computational_optimizations": ["Optimize the efficiency of path calculation"],"robustness_improvements": ["Enhance the adaptability of the model to different scenarios"]}},"constraint_system_optimization":{"enhanced_constraints":{"assignment_constraints":{"mathematical_formulation": "\\sum_{j \\in \\mathcal{J}} y_{ij} = 1, \\foralli \\in \\mathcal{I}","completeness_proof": "Ensure that each order is assigned to a rider. "},"capacity_constraints": {"mathematical_formulation": "0 \\leq L_{ij} \\leq Q_j, \\forall i \\in \\mathcal{N}, j \\in \\mathcal{J}","feasibility_analysis":"Ensure that the rider's cargo load does not exceed the vehicle capacity. "},"temporal_constraints": {"mathematical_formulation": "t_{ij} + s_i + \\frac{d_{i,n+i}}{v_j (1 + \\rho f_{ijk})} \\leq t_{(n+i)j}, \\forall i \\in \\mathcal{P}, j \\in \\mathcal{J}: y_{ij} =1","consistency_proof": "Ensure the consistency of temporal constraints. "},"new_constraints": {"mathematical_formulation": "R_j \\geq t_{ij} - t_{(i-1)j} - M(1 - y_{ij}), \\forall i \\in \\mathcal{P} \\cup \\mathcal{D}, j \\in \\mathcal{J}","integration_proof": "Ensure correct integration of rider rest times."}},"constraint_interactions": {"mathematical_relationships": "The constraints are related to each other through the variables y_{ij} and x_{ijk}. ","consistency_analysis": "Ensure that all constraints are mathematically conflict-free. ","optimization_impact": "Optimize the constraints to improve the quality of the solution. "}},"variable_system_enhancement": {"decision_variables": {"enhanced_definitions": "Introduce R_j to represent the rider's rest time. ","domain_specifications": "R_j \\geq 0, \\forall j \\in \\mathcal{J}","relationship_matrix": "The variables are related to each other through path and time constraints. "},"parameter_optimization": {"mathematical_parameters": "Optimize parameter \\theta to control the impact of rest time. ","sensitivity_analysis": "Analyze the impact of parameter changes on model results. ","robustness_parameters": "Ensure the robustness of parameters in different scenarios. "}},},"enhanced_mathematical_model": {"complete_formulation": "Complete optimization mathematical model expression, including all objective functions and constraints. ","improvement_summary": "By adding consideration of rider rest time, the adaptability and efficiency of the model are optimized. ","implementation_guidance": "In the implementation, attention should be paid to the integration of new variables and constraints to ensure the stability and efficiency of the algorithm. "}}".

[0151] The third layer: algorithm strategy adaptation layer

[0152] Core function: The algorithm strategy adaptation layer is responsible for dynamically adjusting and optimizing the algorithm's genetic algorithm strategy based on the problem analysis results of the first layer and the mathematical model reconstruction results of the second layer, thereby achieving adaptive improvement of the algorithm performance.

[0153] Input: The first genetic algorithm; the detailed analysis results of the first layer (layer_1_result): including information such as existing model evaluation, demand change analysis, and optimization potential; the mathematical model reconstruction results of the second layer (layer_2_result): including reconstruction of the objective function, optimization of the constraint system, variable expansion, etc.

[0154] Key points of processing: Intelligent upgrade of genetic algorithm strategy, optimization of the first genetic algorithm, that is, designing a genetic strategy for the new mathematical model based on the original algorithm, and improving the initialization, selection, crossover, and mutation strategies.

[0155] Still continuing with the above example, here is a feasible prompt word as the third layer input:

[0156] “#RoleDefinition

[0157] You are an expert in algorithm design and intelligent optimization: Your core task is to upgrade the intelligent strategy layer of the existing algorithm. Combining the optimized mathematical model with the results of the first-layer algorithm analysis, you will optimize the existing algorithm. This means designing a genetic strategy for the new mathematical model based on the original algorithm and performing optimization and reconstruction.

[0158] Based on the detailed analysis results of the first layer (layer_1_result) and the optimization results of the mathematical model (layer_2_result), an intelligent algorithm architecture upgrade solution is designed:

[0159] ##1. Two-layer genetic algorithm architecture optimization:

[0160] - Mathematical adaptation optimization of outer GA

[0161] - Enhanced path optimization of inner GA

[0162] - Algorithm improvement of inter-layer coordination mechanism

[0163] ##2. Genetic Operation Intelligence Upgrade:

[0164] - Genetic operations adapted to new objective functions

[0165] - Constraint-aware genetic manipulation design

[0166] - Selection strategy for multi-objective balance

[0167] ##3. Algorithm performance optimization:

[0168] - Algorithm improvements for convergence performance

[0169] - Architecture optimization for computing efficiency

[0170] - Design enhancements for scalability"

[0171] Similarly, since the LLM-based multi-level collaborative optimization framework outputs data in the standard JSON format, the following format constraints are also imposed on the output of the third layer:

[0172] "Please return the algorithm upgrade plan in the following JSON format:```json{{"multi_layer_algorithm_optimization": {{"outer_layer_enhancements": {{"assignment_optimization": {{"chromosome_design": "Enhanced design of order assignment chromosomes","fitness_function_adaptation":"Fitness design adapted to the new objective function","selection_strategy": "Multi-objective-aware selection strategy","crossover_innovation": "Innovative crossover operation design","mutation_intelligence": "Intelligent mutation operation design"}},"performance_optimizations": {{"convergence_acceleration": "Algorithm improvement for convergence acceleration","diversity_maintenance": "Diversity maintenance mechanism","elite_preservation": "Optimization of elite retention strategy"}}}},"inner_layer_enhancements": {{"route_optimization": {{"chromosome_representation": "Optimized representation of path chromosomes","local_search_integration": "Intelligent integration of local search","constraint_handling": "Algorithm improvement of constraint handling","neighborhood_exploration": "Neighborhood exploration strategy optimization"}},"efficiency_improvements": {{"initialization_intelligence": "Intelligent initialization strategy","termination_criteria": "Intelligent design of termination criteria","memory_optimization": "Memory usage optimization"}}}},"inter_layer_coordination": {{"information_exchange": "Inter-layer information exchange mechanism","synchronization_strategy": "Synchronization strategy design","feedback_mechanism": "Algorithm implementation of feedback mechanism"}}}},"genetic_operators_innovation": {{"multi_objective_aware_operators": {{"selection_methods": {{"pareto_based_selection": "Pareto-based selection method","weighted_selection": "Weighted selection strategy","diversity_preservation": "Diversity preservation selection"}},"crossover_strategies": {{"structure_preserving_crossover":"Structure preserving crossover","constraint_aware_crossover": "Constraint aware crossover","adaptive_crossover": "Adaptive crossover strategy"}},"mutation_techniques": {{"intelligent_mutation": "Intelligent mutation technology","local_improvement_mutation": "Local improvement mutation","constraint_repair_mutation": "Constraint repair mutation"}}}},"adaptive_mechanisms": {{"parameter_adaptation": "Parameter adaptation mechanism","operator_selection": "Operator self-selection","population_sizing": "population size self-adjusts"}}}},}}"

[0173] After setting the above input and output format restrictions, the corresponding output results of the third layer are:

[0174] "layer_3_result":{

[0175] "multi_layer_algorithm_optimization": {

[0176] "outer_layer_enhancements":{"assignment_optimization": {"chromosome_design": "Enhanced design of order assignment chromosomes by introducing a rider rest time variable.","fitness_function_adaptation": "Fitness design adapted to the new objective function, taking into account the penalty for rider rest time.","selection_strategy": "Multi-objective-aware selection strategy, using dynamic weight adjustment.","crossover_innovation": "Innovative crossover operation design to ensure the rationality of order assignment.","mutation_intelligence": "Intelligent mutation operation design to enhance the diversity and feasibility of solutions."},"performance_optimizations": {"convergence_acceleration": "Algorithm improvement for convergence acceleration, accelerating convergence through dynamic weight adjustment.","diversity_maintenance": "Diversity maintenance mechanism to ensure the diversity of the population.","elite_preservation": "Optimization of the elite retention strategy to ensure the retention of high-quality solutions."}},

[0177] "inner_layer_enhancements":{"route_optimization": {"chromosome_representation": "Optimized representation of route chromosomes, taking into account rider rest time.","local_search_integration": "Intelligent integration of local search to improve route optimization quality.","constraint_handling": "Algorithm improvements for constraint handling to ensure that time window and capacity constraints are met.","neighborhood_exploration": "Neighborhood exploration strategy optimization to enhance local search capabilities for solutions."},

[0178] "efficiency_improvements": {"initialization_intelligence": "Intelligent initialization strategy to ensure the quality of the initial solution.","termination_criteria": "Intelligent design of termination criteria based on convergence and solution quality.","memory_optimization": "Memory usage optimization to reduce the memory consumption of the algorithm."}},"inter_layer_coordination": {"information_exchange": "Inter-layer information exchange mechanism to ensure coordination between outer and inner layers.","synchronization_strategy": "Synchronization strategy design to ensure consistency of the optimization process.","feedback_mechanism": "Algorithmic implementation of the feedback mechanism to enhance information flow between layers."}},

[0179] "genetic_operators_innovation":{"multi_objective_aware_operators": {"selection_methods": {"pareto_based_selection": "Pareto-based selection method to ensure the effectiveness of multi-objective optimization.","weighted_selection": "Weighted selection strategy to dynamically adjust selection weights.","diversity_preservation": "Diversity preservation selection to ensure population diversity."},"crossover_strategies": {"structure_preserving_crossover": "Structure preserving crossover to ensure the stability of chromosome structure.","constraint_aware_crossover": "Constraint-aware crossover to ensure the satisfaction of constraints.","adaptive_crossover": "Adaptive crossover strategy to dynamically adjust crossover probability."},"mutation_techniques": {"intelligent_mutation": "Intelligent mutation technology to enhance solution diversity.","local_improvement_mutation": "Local improvement mutation to improve solution quality.","constraint_repair_mutation": "Constrained repair mutation ensures the feasibility of the solution."}},"adaptive_mechanisms": {"parameter_adaptation": "Parameter adaptive mechanism dynamically adjusts algorithm parameters.","operator_selection": "Operator self-selection enhances algorithm flexibility.","population_sizing": "Population size self-adjusts to ensure the rationality of the population size."}}"

[0180] Layer 4: Complete solution generation layer

[0181] Core function: The complete solution generation layer is responsible for converting the theoretical analysis results of the second and third layers into specific code for optimization, and generating complete code based on the original code.

[0182] Input: Original code: the existing algorithm code to be optimized; Optimization results of the mathematical model (layer_2_result): specific implementation suggestions based on the mathematical analysis layer; Algorithm strategy optimization results (layer_3_result): the optimization plan from the algorithm strategy optimization result layer.

[0183] Key points of processing: 1) Accurate implementation of mathematical models: converting the mathematical models of theoretical analysis into precise code implementation, adding constraint verification and mathematical expression accuracy checks to ensure the correct implementation of objective function components; 2) Intelligent upgrade of algorithm strategies: enhancing the intelligence level and adaptability of genetic operations, optimizing the coordination and information exchange mechanism between multi-layer algorithms, and improving the convergence performance and solution quality of the algorithm.

[0184] Continuing with the above example, here is a feasible prompt word as the fourth layer input:

[0185] “#RoleDefinition

[0186] You are a code generation expert: Analyze the optimization results of the mathematical model (layer_2_result) and the algorithm strategy optimization results (layer_3_result). Extract the mathematical model optimization strategy and algorithm optimization strategy from the analysis results, and generate a complete optimization algorithm based on the optimization strategy of the analysis results.

[0187] ##1. Mathematical model optimization - strictly implement the objective function component according to the analysis results - add constraint verification method - ensure the accuracy of mathematical expressions

[0188] Output requirements: Please directly output the complete optimized mathematical model##2. Algorithm architecture optimization - Enhance the intelligence of genetic operations - Optimize the coordination mechanism of multi-layer algorithms - Improve the convergence performance of the algorithm

[0189] ##Output requirements: Please directly output the complete optimized Python code, ensuring:

[0190] - Generate complete code that can be run directly

[0191] - All original functions are retained

[0192] - Implement all analysis-suggested improvements

[0193] - Added clear notes explaining new features"

[0194] After setting the above input, the corresponding output of the fourth layer is:

[0195] "layer_4_result": {

[0196] {

[0197] "mathematical_model": {

[0198] "objective _function": "Optimization objective function",

[0199] "constraints": "Optimization constraint set",

[0200] "variables": "Optimization variable set"

[0201] },

[0202] "algorithm _implementation": {

[0203] "Optimize the complete algorithm code"

[0204] },

[0205] "performance_analysis": {

[0206] "improvement _summary": "Improvement Summary",

[0207] "code_comments": "Add code comments"

[0208] }

[0209] }”

[0210] In step S3, the code is automatically executed based on the pre-built MCP-based code agent, and when an abnormality in the code operation is detected, the self-correction mechanism for the code or the self-verification mechanism for the second mathematical model is automatically called to ultimately output the optimal solution for the takeaway delivery route planning that meets the new requirements.

[0211] This step builds an MCP-based code agent (MCP-Code-Agent) to achieve automatic code execution and automatically invoke self-correction and self-verification mechanisms when an operation anomaly is detected.

[0212] Based on the MCP code agent, the entire system is centered around the MCP protocol communication layer, implementing a standardized communication mechanism between LLM and tools. This communication mechanism includes:

[0213] User request phase: receiving new requirements or code-related requests submitted by users to the system;

[0214] In the code agent processing phase, after receiving the user request, it acts as an intermediate coordination layer, responsible for understanding the user's intention and determining the various execution tools that need to be called during the entire execution process;

[0215] MCP protocol conversion: encapsulating the user request into a unified message format through the MCP protocol to achieve message encapsulation, interface adaptation, call distribution and status management;

[0216] During the tool execution phase, standardization requests are distributed to the most suitable execution tools through the MCP protocol.

[0217] Further, such as Figure 4 As shown in the figure, the workflow of the MCP-based code proxy in this step specifically includes:

[0218] After receiving the user request, obtaining the code output by the LLM-based multi-level collaborative optimization framework (specifically, the fourth complete solution generation layer);

[0219] Put the code into the sandbox and execute it using the execution tool to determine whether the execution is successful. If successful, output the optimal solution for the takeaway delivery route planning that meets the new requirements, including the order allocation result and the shortest delivery route; otherwise

[0220] If execution errors occur consecutively for less than a preset number of times (for example, the preset number is 3, here 1-2 times), the self-correction mechanism is invoked, and the code correction tool is used to analyze the error information of the code, output the error solution, correct the code, and put the corrected code into the sandbox for execution again. If successful, the optimal solution for the takeaway delivery route planning is output;

[0221] If a preset number of execution errors occurs consecutively (for example, the preset number is 3), the self-verification mechanism is called, and a mathematical verification tool is used to recheck (for example, recheck the matching degree between the mathematical model and the external change description, the integrity of the constraints and boundary conditions, the correctness of the mathematical expression of the optimization target, etc.) to determine the logical correctness and implementation deviation of the mathematical reconstruction result (specifically output by the second layer of the optimization reconstruction layer based on the existing mathematical model). The optimized code is regenerated based on the inspection result, and the regenerated optimized code is put into the sandbox again for execution. If successful, the optimal solution for the takeaway delivery route planning is output.

[0222] It is understandable that in the entire process, the MCP-based code agent proposed in the embodiment of the present invention is in the position of an intelligent scheduling center, and can dynamically select tools according to different error levels during the execution process.

[0223] At this point, the embodiment of the present invention completes the entire process of the intelligent path planning method based on the large language model.

[0224] Example 2:

[0225] An embodiment of the present invention provides an intelligent path planning system based on a large language model, including:

[0226] A mathematical modeling and algorithm solving module is used to construct a first mathematical model and design a first genetic algorithm for solving the takeaway delivery route planning problem;

[0227] An intelligent optimization module is used to obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in a standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and the complete code of both;

[0228] The standardized execution module is used to automatically execute the code based on a pre-built MCP-based code agent, and when an abnormality in the code operation is detected, automatically call a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model to ultimately output an optimal solution for food delivery route planning that meets the new requirements.

[0229] Example 3:

[0230] An embodiment of the present invention provides a storage medium storing a computer program for intelligent path planning based on a large language model, wherein the computer program enables a computer to execute the intelligent path planning method as described in Example 1.

[0231] Example 4:

[0232] An embodiment of the present invention provides an electronic device, including:

[0233] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including a method for executing the intelligent path planning method as described in Example 1.

[0234] It is understandable that the intelligent path planning system, storage medium and electronic device based on the large language model provided in the embodiments of the present invention correspond to the intelligent path planning method based on the large language model provided in the embodiments of the present invention. The explanations, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the intelligent path planning method and will not be repeated here.

[0235] In summary, compared with the existing technology, the present invention has the following beneficial effects:

[0236] 1. In an embodiment of the present invention, a multi-level collaborative optimization framework based on LLM optimizes existing mathematical models and algorithmic strategies based on new requirements described in natural language by integrating LLM's semantic understanding capabilities. This framework generates an optimized second mathematical model and second genetic algorithm based on the already constructed first mathematical model and first genetic algorithm, combined with the changing new requirements. This framework overcomes the expressive limitations of engineering modeling directly using LLM prompts and the lack of domain adaptability of the generated metaheuristic algorithm, while also improving the adaptability of traditional frameworks to different scenarios. Furthermore, an MCP-based code agent is constructed, whose hierarchical and progressive self-correction mechanism, combined with the standardized scheduling of the MCP protocol, enables comprehensive automated processing from surface-level code errors to deep-level mathematical model problems.

[0237] 2. A two-layer genetic algorithm structure was designed to solve the food delivery optimization problem. The outer genetic algorithm is responsible for the global allocation decision of orders to riders, while the inner genetic algorithm focuses on the specific path planning of each rider under the assigned order set. This hierarchical progressive structure from coarse-grained global allocation to fine-grained path optimization achieves the coordinated optimization of order allocation and path planning, making up for the defects of LLM expressiveness limitations in complex scenarios. At the same time, the domain-specific genetic algorithm design ensures domain adaptability when dealing with large-scale food delivery problems, significantly improving delivery efficiency and overall system performance.

[0238] 3. The LLM multi-level collaborative optimization architecture realizes semantic-driven adaptive optimization: The core innovation of this invention lies in the construction of an intelligent conversion mechanism from unstructured natural language descriptions to structured mathematical models and algorithm strategies. Through LLM, natural language is converted into specific engineering code adjustments, and the mathematical model and optimization algorithm strategy of the optimization process can be adaptively adjusted according to changes in the scenario.

[0239] 4. The core innovation of the MCP-based code agent automated execution method lies in the construction of an intelligent code execution system with hierarchical self-correction capabilities. This system uses the MCP protocol as a standardized communication layer to achieve seamless coordination between LLM and various execution tools. When errors occur during code execution in a sandbox environment, the agent can intelligently select a correction strategy based on the number of errors: for shallow errors that occur once or twice, code correction tools are used for direct repair. When errors occur more than three times, the system automatically traces back to the mathematical model layer for deep verification. Mathematical verification tools are used to re-check the logical correctness and implementation deviations of the model, fundamentally solving the problem and regenerating optimized code. This hierarchical and progressive self-correction mechanism, combined with the standardized scheduling of the MCP protocol, realizes comprehensive automated processing from surface code errors to deep mathematical model problems.

[0240] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0241] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. An intelligent path planning method based on a large language model, characterized in that: include: For the takeaway delivery route planning problem, a first mathematical model is constructed and a first genetic algorithm is designed to solve the model; Obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and their complete codes; Based on a pre-built MCP-based code agent, the code is automatically executed, and when an abnormality in the code operation is detected, a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model is automatically invoked to ultimately output an optimal solution for food delivery route planning that meets the new requirements; The first mathematical model is a mixed integer programming model, including a first objective function and a first constraint; wherein the optimization goal of the first objective function is to minimize the total cost, and the total cost is composed of the total travel time cost, the early arrival penalty cost, the late arrival penalty cost, the cluster splitting penalty, the capacity overload penalty, and the path familiarity reward; the first constraint includes an order allocation constraint, a path continuity constraint, a rider capacity constraint, and a time sequence constraint; The first genetic algorithm is a two-layer genetic optimization algorithm, including an outer genetic algorithm and an inner genetic algorithm; wherein the outer genetic algorithm is used for global search of order clustering and rider allocation, and the inner genetic algorithm is used for path planning for each rider's order set; The LLM-based multi-level collaborative optimization framework includes: The deep model analysis and demand understanding layer is used to parse the mathematical expression of the first objective function, evaluate the completeness of the first constraint condition, identify the two-layer genetic characteristics of the algorithm framework of the first genetic algorithm, and, based on the results of the first three analyses, deeply analyze the changes in the new requirements and analyze the optimization potential, and output the problem analysis results in standard JSON format; An optimization and reconstruction layer based on an existing mathematical model, configured to integrate the mathematical expression of the new requirement based on the problem analysis results and the first objective function, improve the first constraint conditions, and expand decision variables to output the mathematical reconstruction results in a standard JSON format; An algorithm strategy adaptation layer, configured to design a genetic strategy for the model reconstruction result based on the problem analysis result and the mathematical reconstruction result, using the first genetic algorithm as a basis, and improving initialization, selection, crossover, and mutation strategies to output an algorithm upgrade plan in a standard JSON format; A complete solution generation layer is used to transform and adjust the first mathematical model, the first genetic algorithm and the original codes of the two based on the mathematical reconstruction results and the algorithm upgrade plan, so as to output the second mathematical model, the second genetic algorithm and the complete codes of the two in standard JSON format.

2. The intelligent path planning method according to claim 1, wherein: Based on the MCP-based code proxy, the communication mechanism of the entire system includes: User request phase: receiving new requirements or code-related requests submitted by users to the system; In the code agent processing phase, after receiving the user request, it is responsible for understanding the user's intention and determining the various execution tools that need to be called during the entire execution process; MCP protocol conversion: encapsulating the user request into a unified message format through the MCP protocol to achieve message encapsulation, interface adaptation, call distribution and status management; During the tool execution phase, standardization requests are distributed to the most suitable execution tools through the MCP protocol.

3. The intelligent path planning method according to claim 2, wherein: The workflow of the MCP-based code proxy specifically includes: After receiving the user request, obtaining the code output by the LLM-based multi-level collaborative optimization framework; Put the code into the sandbox and execute it using the execution tool to determine whether the execution is successful. If successful, output the optimal solution for the takeaway delivery route planning that meets the new requirements, including the order allocation result and the shortest delivery route; otherwise If execution errors occur continuously for less than a preset number of times, the self-correction mechanism is invoked, and the code correction tool is used to analyze the error information of the code, output the error solution, correct the code, and execute the corrected code again in the sandbox. If successful, the optimal solution for the takeaway delivery route planning is output; If a preset number of execution errors occur consecutively, the self-verification mechanism is called, and a mathematical verification tool is used to recheck to determine the logical correctness and implementation deviation of the mathematical reconstruction result. Based on the inspection result, the optimized code is regenerated and put into the sandbox again for execution. If successful, the optimal solution for the takeaway delivery route planning is output.

4. An intelligent path planning system based on a large language model, characterized in that: The method for executing the intelligent path planning method according to claim 1 comprises: A mathematical modeling and algorithm solving module is used to construct a first mathematical model and design a first genetic algorithm for solving the takeaway delivery route planning problem; An intelligent optimization module is used to obtain new requirements described in natural language, optimize and reconstruct the first mathematical model and the first genetic algorithm based on a pre-built LLM-based multi-level collaborative optimization framework, and output them in a standard JSON format at each level to obtain the converted second mathematical model, second genetic algorithm, and the complete code of both; The standardized execution module is used to automatically execute the code based on a pre-built MCP-based code agent, and when an abnormality in the code operation is detected, automatically call a self-correction mechanism for the code or a self-verification mechanism for the second mathematical model to ultimately output an optimal solution for food delivery route planning that meets the new requirements.

5. A storage medium, characterized in that It stores a computer program for intelligent path planning based on a large language model, wherein the computer program enables a computer to execute the intelligent path planning method according to any one of claims 1 to 3.

6. An electronic device, characterized in that: include: one or more processors; Memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including a program for executing the intelligent path planning method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • CMIES day-ahead scheduling scheme intelligent generation method based on multi-task learning

    CN118153760A

  • Double-layer double-target optimization scheduling method based on large language model

    CN120218552A

Cited By

  • Intelligent battlefield situation analysis and generation method and system based on multi-modal semantic understanding and mcp cooperation

    CN122527726A