A water regime scheduling intelligent agent multi-round dialogue method and system based on a model context protocol
Patent Information
- Application Number
- CN202611417134.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-10-16
AI Technical Summary
现有基于智能体的水库调度方法通过融合知识图谱与大语言模型实现任务指令解析与调度优化,但大语言模型直接接入知识图谱和感知数据集时缺乏标准化的数据访问协议,当需要接入新的数据源或计算模型时需重新开发接口,系统与数据源紧耦合,扩展性难以满足实际工程需要
[0063] 1. This invention encapsulates the data access and computing capabilities required for water situation scheduling into intelligent tools with standardized input and output specifications by constructing a standardized tool registration center based on a model context protocol. Large language models dynamically discover and call tools through a unified protocol. New data sources or computing models can be accessed simply by encapsulating and registering them, without modifying the core code of the intelligent agent. This solves the technical problems of tight coupling between the system and the data source and insufficient scalability in the prior art.
Smart Images

Figure CN122927322A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the interdisciplinary field of artificial intelligence and water conservancy engineering, and in particular to a multi-turn dialogue method and system for water situation scheduling intelligent agents based on model context protocol. Background Technology
[0002] Reservoir scheduling is a core technical means to ensure flood control safety, efficient water resource utilization, and stable power grid operation. Dispatchers need to comprehensively analyze real-time hydrological data, meteorological forecasts, scheduling procedures, reservoir characteristic parameters, and various constraints to formulate scientifically sound scheduling plans. Existing agent-based reservoir scheduling methods achieve task instruction parsing and scheduling optimization by integrating knowledge graphs and large language models. However, when large language models directly access knowledge graphs and perception datasets, a standardized data access protocol is lacking. When new data sources or computational models need to be accessed, interfaces must be redeveloped, resulting in tight coupling between the system and data sources and difficulty in achieving scalability that meets practical engineering needs.
[0003] Furthermore, such solutions generally adopt a single-round task instruction model, making it impossible for dispatchers to refine and adjust the dispatch plan through multi-round dialogues. This makes it difficult to adapt to the progressive work mode of analysis and decision-making in actual dispatching. Although the flood control dispatching rule question-and-answer recommendation method based on a large language model can achieve rapid retrieval and recommendation of dispatching rules, it only supports single-round question-and-answer and does not support multi-round context accumulation. It cannot handle complex dispatching requirements that require multiple rounds of dialogue to clarify, and the recommendation results are only rule clauses without combining them with actual working conditions for constraint feasibility verification. Dispatchers still need to manually complete flood control calculations and plan preparation.
[0004] In existing engineering processes, the generated scheduling schemes lack multi-dimensional constraint verification loops. Scheduling schemes generated by large language models may violate flood control safety constraints or ecological baseflow constraints, posing safety risks. Water resources scheduling involves multiple types of constraints, including flood control, water conservancy, ecological, and engineering constraints. These constraints are coupled with each other. Single-method constraint perception methods can only perform pre-defined rule matching, making it difficult to cover scenarios where multiple constraints are activated simultaneously under complex operating conditions. Furthermore, relying solely on large language models to generate schemes without constraint loop verification may also output unexecutable schemes that violate physical safety constraints.
[0005] Existing systems also lack a tiered mechanism for human-machine collaboration. Regardless of the reliability level of the solution, they employ fixed strategies of manual confirmation or automatic execution, failing to dynamically adjust the degree of human-machine involvement based on the solution's confidence level. This makes it difficult to improve automation efficiency in high-reliability scenarios and to ensure decision-making safety in low-reliability scenarios. Alternative methods such as knowledge graph question answering, single-round instruction parsing, or preset rule matching cannot directly provide executable scheduling solutions corresponding to flood control constraints, beneficial constraints, ecological constraints, and engineering constraints, nor can they support dispatchers in progressively refining decision-making needs through multi-round dialogue.
[0006] Therefore, there is a need for a method and system that supports dynamic registration and invocation of standardized tools, accumulation and fusion of multi-turn dialogue contexts, quantitative verification and iterative correction of multi-dimensional constraints of scheduling schemes, and multi-turn dialogue of water situation scheduling agents based on comprehensive confidence-based hierarchical execution control. Summary of the Invention
[0007] The purpose of this invention is to provide a multi-turn dialogue method and system for water situation scheduling agents based on model context protocol, so as to solve the above-mentioned technical problems existing in the prior art.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: a multi-turn dialogue method for water situation scheduling agents based on model context protocol, comprising:
[0009] A tool registry center based on the Model Context Protocol is constructed, and the data acquisition tools, calculation and analysis tools, and verification and execution tools required for water situation scheduling are encapsulated into standardized intelligent tools that conform to the Model Context Protocol specification. Each of the standardized intelligent tools defines a structured description of the input parameters and an output specification, and registers them to the tool registry center.
[0010] The system receives multi-turn dialogue requests in natural language from the scheduler. The large language model performs intent understanding on the current round request, extracts scheduling intent elements and maps them into vector representations. The current round vector is then weighted and fused with the vectors from previous rounds to obtain the cumulative context vector.
[0011] Based on the accumulated context vector, the semantic relevance score between the current query and each standardized intelligent tool in the tool registry is calculated, and the tool call sequence is dynamically arranged according to the scheduling scenario identification result. The large language model calls the corresponding standardized intelligent tools in sequence through the model context protocol client according to the tool call sequence to obtain hydrological data, scheduling rules and water conservancy calculation results, and generate a preliminary scheduling plan.
[0012] The constraint verification tool in the verification execution class tool performs multi-dimensional constraint verification on the preliminary scheduling scheme, calculates the constraint violation degree, and when the constraint violation degree exceeds the preset threshold, generates a correction suggestion and triggers the large language model to iterate and regenerate the scheduling scheme until the constraint verification passes or the maximum number of iterations is reached.
[0013] The confidence score of the scheduling scheme that passes the constraint verification is calculated. The confidence score is calculated based on the confidence score of the tool output data, the constraint satisfaction score, and the adoption rate of schemes in similar historical scenarios. The confidence score is compared with a preset tiered threshold, and a tiered decision is executed based on the comparison result: when the confidence score is higher than the high threshold, it is automatically compiled into a scheduling instruction and executed; when the confidence score is between the medium and high thresholds, it is displayed to the scheduler and executed after confirmation; when the confidence score is not higher than the medium threshold, it is only used as a reference for the scheduler to make their own decision.
[0014] By constructing a tool registry center based on a model context protocol and encapsulating various water resources scheduling tools into standardized intelligent tools, the large language model can dynamically discover and invoke tools through a unified protocol. Adding new data sources or computational models only requires encapsulation into tools conforming to the protocol specifications and registration, without modifying the core agent code, thus resolving the problem of tight coupling between the system and data sources. A multi-round context accumulation vector mechanism allows schedulers to follow up or adjust based on previous rounds of dialogue, and the agent integrates historical context to understand the incremental needs of the current round, supporting incremental scheduling decisions. A constraint verification closed-loop iterative correction mechanism ensures that the generated scheduling scheme meets four types of physical constraints: flood control, water conservancy, ecological, and engineering. A confidence-based hierarchical decision-making mechanism dynamically adjusts the degree of human-machine collaboration based on the overall confidence level of the scheme, balancing automation efficiency and decision-making safety.
[0015] Furthermore, the standardized intelligent tools include:
[0016] The hydrological data query tool is a data acquisition tool that connects to the data query interfaces of hydrological telemetry systems, meteorological forecasting systems, and reservoir real-time monitoring systems. Its input parameters include reservoir number, data type, and time range, and the output is time-series data.
[0017] The scheduling rule retrieval tool is a data acquisition tool that connects to the reservoir scheduling procedure database and flood control plan database. Its input parameters include reservoir number, scheduling scenario and current operating conditions, and the output is the applicable scheduling rule clauses and judgment conditions.
[0018] Water conservancy calculation tools belong to the category of calculation and analysis tools. They encapsulate flood control calculation models and water balance calculation models. Their input parameters include inflow process, reservoir characteristic parameters and starting water level. The outputs are outflow process, water level process and maximum discharge.
[0019] Constraint verification tools belong to the category of verification execution tools. They encapsulate multi-dimensional constraints. Their input parameters include scheduling scheme parameters and constraint configurations, and their outputs are the verification results and violation scores for each constraint item.
[0020] The scheduling scheme generation tool belongs to the verification and execution category. It encapsulates scheme comparison and scheduling instruction compilation functions. Its input parameters include hydraulic calculation results and constraint verification results, and its output includes scheduling scheme comparison results and scheduling instructions.
[0021] By encapsulating and registering five types of tools with standardized input and output specifications, modular and plug-and-play management of the data access and computing capabilities required for water situation scheduling has been achieved.
[0022] Preferably, the method for obtaining the cumulative context vector by weighted fusion of the current round vector and the historical round vectors is as follows:
[0023] Let the vector representation of the i-th round of dialogue intent be... Then the cumulative context vector in the nth round for:
[0024]
[0025] in, For the weights in round i, an exponential decay strategy is adopted:
[0026]
[0027] in, The attenuation coefficient is... This results in a higher weighting for near-turn dialogues compared to far-turn dialogues. This exponentially decaying weighted accumulation mechanism allows the agent to retain historical context information while avoiding excessive interference from distant turns in current decisions when handling multi-turn dialogues, thus supporting the scheduler's progressively refined decision-making needs.
[0028] Based on the cumulative context vector, the semantic relevance score S(q, t) between the query and each MCP tool is calculated, comprehensively considering three dimensions: the cosine similarity between the cumulative context vector and the tool description vector reflects semantic matching; the overlap between query keywords and tool description keywords reflects lexical matching; and the matching degree between the current scheduling scenario and the tool's applicable scenario reflects scenario adaptation. Specifically, the semantic relevance score is calculated as follows: Let the current query be q, and the functional description vector of tool t be , then the semantic relevance score is... for:
[0029]
[0030] in, The cosine similarity between the cumulative context vector and the tool function description vector; To query the overlap between the keyword set and the tool description keyword set; The degree of matching between the current scheduling scenario and the applicable scenario of tool t; For the weighting coefficients, satisfying Default value =0.4、 =0.3、 =0.3. Scene(t) ensures that flood control scenarios prioritize the use of flood regulation calculation tools, while power generation scenarios prioritize the use of water balance tools. This three-dimensional fusion scoring mechanism ensures accurate matching between tool routing and scheduling requirements.
[0031] Furthermore, the method for dynamically arranging the tool call sequence based on the scheduling scenario identification result is as follows:
[0032] Based on the scheduling scenario type identified by the large language model, the corresponding tool call sequence is obtained from the preset scenario and tool sequence mapping relationship;
[0033] Among them, the tool call sequence corresponding to the flood control scenario includes hydrological data query, scheduling rule retrieval, flood control calculation, constraint verification and scheme generation in sequence;
[0034] The tool call sequence for the power generation scenario includes, in sequence, hydrological data query, scheduling rule retrieval, water balance calculation, constraint verification, and scheme generation;
[0035] Each tool in the tool invocation sequence is invoked sequentially through the model context protocol client. By establishing a pre-defined mapping relationship between scenarios and tool sequences, different scheduling scenarios can automatically trigger differentiated tool invocation paths, ensuring precise adaptation between the invoked tools and specific scheduling business requirements.
[0036] Furthermore, the multidimensional constraint verification includes flood control constraint verification, beneficial resource constraint verification, ecological constraint verification, and engineering constraint verification; the method for calculating the constraint violation degree V is as follows:
[0037]
[0038] Where M is the total number of constraint terms, This is the violation indicator value for the j-th constraint. It is set to 1 when the j-th constraint is violated, and 0 otherwise. Let be the weight coefficient of the j-th constraint, reflecting the severity of the constraint, and satisfy . ;
[0039] When V exceeds a preset threshold, the constraint verification fails. A correction suggestion is generated based on the violated constraint, including the required adjustment of the discharge flow deviation. and / or water level deviation The large language model regenerates the scheduling scheme based on the correction suggestion and performs constraint verification again, iterating until the constraint violation degree meets the preset threshold requirement or reaches the maximum number of iterations.
[0040] By quantifying and verifying the four types of constraints and automatically generating correction suggestions to trigger iterations, the physical feasibility of the scheduling scheme is ensured, and the security risks of large language models directly outputting unexecutable schemes are eliminated.
[0041] Preferably, the method for calculating the confidence level of the scheme is as follows:
[0042]
[0043] in, The tool outputs data confidence scores, reflecting the quality of the data source. To constrain satisfaction; The adoption rate of solutions for similar historical scenarios; For the weighting coefficients, satisfying ;
[0044] The tiered thresholds include a high threshold and a medium threshold. When the confidence level of a solution is higher than the high threshold, it enters automatic execution mode; when the confidence level is between the medium and high thresholds, it enters suggestion confirmation mode; and when the confidence level is not higher than the medium threshold, it enters manual decision-making mode. This comprehensive confidence level calculation method takes into account data quality, constraint satisfaction, and historical experience, providing a reliable quantitative basis for tiered decision-making.
[0045] In some embodiments, the method further includes: after the scheme is executed, recording the execution results and actual effects, updating the historical prediction accuracy of each factor, and adaptively updating the weight coefficients.
[0046]
[0047] in, Let be the historical prediction accuracy of the i-th factor. The average prediction accuracy for all factors. The learning rate is used; after updating, the weight coefficients are normalized to make... This adaptive update mechanism enables the system to continuously optimize confidence assessment parameters based on historical performance, thereby improving the accuracy of hierarchical decision-making.
[0048] As a preferred solution, if the constraint violation degree still does not meet the preset threshold requirement when the maximum number of iterations is reached, the scheduling scheme obtained in the current iteration is output and a manual intervention prompt is triggered to ensure that the system can still provide a reference scheme and promptly remind the scheduler to intervene under extreme conditions.
[0049] This invention also provides a multi-turn dialogue system for water situation scheduling agents based on a model context protocol, used to implement the above method, comprising:
[0050] The multi-turn dialogue interaction module is used to provide a natural language dialogue interface, receive multi-turn dialogue input from the dispatcher, and display the scheduling plan, constraint analysis results, and plan confidence assessment to the dispatcher;
[0051] The scheduling agent module is data-connected to the multi-turn dialogue interaction module and is used to perform intent understanding, multi-turn context accumulation, dynamic tool orchestration, scheme generation and constraint verification closed loop. It communicates with the tool registration center module through the model context protocol client.
[0052] The tool registration center module is data-connected to the scheduling intelligent agent module and is used to manage the metadata of all registered standardized intelligent tools. The metadata includes tool name, function description, input and output structured description and applicable scenario tags, and provides tool discovery interface and tool calling interface.
[0053] The data source access module is connected to the tool registration center module to interface with the hydrological telemetry system, meteorological forecasting system, scheduling procedure library, reservoir characteristic parameter library, constraint configuration library and historical scheduling scheme library, providing underlying data access capabilities for various standardized intelligent tools.
[0054] The human-machine collaborative decision-making module is connected to the scheduling intelligent agent module. It is used to determine the decision mode based on the confidence level of the scheme. When the confidence level of the scheme is higher than the high threshold, it automatically compiles and executes the scheduling instruction. When the confidence level of the scheme is between the medium threshold and the high threshold or not higher than the medium threshold, it presents the scheduling scheme to the scheduler for confirmation or reference and feeds back the execution result to the scheduling intelligent agent module.
[0055] Furthermore, the scheduling agent module includes an intent understanding unit, a context accumulation unit, a tool orchestration unit, a scheme generation unit, and a constraint verification unit;
[0056] The intent understanding unit is used to extract the intent from the received natural language request to obtain structured intent elements;
[0057] The context accumulation unit is data-connected to the intent understanding unit and is used to perform weighted fusion of the current round intent vector and the historical round intent vectors to obtain the accumulated context vector.
[0058] The tool orchestration unit is data-connected to the context accumulation unit and is used to calculate the semantic relevance score based on the accumulated context vector and dynamically orchestrate the tool call sequence according to the scheduling scenario.
[0059] The scheme generation unit is data-connected to the tool orchestration unit and is used to generate a preliminary scheduling scheme based on the hydrological data, scheduling rules and water conservancy calculation results returned by the tool call.
[0060] The constraint verification unit is data-connected to the scheme generation unit and is used to perform multi-dimensional constraint verification on the preliminary scheduling scheme, calculate the constraint violation degree, and generate a correction suggestion when the constraint violation degree exceeds a preset threshold to trigger the scheme generation unit to iteratively regenerate the scheduling scheme.
[0061] A complete data flow link is formed between the units, which together support the multi-round dialogue decision-making closed loop of the water situation dispatching intelligent agent.
[0062] Compared with the prior art, the present invention has the following beneficial effects:
[0063] 1. This invention encapsulates the data access and computing capabilities required for water situation scheduling into intelligent tools with standardized input and output specifications by constructing a standardized tool registration center based on a model context protocol. Large language models dynamically discover and call tools through a unified protocol. New data sources or computing models can be accessed simply by encapsulating and registering them, without modifying the core code of the intelligent agent. This solves the technical problems of tight coupling between the system and the data source and insufficient scalability in the prior art.
[0064] 2. This invention uses an exponential decay weighted accumulation mechanism for multi-turn dialogue intent vectors to fuse historical dialogue intents into a cumulative context vector with higher weights for recent turns and lower weights for distant turns. This allows the scheduler to gradually follow up and adjust based on previous rounds of dialogue, and the agent can integrate historical context to understand the incremental needs of the current turn. This solves the technical problem that single-turn interaction cannot support progressive scheduling decisions in existing technologies.
[0065] 3. This invention dynamically arranges tool call sequences through three-dimensional fusion semantic relevance scoring. It calculates scores by comprehensively considering three dimensions: the cosine similarity between the cumulative context vector and the tool description vector, the overlap between query keywords and tool description keywords, and the matching degree between the current scheduling scenario and the applicable tool scenario. This ensures that the tools called in different scheduling scenarios are accurately matched with business needs. Differentiated tool sequences are triggered for flood control scenarios and power generation scenarios, which improves the accuracy of tool routing.
[0066] 4. This invention quantifies and verifies four types of constraints—flood control, water conservancy, ecology, and engineering—and calculates the degree of constraint violation. When the degree of violation exceeds a preset threshold, it automatically generates correction suggestions for the discharge flow deviation and water level deviation and triggers the large language model to iterate and regenerate the scheduling scheme, forming a constraint verification closed loop. This ensures the physical feasibility of the scheduling scheme and eliminates the safety hazards of the large language model directly outputting schemes that violate safety constraints.
[0067] 5. This invention calculates the confidence level of a solution by integrating the output data confidence level, constraint satisfaction level, and historical adoption rate of similar solutions using a comprehensive tool. After comparing the results with two thresholds, the solution is divided into three levels: automatic execution, suggestion confirmation, and manual decision-making. At the same time, the weight coefficients are adaptively updated based on historical execution results. This solves the technical problem in the prior art where the degree of human-machine collaboration is fixed and cannot be dynamically adjusted according to the reliability of the solution. It improves automation efficiency in high-confidence scenarios and ensures decision-making safety in low-confidence scenarios. Attached Figure Description
[0068] Figure 1 This is a schematic diagram of the overall architecture of the multi-turn dialogue system for water situation scheduling agents based on the model context protocol in this embodiment.
[0069] Figure 2 This is a flowchart illustrating the multi-turn dialogue method for water situation scheduling agents based on the model context protocol in this embodiment.
[0070] Figure 3 This is a schematic diagram of the scheduling scenario differentiation tool call sequence in this embodiment.
[0071] Figure 4 This is a schematic diagram of the constraint verification closed loop in this embodiment.
[0072] Figure 5 This is a schematic diagram of the confidence level decision-making process in this embodiment. Detailed Implementation
[0073] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the following embodiments are used to illustrate the technical solutions of the present application, and are not intended to limit the scope of protection of the present application.
[0074] In one implementation, combined with Figure 1 The system architecture shown fully describes the basic implementation process of a multi-turn dialogue system for water resources dispatching agents based on the Model Context Protocol (MGP). The system includes a dispatcher terminal, water resources dispatching agents, a MGP tool registry center, and five types of data sources.
[0075] The dispatcher inputs dispatch requests through a multi-turn dialogue interface on the terminal. The water situation dispatching intelligent agent is deployed on the reservoir dispatching center server, adopts a large language model with 13B parameters, and communicates with the tool registration center through the model context protocol client.
[0076] The tool registry is deployed on the application server and manages the metadata of registered tools. This metadata includes the tool name, function description, structured input / output descriptions, and applicable scenario tags. Data sources include a real-time hydrological database (stores monitoring data such as water level, flow, and rainfall, with a sampling interval of 1 hour), a scheduling procedure knowledge base (containing flood control scheduling procedures, beneficial scheduling plans, and flood prevention plans), a reservoir characteristic parameter database (stores capacity curves, discharge curves, and characteristic water levels), a constraint configuration database (stores flood control safety constraints, ecological baseflow requirements, and engineering limitations), and a historical scheduling scheme database (stores scheduling schemes and their execution effects from the past 5 years).
[0077] First, a Model Context Protocol (MGP) tool registry is built. The MGP server program is deployed on the application server, encapsulating five types of data access and computational capabilities into standardized intelligent tools:
[0078] The hydrological data query tool is registered as "query_hydro_data". It connects to the data query interface of the hydrological telemetry system, the meteorological forecasting system and the reservoir real-time monitoring system. Its input parameters include reservoir number, data type and time range, and the output is time series data.
[0079] The dispatch rule retrieval tool is registered as "retrieve_dispatch_rules". It connects to the reservoir dispatch procedure database and the flood control plan database. Its input parameters include reservoir number, dispatch scenario and current operating conditions. The output is the applicable dispatch rule clauses and judgment conditions.
[0080] The water conservancy calculation tool is registered as "compute_hydraulic". It encapsulates the flood control calculation model and the water balance calculation model. Its input parameters include the inflow process, reservoir characteristic parameters and the starting water level. The output is the outflow process, water level process and maximum discharge.
[0081] The constraint verification tool is registered as "verify_constraints". It encapsulates multi-dimensional constraints. Its input parameters include scheduling scheme parameters and constraint configuration. The output is the verification result and violation score of each constraint item.
[0082] The scheduling scheme generation tool is registered as "generate_dispatch_plan". It encapsulates the scheme comparison function and the scheduling instruction compilation function. Its input parameters include hydraulic calculation results and constraint verification results, and its output is the scheduling scheme comparison results and scheduling instructions.
[0083] Each tool registers its tool name, function description, input and output structured description, and applicable scenario tags with the tool registry center. Through the dynamic capability negotiation mechanism of the model context protocol, the large language model can discover all available tools when establishing a connection, without the need to develop separate interfaces for each data source.
[0084] Combination Figure 2 The multi-turn dialogue decision-making process shown involves multi-turn dialogue intent understanding and dynamic tool routing. The dispatcher initiates the first round of dialogue, for example, "What is the forecast for the inflow to Yebatan Reservoir over the next 3 days?" A large language model performs intent understanding, extracting the dispatch intent elements: the dispatch intent is a forecast query, the dispatch object is Yebatan Reservoir, the dispatch scenario is a water situation query, and the time range is 3 days. The structured intent elements are then encoded using a text embedding model (such as Sentence-BERT) to obtain a vector representation. Calculate the cumulative context vector (No historical accumulation in the first round).
[0085] based on Calculate the semantic relevance score for each tool, including the cosine similarity between the cumulative context vector and the tool function description vector of the hydrological data query tool. Search for the overlap between keywords and tool description keywords. The matching degree between the current scenario and the applicable scenario of the tool, with the weighting coefficients being optimized. =0.4、 =0.3、 =0.3, then If the inflow exceeds the trigger threshold of 0.6, the hydrological data query tool will be invoked to obtain the inflow forecast process line for the next 3 days. The maximum inflow of 2800 m³ / s will occur at 14:00 on the second day.
[0086] The dispatcher initiates a second round of dialogue, such as "According to the 20-year flood control plan, what is the maximum downstream discharge limit?" The large language model extracts the intent vector for the current round. Calculate the cumulative context vector:
[0087]
[0088] Where the attenuation coefficient If the optimal value is 0.85, then... , . By integrating the context of the first round of water situation query and the flood control scheduling intention of the second round, the weight of the near round dialogue (1.0) is higher than that of the far round dialogue (0.85), which enables the agent to retain historical context information while understanding the incremental demand of the current round.
[0089] The large language model identified the scheduling scenario as a flood control scenario, combined with... Figure 3 The differentiated tool call sequence shown is obtained from the preset scenario and tool sequence mapping relationship, and is arranged as follows: hydrological data query tool, scheduling rule retrieval tool, flood control calculation tool, constraint verification tool, and scheduling scheme generation tool.
[0090] The scheduling agent module sequentially calls various tools through the model context protocol client: the hydrological data query tool obtains the inflow forecast; the scheduling rule retrieval tool obtains the 20-year flood control plan rules (starting water level 145m, maximum allowable discharge 2200m³ / s, discharge variation not exceeding 500m³ / s / h); the water conservancy calculation tool takes the inflow process, reservoir capacity curve, and discharge curve as input, performs flood control calculations, calculates the outflow process and water level process, and provides the large language model to generate a preliminary scheduling plan.
[0091] Combination Figure 4 The constraint verification closed-loop process shown is used for iterative correction of the constraint verification closed-loop. The large language model generates a preliminary scheduling scheme based on the hydrological data, scheduling rules, and hydraulic calculation results returned by the tool call, extracting the scheme parameter: the discharge flow rate at 14:00 on the second day. highest water level .
[0092] The constraint verification tool verifies each of the four types of constraints on the scheme parameters:
[0093] Check whether the flood control constraint discharge exceeds the maximum allowable discharge. Therefore ;
[0094] The beneficial water level is checked to determine whether it is between the dead water level and the normal storage water level. Therefore ;
[0095] The ecological constraint verification checks whether the outflow meets the ecological base flow requirements. Therefore ;
[0096] Engineering constraint verification: Check whether the leakage amplitude is within the allowable rate, amplitude Therefore .
[0097] Each constraint weight is taken separately , , , Calculate the degree of constraint violation:
[0098]
[0099] The constraint verification failed. Based on the flood control constraint violation, a correction suggestion was generated: deviation in downstream flow rate. This means that the outflow rate needs to be reduced by 150 m³ / s.
[0100] The large language model regenerated the scheduling plan based on the revised suggestions, adjusting the discharge flow at 14:00 on the second day to 2200 m³ / s, and recalculated the maximum water level to 148.5 m. Constraint verification was then performed again. ( ), ( ), , , If the verification passes, a feasible scheduling scheme is output. If the constraint violation still does not meet the preset threshold requirement when the maximum number of iterations is reached (preferably 5), the scheduling scheme obtained in the current iteration is output and a manual intervention prompt is triggered to ensure that the system can still provide a reference scheme and promptly remind the scheduler to intervene under extreme conditions.
[0101] Combination Figure 5 The confidence level grading decision-making process shown involves confidence level assessment and human-machine collaborative grading decision-making. After constraint verification passes, the confidence level of the solution is calculated: the tool outputs the confidence level of the data. (High forecast accuracy and complete data), constraint satisfaction Adoption rate of solutions in similar historical scenarios The preferred weighting coefficient is... , , (Constraint satisfaction has the highest weight, reflecting the priority of solution safety), then:
[0102]
[0103] High threshold The preferred value is 0.85, which is the middle threshold. The preferred value is 0.6. Because... Entering automatic execution mode, the human-machine collaborative decision-making module automatically compiles the plan into a scheduling instruction: "At 14:00 on the second day, adjust the discharge flow to 2200 m³ / s and maintain it until the inflow drops below 1800 m³ / s," and sends it to the gate control system for execution.
[0104] After the plan is implemented, the human-machine collaborative decision-making module records the execution results and actual effects, updates the historical prediction accuracy of each factor, and the scheduling agent module adaptively updates the weight coefficients.
[0105]
[0106] in Let be the historical prediction accuracy of the i-th factor. The average prediction accuracy for all factors, and the learning rate. The preferred value is 0.1; after updating, the weight coefficients are normalized to make... This enables the system to continuously optimize confidence evaluation parameters based on historical execution results.
[0107] In another implementation, combined Figure 3 The illustrated tool call sequence for a power generation dispatch scenario fully describes the implementation process of differentiated tool routing under a power generation dispatch scenario. When a dispatcher initiates a power generation dispatch request, the large language model identifies the dispatch scenario as a power generation scenario. It then retrieves the corresponding tool call sequence from a pre-defined scenario-tool sequence mapping relationship and arranges it as follows: hydrological data query tool, dispatch rule retrieval tool, water balance calculation tool, constraint verification tool, and dispatch scheme generation tool.
[0108] The difference from flood control scenarios lies in the use of a water balance calculation tool instead of a flood regulation calculation tool. This tool takes the inflow process, reservoir capacity curve, and discharge curve as input to calculate the optimal discharge flow for each time period to maximize power generation. The focus of constraint verification has been adjusted to beneficial constraints (water level between dead water level and normal storage level) and ecological constraints (discharge flow not lower than the ecological base flow requirement), while the weight of flood control constraints has been correspondingly reduced to better suit the operational characteristics of power generation dispatch.
[0109] Confidence of the final calculation scheme The system then enters automatic execution mode. By pre-setting the mapping relationship between scenarios and tool sequences, flood control and power generation scenarios trigger differentiated tool invocation paths, ensuring accurate adaptation between the invoked tools and specific scheduling business requirements. This verifies the adaptive capability of the dynamic tool routing mechanism for various scheduling scenarios.
[0110] In yet another implementation, combined with Figure 4 The confidence level-based decision-making process illustrated describes the implementation of human-machine collaborative decision-making in low-to-medium confidence scenarios. If the confidence level of the tool's output data is low (e.g., sensor malfunction or insufficient forecast accuracy), causing the solution's confidence level to fall into the medium confidence range: , , ,but ,satisfy Once the suggestion confirmation mode is entered, the multi-round dialogue interaction module displays the scheduling plan and confidence analysis results to the dispatcher, and then executes the plan after the dispatcher confirms it.
[0111] If the confidence level decreases further, for example , , ,but In manual decision-making mode, the multi-round dialogue interaction module only provides reference solutions, and the dispatcher makes the decision on his own.
[0112] The three-level decision-making model can correctly trigger the corresponding human-machine collaboration mode under different data quality conditions, improving automation efficiency in high-confidence scenarios and ensuring decision security in low-confidence scenarios.
[0113] In some implementations, comparative verification with existing technologies can also be conducted. A test of 50 historical dispatching cases (including 30 flood control scenarios and 20 power generation scenarios) was performed at a cascade hydropower station. Compared with existing multi-agent dispatching schemes (single-round interaction, model-free context protocol, unconstrained closed loop), the following results were observed: the amount of code required to add new data sources decreased from approximately 500 lines to approximately 50 lines, and the workload for tool integration decreased by approximately 90%; the average number of decision rounds was 2.8, supporting the dispatcher's progressive questioning and adjustment; the constraint violation rate decreased from approximately 12% to 0%; and the scheme adoption rate increased from approximately 76% to approximately 91%. These comparative results demonstrate that the synergistic effect of the five key technical features produced unexpected technical benefits.
[0114] This invention encapsulates the data access and computing capabilities required for water situation scheduling into intelligent tools with standardized input and output specifications by constructing a standardized tool registration center based on a model context protocol. The large language model dynamically discovers and calls the tools through a unified protocol. New data sources can be accessed simply by encapsulating and registering them, without modifying the core code of the intelligent agent, thus solving the technical problem of tight coupling between the system and the data source.
[0115] By using an exponential decay weighted accumulation mechanism for multi-round dialogue intent vectors, the historical dialogue intents from each round are merged into a cumulative context vector with higher weights for recent rounds and lower weights for distant rounds. This allows the scheduler to gradually follow up and adjust based on previous rounds of dialogue, supporting incremental scheduling decisions.
[0116] By dynamically orchestrating tool call sequences through three-dimensional fusion semantic relevance scoring, and integrating three dimensions—cosine similarity, keyword overlap, and scenario matching—we ensure that tool routing accurately matches business needs under different scheduling scenarios.
[0117] By quantifying and verifying four types of constraints—flood control, water conservancy, ecology, and engineering—and calculating the degree of constraint violation, the system automatically generates correction suggestions for the deviation of discharge flow and water level, triggering the large language model to iterate and regenerate the scheduling scheme. This ensures the physical feasibility of the scheduling scheme and eliminates the safety hazards of the large language model directly outputting schemes that violate safety constraints.
[0118] The confidence level of a solution is calculated by integrating data confidence, constraint satisfaction, and historical adoption rates of similar solutions using comprehensive tools. This confidence level is then compared with dual thresholds and categorized into three levels: automatic execution, suggestion confirmation, and manual decision-making. Furthermore, the weighting coefficients are adaptively updated based on historical execution results, enabling dynamic adjustment of the human-machine collaboration level. The synergistic effect of these five key technical features ensures that water resources management decisions are intelligent, secure, and progressive.
[0119] It is understood that the specific implementation methods of the aforementioned multi-round context accumulation, tool routing, constraint verification, and confidence level decision-making are not limited to those used in the above implementation methods. The large language model is not limited to locally deployed models with specific parameter counts; a cloud-based large language model called through an application programming interface (API) can also be used. Intent vector encoding is not limited to Sentence-BERT; other text embedding models can also be used. The attenuation coefficient... Not limited to the preferred value of 0.85, the value can be adjusted based on the historical context importance of the scheduling scenario. The system allows for dynamic adjustment within a given range; it features dual thresholds that can be configured according to reservoir safety requirements; and its scheduling scenarios are not limited to flood control and power generation, but also include water supply scheduling, ecological scheduling, and comprehensive scheduling. These scenarios can be supported through extended scenario and tool sequence mapping relationships without requiring modification to the core agent code. All of the above variations are within the scope of protection of this application.
Claims
1. A multi-turn dialogue method for water situation scheduling agents based on model context protocol, characterized in that, include: A tool registry center based on the model context protocol is constructed, and water situation scheduling tools are encapsulated as standardized intelligent tools and registered to the tool registry center. The system receives multi-turn dialogue requests in natural language from the scheduler. The large language model performs intent understanding on the current round request, extracts scheduling intent elements and maps them into vector representations. The current round vector is then weighted and fused with the vectors from previous rounds to obtain the cumulative context vector. Based on the accumulated context vector, the semantic relevance score of each standardized intelligent tool is calculated, and the tool call sequence is dynamically arranged according to the scheduling scenario; The corresponding standardized intelligent tools are invoked according to the tool invocation sequence to generate a preliminary scheduling scheme; The preliminary scheduling scheme is subjected to multi-dimensional constraint verification, and the constraint violation degree is calculated. When the constraint violation degree exceeds a preset threshold, a correction suggestion is generated and the large language model is triggered to iterate and regenerate the scheduling scheme until the constraint verification is passed. Calculate the scheme confidence of the scheduling scheme that passes the constraint verification, compare the scheme confidence with the preset grading threshold, and perform grading decision based on the comparison result.
2. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that, The standardized intelligent tools include: The hydrological data query tool is a data acquisition tool that connects to the data query interfaces of hydrological telemetry systems, meteorological forecasting systems, and reservoir real-time monitoring systems. Its input parameters include reservoir number, data type, and time range, and the output is time-series data. The scheduling rule retrieval tool is a data acquisition tool that connects to the reservoir scheduling procedure database and flood control plan database. Its input parameters include reservoir number, scheduling scenario and current operating conditions, and the output is the applicable scheduling rule clauses and judgment conditions. Water conservancy calculation tools belong to the category of calculation and analysis tools. They encapsulate flood control calculation models and water balance calculation models. Their input parameters include inflow process, reservoir characteristic parameters and starting water level. The outputs are outflow process, water level process and maximum discharge. Constraint verification tools belong to the category of verification execution tools. They encapsulate multi-dimensional constraints. Their input parameters include scheduling scheme parameters and constraint configurations, and their outputs are the verification results and violation scores for each constraint item. The scheduling scheme generation tool belongs to the verification and execution category. It encapsulates scheme comparison and scheduling instruction compilation functions. Its input parameters include hydraulic calculation results and constraint verification results, and its output includes scheduling scheme comparison results and scheduling instructions.
3. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that, The method for obtaining the cumulative context vector by weighted fusion of the current round vector and historical round vectors is as follows: Let the vector representation of the i-th round of dialogue intent be... Then the cumulative context vector in the nth round for: ; in, For the weights in round i, an exponential decay strategy is adopted: ; in, The attenuation coefficient is... This results in a higher weight for near-round dialogues compared to far-round dialogues.
4. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that, The semantic relevance score is calculated as follows: Let the current query be q, and the function description vector of tool t be... Then the semantic relevance score for: ; in, The cosine similarity between the cumulative context vector and the tool function description vector; To query the overlap between the keyword set and the tool description keyword set; The degree of matching between the current scheduling scenario and the applicable scenario of tool t; Let be the weighting coefficient, satisfying .
5. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that, The method for dynamically arranging the tool call sequence based on the scheduling scenario identification result is as follows: Based on the scheduling scenario type identified by the large language model, the corresponding tool call sequence is obtained from the preset scenario and tool sequence mapping relationship; Among them, the tool call sequence corresponding to the flood control scenario includes hydrological data query, scheduling rule retrieval, flood control calculation, constraint verification and scheme generation in sequence; The tool call sequence for the power generation scenario includes, in sequence, hydrological data query, scheduling rule retrieval, water balance calculation, constraint verification, and scheme generation; The tools in the tool call sequence are invoked sequentially through the Model Context Protocol client.
6. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that: The multidimensional constraint verification includes flood control constraint verification, beneficial resource constraint verification, ecological constraint verification, and engineering constraint verification; the method for calculating the constraint violation degree V is as follows: ; Where M is the total number of constraint terms, This is the violation indicator value for the j-th constraint. It is set to 1 when the j-th constraint is violated, and 0 otherwise. Let be the weight coefficient of the j-th constraint, reflecting the severity of the constraint, and satisfy . ; When V exceeds a preset threshold, the constraint verification fails. A correction suggestion is generated based on the violated constraint, including the required adjustment of the discharge flow deviation. and / or water level deviation The large language model regenerates the scheduling scheme based on the correction suggestion and performs constraint verification again, iterating until the constraint violation degree meets the preset threshold requirement or reaches the maximum number of iterations.
7. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 1, characterized in that, The method for calculating the confidence level of the proposed scheme is as follows: ; in, The tool outputs data confidence scores, reflecting the quality of the data source. To constrain satisfaction; The adoption rate of solutions for similar historical scenarios; Let be the weighting coefficient, satisfying ; The grading thresholds include a high threshold and a medium threshold. When the confidence level of a solution is higher than the high threshold, it enters the automatic execution mode. When the confidence level of a solution is between the medium and high thresholds, it enters the suggestion confirmation mode. When the confidence level of a solution is not higher than the medium threshold, it enters the manual decision-making mode.
8. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 7, characterized in that, The method further includes: after the plan is executed, recording the execution results and actual effects, updating the historical prediction accuracy of each factor, and adaptively updating the weight coefficients. ; in, Let be the historical prediction accuracy of the i-th factor. The average prediction accuracy for all factors. For learning rate, This represents the weight coefficient corresponding to the i-th factor in the k-th iteration; after updating, the weight coefficients are normalized to make... .
9. The multi-turn dialogue method for water situation dispatching intelligent agents according to claim 6, characterized in that, If the constraint violation rate still does not meet the preset threshold requirement when the maximum number of iterations is reached, the scheduling scheme obtained in the current iteration is output and a manual intervention prompt is triggered.
10. A multi-turn dialogue system for water situation scheduling agents based on a model context protocol, used to implement the method described in any one of claims 1 to 9, characterized in that, include: The multi-turn dialogue interaction module is used to provide a natural language dialogue interface, receive multi-turn dialogue input from the dispatcher, and display the scheduling plan, constraint analysis results, and plan confidence assessment to the dispatcher; The scheduling agent module is data-connected to the multi-turn dialogue interaction module and is used to perform intent understanding, multi-turn context accumulation, dynamic tool orchestration, scheme generation and constraint verification closed loop. It communicates with the tool registration center module through the model context protocol client. The tool registration center module is data-connected to the scheduling intelligent agent module and is used to manage the metadata of all registered standardized intelligent tools. The metadata includes tool name, function description, input and output structured description and applicable scenario tags, and provides tool discovery interface and tool calling interface. The data source access module is connected to the tool registration center module to interface with the hydrological telemetry system, meteorological forecasting system, scheduling procedure library, reservoir characteristic parameter library, constraint configuration library and historical scheduling scheme library, providing underlying data access capabilities for various standardized intelligent tools. The human-machine collaborative decision-making module is connected to the scheduling intelligent agent module. It is used to determine the decision mode based on the confidence level of the scheme. When the confidence level of the scheme is higher than the high threshold, it automatically compiles and executes the scheduling instruction. When the confidence level of the scheme is between the medium threshold and the high threshold or not higher than the medium threshold, it presents the scheduling scheme to the scheduler for confirmation or reference and feeds back the execution result to the scheduling intelligent agent module.