A catering intelligent agent service scheduling method and system
By constructing a state-bearing service graph and generating candidate execution contracts, the problem of inconsistent states across agents in catering service scheduling is solved, the continuity of service states and anomaly repair are realized, and the efficiency and accuracy of scheduling are improved.
Patent Information
- Application Number
- CN202611348549.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-27
AI Technical Summary
Existing catering service scheduling technologies lack unified constraints on input states, output states, state versions, and subsequent consumption relationships during cross-agent execution, leading to inconsistent service states, state breaks, and propagation problems.
By constructing a state-bearing service graph, the set of executable operations of the catering agent is obtained, and candidate execution contracts are generated based on state dependencies. Counterfactual inference is performed to identify state breakpoints and transition boundaries, determine the target execution contract, and ensure state continuity and anomaly compensation.
It achieves continuous consistency of service state across intelligent agents, reduces repeated undoing and execution of unrelated nodes, and maintains the state consistency of service links and anomaly repair within the scope of real dependencies.
Smart Images

Figure CN123177993A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-agent collaborative scheduling technology, specifically to a method and system for scheduling catering intelligent agent services. Background Technology
[0002] Existing restaurant service scheduling software typically converts customer requests for ordering, adding dishes, expediting orders, canceling orders, settling accounts, and table service into several independent tasks. Then, based on task type, priority, estimated processing time, and current availability, it selects a matching agent from a pre-registered pool of restaurant agents. A common implementation involves maintaining a task queue, agent capability tags, and execution status table within the service platform. Upon receiving a service request, the scheduler determines the task category using keyword recognition, rule templates, or classification models, and then assigns the task according to a fixed priority, round-robin order, or load value. After a task is completed, the execution result is written to the order record, table record, or session record, and subsequent tasks retrieve the necessary information from these records. For service requests involving multiple processing stages, existing solutions typically break them down into sequential or parallel tasks, maintaining a superficial association through task numbers, order numbers, or table numbers. When an agent becomes unavailable or times out, the scheduler usually cancels the original task assignment and selects another agent based on the current queue status. This type of solution can complete basic task allocation, but its scheduling is primarily based on the functional matching between a single task and a single agent.
[0003] Another type of technology employs process orchestration or a multi-agent collaborative framework, representing the catering service process as a flowchart composed of multiple nodes. Each node is configured with input parameters, output parameters, execution conditions, and exception branches. During runtime, the process module triggers nodes sequentially according to predetermined connections, writing the output of the previous node into the shared context, and then the subsequent node reads the corresponding fields. If a node fails, it enters a preset retry, rollback, or alternative branch. Some solutions also dynamically adjust node executors based on agent load, task deadlines, or historical completion rates, and recalculate the task order during the service process. Compared to simple queue scheduling, this type of technology can express more complex processing sequences. However, the shared context is usually stored as a unified set of fields or loose key-value data. The process module mainly verifies the existence of fields, with less verification of field origin, version, consumption status, and state inheritance relationships between different agents. During reassignment, the system often only determines whether the alternative agent has the corresponding functionality, without further determining whether the state generated by the alternative execution can be directly accepted by all subsequent nodes, nor limiting the boundaries of abnormal state propagation to downstream processes.
[0004] Therefore, for catering service chains with continuous state dependencies, the existing scheduling process still uses independent tasks and function tags as the basic matching objects, lacking unified constraints on input states, output states, state versions, and subsequent consumption relationships. When service nodes are executed across multiple catering agents, or are replaced midway due to timeouts or anomalies, the service state formed by the preceding agent may be inconsistent with the input state required by the subsequent agent in terms of field meaning, version source, or completion boundaries. However, the scheduler may still determine that the task match is successful and continue to trigger subsequent nodes. This inconsistency will propagate along the task connection relationship, causing subsequent nodes to execute based on missing, expired, or conflicting states, and forcing the system to expand the fallback scope or re-execute the originally unaffected service nodes. Therefore, the core problem to be solved is how to maintain the continuity and consistency of service states across nodes and across agents during the scheduling of catering agents, and limit the scope of subsequent nodes affected when state anomalies occur. Summary of the Invention
[0005] The purpose of this invention is to provide a catering intelligent agent service scheduling method and system, which can solve the problems in the background art mentioned above.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A catering intelligent agent service scheduling method includes: obtaining catering service requests and service contexts, parsing the catering service requests into service intentions, execution constraints and completion conditions, and constructing a state-bearing service graph containing multiple service nodes and directed connection edges according to state dependencies; Obtain the set of executable operations for the catering intelligent agent, and match the input state mode, output state mode, and anomaly recovery boundary of each executable operation with the service node; Based on the matching results, the continuous service nodes are combined with the catering intelligent agent to form candidate execution contracts. Each candidate execution contract includes state reception constraints, state submission constraints, and anomaly compensation entry. Counterfactual analysis is performed on the subsequent service graph corresponding to each candidate execution contract to obtain the state breakpoint, state transition boundary and downstream re-execution range; Determine the target execution contract based on the simulation results; Receive the actual output state of the service node, determine the affected downstream subgraph when the actual output state does not conform to the state submission constraint of the target execution contract, and replace the execution contract in the affected downstream subgraph.
[0007] Preferably, constructing the state-bearing service graph includes: establishing an input state description, an output state description, a precondition description, a completion condition description, a state validity period, and a failure compensation entry for each service node; The directed connection edge is generated based on the satisfyable relationship between the output state description of the previous service node and the input state description of the next service node, and the required state fields, allowed default fields and state inheritance methods are recorded for the directed connection edge. When the output status of a service node is shared by multiple subsequent service nodes, a status branch identifier is generated and an independent consumption flag is configured for each branch. When multiple preceding service nodes jointly form the input state of the subsequent service node, a state convergence identifier is generated, and a convergence mapping table is established according to the field source and state version. The state dependency chain is composed of the directed connection edge, state branch identifier, consumption mark, state convergence identifier and convergence mapping table.
[0008] Preferably, generating the candidate execution contract includes: extracting candidate node segments from the state-bearing service graph that have continuous input states and no unmergeable state boundaries; The candidate node segments are bidirectionally matched with the set of executable operations of each catering agent, and the agent combination that covers all input state modes and output state modes of the candidate node segments is retained. For each agent combination, a state receiving sequence, a node execution sequence, a state submission sequence, and an anomaly compensation sequence are generated, and a state handover boundary is established between adjacent agents. Based on the field transformation relationship, version inheritance relationship, and compensation reachability relationship at the state handover boundary, candidate execution contracts are formed that respectively cover single nodes, continuous nodes, or parallel branch nodes.
[0009] Preferably, the counterfactual deduction includes: copying the current state carrying service graph and the corresponding service state, writing a candidate execution contract into the copied state carrying service graph and keeping other determined execution contracts unchanged; Based on the state acceptance constraints and state submission constraints in the candidate execution contract, the simulated output state is propagated node by node, and a state break node is recorded when the simulated output state is inconsistent with the input state mode of the subsequent service node. When the candidate execution contract spans multiple catering agents, the state transition boundary is recorded, and the set of downstream service nodes reachable from the state break node is determined along the directed connection edge. Based on the state breakpoint, the state transition boundary, and the set of downstream service nodes, counterfactual evaluation data corresponding to the candidate execution contracts is generated.
[0010] Preferably, the state dependency chain uses a state spectrum to record the generation node, modification node, consumption node and current version of the service state, establishes standardized field identifiers for state fields generated by different catering agents but semantically equivalent, and records the original field values, standardized field values and conversion rules as state mapping entries; When states merge, the common ancestor version of each input state is determined according to the state spectrum. Conflict flags are generated for fields with the same name from different ancestor versions. Merged states are formed according to the field priority order or mergeable rules predefined by the service node. After a state branch is consumed, the corresponding consumption tag is written into the state hierarchy, and the service state with a definite source, definite version, and definite consumption state is marked as a referable state.
[0011] Preferably, the anomaly compensation sequence is divided into multiple compensation segments according to the reversible boundary of the state in the candidate node segment, and each compensation segment is set with a compensation start state, a compensation end state, and a set of catering intelligent agents that can be replaced. When adjacent compensation segments are executed by different catering smart agents, a compensation anchor point is set at the state handover boundary, and the state field that has been submitted and is irreversible before the compensation anchor point is registered as a hold field, and the state field that has not been consumed or can be rolled back after the compensation anchor point is registered as a rebuild field. A local compensation contract is generated based on the preserved field and the reconstructed field, and when an execution anomaly is detected, the node execution sequence, status commit sequence and anomaly compensation sequence are recombined with the compensation anchor point as the boundary.
[0012] Preferably, the counterfactual evaluation data is generated through paired substitution trajectories. For the same candidate node segment, a first simulated trajectory using the current candidate execution contract and a second simulated trajectory using another candidate execution contract are constructed respectively, while maintaining consistency in the initial service state, locked execution contract, and external constraints in the two simulated trajectories. The sets of state break nodes, state transition boundaries, and downstream service nodes in the two simulated trajectories are counted separately. A hierarchical index is established according to the dependency depth between service nodes, and the distribution of each set at different dependency depths is encoded as an evaluation vector. Based on the evaluation vector, a comparison relationship is formed between the candidate execution contracts, and candidate execution contracts that are not superior to another candidate execution contract in all dependency depths are screened out according to the comparison relationship.
[0013] Preferably, determining the affected downstream subgraph includes: locating the abnormal state field and its corresponding generated version in the state spectrum according to the actual output state that does not meet the state submission constraints, reversing the association with the service node along the consumption record that references the abnormal state field or its derived field, and continuing to trace along the directed connection edge until reaching the state isolation node that does not reference the abnormal state field. The abnormal state field corresponding to the generating node, the service node associated with the consumption record, and the reachable service node located before the state isolation node are merged into an initial set of affected nodes. Based on the convergence mapping table and state branch identifier of each node, the associated nodes that share the input version with the initial affected node set are added to form an affected downstream subgraph with closed boundaries, and candidate execution contracts are regenerated only within the affected downstream subgraph.
[0014] Preferably, the comparison relationship is divided into a proximal comparison layer, a middle comparison layer and a terminal comparison layer according to the dependency depth, and a state breakage sorting, a state transition sorting and a downstream re-execution sorting are established for each comparison layer respectively; For candidate execution contracts that have not been screened out, firstly, a first candidate set without state break disadvantage is determined based on the near-end comparison layer. Then, a second candidate set without state transition boundary expansion is determined from the first candidate set based on the mid-section comparison layer. Finally, a target candidate set with the smallest downstream service node set boundary is determined from the second candidate set based on the end comparison layer. When the target candidate set contains multiple candidate execution contracts, the target execution contract is determined based on the number of state handover boundaries between each candidate execution contract and the locked execution contract.
[0015] A catering intelligent agent service scheduling system includes a processor and a memory. The memory stores a program. When the processor executes the program, it receives and parses catering service requests and service contexts to obtain service intentions, execution constraints, and completion conditions. It then constructs a state-bearing service graph composed of service nodes and directed connection edges according to state dependencies. Obtain the action set of the intelligent agent, and match the input state pattern, output state pattern, and anomaly recovery boundary of the action set with the service node; Based on the matching results, continuous service nodes and catering intelligent agents are combined into candidate execution contracts, which include state reception constraints, state submission constraints and anomaly compensation entry points. Counterfactual analysis is performed to derive the subsequent service graph of each candidate execution contract, obtain state breakpoints, state transition boundaries and downstream re-execution ranges, and determine the target execution contract; Read the actual output state, and when the actual output state does not conform to the state submission constraint of the target execution contract, determine the affected downstream subgraph and replace the execution contract in the affected downstream subgraph.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By parsing catering service requests into service intentions, execution constraints, and completion conditions, and constructing a state-bearing service graph according to state dependencies, each service node has verifiable input states, output states, and adjacent node inheritance relationships. Then, the executable operations of the catering agent are matched with the node state patterns to form candidate execution contracts containing state acceptance constraints, state submission constraints, and anomaly compensation entry points. During scheduling, counterfactual deduction is performed on the subsequent service graphs corresponding to each candidate execution contract to pre-identify potential state break nodes, state transition boundaries, and downstream re-execution ranges, thereby determining the target execution contract. With the combined effect of these techniques, the scheduling object changes from isolated tasks to a combination of service nodes with continuous state conditions. Assignments that are functionally executable but whose states are not inheritable can be excluded before actual execution. Field sources, state versions, and submission boundaries remain consistent during cross-agent handover, thus addressing the technical problem of state breaks propagating backward during task replacement or continuous execution.
[0017] 2. When the actual output state of a service node does not conform to the state submission constraints of the target execution contract, this invention locates the generation version of the abnormal state field and its reference path based on the state spectrum, state branch identifier, consumption record, and convergence mapping relationship. It determines the affected nodes along directed connection edges and stops tracing at state isolation nodes that do not reference the abnormal state, thereby forming a boundary-closed affected downstream subgraph. The system only regenerates and replaces the execution contract within the affected downstream subgraph. State fields that have been committed and are irreversible are retained through compensation anchors, while state fields that have not yet been consumed or are allowed to be rolled back are reorganized according to the reconstruction scope. By combining the pairwise substitution trajectories of candidate execution contracts, hierarchical comparison of dependency depth, and state handover boundary filtering, it can reduce the repeated cancellation, reassignment, or repeated execution of unrelated nodes and keep anomaly repair within the scope of the actual state dependency. Simultaneously, the state spectrum records the generation node, modification node, consumption node, and current version, enabling subsequent service nodes to reference service states with a definite source, consistent version, and clear consumption state. Attached Figure Description
[0018] Figure 1 A flowchart illustrating the overall processing flow of a catering intelligent agent service scheduling method; Figure 2 A flowchart for constructing the state service graph, state branches, state merging, and state hierarchy; Figure 3 Flowchart for candidate execution contract generation, counterfactual deduction, and target execution contract determination; Figure 4 This is a flowchart for detecting anomalies in the actual output state, determining the affected downstream subgraphs, and repairing local execution contracts. Figure 5 A distribution chart of state matching scores; Figure 6 To consolidate the batch consistency curve; Figure 7 A ranking chart of the comprehensive costs of candidate contracts; Figure 8 This is a curve chart for tracing the abnormal propagation path; Figure 9 A matrix diagram of candidate contract dominance relationships; Figure 10 This is a decision graph for boundary dependency closure. Detailed Implementation
[0019] In one embodiment, please refer to Figure 1 The catering intelligent agent service scheduling method includes: acquiring catering service requests and service contexts; parsing the catering service requests into service intentions, execution constraints, and completion conditions; constructing a state-bearing service graph containing multiple service nodes and directed connection edges according to state dependencies; acquiring a set of executable operations for the catering intelligent agent; matching the input state mode, output state mode, and anomaly recovery boundary of each executable operation with the service nodes; combining consecutive service nodes with the catering intelligent agent into candidate execution contracts based on the matching results; each candidate execution contract includes state reception constraints, state submission constraints, and anomaly compensation entry points; performing counterfactual deduction on the subsequent service graphs corresponding to each candidate execution contract to obtain state break nodes, state transition boundaries, and downstream re-execution ranges; determining the target execution contract based on the deduction results; receiving the actual output state of the service nodes; and when the actual output state does not conform to the state submission constraints of the target execution contract, determining the affected downstream subgraph and replacing the execution contracts in the affected downstream subgraph.
[0020] In this embodiment, a catering service request is a data object to be processed, formed by customer interaction records, order status records, table service records, or previous service node submission records. The service context includes at least the session identifier to which the request belongs, the order identifier, the table identifier, the current service stage, the confirmed service status, the constraints that still need to be met, and the contract identifier that is being executed. Before entering the scheduling process, all types of data are converted into a unified set of key-value fields, and each field is written with a field name, field type, field source, generation time, status version, and consumable range. This allows the same service request to be handled through a defined data structure when it flows between multiple catering agents, rather than relying solely on natural language text or a single task number to maintain the association.
[0021] Specifically, the parsing of catering service requests adopts a joint processing approach of rule constraints and semantic representation. The processing program first generates candidate service intents based on the action words, object words, and qualifiers in the request. Then, it uses the current order status, current table status, and historical session status to eliminate candidate service intents that contradict the context. The retained service intents are then broken down into actions to be executed, objects to be acted upon, input status requirements, and completion criteria. Execution constraints consist of immutable fields, sequential dependencies, parallel exclusion, cutoff status, and allowed substitution ranges. Completion conditions consist of output fields that must be generated, output fields that can be empty, and subsequent states that need to be triggered. When a request contains multiple meanings, the processing program generates transient service nodes for different interpretations and isolates them through preconditions until the subsequent context causes one of the interpretations to meet the execution conditions.
[0022] In one embodiment, the state-bearing service graph is represented by a directed attribute graph. Each service node corresponds to a catering service processing unit whose completion status can be independently verified. The directed connection edge represents the transmission relationship from the output status of the previous node to the input status of the next node. The graph simultaneously stores nodes that have been completed, nodes that are currently executing, nodes that have not yet been triggered, and nodes that have been blocked by an anomaly. The node status is not represented by a single completion marker, but is jointly defined by the input preparation status, the execution occupancy status, the output submission status, and the compensation reachable status. The scheduling process only sets the node to the dispatchable state when the input status pattern is satisfied and there is no unresolved parallel exclusion relationship, and opens up subsequent nodes along the directed connection edge after the output status passes the contract verification.
[0023] In this embodiment, the set of executable operations for a catering agent consists of an operation identifier, a set of acceptable input fields, input field type constraints, a set of output fields that can be generated, output field version rules, a default state mode that can be handled, and an exception recovery boundary. The exception recovery boundary records the range of operations that can be undone or replaced in three states: no output has been submitted, reversible output has been submitted, and irreversible output has been submitted. The scheduling process uses executable operations as the basic matching unit, represents multiple operations that the same catering agent can complete continuously without external state transformation as an operation chain, and records the internal state transmission relationship for the operation chain, so that the candidate contract can cover both a single service node and a service node segment with continuous input-output relationship.
[0024] Preferably, the candidate execution contract does not simply record the correspondence between the catering agent and the task, but records the service node segment, the execution subject, the state reception constraint, the state submission constraint, the node execution order, the state handover boundary, and the anomaly compensation entry. The state reception constraint is used to limit the fields that must exist and have acceptable versions before execution. The state submission constraint is used to limit the fields that must be written after execution, the field source, the field version, and the submission integrity. The anomaly compensation entry is used to point to the service node or state anchor point that allows the start of partial reconstruction. When generating the candidate execution contract, the processing program establishes multiple alternative combinations for the same service node segment and excludes combinations where the input state cannot be completely covered, the output state cannot be consumed by subsequent nodes, or there is no reachable compensation entry after an anomaly.
[0025] In a preferred embodiment, counterfactual reasoning is performed in an isolated graph copy. The processor copies the current state carrying the service graph, the current committed state, and the locked execution contracts. After writing a candidate execution contract into the graph copy, it generates simulated inputs based on its state receiving constraints and generates simulated outputs based on the output state patterns of the corresponding catering agent. The simulated outputs are then propagated backward along the directed connection edges. During the propagation, the real service state is not modified. Only field missing, type conflict, version conflict, and consumption conflict between the simulated output and the subsequent input patterns are recorded. At the same time, the state transitions that occur when the candidate execution contract crosses the boundary of the catering agent are recorded. The range of downstream nodes that must be re-executed after an inconsistency is determined based on the anomaly compensation entry.
[0026] In this embodiment, the target execution contract is determined through a hierarchical comparison method. The processing program first eliminates candidate execution contracts that have unrecoverable state breaks or no compensation entry point. Then, it compares the state break distribution, number of state transition boundaries, and downstream re-execution range of the remaining candidate execution contracts in the near-end node, middle node, and end node. It retains the combinations that are not completely dominated by other candidate execution contracts at each comparison layer. When there are multiple combinations, the combination with fewer state handover boundaries with the locked execution contract and that does not change the submitted state version is selected first. After the target execution contract is determined, it is written into the current service graph and an occupancy relationship is established with the corresponding service node.
[0027] Furthermore, when the catering agent submits the actual output state, the processing program reads the submission fields, field versions, field sources, and integrity flags, and compares them item by item with the state submission constraints in the target execution contract. If all are satisfied, the service node is updated to the submitted state and subsequent nodes are opened. If there are missing fields, source mismatches, version mismatches, or disallowed null values, the abnormal state field is marked. The downstream nodes referencing the abnormal state field are located along the state spectrum and consumption relationship to form an affected downstream subgraph. Only the execution contracts that have not yet formed irreversible submissions within the affected downstream subgraph are revoked. Then, candidate execution contracts are regenerated based on the retained state to avoid irrelevant nodes being reassigned due to local anomalies.
[0028] In this embodiment, the service node Operation of catering smart body The state matching degree is calculated using the following formula: ; in, Indicates service node The set of required input fields, Indicates service node The required set of output fields, Indicates operation Acceptable set of input fields Indicates operation The set of output fields that can be generated This indicates a collection of fields with inconsistent field types or versions. , and The weights for input coverage, output coverage, and conflict suppression are respectively, and satisfy the following conditions: When any required input field does not belong to Or any required output field does not belong to Regardless of time All values will result in disqualification from matching.
[0029] Please refer to Figure 5 , Figure 5 The horizontal axis represents the candidate operation sample number, ranging from 1 to 840, and the vertical axis represents the state matching score, ranging from 0 to 1. The solid black line represents the trend of the state matching score between the service node and the catering intelligent agent operation, the dashed line represents the warning threshold of 0.72, and the dotted line represents the stability threshold of 0.90. The legend indicates the judgment meaning of each line type. Figure 5 correspond The calculation results are used to represent the process of candidate operations changing from low fitness to high fitness after the combined effects of three factors: input coverage, output coverage, and conflict suppression.
[0030] from Figure 5 As can be seen, the state matching scores for sample numbers 1 to 300 are mainly distributed between 0.55 and 0.66, which are generally lower than the warning threshold. This indicates that although the candidate operations at this stage can read some order, table, or dish status fields, the output field's capacity and version consistency are still insufficient, making it unsuitable to directly enter the contract generation queue. In this interval, the input and output coverage terms in the corresponding formula have not yet reached a high level simultaneously, and the conflict suppression term will also significantly reduce the total score.
[0031] After sample number 337, the curve gradually rises and repeatedly approaches or exceeds the 0.72 warning threshold, indicating that the coverage of the candidate operation's input and output states of the service node is gradually increasing. After sample number 504, the curve is mostly above the warning threshold, indicating that most candidate operations at this point meet the basic conditions for entering the candidate execution contract screening process, but a comprehensive judgment is still needed based on factors such as whether all required fields exist, whether field versions are convertible, and subsequent contract costs.
[0032] Around sample number 831, the curve reaches its highest score, peaking at approximately 0.946, exceeding the stability threshold of 0.90. This indicates that this type of candidate operation simultaneously satisfies high input coverage, high output coverage, and low field conflict. This peak region can be considered the most stable combination of operations for matching the capabilities of the catering agent, suitable for prioritizing the generation of state acceptance constraints and state submission constraints, and serving as highly reliable candidates for subsequent contract comparisons.
[0033] For example, a service node needs to input an order identifier, a dish identifier, and a dietary restriction status, and output a confirmation result and a subsequent processing flag. An operation can receive all three input fields and generate all two output fields, but the dietary restriction status versions are inconsistent. In this case, the input coverage item and the output coverage item are at their full values, while the conflict suppression item is below its full value. The processing program will reserve the operation as a candidate for conversion instead of directly forming a contract. The candidate status will only be restored when the status mapping entry can convert the old version of the dietary restriction status to the current version and there is no loss of fields after the conversion.
[0034] In another embodiment, please refer to Figure 2 When constructing the state-bearing service graph, for each service node, an input state description, output state description, precondition description, completion condition description, state validity period, and failure compensation entry are established. The input state description records the fields that the node must read before execution and the allowed version range. The output state description records the fields that the node must generate when it submits and the generation version rules. The precondition description records the upstream node state required to trigger the node. The completion condition description records the field integrity required for the node to close. The state validity period records the consumable stage of the field in the service chain. The failure compensation entry records the node position or state position that the node is allowed to re-enter after execution failure.
[0035] Furthermore, directed connections are generated based on the satisfyable relationship between the output state description of the previous service node and the input state description of the next service node. For each directed connection, the required state fields, allowed default fields, and state inheritance methods are recorded. The state inheritance methods include direct inheritance, field mapping inheritance, aggregate inheritance, and conditional inheritance. Direct inheritance means that the field name, type, and version remain unchanged. Field mapping inheritance means that the field name or enumeration value is transformed through pre-registered mapping rules. Aggregate inheritance means that multiple upstream fields are formed into a downstream field through a deterministic operation. Conditional inheritance means that the corresponding field is passed only when the precondition is true. Fields without a registered inheritance method are not allowed to be implicitly passed across nodes.
[0036] When the output state of a service node is shared by multiple subsequent service nodes, the handler generates a state branch identifier and configures an independent consumption flag for each branch. The state branch identifier includes the source node identifier, the source state version, the set of branch nodes, and the allowed number of consumptions. The independent consumption flag is used to record whether a branch has been read, whether repeated reading is allowed, and whether reading will change the source state. When a branch completes consumption, only the consumption flag of the corresponding branch is updated, without changing the consumable state of other branches. When the source state is modified by a subsequent node, the handler decides whether to retain the old version or to make the unconsumed branches switch to the new version, depending on whether the branch node has consumed the original version.
[0037] When multiple preceding service nodes jointly form the input state of a subsequent service node, the processing program generates a state convergence identifier and establishes a convergence mapping table according to the field source and state version. The convergence mapping table records the fields that each preceding node can provide, the field priority, the allowed merged value range, and the conflict handling rules. The subsequent service node is only opened when all required fields have an acceptable source and the version relationship meets the convergence rules. For fields that are allowed to be defaulted, a default source flag is written. For fields with the same name but different semantics, they are distinguished by a standardized field identifier. A traceable state dependency chain is formed by directed connection edges, state branch identifiers, consumption flags, state convergence identifiers, and the convergence mapping table.
[0038] In this embodiment, the consistency of state merging is calculated using the following formula: ; in, This indicates the degree of convergence consistency corresponding to the convergence identifier h. This represents the set of fields participating in the merge. This indicates the necessity weight of field f in the current service node. The value is 1 when the field source is unique and the version is inheritable; 0.5 when the field can be merged according to registration rules; and 0 when there are unresolved conflicts in the field. The processing procedure also requires all required fields to be... Greater than 0 and A merging state is generated only when the threshold value is not lower than the preset merging threshold.
[0039] Please refer to Figure 6 , Figure 6 The horizontal axis represents the batch number, ranging from 1 to 560, and the vertical axis represents the consistency of the batch, ranging from 0 to 1. The solid black line represents the change in consistency of the batch under different service batches, and the dashed line represents the batch threshold of 0.74. Figure 6 correspond The calculation results are used to explain whether multiple source fields such as table status, order status, food processing status, and payment status can form a unified state that can be closed at the convergence node.
[0040] from Figure 6 As can be seen, the convergence consistency curve generally remains around 0.78 to 0.88, with the vast majority of batches exceeding the convergence threshold of 0.74. This indicates that the fields involved in the convergence mostly have unique sources, are version-inheritable, or can be merged through registration rules. This phenomenon suggests that in the catering service chain, the states submitted in parallel by agents such as the front-of-house, back-of-house, and settlement are not arbitrarily merged, but rather a verifiable convergence determination is formed through field necessity weights and field quality values.
[0041] The curve dipped in some batches, with a minimum value of approximately 0.642, indicating that some merge batches had issues such as field source conflicts, insufficient version continuity, or missing necessary fields. Although these dips were few in number, they were significant for system operation: once the quality value of a necessary field was 0, the processing program would not generate a merge state based solely on the average score, but would keep the node blocked and enter conflict resolution processing to prevent the erroneous state from spreading to subsequent service nodes.
[0042] The curve shows a slight upward trend in the latter part, with a maximum value of approximately 0.899, indicating that as the field source records, convergence mapping tables, and version inheritance rules gradually stabilize, the system's ability to converge results submitted by multiple agents improves. This trend illustrates... It can serve as a quantitative basis for determining whether a merging node is closed, and can provide stable input for subsequent state hierarchy records, field consumption markers, and compensation boundary determination.
[0043] For example, a merging node needs order status, food processing status, and table confirmation status. The order status and food processing status have a unique source and consistent version. The table confirmation status was submitted by two preceding nodes but can be merged based on time order. Therefore, the first two items... If the first item is set to 1 and the second item is set to 0.5, and the second item is a field that allows merging and the weighted result meets the merging threshold, the processor generates a merging status containing the source record of the merge. If the second item is a field that must be uniquely determined, the node is kept blocked and the conflict resolution process begins.
[0044] In a preferred embodiment, the state dependency chain uses a state hierarchy to record the generating nodes, modifying nodes, consuming nodes, and current version of the service state. Each time a node submits an output, a hierarchy record is generated. The hierarchy record includes the parent version identifier, the current version identifier, the field source, the generation contract, the submission time sequence, and the allowed consumption range. When a field is modified, the original hierarchy record is not overwritten; instead, a parent-child version relationship is established. When a field is consumed, the consuming node and the consumption result are written under the corresponding version, enabling the processor to trace back to the generating node of any abnormal field and query all nodes that reference that field.
[0045] For state fields generated by different catering agents but semantically equivalent, the processing program establishes standardized field identifiers and records the original field values, standardized field values, and conversion rules as state mapping entries. The conversion rules adopt defined field renaming, enumeration mapping, unit normalization, set expansion, or field combination expressions. Freely generated results that cannot be traced back to the input basis are not allowed. The state mapping entries also record the applicable source version range and target version range. The conversion is only performed when the source, type, and version of the original field all fall within the applicable range. The standardized fields after conversion retain the original field identifier and mapping rule identifier.
[0046] During state merging, the processing program determines the common ancestor version of each input state based on the state spectrum, generates conflict markers for fields with the same name from different ancestor versions, and forms a merged state according to the field priority order or mergeable rules predefined by the service node. The field priority order can be arranged according to the irreversible submission source, the most recent valid confirmation source, and the ordinary transient source. The mergeable rules limit the set to a specific method of union, intersection, overwrite, or retention of multiple values. When there is no common ancestor and no mergeable rules are configured, no merged state is generated, and the conflicting fields are written to the abnormal input record of the corresponding service node.
[0047] After a state branch is consumed, the processor writes the corresponding consumption mark into the state hierarchy and marks the service state with a definite source, definite version, and definite consumption state as a referable state. The referable state can only be used by nodes that are within the allowed consumption range and have the same input state pattern. When a field has been read by a node that cannot be consumed repeatedly, its consumption mark is turned off, and subsequent nodes cannot read the original version again. When a field is allowed to be consumed repeatedly, an independent record is added for each consumption so that branches that have formed downstream results and branches that have not yet formed downstream results can be distinguished during anomaly repair.
[0048] In another embodiment, please refer to Figure 3 When generating candidate execution contracts, the processor extracts candidate node segments from the state-bearing service graph that have continuous input states and no unmergeable state boundaries. Continuous input states mean that the required output of the previous node can satisfy the required input of the next node without introducing unregistered sources. Unmergeable state boundaries include irreversible state commits, no mapping across versions, unresolved parallel exclusion, and unreachable exception compensation. Candidate node segments terminate at the above boundaries and retain the state receiving relationships formed before the boundary and the input relationships that still need to be satisfied after the boundary.
[0049] When performing bidirectional matching between candidate node segments and the set of executable operations for each catering agent, the processor checks whether the set of operations can cover the input and output state patterns of all nodes, starting from the candidate node segments. Then, it checks whether the selected operation has any forced inputs not provided by the candidate node segments and whether it generates forced outputs that cannot be received by the nodes, starting from the set of operations. Only when both directions are satisfied will the corresponding agent combination be retained. When an agent cannot cover all nodes, the processor allows multiple agents to be combined according to the node boundaries, but requires that the submission state of the previous agent can satisfy the reception state of the next agent through direct inheritance or registered mapping.
[0050] For each combination of agents, the processor generates a state receiving sequence, a node execution sequence, a state commit sequence, and an anomaly compensation sequence. The state receiving sequence arranges the states to be read according to the depth of input dependency. The node execution sequence determines the executable order according to directed edges and parallel exclusion relationships. The state commit sequence limits the commit time and set of commit fields for each node. The anomaly compensation sequence records the compensation entry points that are allowed to be returned when an anomaly occurs in different execution stages. All sequences share the same contract version and generate a new version when any sequence changes, so as to avoid reading inconsistent sequence combinations during the execution process.
[0051] Between adjacent agents, the processor establishes a state handover boundary. The state handover boundary records the commit field of the previous agent, the receive field of the next agent, the field transformation relationship, the version inheritance relationship, and the compensation reachability relationship. Based on the state handover boundary, a candidate execution contract covering a single node, consecutive nodes, or parallel branch nodes is formed. The candidate execution contract covering parallel branch nodes saves the independent commit state of each branch and prohibits one branch from overwriting the shared state version still in use by another branch before the branches merge.
[0052] In this embodiment, the comprehensive cost of candidate execution contract c is calculated using the following formula: ; in, This represents the number of state breakpoints obtained from counterfactual deduction. Indicates the number of state transition boundaries. This indicates the number of downstream nodes that need to be re-executed in case of an exception. This indicates the number of state version changes that have occurred with the locked execution contract. , , and The weights are non-negative and are used to reflect the constraints of different service chains on state continuity and the scope of local repair. The process only compares the candidate execution contracts if there is no unrecoverable state break. And selected from candidate execution contracts that were never excluded by the hierarchical rules. The smaller one.
[0053] Please refer to Figure 7 , Figure 7 The horizontal axis represents the candidate contract sample number, ranging from 1 to 480, and the vertical axis represents the comprehensive cost value. In the legend, the black, dark gray, medium gray, and light gray bars represent the cost components of the fracture node, the cost components of the handover boundary, the cost components of the downstream rerun, and the cost components of the version change, respectively. Figure 7 correspond In the calculation process, each column segment has been converted into a cost component according to the weight in the formula. Therefore, the total height of the column can be used to compare the degree of disturbance of the candidate execution contract to the current service chain.
[0054] from Figure 7 As can be seen, the comprehensive costs of different candidate contract samples exhibit clear stratification, with the cost values mainly ranging from 5.0 to 17.7. The cost component at the break point reaches a maximum of 6.4, indicating that when a candidate contract causes the service node state to break, the system's cost will significantly increase. The cost component at the handover boundary is mainly between 2.2 and 5.5, reflecting that the more cross-agent and cross-stage state handovers occur, the more easily the contract execution stability is affected.
[0055] The gray bar segment represents the downstream range that needs to be re-executed after an anomaly, and its cost component can reach up to 8.4. Figure 7 The part that has a significant impact on the height of the column. This result indicates that in food service scheduling, if a candidate contract causes a large number of reruns in subsequent nodes such as kitchen preparation, table confirmation, or settlement submission, it may not be suitable as the final dispatch contract even if its current matching score is high, because the compensation range is too large.
[0056] The light gray bars represent the cost of locking the contract version change, with a maximum value of approximately 3.4. Although this component is usually less than the cost of rerunning downstream, it is still significant when committed results are consumed by subsequent nodes or enter an irreversible state. Figure 7 By displaying different sources of risk using segmented bars, the scheduler can distinguish between candidates with high current costs but which can be locally repaired and candidates with good local scores but which would expand the scope of reruns.
[0057] For example, if two candidate execution contracts can both complete the same continuous node segment, one candidate execution contract does not produce a state break but has two state transition boundaries, and the other candidate execution contract has one state transition boundary but will cause an end node to re-execute. The processor sets the constraints on the irreversible state of the end node according to the service chain. Greater than The former is selected and the existing state of the end node is retained. The weight is determined by the state reversibility attribute and node dependency depth in the service graph, rather than by random adjustment.
[0058] In a preferred embodiment, the anomaly compensation sequence is divided into multiple compensation segments according to the state reversibility boundary in the candidate node segment. Each compensation segment is set with a compensation start state, a compensation end state, and a set of catering agents that can be replaced. The state reversibility boundary is determined by whether the output has been consumed by the downstream node, whether the output can be regenerated from the original input, and whether the output has participated in irreversible merging. The compensation start state is the most recent state version that can still be read after the anomaly occurs, and the compensation end state is the target state version that needs to be restored to the contract submission constraint.
[0059] When adjacent compensation segments are executed by different catering agents, the processing program sets compensation anchor points at the state transition boundary and registers the state fields that have been submitted and are irreversible before the compensation anchor point as retain fields, and registers the state fields that have not been consumed or can be rolled back after the compensation anchor point as rebuild fields. The retain fields are read-only and their versions are not allowed to be changed during the local compensation process. The rebuild fields can be regenerated based on the retain fields and the corresponding input states. If a certain field is referenced by both the retain segment and the rebuild segment, the original version is retained for the retain segment and a derived version is created for the rebuild segment.
[0060] Based on the preserved and reconstructed fields, the processor generates a local compensation contract. When an execution anomaly is detected, the node execution sequence, state submission sequence, and anomaly compensation sequence are recombined with the compensation anchor point as the boundary. During recombination, the processor selects a combination of agents that can receive the compensation start state and generate the compensation termination state from the set of allowed replacement catering agents. Nodes that have completed and whose output does not reference the anomaly field retain their original execution contract. Only nodes that are within the compensation segment and depend on the anomaly field are written into the new local compensation contract.
[0061] In another embodiment, counterfactual inference forms an isolated inference space by copying the current state carrying service graph and the corresponding service state. The copied content includes node attributes, directed connection edges, state hierarchy, state mapping entries, locked execution contracts, and currently referenceable states. The processor writes a candidate execution contract into the copied state carrying service graph and keeps other determined execution contracts unchanged. The graph copy uses an independent version number. The simulated states generated during the inference process are only written to the graph copy and discarded after the inference is completed, and are not merged with the real service states.
[0062] Based on the state reception constraints and state submission constraints in the candidate execution contract, the process propagates the simulated output state node by node. The simulated output is generated by the operation output state mode, the current simulated input, and the determined state mapping rules. When the simulated output is inconsistent with the input state mode of the subsequent service node, a state break node is recorded. The inconsistency includes missing required fields, field types that cannot be converted, field versions that are not within the allowed range, field sources that are not allowed sources, and fields that cannot be consumed repeatedly that have been occupied by other simulated nodes.
[0063] When a candidate execution contract spans multiple catering agents, the processor records the state transition boundaries and determines the set of downstream service nodes reachable from the state break node along the directed connection edge. During the tracing process, when a state isolation node that does not reference the break field and its derived fields is encountered, the processor stops expanding. For paths that include state convergence, the processor checks whether the convergence mapping table can still satisfy the input by other normal branches. If it can, the convergence node is not included in the set of downstream service nodes. If it cannot, the convergence node and its subsequent reachable nodes are included.
[0064] Based on the state breakpoints, state transition boundaries, and downstream service node sets, the processing program generates counterfactual evaluation data corresponding to the candidate execution contracts. The counterfactual evaluation data also records the breakpoint field identifier, the dependency depth of the breakpoint occurrence, the available compensation entry point, the state version that must be retained, and the agent combination that can be replaced. The evaluation data is saved with the candidate execution contract identifier as an index, and the corresponding deduction trajectory is retained after the target execution contract is determined, so as to directly locate the compensation entry point when an actual anomaly occurs.
[0065] In this embodiment, the abnormal state originates from the node. To the node The propagation value is calculated using the following formula: ; in, Indicates abnormal state along the path Reaching the node The propagation value, Indicates from node To node The set of directed connecting edges traversed. Indicates connecting edges Dependency retrieval of exception fields, when the connecting edge must reference the exception field. If the value is 1, then the abnormal field can be replaced by a normal branch. When retrieving 0, referencing an optional derived field of an exception field. If we set the value to 0.5, when multiple paths exist, we continue checking nodes as long as the propagation value of any path is greater than 0. The input mode.
[0066] For example, when an exception field reaches an intermediate node from the source node via a directly inherited edge, it corresponds to... If the output of the intermediate node is set to 1, then the output of the next connecting edge at the merging node can be completely replaced by another normal branch. If the value is 0, then the entire path... If the value is 0, the process stops expanding the affected range at the merging node. If the other branch can only supplement optional fields but cannot replace required fields, then the subsequent connecting edge... Take 1 and continue tracing downstream.
[0067] Please refer to Figure 8 , Figure 8 The horizontal axis represents the path sample number, ranging from 1 to 520, and the vertical axis represents the propagation value, ranging from 0 to 1. The solid black line represents the intensity of the abnormal state continuing to propagate along different path samples, and the dashed line represents the tracking boundary of 0.01. Figure 8 correspond The calculation results are used to illustrate the impact of the three types of edge values—required reference, normal substitution, and optional derivation—on the propagation range when the abnormal field propagates along the directed connection edges of the state-bearing service graph.
[0068] from Figure 8 As can be seen, the propagation value curve is generally greater than the tracking boundary, indicating that in most path samples, anomalous fields are still referenced by subsequent nodes as required or derived inputs, and the processing program needs to continue to check the node input patterns. The curve fluctuates around 0.21 to 0.24 in the early part, indicating that although anomalous fields are propagated in some paths, normal branch substitution or optional derived fields reduce the propagation intensity.
[0069] The curve gradually rises in the latter part, with a relatively high peak around sample number 460. The propagation value is approximately 0.464, indicating that the abnormal field continuously affects subsequent nodes through multiple dependency edges on this type of path, and the normal alternative sources are insufficient to completely cut off the propagation. This peak area may correspond to scenarios where order status, food processing status, or table confirmation status continue to be referenced by subsequent service nodes, and needs to be included in the affected downstream subgraph for compensation judgment.
[0070] Figure 8 The absence of large areas of zero-value regions indicates that most of the abnormal fields in the selected scenario still have subsequent reference relationships. If a path contains a connecting edge that can be completely replaced by a normal branch, the corresponding edge value will be 0, and the propagation value of the entire path will also be zero. The handler can then stop expanding the affected range at the merging or branching point.
[0071] In a preferred embodiment, counterfactual evaluation data is generated through paired alternative trajectories. For the same candidate node segment, a first simulated trajectory using the current candidate execution contract and a second simulated trajectory using another candidate execution contract are constructed respectively. The initial service state, locked execution contract and external constraints in the two simulated trajectories are kept consistent. The processor only replaces the candidate execution contract being compared, so that the difference between the two trajectories can correspond to the difference in the combination of execution subjects, state handover boundaries and compensation entry points, without mixing in irrelevant state changes.
[0072] The processing program separately counts the set of state break nodes, the set of state transition boundaries, and the set of downstream service nodes in the two simulated trajectories. It establishes a hierarchical index according to the dependency depth between service nodes and encodes the distribution of each set at different dependency depths into an evaluation vector. Each dimension in the evaluation vector represents the number of state breaks, the number of state transitions, and the number of downstream re-executions at the corresponding dependency depth. The near-end dependency depth is determined from the end of the candidate node segment backwards, while the middle and end dependency depths are divided according to the longest reachable path in the service graph. All candidate execution contracts adopt the same division result.
[0073] Based on the evaluation vector, the processing program forms a comparison relationship between candidate execution contracts and filters out combinations that are not better than another candidate execution contract in all dependency depths. During the comparison, different dimensions are not directly added together. Instead, three types of components, namely state break, state transition and downstream re-execution, are compared separately. Only when a candidate execution contract is not less than the other in all components and has at least one component greater than the other, is it determined to be dominated. This is to retain candidate combinations with different state handover methods that may still be suitable for the current service constraints.
[0074] In this embodiment, candidate execution contract Candidate execution contract The dominance determination is expressed by the following formula: ; in, Indicates the result of the dominance judgment. This indicates that the value is 1 if the condition is true and 0 if the condition is false. and Representing candidate execution contracts and candidate execution contract The evaluation vector takes values in its k-th dimension when Time Retention And screen out ,when and Both candidate execution contracts then proceed to the subsequent hierarchical comparison.
[0075] For example, candidate execution contracts The evaluation vector has 0, 2, and 1 on the three components of proximal state breakage, mid-state transition, and terminal re-execution, respectively, and the candidate execution contract is... If they are 1, 2, and 3 respectively, then... Not greater than in all components And at least two of the components are smaller. Take 1 and sieve out ,like If the intermediate state transition is set to 1, then the two do not dominate each other and are retained simultaneously.
[0076] Please refer to Figure 9 , Figure 9 The horizontal axis represents column candidate contracts, and the vertical axis represents row candidate contracts. The matrix cells are used to represent the dominance determination results between candidate contracts. Black cells indicate a correspondence value of 1, meaning that the row candidate contract is not inferior to the column candidate contract in all evaluation dimensions and is superior in at least one dimension; light gray cells indicate a correspondence value of 0, meaning that the column candidate contract cannot be directly eliminated based on this. Figure 9 correspond The calculation results.
[0077] from Figure 9 As can be seen from the data, among the 420 candidate relationship samples, there are approximately 27 black units and approximately 393 light gray units, indicating that most candidate contracts do not have an absolute dominance relationship and need to be further refined by entering the near-end comparison layer, the middle-end comparison layer, and the end-end comparison layer. This result is consistent with the characteristics of the catering service scheduling scenario: a candidate contract may be superior in the state break dimension, but weak in the rerun range or version change dimension, so it cannot be directly eliminated based on a single indicator.
[0078] The black cells are locally scattered, indicating that a few candidate contracts are superior to the compared object in multiple dimensions. This type of dominance relationship can be used to compress the candidate set, reducing the computational cost of subsequent counterfactual deduction and contract comparison. When, the processing procedure retains row candidate contracts and filters out column candidate contracts; when And reverse comparison At that time, both candidate contracts were retained and entered into subsequent hierarchical comparisons.
[0079] Figure 9 The absence of large black blocks indicates a clear local adaptability among the candidate contracts. This phenomenon suggests that while some contracts may have slightly higher overall value, they may be more suitable for specific service chains in terms of irreversible state protection, compensation for entry clarity, or the range of subsequent node reruns. Therefore, the system needs to first eliminate obviously inferior contracts using the dominance matrix, and then retain non-dominant candidates for fine-grained comparison.
[0080] Furthermore, the comparison relationships are divided into near-end comparison layer, middle-end comparison layer and end-end comparison layer according to the dependency depth. State break sorting, state transition sorting and downstream re-execution sorting are established for each comparison layer. The near-end comparison layer corresponds to the nodes that the candidate node segment directly depends on. The middle-end comparison layer corresponds to the nodes that need to be reached through at least one intermediate node. The end-end comparison layer corresponds to the nodes in the service graph that have no unfinished successor nodes or have irreversible commit states. The processing program dynamically establishes each layer according to the current structure of the service graph without relying on a fixed number of nodes.
[0081] For candidate execution contracts that have not been screened out, the processing procedure first determines the first candidate set without state break disadvantage based on the near-end comparison layer. State break disadvantage means that a candidate execution contract has a greater number of required input breaks at the near end than another candidate execution contract. Then, based on the mid-end comparison layer, it determines the second candidate set from the first candidate set where the state transition boundary does not expand. State transition boundary expansion means that the newly added handover boundary introduces field transformations or version transformations that do not exist in the original service graph. Existing directly inherited boundaries are not counted as expansion.
[0082] The processing program then determines the target candidate set with the smallest downstream service node set boundary from the second candidate set based on the end comparison layer. The boundary size is determined by the number of nodes that need to be re-executed before the end node and the irreversible state boundary it crosses. When the target candidate set contains multiple candidate execution contracts, the target execution contract is determined based on the number of state handover boundaries between each candidate execution contract and the locked execution contract. If the number of boundaries is the same, the candidate execution contract that does not need to change the current referenceable state version is selected.
[0083] In another embodiment, please refer to Figure 4When determining the affected downstream subgraph, the processing program locates the abnormal state field and the corresponding generated version in the state spectrum based on the actual output state that does not meet the state submission constraints. The abnormal state fields include missing fields, value range mismatch fields, source mismatch fields, version mismatch fields, and submission integrity mismatch fields. For missing fields, a virtual abnormal record is established with the expected generated node and the target version. For fields that have been submitted but do not meet the constraints, the actual generated version is directly referenced to establish an abnormal record.
[0084] The processing procedure traces back to the service node along the consumption record that references the abnormal state field or its derived fields, and continues to trace along the directed connection edge until it reaches the state isolation node that does not reference the abnormal state field. If a node only references the old version of the abnormal field and the old version is still in a referenceable state, then the node is identified as a state isolation node. If a node can replace the abnormal field with other normal fields through the aggregation mapping table, then it is identified as a state isolation node after the aggregation condition verification is completed. If the node output continues to derive abnormal fields, then the derived fields are added to the tracking set.
[0085] After merging the generator node corresponding to the abnormal state field, the service node associated with the consumption record, and the reachable service node located before the state isolation node into the initial affected node set, the processing program adds the associated nodes that share the input version with the initial affected node set according to the merge mapping table and state branch identifier of each node. The addition process is used to avoid version splitting caused by the same shared state version being partially rolled back while another part continues to be committed. When the shared input version allows independent consumption and the associated node has completed irreversible commit, the corresponding associated node is not added, but a derived version is created on the reconstruction branch.
[0086] In this embodiment, the boundary closure condition of the affected downstream subgraph is determined by the following formula: ; in, This represents the dependency of candidate boundary node u on the abnormal state. This represents the set of fields in the input fields of node u that originate from the exception field or its derived fields. The value is 1 when field f is a required input, 0 when field f has a normal alternative source, and 0.5 when field f is a default input. When node u is determined to be an external node, when Node u is then included in the affected downstream subgraph and its output fields are continuously tracked.
[0087] For example, a candidate boundary node has three input fields: one required field comes from an abnormal state, another optional field is derived from the abnormal state, and the remaining fields come from normal states. Take 1.5 and include the node in the affected downstream subgraph. If the required field also has a normal alternative source confirmed by the merge mapping table, then the corresponding... Change it to 0; now only fields that can be omitted are left. If the value is set to 0.5, the process still includes the node but marks it as a locally reconstructable node until all abnormal association fields have a normal alternative source before stopping the expansion.
[0088] Please refer to Figure 10 , Figure 10 The horizontal axis represents the candidate boundary node sample number, ranging from 1 to 520, and the vertical axis represents the boundary dependency. In the legend, the black bars represent the dependency of each candidate boundary node on the abnormal state or abnormal derived field, and the dashed line represents the closed boundary 0.01. Figure 10 correspond The calculation results are used to determine whether a node should still be included in the affected downstream subgraph.
[0089] from Figure 10 As can be seen, the value range of the boundary dependency is 0 to 2.0, with most samples exceeding the closed boundary, indicating that most candidate boundary nodes still directly or indirectly reference the abnormal field. Statistical results show that approximately 475 out of 520 samples are positive, and approximately 45 samples are 0, indicating that in the current catering service chain, abnormal states usually do not only affect a single node, but continue to affect subsequent nodes along the order, table, food processing, or settlement fields.
[0090] A dependency value of 2.0 indicates that a node has multiple anomalous associated inputs, typically corresponding to a situation where both required and optional derived inputs are affected. Samples with a dependency value of 0.5 or 1.0 indicate that the anomalous impact is weak or locally negligible, but they still cannot be directly excluded from the affected subgraph. Only when the dependency value is 0 does it mean that all anomalous associated fields of the node have normal alternative sources or are no longer referenced, and it can be treated as an out-of-bounds node.
[0091] Figure 10 The high proportion of positive values indicates that when determining the scope of local repair, the system cannot simply use the node where the anomaly occurred as the endpoint, but must continue to track whether the output fields are consumed by downstream nodes. Figure 10 and Figure 8 The propagation path results complement each other: Figure 8 Determine whether the anomaly continues to propagate along the path. Figure 10 Further determine whether specific candidate boundary nodes still depend on abnormal fields, and form a closed affected downstream subgraph.
[0092] After forming an affected downstream subgraph with closed boundaries, the processing program only regenerates candidate execution contracts within the affected downstream subgraph. The execution contracts, state versions, and consumption records of nodes outside the subgraph remain unchanged. The subgraph entry point uses the most recently referenced normal state as the starting point for state reception, and the subgraph exit point uses the state submission mode that the original subsequent nodes can accept as the reconstruction target. If the original execution contract contains a continuous node segment that crosses the subgraph boundary, the original execution contract is split at the compensation anchor point, and the part outside the boundary and the part inside the reconstructed boundary are retained respectively.
[0093] In a preferred embodiment, the catering intelligent agent service scheduling system includes a processor and a memory. The memory stores the program. When the processor executes the program, it receives and parses catering service requests and service contexts to obtain service intentions, execution constraints, and completion conditions. It constructs a state-bearing service graph composed of service nodes and directed connection edges according to state dependencies, obtains the intelligent agent operation set, matches the input state pattern, output state pattern, and anomaly recovery boundary of the operation set with the service nodes, and combines continuous service nodes with the catering intelligent agent according to the matching results to form candidate execution contracts containing state reception constraints, state submission constraints, and anomaly compensation entry points. It reverse-factually infers the subsequent service graph of each candidate execution contract, obtains state break nodes, state transition boundaries, and downstream re-execution ranges, and determines the target execution contract. It reads the actual output state, and when the actual output state does not meet the state submission constraints of the target execution contract, it determines the affected downstream subgraph and replaces the execution contracts in the affected downstream subgraph.
[0094] In this embodiment, the program consists of a continuous call chain formed by request parsing processing, state graph processing, operation matching processing, contract generation processing, counterfactual deduction processing, state spectrum processing, and local repair processing. Each processing part exchanges data through a unified service state object. Request parsing processing generates service intent and state requirements and writes them into state graph processing. State graph processing returns dispatchable service nodes and their input patterns. Operation matching processing returns a set of overridable operations. Contract generation processing forms candidate execution contracts. Counterfactual deduction processing outputs evaluation data. Local repair processing updates the affected downstream subgraphs based on the anomaly propagation path returned by state spectrum processing.
[0095] The memory stores current service graph data, state hierarchy data, operational capability data, execution contract data, and deduction trajectory data, respectively. Each type of data has a service session identifier and a version identifier. The current service graph data records nodes and directed connection edges. The state hierarchy data records the field version and consumption relationship. The operational capability data records the input and output patterns of the catering agent. The execution contract data records the current contract and historical contracts. The deduction trajectory data records the candidate comparison results before the formation of the target execution contract. The processor limits the reading range through the service session identifier and rejects the submission of old versions that overwrite the new version state through the version identifier.
[0096] When multiple catering service requests arrive in parallel, the processor maintains a state-bearing service graph according to the service session and establishes cross-graph state references for shared order status or shared table status. Cross-graph state references only allow reading committed and marked as referable state versions. When a service graph is about to modify a shared state, it generates a transient derived version and checks the consumption records of other service graphs. If there are incomplete consumption records, the original version is retained for use by other service graphs. After the modification is completed, it determines whether to set the derived version as the default reference version in the future based on the state mapping and merging rules.
[0097] When the catering agent interrupts its submission during execution, the processor determines which stage the interruption occurred in—unsubmitted, reversible submitted output, or irreversible submitted output—based on the anomaly recovery boundary. In the unsubmitted stage, the node is released directly and a new candidate execution contract is selected. In the reversible submitted output stage, the submitted fields are marked as versions to be verified and local compensation is initiated. In the irreversible submitted output stage, the irreversible fields are retained and the subsequent state is reconstructed after the most recent compensation anchor point. Historical versions and consumption records in the state spectrum are not deleted in any stage.
[0098] Specifically, in the application of order changes and subsequent service integration, when a customer requests to replace the original dish with another dish, the request parsing process forms a dish change node, constraint verification node, order status update node, and subsequent processing notification node. The state-bearing service graph takes the original order version, replacement target, existing processing status, and allowed change boundaries as node inputs. The candidate execution contracts correspond to either a combination of continuous processing of all nodes by one catering agent or segmented processing by multiple catering agents. Counterfactual inference checks whether the new order version can be received by the subsequent processing notification node, and sets the original dish as a compensation anchor point when it has reached an irreversible processing state, preventing it from being overwritten.
[0099] In applications where table service requests include parallel intentions for adding dishes and settling accounts, the request parsing process generates parallel branch nodes for the two types of intentions. The state branch identifier enables the adding dish branch and the settling branch to consume the same order state version respectively. If the adding dish branch submits a new order version while the settling branch has not yet completed, the state hierarchy retains both the original version and the derived version. The settling branch continues to read the original version according to its contractual acceptance constraints or switches to the derived version when re-merging is allowed. The processor prevents the settling branch from directly overwriting the order completion state without verifying the status of the added dish through the consumption flag.
[0100] In applications where service requests require cross-category intelligent agents to exchange data, the state fields submitted by the previous catering intelligent agent are converted into a field format acceptable to the next catering intelligent agent through standardized field identifiers and state mapping entries. The state exchange boundary records the fields before conversion, the fields after conversion, the source version, and the target version. When the next catering intelligent agent submits the result, it must carry the target execution contract identifier and the received source version identifier. The processor determines whether its output is based on the current valid input. If the source version has been replaced by a new incompatible version, the output is not accepted into the current service graph and is saved as an isolated submission record.
[0101] In applications where the catering service chain contains multiple convergence nodes, the processor independently maintains a convergence mapping table and a common ancestor version for each convergence node. When the current order branches are executed by different catering agents, the submission results of each branch first enter the branch temporary storage area. Only when all required fields are complete and the convergence consistency meets the conditions is a convergence state generated. If a branch is delayed or has an abnormal submission, the counterfactual inference result is used to select one of the following contract combinations: wait for the original branch, replace the corresponding agent, or rebuild the branch from the compensation anchor point. The submission results of unaffected branches continue to remain in a referable state.
[0102] In this embodiment, the same transaction version is used for service graph updates, state lineage writing, and contract replacement during program execution. At the start of a transaction, the current graph version is read and a new version is allocated for the content to be updated. Before the transaction is committed, the service node occupancy relationship, input state version, and contract version are checked to see if they are still consistent with those read. If there is an inconsistency, the content to be updated is abandoned and a candidate contract is regenerated based on the latest version. After the transaction is successfully committed, the graph node status, field lineage record, consumption mark, and contract occupancy relationship are written synchronously, so that no node is in an intermediate state where the output has been committed but the lineage is not recorded or the contract has been replaced but the node is still occupied by the old contract.
[0103] Through the above implementation method, the state-bearing service graph, the set of executable operations of the catering agent, the candidate execution contract, the counterfactual inference data, the state spectrum, and the affected downstream subgraph establish a definite reference relationship in the same service state model. The catering service request is processed from parsing, matching, dispatching, execution, submission to anomaly repair based on verifiable input and output states and version relationships, and can maintain data continuity between service nodes when different catering agents execute continuously, in parallel, or in replacement.
Claims
1. A method for scheduling catering intelligent services, characterized in that, include: Obtain the catering service request and service context, parse the catering service request into service intent, execution constraints and completion conditions, and construct a state-bearing service graph containing multiple service nodes and directed connection edges according to state dependencies; Obtain the set of executable operations for the catering intelligent agent, and match the input state mode, output state mode, and anomaly recovery boundary of each executable operation with the service node; Based on the matching results, the continuous service nodes are combined with the catering intelligent agent to form candidate execution contracts. Each candidate execution contract includes state reception constraints, state submission constraints, and anomaly compensation entry. Counterfactual analysis is performed on the subsequent service graph corresponding to each candidate execution contract to obtain the state breakpoint, state transition boundary and downstream re-execution range; Determine the target execution contract based on the simulation results; Receive the actual output state of the service node, determine the affected downstream subgraph when the actual output state does not conform to the state submission constraint of the target execution contract, and replace the execution contract in the affected downstream subgraph.
2. The catering intelligent agent service scheduling method according to claim 1, characterized in that, Constructing the state-bearing service graph includes: establishing an input state description, output state description, precondition description, completion condition description, state validity period, and failure compensation entry for each service node; The directed connection edge is generated based on the satisfyable relationship between the output state description of the previous service node and the input state description of the next service node, and the required state fields, allowed default fields and state inheritance methods are recorded for the directed connection edge. When the output status of a service node is shared by multiple subsequent service nodes, a status branch identifier is generated and an independent consumption flag is configured for each branch. When multiple preceding service nodes jointly form the input state of the subsequent service node, a state convergence identifier is generated, and a convergence mapping table is established according to the field source and state version. The state dependency chain is composed of the directed connection edge, state branch identifier, consumption mark, state convergence identifier and convergence mapping table.
3. The catering intelligent agent service scheduling method according to claim 1, characterized in that, Generating the candidate execution contract includes: extracting candidate node segments from the state-bearing service graph that have continuous input states and no unmergeable state boundaries; The candidate node segments are bidirectionally matched with the set of executable operations of each catering agent, and the agent combination that covers all input state modes and output state modes of the candidate node segments is retained. For each agent combination, a state receiving sequence, a node execution sequence, a state submission sequence, and an anomaly compensation sequence are generated, and a state handover boundary is established between adjacent agents. Based on the field transformation relationship, version inheritance relationship, and compensation reachability relationship at the state handover boundary, candidate execution contracts covering single nodes, continuous nodes, or parallel branch nodes are formed respectively.
4. The catering intelligent agent service scheduling method according to claim 1, characterized in that, The counterfactual deduction includes: copying the current state carrying service graph and the corresponding service state, writing a candidate execution contract into the copied state carrying service graph and keeping other determined execution contracts unchanged; Based on the state acceptance constraints and state submission constraints in the candidate execution contract, the simulated output state is propagated node by node, and a state break node is recorded when the simulated output state is inconsistent with the input state mode of the subsequent service node. When the candidate execution contract spans multiple catering agents, the state transition boundary is recorded, and the set of downstream service nodes reachable from the state break node is determined along the directed connection edge. Based on the state breakpoint, the state transition boundary, and the set of downstream service nodes, counterfactual evaluation data corresponding to the candidate execution contracts is generated.
5. The catering intelligent agent service scheduling method according to claim 2, characterized in that, The state dependency chain uses a state hierarchy to record the generation node, modification node, consumption node and current version of the service state. It establishes standardized field identifiers for state fields generated by different catering agents but with semantic equivalence, and records the original field values, standardized field values and conversion rules as state mapping entries. When states merge, the common ancestor version of each input state is determined according to the state spectrum. Conflict flags are generated for fields with the same name from different ancestor versions. Merged states are formed according to the field priority order or mergeable rules predefined by the service node. After a state branch is consumed, the corresponding consumption tag is written into the state hierarchy, and the service state with a definite source, definite version, and definite consumption state is marked as a referable state.
6. The catering intelligent agent service scheduling method according to claim 3, characterized in that, The anomaly compensation sequence is divided into multiple compensation segments according to the reversible boundary of the state in the candidate node segment. Each compensation segment is set with a compensation start state, a compensation termination state, and a set of catering intelligent agents that can be replaced. When adjacent compensation segments are executed by different catering smart agents, a compensation anchor point is set at the state handover boundary, and the state field that has been submitted and is irreversible before the compensation anchor point is registered as a hold field, and the state field that has not been consumed or can be rolled back after the compensation anchor point is registered as a rebuild field. A local compensation contract is generated based on the preserved field and the reconstructed field, and when an execution anomaly is detected, the node execution sequence, status commit sequence and anomaly compensation sequence are recombined with the compensation anchor point as the boundary.
7. The catering intelligent agent service scheduling method according to claim 4, characterized in that, The counterfactual assessment data is generated through paired substitution trajectories. For the same candidate node segment, a first simulated trajectory using the current candidate execution contract and a second simulated trajectory using another candidate execution contract are constructed respectively, while keeping the initial service state, locked execution contract and external constraints consistent in the two simulated trajectories. The sets of state break nodes, state transition boundaries, and downstream service nodes in the two simulated trajectories are counted separately. A hierarchical index is established according to the dependency depth between service nodes, and the distribution of each set at different dependency depths is encoded as an evaluation vector. Based on the evaluation vector, a comparison relationship is formed between the candidate execution contracts, and candidate execution contracts that are not superior to another candidate execution contract in all dependency depths are screened out according to the comparison relationship.
8. The catering intelligent agent service scheduling method according to claim 5, characterized in that, Determining the affected downstream subgraph includes: locating the abnormal state field and its corresponding generated version in the state spectrum based on the actual output state that does not meet the state submission constraints, reversing the association with the service node along the consumption record that references the abnormal state field or its derived field, and continuing to trace along the directed connection edge until reaching the state isolation node that does not reference the abnormal state field. The abnormal state field corresponding to the generating node, the service node associated with the consumption record, and the reachable service node located before the state isolation node are merged into an initial set of affected nodes. Based on the convergence mapping table and state branch identifier of each node, the associated nodes that share the input version with the initial affected node set are added to form an affected downstream subgraph with closed boundaries, and candidate execution contracts are regenerated only within the affected downstream subgraph.
9. The catering intelligent agent service scheduling method according to claim 7, characterized in that, The comparison relationships are divided into a proximal comparison layer, a middle comparison layer, and a terminal comparison layer according to the dependency depth, and state breakage sorting, state transition sorting, and downstream re-execution sorting are established for each comparison layer respectively. For candidate execution contracts that have not been screened out, firstly, a first candidate set without state break disadvantage is determined based on the near-end comparison layer. Then, a second candidate set without state transition boundary expansion is determined from the first candidate set based on the mid-section comparison layer. Finally, a target candidate set with the smallest downstream service node set boundary is determined from the second candidate set based on the end comparison layer. When the target candidate set contains multiple candidate execution contracts, the target execution contract is determined based on the number of state handover boundaries between each candidate execution contract and the locked execution contract.
10. A catering intelligent service scheduling system, characterized in that, Includes a processor and a memory, wherein the memory stores the program, and when the processor executes the program: receives and parses the catering service request and service context, obtains the service intent, execution constraints and completion conditions, and constructs a state-bearing service graph composed of service nodes and directed connection edges according to state dependencies; Obtain the action set of the intelligent agent, and match the input state pattern, output state pattern, and anomaly recovery boundary of the action set with the service node; Based on the matching results, continuous service nodes and catering intelligent agents are combined into candidate execution contracts, which include state reception constraints, state submission constraints and anomaly compensation entry points. Counterfactual analysis is performed to derive the subsequent service graph of each candidate execution contract, obtain the state breakpoint, state transition boundary and downstream re-execution range, and determine the target execution contract; Read the actual output state, and when the actual output state does not conform to the state submission constraint of the target execution contract, determine the affected downstream subgraph and replace the execution contract in the affected downstream subgraph.
