Operation planning optimization data synthesis method and device based on high-quality seed data
By building an initial task pool and using a small sample prompt technology to expand the operational optimization problem scenarios and generate mathematical models and codes, the problems of insufficient flexibility of existing tools and inability to effectively respond to changing application needs are solved, and diversified expansion of problem samples and efficient generation and solution of operational optimization problems are achieved.
Patent Information
- Application Number
- CN202510164162.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2045-02-14
AI Technical Summary
The existing operational optimization tools rely on predefined fixed templates, lack flexibility, are difficult to adapt to different problem scenarios, and have limited capabilities in the diversity of generation problems and model automation expansion, so they cannot effectively respond to changing practical application needs.
By building an initial task pool, it contains multiple seed data samples, each sample includes problems, models and code, and uses few sample prompt technology to expand the problem scenario, generate corresponding mathematical models and code, and expand the data samples through enhanced operations.
It realizes the diversified expansion of problem samples, can cover more practical application scenarios and optimization requirements, and automatically generates mathematical models that match the problem samples, improving the efficiency of operation optimization problem generation and solution.
Smart Images

Figure CN119623781A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of operations research and optimization, and in particular to an operations research and optimization data synthesis method and device based on high-quality seed data. Background Art
[0002] With the widespread popularity of operations research and optimization in multiple application fields such as industry, logistics, transportation, and supply chain management, the use of mathematical modeling and intelligent algorithms to optimize and solve complex problems has become a key means to improve corporate operational efficiency and resource utilization. Traditional operations research and optimization methods usually rely on customized mathematical models built for specific problems, using linear programming, integer programming, mixed integer programming, dynamic programming and other methods to solve them.
[0003] Although there are some methods that attempt to use automated tools or frameworks to assist in the modeling and solving of operations research optimization problems, there are still many deficiencies when dealing with complex problem scenarios. First, existing tools usually rely on predefined fixed templates, which are not flexible enough and difficult to adaptively expand for different problem scenarios. In addition, they are limited in their ability to generate a variety of problems and the automated expansion of models, and cannot efficiently respond to the changing needs of actual applications. Summary of the invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides a data synthesis method for operations optimization based on high-quality seed data to solve the problem that existing tools usually rely on predefined fixed templates, lack flexibility, and are difficult to adaptively expand for different problem scenarios. In addition, the ability to generate a variety of problems and the automatic expansion of models is limited, and it is impossible to efficiently cope with the changing actual application needs.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a data synthesis method for operations optimization based on high-quality seed data, which includes constructing an initial task pool, wherein the initial task pool includes a plurality of seed data samples, each of which includes a question, a model, and a code;
[0008] Based on the problems in the seed data sample, the few-sample prompt technology is used to expand to multiple problem scenarios and generate corresponding complete problem samples;
[0009] Based on the problem samples, combined with the mathematical models in the initial task pool, a mathematical model corresponding to the corresponding problem samples is generated through the few-sample prompt technology;
[0010] Based on the generated mathematical model, a code corresponding to the mathematical model is generated through a few-sample prompting technique;
[0011] Expand the generated data samples through augmentation operations;
[0012] Perform quality checks by executing the generated code;
[0013] Construct an initial task pool, which contains multiple seed data samples, each of which includes a question, a model, and a code. Specifically, the following steps are included:
[0014] Define the types of problems, including resource allocation problems, path planning problems, inventory management problems, and scheduling problems, and extract key elements of the problems;
[0015] Extract models including linear programming, integer programming, mixed integer programming, dynamic programming and stochastic programming types, and extract mathematical expressions, variables and parameters of the models;
[0016] Extract the code including model building, solution process and result processing, as well as code comments and documents;
[0017] Use data structures to define problem pools, model pools, and code pools;
[0018] Integrate the problem pool, model pool and code pool to form an initial task pool;
[0019] Use a relational database to store task samples and add metadata and tags to the task samples.
[0020] As a preferred solution of the data synthesis method for operations optimization based on high-quality seed data described in the present invention, the method is expanded to multiple problem scenarios based on the problems in the seed data samples through the small sample prompt technology, which specifically includes the following steps:
[0021] Select a seed problem from the constructed initial task pool, and the seed problem conforms to the type of operations research optimization problem defined in the initial task pool;
[0022] Extract optimization objectives, constraints, and decision variables from the seed problem;
[0023] According to the description of the seed problem, a prompt template with examples is designed, wherein the prompt template includes the problem type, the description of the optimization target, and the constraint conditions, and the content in the prompt template is adjusted according to the type of the problem;
[0024] Add specific scenarios and optimization requirements to the prompt template to complete the design of the prompt template;
[0025] Input the designed prompt template into the language model, and the language model will generate N different operations optimization problem scenarios based on the seed data and prompt template;
[0026] The verification and screening of problem scenarios are completed by verifying whether the scenario description of the generated problem is reasonable and removing duplicate questions that are too similar to the seed questions.
[0027] As a preferred solution of the operations optimization data synthesis method based on high-quality seed data described in the present invention, generating a corresponding complete problem sample specifically includes the following steps:
[0028] Extract background information from the seed question, and further parse the question description through natural language processing technology to extract key elements and form a complete question description;
[0029] Extract optimization objectives from new problem scenarios and match mathematical model types based on the type and complexity of the problem;
[0030] Extract constraints from new problem scenarios and check whether the logic and conditions are reasonable;
[0031] Integrate the complete problem description, optimization objectives and constraints to form a complete operations research optimization problem sample.
[0032] As a preferred solution of the operations optimization data synthesis method based on high-quality seed data described in the present invention, wherein: based on the problem sample, combined with the mathematical model in the initial task pool, a mathematical model corresponding to the corresponding problem sample is generated through a small sample prompting technology, specifically including the following steps:
[0033] Analyze the background of the problem sample, identify the operational optimization type of the problem, and extract resource information;
[0034] Extract optimization goals from problem samples, clarify the specific content of optimization, and identify the form of optimization goals;
[0035] Extract all constraints from the problem sample and specify the numerical limits involved in each constraint;
[0036] Retrieve mathematical models of similar problems from the initial task pool based on the type of problem samples, and further match the form of the optimization objective and the complexity of the constraints;
[0037] Extracting mathematical model templates from the retrieved similar problems;
[0038] Structurally mark the extracted mathematical model template;
[0039] Design a few-shot prompt template that includes a problem description and a reference mathematical model template;
[0040] Input the few-sample prompt template into the language model, guide the language model to generate the optimization target based on the problem sample and the constraint condition consistent with the problem description, and form the corresponding mathematical model of the corresponding problem sample;
[0041] Generate its decision variables based on the formed mathematical model and clarify its limitations.
[0042] As a preferred solution of the data synthesis method for operations optimization based on high-quality seed data described in the present invention, wherein: based on the generated mathematical model, a code corresponding to the mathematical model is generated by a small sample prompting technology, specifically including the following steps:
[0043] Extract the problem description, the description of the optimization goal, the description of the constraint conditions and the code prompt from the generated mathematical model to form a prompt template;
[0044] Input the prompt template into the language model to generate code for importing relevant mathematical solution libraries;
[0045] Use the library classes to define classes of optimization problems;
[0046] Use LpVariable to define the decision variables in the optimization problem;
[0047] Generate optimization target code that defines the optimization goal and adds constraints;
[0048] By calling the solver, we start solving the optimization problem and find a solution that satisfies all constraints and optimizes the objective.
[0049] Output the optimal solution found by the solver.
[0050] As a preferred solution of the data synthesis method for operations optimization based on high-quality seed data described in the present invention, the generated data samples are expanded by enhancement operation, specifically comprising the following steps:
[0051] prompting the language model to identify modifiable parts in the mathematical model, wherein the modifiable parts include optimization objectives and constraints;
[0052] Randomly select one of the potential modifiable elements and generate new data samples with different optimization requirements by modifying the optimization objectives and constraints;
[0053] Restate the existing problem description in various forms by prompting the language model;
[0054] Generate problem descriptions with different semantic expressions, and the restatement process allows for diverse language expressions;
[0055] For complex operations optimization problems, language model recognition modeling techniques are provided;
[0056] By prompting the language model to generate different modeling schemes, one of the modeling techniques is randomly selected to modify and replace the existing mathematical model;
[0057] By applying different modeling techniques, we can generate diverse data samples suitable for different problem complexities and scenario requirements;
[0058] By executing the generated code, the quality check is carried out, which includes the following steps:
[0059] Extract the core modules from the generated code, check the code integrity and whether the required mathematical solution libraries are correctly imported;
[0060] Create an isolated virtual environment for code execution and provide input data;
[0061] Call the solver to execute the generated code and capture the execution log and exceptions;
[0062] Set evaluation metrics based on code optimization time, solution accuracy, and resource usage;
[0063] Read the output of the solver to verify whether the solution is found successfully and check whether the solution output by the solver satisfies all constraints;
[0064] Evaluate the output solution effect according to the evaluation indicators to determine whether the quality of the solution meets expectations;
[0065] The solution that runs successfully and meets expectations is defined as the optimal solution;
[0066] For the code sample with the optimal solution, the execution result of the sample is recorded and saved, and marked as a successful sample.
[0067] In a second aspect, the present invention provides a data synthesis device for operational optimization based on high-quality seed data, comprising:
[0068] The seed data management module builds and manages the initial task pool and stores multiple seed data samples containing questions, models, and codes;
[0069] The question expansion module uses the few-sample prompting technology to expand the questions in the seed data to multiple different question scenarios and generate corresponding complete question samples;
[0070] The mathematical model generation module generates the corresponding mathematical model based on the expanded problem samples using the few-sample prompting technology;
[0071] The code generation module, based on the generated mathematical model, uses the few-sample hint technology to generate the operations optimization code that can solve the model;
[0072] The data enhancement module expands the generated data samples through various enhancement operations;
[0073] The execution and quality inspection module executes the generated code to check its functional integrity, the output quality of the solver, and the rationality of the solution.
[0074] In a third aspect, the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the operations optimization data synthesis method based on high-quality seed data as described in the first aspect of the present invention.
[0075] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the operations optimization data synthesis method based on high-quality seed data as described in the first aspect of the present invention.
[0076] The beneficial effects of the present invention are as follows: through the few-sample prompting technology, the seed problems in the task pool are expanded to multiple different operations research optimization problem scenarios. The use of the few-sample prompting technology makes it possible to generate a variety of operations research optimization problem samples even when the sample data is limited. The scenario expansion of the problem samples is achieved, which can cover more practical application scenarios and optimization requirements. Through the few-sample prompting technology combined with the mathematical model in the initial task pool, a mathematical model matching the problem sample is automatically generated. Combining the problem description with the appropriate mathematical model ensures that each generated problem sample is equipped with a reasonable mathematical model. A one-to-one mapping between the problem and the mathematical model is achieved, solving the problem of model design relying on manual experience in traditional operations research optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0078] Figure 1 This is a flow chart of the data synthesis method for operational optimization based on high-quality seed data in Example 1.
[0079] Figure 2 Schematic diagram of the operations optimization data synthesis method based on high-quality seed data in Example 1. DETAILED DESCRIPTION
[0080] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0081] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0082] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0083] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, and provides a data synthesis method for operations optimization based on high-quality seed data, comprising the following steps:
[0084] S1. Define problem types, which include but are not limited to resource allocation problems, path planning problems, inventory management problems, and scheduling problems.
[0085] Specifically, by defining the type of problem and extracting the key elements of each problem (such as optimization objectives, constraints, and decision variables), it is possible to ensure that the subsequent model design and solution process are optimized in a targeted manner. The beneficial effect of this step is that it clarifies the application scenario of the problem, ensures the structuring and standardization of the problem description, and thus provides a clear path for subsequent automated modeling and code generation. By reasonably defining the problem type, the ambiguity of problem modeling can be reduced, thereby improving the solution efficiency and accuracy of the entire system.
[0086] S1.1. Extract mathematical expressions, variables and parameters of various types of mathematical models from seed data and generate corresponding mathematical model templates for each problem. This ensures the parameterization and modular design of the model, so that different optimization problems can be adapted to different model types.
[0087] S1.2. Extract the codes used for model construction, solution process and result processing to form a standardized code template, and extract code comments and documents at the same time.
[0088] It is further explained that the automatic generation of solution codes suitable for different problems and models reduces the duplication of work in the development process, and at the same time improves the reliability and maintainability of the code by extracting code comments and documents.
[0089] S1.3. Through reasonable data structure design, the seed data is organized into question pool, model pool and code pool.
[0090] The problem pool stores different types of operations research optimization problems and their key elements, including problem description, optimization objectives, and constraints.
[0091] The model pool stores mathematical models that match the problem and the corresponding expressions, variables, and parameters.
[0092] The code pool stores the solution codes corresponding to the model, including codes for different modules such as construction, solution and result processing.
[0093] Integrate the problem pool, model pool and code pool to form the initial task pool.
[0094] Metadata can include information such as the type, complexity, and application field of the task, while tags can quickly retrieve and filter task samples that meet specific conditions.
[0095] S2. Few-shot prompting technology is a method of learning through language models in the field of natural language processing, especially for application scenarios of large-scale pre-trained models (such as the GPT series). In few-shot prompting, by providing a small amount of example data to the model, that is, only a few specific examples are needed to enable the model to understand the task and perform corresponding reasoning or generation.
[0096] Specifically, a seed problem that meets the defined operation research optimization problem type is selected from the initial task pool. Three core elements are extracted from the selected seed problem: optimization objective, constraint conditions and decision variables.
[0097] The optimization objective refers to what the goal of the problem is, such as minimizing cost, maximizing efficiency, etc.
[0098] The constraints are defined to be the restrictions that must be followed in the problem, such as resource restrictions, time constraints, etc.
[0099] The decision variables refer to the variables that need to be solved in the problem, such as the number of resource allocations, the choice of paths, etc.
[0100] It is further explained that by automatically extracting optimization objectives, constraints, and decision variables, the workload of manual problem analysis is reduced, and the consistency and accuracy of problem modeling are improved.
[0101] S2.1. The design of the prompt template mainly includes the problem type, the description of the optimization goal and the constraints.
[0102] The problem type refers to the type of operations research optimization that the problem belongs to (such as resource allocation or path planning).
[0103] The description of the optimization goal is used to clearly state the optimization goal of the problem, such as the cost to be minimized or the output to be maximized.
[0104] Constraints are used to list the constraints that need to be met in the problem, such as a budget cap or time limit.
[0105] It is further explained that by automatically extracting optimization objectives, constraints, and decision variables, the workload of manual problem analysis is reduced, and the consistency and accuracy of problem modeling are improved.
[0106] S2.2. Design a prompt template including the problem type, description of the optimization goal, and constraints.
[0107] The problem type specifies which type of operations research optimization the problem belongs to (such as resource allocation or path planning).
[0108] The design of the prompt template needs to be adjusted according to the type of question to ensure that the template can correctly describe the characteristics of the seed question and provide sufficient information for generating new question scenarios.
[0109] S2.3. Further add specific scenarios and optimization requirements to the designed basic prompt template.
[0110] Specifically, the addition of specific scenarios is to enhance the realism and applicability of the questions and ensure that the generated question samples can be applied in actual scenarios.
[0111] For example, in the path planning problem, the logistics scenario of a specific geographical area can be added; in the resource allocation problem, the resource and time constraints of a specific project can be added.
[0112] It is further explained that by adding specific scenarios and optimization requirements, the generated problem samples are closer to actual application scenarios and can better meet the diverse optimization requirements in different scenarios. This process improves the realism and operability of the generated problems, ensuring that the problem samples are not only of theoretical significance, but can also be applied to different optimization scenarios in reality.
[0113] S2.4. Input the designed prompt template into the language model, and the language model generates N different operations optimization problem scenarios based on the seed data and prompt template. Through the generation capability of the language model, multiple operations optimization problems with different scenarios and optimization requirements can be expanded from the seed problem. These problem scenarios include different optimization objectives, constraints, and variable settings, ensuring the diversity and wide applicability of the problem samples.
[0114] Small-scale generation (N≈10-20) is suitable for some simple scenarios, or when the variation space of the seed problem itself is small, the number of generated problem samples can be small, which is suitable for refined analysis and manual verification.
[0115] Medium-scale generation (N≈50-100) is suitable for scenarios where diverse problem samples need to be generated. If the problem type is more complex or multiple different scenarios and constraints need to be verified, generating 50-100 problem samples can ensure that most possible variants are covered.
[0116] Large-scale generation (N≈100-1000). In large-scale application scenarios, especially when training machine learning models or building large data sets are required, it is common to generate hundreds or even thousands of problem samples.
[0117] S2.5. After generating N different operations research optimization problem scenarios, these problem scenarios need to be verified and screened. Ensure that the generated problem scenario descriptions are reasonable and remove duplicate problems that are too similar to the seed problem.
[0118] By verifying the rationality of the problem description, we can eliminate those problems that do not conform to actual logic or have no application significance; and by removing duplicate problems, we ensure the diversity and uniqueness of the problem samples.
[0119] For example, select a simple path planning seed problem from the initial task pool.
[0120] Problem description: A logistics company needs to deliver goods from the warehouse to several customers. The company hopes to find the shortest path that passes through all customers and returns to the warehouse, minimizing the total delivery time.
[0121] Optimization goal: minimize the total delivery time.
[0122] Constraints: Each customer must be visited once, vehicle capacity is limited, and working hours per day do not exceed 8 hours.
[0123] Decision variables: determine the order in which the delivery vehicles travel.
[0124] Based on the above seed questions, multiple different operations research optimization problem scenarios are generated through the language model.
[0125] Scenario 1, Problem Description: A courier company wants to optimize its delivery routes. The company needs to start from the distribution center, deliver to several customers and return. The total delivery distance must be minimized.
[0126] Optimization goal: minimize the total delivery distance.
[0127] Constraints: Each customer must be visited once, the vehicle’s fuel consumption is limited to 300 kilometers, and the delivery must be completed within one day.
[0128] Scenario 2, Problem Description: A cold chain company needs to plan the delivery routes of its refrigerated trucks. The refrigerated trucks start from the warehouse, deliver frozen food to several retail stores, and return to the warehouse. The driving distance of the refrigerated trucks should be the shortest to reduce fuel consumption.
[0129] Optimization goal: Minimize fuel consumption.
[0130] Constraints: Each retail store must be visited once, the maximum driving distance of the refrigerated truck is 400 kilometers, and the refrigeration equipment of the refrigerated truck must complete the delivery within 12 hours.
[0131] Scenario 3, Problem Description: A construction company needs to transport construction materials from a warehouse to multiple construction sites. The company hopes to find the shortest path that passes through all construction sites and returns to the warehouse to minimize the total transportation cost.
[0132] Optimization goal: Minimize transportation costs.
[0133] Constraints: Each construction site must be visited once, the maximum load of the truck is 10 tons, and the working time per day does not exceed 9 hours.
[0134] Scenario 4, Problem Description: A medical supplies company needs to optimize the delivery route to deliver medicines from the warehouse to multiple hospitals. The total delivery time must be minimized.
[0135] Optimization goal: minimize the total delivery time.
[0136] Constraints: Each hospital must be visited once, vehicle capacity is limited, and deliveries must be completed within 8 hours per day.
[0137] Scenario 5, Problem Description: An electronics company needs to transport electronic components from the warehouse to different factories and plan a shortest path that passes through all factories and returns to the warehouse.
[0138] Optimization goal: Minimize the total transportation time.
[0139] Constraints: Each factory must be visited once, the maximum working time of the vehicle is 10 hours, and traffic jams need to be considered during transportation.
[0140] After generating these scenarios, they were validated for plausibility and removed for duplication.
[0141] Reasonableness verification:
[0142] Scenario 1 is similar to the initial seed problem of the logistics company, but emphasizes minimizing the total delivery distance instead of time, and adds fuel consumption constraints. The scenario description is reasonable and the constraints are meaningful.
[0143] Scenario 2, the cold chain distribution scenario, adds the fuel consumption of the refrigerated truck and the time limit of the refrigeration equipment. The scenario is reasonable and has specific constraints for cold chain distribution, which meets the limitations in actual applications.
[0144] Scenario 3: The construction company needs to minimize the transportation cost. Different from the traditional path planning problem, this scenario is reasonable and practical, and takes the transportation problem of construction materials into consideration.
[0145] Scenario 4 is very similar to the seed problem and is almost a restatement of the initial problem. The only difference is that the type of supplies is medical supplies. Other conditions are almost the same, so it may be considered too similar.
[0146] Scenario 5: Special constraints of electronic product transportation and traffic congestion are added. The scenario is reasonable and has practical application significance.
[0147] Remove duplicate questions:
[0148] Scenario 4 is very similar to the seed problem, with almost the same optimization objectives and constraints. The only difference is the change in the type of goods (drugs vs. ordinary goods). Although the scenario is slightly different, its optimization objectives and constraints are too similar to the seed problem, so it can be considered a duplicate problem and needs to be removed.
[0149] Although scenario 1 is similar to the seed problem, the optimization objective changes from minimizing time to minimizing distance, and the constraints change (fuel consumption limit), so it can be retained.
[0150] Scenarios 2, 3, and 5 are relatively unique, with different constraints and optimization goals, and are completely reasonable and can be retained.
[0151] After verification and screening, scenarios 1, 2, 4, and 5 were retained. Scenario 4 was removed because it was too similar to the seed problem.
[0152] Further explanation: Through this verification and screening process, it is ensured that the generated question scenarios are reasonable and do not repeat the seed questions. This ensures the diversity and uniqueness of the question samples.
[0153] S3. Extract background information from the seed problem. Background information usually refers to the application scenario and field of the problem, such as logistics distribution, factory scheduling, inventory management, etc.
[0154] Through natural language processing technology, the natural language description of the problem is parsed to identify the key elements therein, which are usually optimization objectives, constraints and decision variables.
[0155] Through parsing, a structured complete problem description is generated, which includes background information and extracted key elements.
[0156] S3.1. Use NLP technology to extract optimization goals from the problem description of the new problem scenario, and match the appropriate mathematical model based on the extracted optimization goals.
[0157] Different optimization objectives may correspond to different types of mathematical models, such as linear programming, integer programming, mixed integer programming, dynamic programming, and network flow models.
[0158] Specifically, not only will the appropriate mathematical model be matched, but it will also be selected based on the complexity of the problem. For example, if the problem is small and the variables are continuous, linear programming may be sufficient; if the problem is large and the variables are discrete, mixed integer programming may be needed.
[0159] S3.2. Automatically extract constraints from new problem scenarios and extract their specific values or logical relationships. For example, "10 tons" in "the maximum capacity of the machine is 10 tons" is a specific quantity restriction.
[0160] After the constraints are extracted, a logic check is performed to ensure that the constraints are reasonable. If there are conflicts or unreasonable constraints, they will be deleted.
[0161] For example, if a problem requires a task to be completed in 1 hour, but resource allocation indicates that the task will take at least 2 hours, then there is a logical conflict.
[0162] If the vehicle capacity in a scenario is limited to 10 tons, but the requirement for a certain task is 12 tons, this will also create unreasonable constraints.
[0163] Further explanation: NLP technology can automatically parse the problem description and extract key elements, reducing manual intervention. Automated logic checking and constraint verification ensure that the generated problems are practical. It greatly reduces the workload of manual design, verification and problem solving, and improves the efficiency of generating and solving operations optimization problems.
[0164] S4. Analyze the background information of the generated problem samples and extract the operation optimization type of the problem. For example, the system can identify whether it is a logistics distribution problem, a production scheduling problem, or an inventory control problem.
[0165] Further extract resource information from the problem. Resources are variables directly related to the problem, such as vehicles, workers, machines, inventory, etc. Extracting this resource information can help the system clarify which variables need to be optimized when building a mathematical model.
[0166] S4.1. Extract the optimization objective of the problem sample and identify the mathematical form of the optimization objective, for example, linear objective function and nonlinear objective function.
[0167] The form of the optimization objective determines the type of mathematical model required. For example, a linear objective function is usually suitable for linear programming, while a nonlinear objective function may require a model for nonlinear programming.
[0168] S4.2. Automatically extract all constraints from the problem sample and clarify the numerical limits of the constraints.
[0169] S4.3. Based on the analyzed problem type, retrieve mathematical models similar to the current problem sample from the initial task pool.
[0170] The retrieved similar problem models not only need to match the type of problem, but also need to further match the form of the optimization objective (such as linear or nonlinear) and the complexity of the constraints.
[0171] For example, if the optimization objective is a linear objective, a linear programming (LP) model is preferred.
[0172] If the constraints are complex, choose a model that is suitable for handling complex constraints, such as mixed integer programming (MIP) or dynamic programming (DP).
[0173] Extract the corresponding mathematical model template from the retrieved similar problems.
[0174] S4.4. Structurally mark the mathematical model template and clarify which parts need to be expanded or modified according to the problem sample. The marked expansion parts usually include the optimization objectives and constraints.
[0175] S4.5. Design a few-shot prompt template that includes the problem description and the reference mathematical model template. The prompt template is passed as input to the language model.
[0176] The language model generates a mathematical model that matches the problem sample by taking the problem description and reference model in the prompt template.
[0177] S4.5.1. In the generated mathematical model, the corresponding decision variables are automatically generated. Appropriate decision variables are generated according to the problem type.
[0178] For example, in a path planning problem, the decision variable might be “the path that each vehicle is planned to take.”
[0179] In a resource allocation problem, the decision variable might be “the amount of resources to allocate to each task.”
[0180] S4.5.2. For each decision variable, the system will also clearly define its value range and restrictions.
[0181] For example, whether the decision variable is an integer, the upper and lower limits of the variable, and whether there are other physical or logical restrictions.
[0182] It is further explained that through the few-sample prompting technology, a mathematical model that conforms to the problem sample can be automatically generated, which greatly reduces the workload of manual modeling and reduces the dependence on large amounts of training data.
[0183] S5. Extract the description of each key element from the generated operations research optimization mathematical model, including the description of the problem, the description of the optimization goal and the description of the constraints.
[0184] The problem description, the description of the optimization goal and the description of the constraint conditions are converted into a code prompt template for guiding the language model to generate solution codes.
[0185] Specifically, by extracting key information from the generated mathematical model and forming a code hint template, a clear generation guide is provided for the language model, reducing the ambiguity and uncertainty of code generation. The code hint template presents the problem description, optimization objectives and constraints in a structured manner, which helps to generate high-quality code.
[0186] S5.1. Input the generated code hint template into the language model. Based on the code hint template, the language model generates a code for solving the optimization problem.
[0187] First, introduce or import relevant mathematical solution libraries, such as PuLP, SciPy, and Gurobi.
[0188] The PuLP is a Python-based linear programming modeling library for defining, solving and processing linear optimization problems.
[0189] The SciPy is an open source Python library for scientific computing, which includes many modules for mathematical, scientific and engineering computing.
[0190] Gurobi is a commercial optimization software specially used to solve various complex mathematical optimization problems.
[0191] S5.2, when the language model generates code, it will select the appropriate class to define the category of the optimization problem according to the type of problem. For example, in PuLP, the commonly used class is LpProblem, which is used to define linear programming problems.
[0192] If the problem is a nonlinear programming, the language model might choose another library (such as SciPy) and use different classes to define the problem.
[0193] Further explanation: by generating code through language models, the category of optimization problems (such as linear programming or nonlinear programming) can be automatically defined according to problem samples, avoiding errors or omissions in manual selection. The problem definition in the code can also be automatically adjusted according to the optimization goal of the problem (maximization or minimization), enhancing the flexibility of the code.
[0194] S5.3. Based on the resource information in the problem sample, the language model uses the classes of the solution library to define decision variables when generating code. For example, in PuLP, LpVariable is used to define decision variables.
[0195] Automatically generate the definition of decision variables based on the description in the problem sample. For example, in a path planning problem, the decision variable may be the driving path of each vehicle; in a production scheduling problem, the variable may be the allocation of each task.
[0196] S5.4. Based on the optimization goal in the problem sample, the language model generates code to define the objective function. In PuLP, the objective function is usually a linear expression.
[0197] The language model automatically generates corresponding inequality or equality constraints based on the constraint description in the problem sample and adds them to the model.
[0198] Further explanation: The code of the optimization target is automatically generated according to the problem description to ensure the correctness and consistency of the objective function. The code generated by the language model automatically adds all constraints to ensure that the model is complete and covers all restrictions.
[0199] S5.5. The code generated by the language model will call the solver in the solution library to find the optimal solution that satisfies all constraints based on the objective function and constraints in the model.
[0200] The solver solves the optimization problem through internal mathematical algorithms (such as simplex method, interior point method, branch and bound method, etc.) For different optimization problems, the solver may use different algorithms to find the optimal solution.
[0201] S5.6. After the solver completes the solution, the code generated by the language model will output the optimal solution to the optimization problem. For each decision variable, its optimal value will be output.
[0202] It is further explained that the solver using the solution library can quickly find the optimal solution that meets the constraints, significantly improving the solution efficiency, and can automatically select the appropriate solution library and method to handle different types of optimization problems.
[0203] S6. Expanding the generated data samples through enhancement operations, wherein the enhancement operations include modifying the optimization objectives or condition constraints, restating the problem, and modifying the modeling solution by including multiple modeling techniques.
[0204] S6.1. Modifying the optimization target or conditional constraints refers to prompting the language model to identify the modifiable parts in the existing mathematical model, and the modifiable parts include the optimization target and conditional constraints.
[0205] Randomly select an element from the identified modifiable parts to modify. Generate new data samples by modifying the optimization objectives and constraints. The new samples show different optimization requirements and constraints and are suitable for different scenarios.
[0206] For example, in a production scheduling problem, a new sample may be generated in which the optimization objective changes from minimizing production time to minimizing production cost, or the constraint changes from at most 5 machines being available to at most 3 machines being available.
[0207] It is further explained that by randomly selecting and modifying the modifiable elements in the model, a series of data samples with different optimization requirements are generated, which improves the diversity of the data. Moreover, by modifying the optimization objectives and constraints, the generated new data samples can adapt to different scenarios and problem requirements, making the model show good applicability in different environments.
[0208] S6.2. Prompt the language model to restate the existing problem description in multiple forms.
[0209] The restatement process allows the language model to generate diverse language expressions, ensuring that each restatement has a different semantic expression.
[0210] For example, in the original problem description, we need to minimize the transportation cost, and the vehicle's load cannot exceed 10 tons.
[0211] Restatement 1, the goal is to reduce transportation costs, and the maximum load per vehicle is 10 tons.
[0212] To restate 2, the maximum load capacity of the vehicle is 10 tons, and our optimization goal is to make the transportation cost as low as possible.
[0213] Further explanation: by restating the problem description, a variety of different expression forms are generated, which improves the diversity of problem description and adapts to different language styles and user needs. In addition, the diverse language expressions help the model to be universal among different users, application scenarios or regions, ensuring that the model adapts to multi-language and multi-cultural backgrounds.
[0214] S6.3. For complex operations research optimization problems, the prompt language model identifies modeling techniques that can be used to build and optimize the model.
[0215] The language model automatically identifies the modeling technique that is appropriate for the problem based on its complexity and structure.
[0216] For example, faced with a production scheduling problem with a large number of variables and constraints, a language model might recommend using branch and bound or dynamic programming.
[0217] S6.3.1. The language model generates multiple different modeling schemes, each of which uses different modeling techniques to build or optimize an existing mathematical model.
[0218] For example, in a path optimization problem, multiple modeling options may be generated, including the use of mixed integer programming (MIP) or network flow models.
[0219] From the generated modeling solutions, the system randomly selects one of the techniques and modifies or replaces the existing mathematical model accordingly.
[0220] For example, if a relaxation method is chosen, the model may make the problem easier to solve by relaxing some constraints.
[0221] It is further explained that by generating different modeling solutions, multiple solutions are provided for the same problem, which improves the flexibility of the model. In addition, the automatic selection and application of different modeling techniques reduces the need for manual intervention and improves the modeling efficiency.
[0222] S6.4. Generate diverse data samples for different problem complexities and scenario requirements through different modeling techniques. These data samples can reflect various optimization requirements and constraints.
[0223] For example, for a resource allocation problem, multiple different data samples are generated, reflecting different resource constraints, time constraints, and optimization goals.
[0224] It is further explained that the data synthesized by the enhanced operation can better cope with the dynamic changes of the modeling environment, and effectively meet the needs of coping with diversified expressions by restating the problem. In addition, for difficult problems, modeling modification and optimization are carried out through different modeling techniques to better adapt to the possibility of multiple modeling schemes.
[0225] S7. Extract the core modules from the generated code and check whether the code is complete, ensuring that each part exists and has a clear structure without omissions. For example, whether the necessary solver library imports are missing, whether the solver call is missing, etc. Also check whether the code correctly imports the required mathematical solver library. Ensure that the generated code contains the correct library import statements. Finally, check whether the imported library is version compatible to avoid runtime errors caused by version incompatibility.
[0226] S7.1. To avoid conflicts, create an isolated virtual environment for each code sample run. The isolated virtual environment ensures that each code sample runs in an independent environment, avoiding package dependency and library version conflicts with other code samples.
[0227] S7.2. Run the generated code and call the pre-imported solver to solve the optimization problem.
[0228] During code execution, execution logs are captured, including solver output information, such as intermediate results, warning messages, iteration times, etc. These logs help track code execution.
[0229] It also captures exceptions, such as errors that occur during code execution, such as library import errors, data type errors, solution failures, etc. By capturing exceptions, problems in the code can be identified and appropriate solutions can be taken.
[0230] S7.3. Set evaluation indicators based on code optimization time, solution accuracy, and resource usage.
[0231] The optimization time of the code is the time required by the solver to find the optimal solution, usually in seconds.
[0232] The accuracy of the solution indicates whether the solution output by the solver reaches the expected accuracy, and the accuracy can be evaluated by the value of the objective function or the degree of satisfaction of the constraint conditions.
[0233] The resource usage refers to the computing resources used during code execution, such as CPU and memory usage.
[0234] S7.4. Read the output results of the solver, including the value of each decision variable and the value of the objective function.
[0235] Check whether the solver successfully found a solution and check whether the solution output by the solver satisfies all constraints.
[0236] For example, if the constraint is x+y<=100, check whether the output values of x and y satisfy this condition.
[0237] S7.5. Compare the quality of the solution with the expected standard to determine whether the solution is of high quality, for example, whether the accuracy of the solution is high enough, whether the optimization time is within a reasonable range, and whether the resource usage is efficient.
[0238] S7.6. The code runs successfully and the output solution meets all the evaluation criteria, which is defined as the optimal solution.
[0239] Record and save successfully run code samples and their output results.
[0240] Further explanation, the use of virtual environments ensures the independence between different code samples and avoids package dependency conflicts. The high quality of the solutions output by the solver is ensured by optimizing the evaluation of time, solution accuracy and resource usage.
[0241] This embodiment also provides a data synthesis device for operational optimization based on high-quality seed data, comprising:
[0242] The seed data management module builds and manages the initial task pool and stores multiple seed data samples containing questions, models, and codes;
[0243] The question expansion module uses the few-sample prompting technology to expand the questions in the seed data to multiple different question scenarios and generate corresponding complete question samples;
[0244] The mathematical model generation module generates the corresponding mathematical model based on the expanded problem samples using the few-sample prompting technology;
[0245] The code generation module, based on the generated mathematical model, uses the few-sample hint technology to generate the operations optimization code that can solve the model;
[0246] The data enhancement module expands the generated data samples through various enhancement operations;
[0247] The execution and quality inspection module executes the generated code to check its functional integrity, the output quality of the solver, and the rationality of the solution.
[0248] This embodiment also provides a computer device, which is suitable for the case of an operations optimization data synthesis method based on high-quality seed data, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the operations optimization data synthesis method based on high-quality seed data proposed in the above embodiment.
[0249] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0250] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for realizing operations optimization data synthesis based on high-quality seed data as proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0251] In summary, the present invention achieves this by: using the few-sample prompting technology to expand the seed problems in the task pool to multiple different operations research optimization problem scenarios. The use of the few-sample prompting technology enables the generation of diverse operations research optimization problem samples even when the sample data is limited. The scenario expansion of the problem samples is achieved, which can cover more practical application scenarios and optimization requirements. The few-sample prompting technology is combined with the mathematical model in the initial task pool to automatically generate a mathematical model that matches the problem sample. The problem description is combined with a suitable mathematical model to ensure that each generated problem sample is equipped with a reasonable mathematical model. A one-to-one mapping between the problem and the mathematical model is achieved, solving the problem of model design relying on manual experience in traditional operations research optimization.
[0252] Example 2, referring to Table 1, is the second example of the present invention. To further verify the technical solution of the present invention, experimental simulation data of an operations optimization data synthesis method based on high-quality seed data is provided.
[0253] This example aims to demonstrate the innovation and advantages of the data synthesis method for operations research optimization based on high-quality seed data in generating mathematical models and solving codes. For comparative experiments, two operations research optimization problem scenarios were selected: path planning problem and inventory management problem. These problems were generated from the initial task pool through the few-sample prompt technology and automatically expanded to multiple problem scenarios. The generated mathematical model and code were then executed through an isolated virtual environment, and the relevant performance data was recorded.
[0254] In the experimental preparation stage of the present invention, an initial task pool is first constructed based on historical project experience, which contains multiple seed data samples. Each seed data sample includes a problem description, a corresponding mathematical model, and a solution code. Specifically, the seed data of the path planning problem aims to optimize the logistics distribution path, with the goal of minimizing the total transportation cost while considering the constraints of the transportation time window and vehicle capacity; the seed data of the inventory management problem aims to optimize the inventory turnover rate, with the goal of minimizing the inventory holding cost while meeting the constraints of demand fluctuations and storage capacity.
[0255] For the comparative test, the currently commonly used manual modeling and code generation methods were used as the control group for the comparative technology. The comparative technology process usually includes the following steps:
[0256] Problem modeling needs to be done manually by domain experts. Taking the path planning problem as an example, experts write a mathematical model based on the problem description, usually based on linear programming or mixed integer programming. The optimization objectives (such as minimizing the path or cost) and constraints (such as time windows and capacity constraints) in the model are manually analyzed and entered manually.
[0257] Code generation also requires manual writing. Usually, experts will manually write code based on the model and use open source solvers such as PuLP or Gurobi to solve it. The code writing process includes importing the solution library, defining decision variables, writing objective functions and constraints, etc.
[0258] Execute the solver to obtain the optimal solution. Since the comparison technology relies on manual modeling and code generation, it is less efficient, especially when the problem complexity is high, it is easy to have inaccurate models or long solution time.
[0259] In contrast, the present invention uses a few-sample prompting technology to automatically generate mathematical models and codes suitable for different problem scenarios, greatly improving generation efficiency and model accuracy. During the experiment, the testers tested the performance of the present invention and the comparison technology in different problem scenarios, focusing on four indicators: model complexity (number of constraints), solution accuracy (objective function value), execution time, and memory usage.
[0260] Through enhanced operations, the present invention can expand the generated data samples. For example, in the path planning problem, the system generates multiple different data samples by modifying the optimization goal (such as changing from minimizing the path length to minimizing the transportation time) and the constraints (such as increasing or decreasing the time window limit). The generated code is executed in an isolated virtual environment, and the solution log, execution time and memory usage are recorded. Comparative tests show that the present invention has significant advantages in the complexity of generating mathematical models and the efficiency of code execution.
[0261] The details are shown in Table 1 below:
[0262] Table 1 Comparison of generated results
[0263] Parameter name Path planning problem (this invention) Inventory Management Problem (Invention) Path Planning Problem (Comparative Technology) Inventory Management Problems (vs. Technology) Model complexity (number of constraints) 18 20 11 15 Accuracy of the solution (objective function value) 98.70% 95.30% 90.20% 85.60% Execution time (seconds) 1.9 2.4 4.5 5.3 Memory usage (MB) 162 155 189 182 Optimal solution success rate (%) 96 92 83 78
[0264] It can be clearly seen from the table data that the method of the present invention is significantly superior to the comparative technology in many aspects, and has good adaptability and scalability in different problem scenarios.
[0265] First, in terms of model complexity (measured by the number of constraints), the present invention demonstrates stronger modeling capabilities. For the path planning problem, the present invention generates a mathematical model containing 18 constraints, while the comparison technology only generates 11 constraints. In the inventory management problem, the model of the present invention contains 20 constraints, while the model of the comparison technology only contains 15 constraints. This shows that the present invention can automatically generate a more complex and complete mathematical model through a small sample prompting technology, covering more business constraints and optimization requirements. This increase in complexity ensures that the model can more comprehensively describe the various constraints in actual problems without significantly increasing the computational cost, thereby improving the accuracy of the solution.
[0266] In terms of solution accuracy. In the path planning problem, the optimal solution solved by the code generated by the present invention has an accuracy of 98.7%. In comparison, the accuracy of the comparison technology of manual modeling is only 90.2%. In the inventory management problem, the accuracy of the present invention is 95.3%, while the comparison technology is only 85.6%. This difference shows that the present invention can better capture the subtle differences in the problem based on the automatically generated mathematical model, ensuring that the solution is closer to the actual optimal solution. This improvement in accuracy is very critical, especially in scenarios with high accuracy requirements such as logistics and inventory management, which can bring significant cost savings and efficiency improvements.
[0267] Execution time. In the path planning problem, the code execution time of the present invention is 1.9 seconds, while the comparison technology requires 4.5 seconds to complete the solution. In the inventory management problem, the execution time of the present invention is 2.4 seconds, while the comparison technology requires 5.3 seconds. The reason for this difference in execution time is that the present invention significantly reduces the time required for manual code writing and debugging by automatically generating code and efficiently calling the solver. At the same time, the model structure generated by the present invention is more efficient, reducing unnecessary calculation steps in the solution process. In large-scale optimization tasks, this time difference will be significantly amplified, resulting in huge efficiency advantages.
[0268] In terms of memory usage, the code generated by the present invention occupies less memory when executed. In the path planning problem, the memory usage of the present invention is 162MB, while the comparison technology is 189MB. In the inventory management problem, the memory usage of the present invention is 155MB, while the comparison technology is 182MB. The reduction in memory usage means that the present invention can better utilize computing resources when dealing with complex problems, avoiding solution interruptions or performance degradation due to insufficient memory. This is especially important when dealing with large-scale data sets and complex problem scenarios, and can significantly improve the stability and processing power of the system.
[0269] Finally, in terms of the success rate of the optimal solution. In the path planning problem, the optimal solution success rate of the present invention is 96%, while the comparison technology is 83%; in the inventory management problem, the success rate of the present invention is 92%, while the comparison technology is only 78%. This shows that the present invention can find the optimal solution more stably when generating code, reducing failures caused by inaccurate models or improper solver settings. In the comparison technology, due to the large manual errors and adjustment costs in manual modeling and code writing, it often takes multiple debugging to find a suitable solution, and the present invention significantly reduces this uncertainty through automated processes.
[0270] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A data synthesis method for operational optimization based on high-quality seed data, characterized by: include, Building an initial task pool, wherein the initial task pool includes multiple seed data samples, each of which includes a question, a model, and a code; Based on the problems in the seed data sample, the few-sample prompt technology is used to expand to multiple problem scenarios and generate corresponding complete problem samples; Based on the problem samples, combined with the mathematical models in the initial task pool, a mathematical model corresponding to the corresponding problem samples is generated through the few-sample prompt technology; Based on the generated mathematical model, a code corresponding to the mathematical model is generated through a few-sample prompting technique; Expand the generated data samples through augmentation operations; Perform quality checks by executing the generated code; Construct an initial task pool, which contains multiple seed data samples, each of which includes a question, a model, and a code. Specifically, the following steps are included: Define the types of problems, including resource allocation problems, path planning problems, inventory management problems, and scheduling problems, and extract key elements of the problems; Extract models including linear programming, integer programming, mixed integer programming, dynamic programming and stochastic programming types, and extract mathematical expressions, variables and parameters of the models; Extract the code including model building, solution process and result processing, as well as code comments and documents; Use data structures to define problem pools, model pools, and code pools; Integrate the problem pool, model pool and code pool to form an initial task pool; Use a relational database to store task samples and add metadata and tags to the task samples.
2. The method for synthesizing operations optimization data based on high-quality seed data according to claim 1, characterized in that: Based on the problems in the seed data sample, the few-sample prompt technology is extended to multiple problem scenarios, which includes the following steps: Select a seed problem from the constructed initial task pool, and the seed problem conforms to the type of operations research optimization problem defined in the initial task pool; Extract optimization objectives, constraints, and decision variables from the seed problem; According to the description of the seed problem, a prompt template with examples is designed, wherein the prompt template includes the problem type, the description of the optimization target and the constraint conditions, and the content in the prompt template is adjusted according to the type of the problem; Add specific scenarios and optimization requirements to the prompt template to complete the design of the prompt template; Input the designed prompt template into the language model, and the language model will generate N different operations optimization problem scenarios based on the seed data and prompt template; The verification and screening of problem scenarios are completed by verifying whether the scenario description of the generated problem is reasonable and removing duplicate questions that are too similar to the seed questions.
3. The method for synthesizing operations optimization data based on high-quality seed data according to claim 1, characterized in that: Generate the corresponding complete question sample, which includes the following steps: Extract background information from the seed question, and further parse the question description through natural language processing technology to extract key elements and form a complete question description; Extract optimization objectives from new problem scenarios and match mathematical model types based on the type and complexity of the problem; Extract constraints from new problem scenarios and check whether the logic and conditions are reasonable; Integrate the complete problem description, optimization objectives and constraints to form a complete operations research optimization problem sample.
4. The method for synthesizing operations optimization data based on high-quality seed data according to claim 1, characterized in that: Based on the problem samples, combined with the mathematical model in the initial task pool, a mathematical model corresponding to the corresponding problem sample is generated through the few-sample prompt technology, which specifically includes the following steps: Analyze the background of the problem sample, identify the operational optimization type of the problem, and extract resource information; Extract optimization goals from problem samples, clarify the specific content of optimization, and identify the form of optimization goals; Extract all constraints from the problem sample and specify the numerical limits involved in each constraint; Retrieve mathematical models of similar problems from the initial task pool based on the type of problem samples, and further match the form of the optimization objective and the complexity of the constraints; Extracting mathematical model templates from the retrieved similar problems; Structurally mark the extracted mathematical model template; Design a few-shot prompt template that includes a problem description and a reference mathematical model template; Input the few-sample prompt template into the language model, guide the language model to generate the optimization target based on the problem sample and the constraint condition consistent with the problem description, and form the corresponding mathematical model of the corresponding problem sample; Generate its decision variables based on the formed mathematical model and clarify its limitations.
5. The method for synthesizing operations optimization data based on high-quality seed data according to claim 1, characterized in that: Based on the generated mathematical model, the code corresponding to the mathematical model is generated through the few-sample prompting technology, which specifically includes the following steps: Extract the problem description, the description of the optimization goal, the description of the constraint conditions and the code prompt from the generated mathematical model to form a prompt template; Input the prompt template into the language model to generate code for importing relevant mathematical solution libraries; Use the library classes to define classes of optimization problems; Use LpVariable to define the decision variables in the optimization problem; Generate optimization target code that defines the optimization goal and adds constraints; By calling the solver, we start solving the optimization problem and find a solution that satisfies all constraints and optimizes the objective. Output the optimal solution found by the solver.
6. The method for synthesizing operations optimization data based on high-quality seed data according to claim 1, characterized in that: The generated data samples are expanded through enhancement operations, which specifically include the following steps: prompting the language model to identify modifiable parts in the mathematical model, wherein the modifiable parts include optimization objectives and constraints; Randomly select one of the potential modifiable elements and generate new data samples with different optimization requirements by modifying the optimization objectives and constraints; Restate the existing problem description in various forms by prompting the language model; Generate problem descriptions with different semantic expressions, and the restatement process allows for diverse language expressions; For complex operations optimization problems, language model recognition modeling techniques are provided; By prompting the language model to generate different modeling schemes, one of the modeling techniques is randomly selected to modify and replace the existing mathematical model; By applying different modeling techniques, we can generate diverse data samples suitable for different problem complexities and scenario requirements; By executing the generated code, the quality check is carried out, which includes the following steps: Extract the core modules from the generated code, check the code integrity and whether the required mathematical solution libraries are correctly imported; Create an isolated virtual environment for code execution and provide input data; Call the solver to execute the generated code and capture the execution log and exceptions; Set evaluation metrics based on code optimization time, solution accuracy, and resource usage; Read the output of the solver to verify whether the solution is found successfully and check whether the solution output by the solver satisfies all constraints; Evaluate the output solution effect according to the evaluation indicators to determine whether the quality of the solution meets expectations; The solution that runs successfully and meets expectations is defined as the optimal solution; For the code sample with the optimal solution, the execution result of the sample is recorded and saved, and marked as a successful sample.
7. A data synthesis device for operations optimization based on high-quality seed data, based on the data synthesis method for operations optimization based on high-quality seed data according to any one of claims 1 to 6, characterized in that: include, The seed data management module builds and manages the initial task pool and stores multiple seed data samples containing questions, models, and codes; The question expansion module uses the few-sample prompting technology to expand the questions in the seed data to multiple different question scenarios and generate corresponding complete question samples; The mathematical model generation module generates the corresponding mathematical model based on the expanded problem samples using the few-sample prompting technology; The code generation module, based on the generated mathematical model, uses the few-sample hint technology to generate the operations optimization code that can solve the model; The data enhancement module expands the generated data samples through various enhancement operations; The execution and quality inspection module executes the generated code to check its functional integrity, the output quality of the solver, and the rationality of the solution.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the operations optimization data synthesis method based on high-quality seed data described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the operations optimization data synthesis method based on high-quality seed data described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Self-guiding code error correction data set generation method for teenager programming scene
CN117971704A
Task processing method and task processing system
CN119336477A
Cited By
Intelligent auxiliary decision-making method and system for logistics support of equipment system, and medium
CN120851561A
A method, system, and medium for intelligent auxiliary decision-making in logistics support of equipment systems.
CN120851561B
Equipment system logistics support large model training method and system and storage medium
CN121257610A