A multi-task and multi-task dispatching optimization method for self-service lottery terminals
Patent Information
- Application Number
- CN202610701609.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-21
- Publication Date
- 2026-08-21
AI Technical Summary
[0005]因此,本发明提供了一种面向自助彩票终端的多任务并发出票调度优化方法解决多任务并发出票中依赖关系与共享资源竞争难以协同调度的问题
[0016]本发明有益效果为:将出票任务、共享资源和执行状态按业务流水号构建为出票任务依赖图,使同一业务流水号内的投注确认、支付核验、票面生成、出票打印、回执校验和状态回写关系能够被统一表达,并使不同业务流水号之间对打印通道、打印缓存、执行线程、状态回写通道和本地事务队列的竞争关系能够作为调度依据。本发明在图注意力网络中引入出票约束三值门控标记,将前置任务执行约束、资源申请程度、资源限制程度和同类任务队列竞争关系分别量化为三值约束标记,并随任务状态、资源占用状态和依赖关系变化动态更新,使节点关联特征不仅体现图结构关联,还体现出票业务中的前置释放、跨流水资源占用和同类任务竞争约束。在生成候选动作后,能够结合出票合法性筛除提前排除不满足出票顺序、回写顺序、流水互斥、打印互斥、补打锁定和三值约束条件的动作,降低无效调度和业务状态冲突的可能性。通过拓扑排序、最长未完成依赖路径计算和束搜索连续动作推演,本发明能够在多个合法候选动作中识别更有利于推进关键出票路径的动作序列,并在推演过程中持续更新三值门控标记组,使策略网络和价值网络评价当前周期可执行调度动作时,同时考虑后继任务就绪、打印通道释放、状态回写通道释放、最长未完成依赖路径推进和出票约束变化情况。
Smart Images

Figure CN122614501A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of task scheduling technology, and in particular to a multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals. Background Technology
[0002] With the development of self-service terminals, electronic payments, instant ticket printing, and online transaction verification technologies, self-service lottery terminals have gradually evolved from single ticket-issuing devices into comprehensive business processing terminals integrating bet confirmation, payment verification, ticket generation, ticket printing, receipt verification, status write-back, exception handling, and backend synchronization. Existing self-service lottery terminals typically rely on local task queues, printing channel control, transaction queues, and backend interface communication mechanisms to complete the ticket issuance process. They also schedule various business tasks through task priority, queue order, thread allocation, and status write-back mechanisms to ensure that betting transactions, ticket output, and transaction status recording can operate collaboratively within the same terminal environment.
[0003] However, in situations involving multiple users placing consecutive bets, delayed payment result returns, busy printing channels, triggering of abnormal reprints, and a backlog of background synchronization tasks, existing scheduling methods often prioritize single tasks or fixed queue orders. This makes it difficult to simultaneously express the execution dependencies within the same business serial number, as well as the competition between different business serial numbers for printing channels, execution threads, status write-back channels, and local transaction queues. This leads to scheduling conflicts between paid-pending ticketing tasks, abnormal reprinting tasks, status write-back tasks, and background synchronization tasks. Especially when there are strict sequential relationships between ticket printing, receipt verification, and status write-back, simply relying on queue order makes it difficult to identify critical incomplete paths and determine the impact of current scheduling actions on the subsequent ticketing process, thus affecting scheduling stability and ticketing continuity in multi-task concurrent ticketing scenarios. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals to solve the problem of difficult coordinated scheduling of dependencies and shared resource competition in multi-task concurrent ticket issuance.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: This invention provides a multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals, comprising: By associating ticketing tasks, shared resources, and execution status with business serial numbers, a ticketing task dependency graph is constructed. A graph attention network is used to perform three-value gating of ticketing constraints and extract node association features in the ticketing task dependency graph. The node association features are then mapped to candidate actions to generate a graph association candidate action set. The candidate action set associated with the graph is screened for ticket issuance legality, and the ticket issuance task dependency graph is topologically sorted, the longest incomplete dependency path is calculated, and continuous action deduction by bundle search is performed to generate the critical path action set. The policy network and value network are invoked to evaluate the critical path action set, determine the executable scheduling actions for the current period, and allocate task queues, printing channels, status write-back channels and local transaction queues to generate scheduling execution results and updated dependency graphs. The scheduling experience is composed of the ticketing task dependency graph, the executable scheduling actions of the current period, the scheduling execution results, and the updated dependency graph. The scheduling experience is then used to update the graph attention network, policy network, and value network to generate the ticketing scheduling strategy for the next period.
[0007] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the ticket issuance tasks include: betting confirmation tasks, payment verification tasks, ticket generation tasks, printing instruction tasks, ticket printing tasks, receipt verification tasks, status write-back tasks, abnormal reprint tasks, reversal processing tasks, and background synchronization tasks; the shared resources include printing channels, printing caches, execution threads, status write-back channels, and local transaction queues; the execution states include waiting states, ready states, executing states, completed states, and abnormal states.
[0008] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the construction of the ticket issuance task dependency graph specifically includes: Retrieve ticketing tasks that are in the waiting, ready, or executing states, and group them into a task group by business serial number if they belong to the same ticketing process. Register the ticket issuance task in the pipeline task group as a task node, and register the printing channel, printing cache, execution thread, status write-back channel and local transaction queue as resource nodes; Establish task dependency edges according to the order of ticket issuance tasks, and establish resource association edges according to resource application relationships and resource occupation relationships; The task nodes, resource nodes, task dependency edges, resource association edges, and execution status constitute the ticket issuance task dependency graph.
[0009] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the generated graph association candidate action set specifically includes: The graph attention network includes a node encoding layer, a dependency attention layer, a resource attention layer, a similar task attention layer, and an attention gating layer; The ticketing task dependency graph is fed into the node encoding layer of the graph attention network to encode task nodes, resource nodes, task dependency edges, and resource association edges respectively, thus obtaining the initial node encoding. The dependency attention layer, resource attention layer, and similar task attention layer calculate execution order association, resource occupation association, and queue competition association respectively based on the initial encoding of the node, and generate execution order association features, resource occupation association features, and similar task association features. The three-value gating flags for ticket issuance constraints include a constraint strength flag, a resource request degree flag, a resource restriction degree flag, and a queue contention relationship flag. The dependency attention layer compares the ticketing task type and execution status of the current task node with those of the preceding task node according to the direction of the task dependency edge to mark the execution constraint strength. When there are multiple preceding task nodes for the current task node, the execution constraint strength with the largest value is selected. The resource attention layer marks the resource request level according to the connection status between task nodes and resource nodes, and marks the resource restriction level according to the resource occupancy status of resource nodes; The attention layer for similar tasks marks queue competition relationships according to the resource request relationship, resource occupation relationship and execution status among similar ticketing tasks. When there are multiple similar ticketing tasks in the current task node, the queue competition relationship with the largest value is selected. The execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship are combined into a three-value gating label group for ticket issuance constraints; The attention gating layer performs channel-level concatenation of execution order association features, resource consumption association features, and similar task association features, and performs gating selection according to the three-value gating label group of ticketing constraints to generate node association features; The node association features are mapped to real-time ticketing actions, print execution actions, exception handling actions, status write-back actions, and hold-and-wait actions, resulting in a set of candidate graph association actions.
[0010] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the ticket issuance validity screening specifically includes: The analysis diagram associates the candidate actions in the candidate action set with the execution status in the ticketing task dependency diagram, and matches the business serial number corresponding to the candidate action to obtain the action serial status. The action flow state is associated with the ticket issuance constraint ternary gating mark group to obtain the action flow state with ternary constraints; The action flow status with three-value constraints is verified according to the payment verification status, receipt verification status, execution status of the same business serial number, printing channel occupancy status, and abnormal reprint lock status. Candidate actions that do not meet the requirements of ticketing order, write-back order, mutual exclusion of flow, mutual exclusion of printing, and reprint lock are eliminated to obtain a set of legal candidate actions.
[0011] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the topology sorting and the calculation of the longest unfinished dependency path specifically include: Based on the ticketing task dependency graph and the set of legal candidate actions, remove the task nodes corresponding to the completed state and the task dependency edges connected to the task nodes to obtain the incomplete dependency graph. Count the number of predecessor tasks for each task node in the incomplete dependency graph, and expand the task nodes with zero predecessor tasks along the task dependency edges to obtain the topological sequence of incomplete tasks. Locate the end nodes corresponding to the ticket printing task, the abnormal reprint task, and the status write-back task in the unfinished task topology sequence, and trace the task dependency edges in reverse to obtain the dependency path record. Based on the dependency path records, the dependency path with the longest task progress length, the associated printing channel occupancy relationship, and the status write-back channel occupancy relationship is selected to obtain the longest incomplete dependency path. The corresponding task node, resource node, and subsequent task readiness relationship are marked to obtain the critical path node mark set.
[0012] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the bundle search continuous action deduction includes: The initial conditions for the bundle search are set using the set of legal candidate actions, the incomplete dependency graph, and the set of critical path node markers. Each legal candidate action is set as the first-level derivation action, and the first-level action branch is obtained. The task status, resource consumption, and subsequent task readiness changes are calculated according to the first-level action branch. The execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship of the corresponding task node of the first-level action branch are updated according to the ticketing constraint three-value gating mark group to obtain the first-level deduction dependency graph. Candidate actions that satisfy the validity of ticket issuance are selected from the first-level deduction dependency graph and appended to the end of the first-level action branch to obtain the second-level action sequence; The task status, resource release, and business serial number status changes are calculated according to the second-level action sequence. The execution constraint strength, resource application degree, resource restriction degree, and queue competition relationship of the corresponding task node in the second-level action sequence are updated according to the ticketing constraint three-value gating mark group to obtain the second-level deduction dependency graph. In the second-level inference dependency graph, candidate actions that satisfy the validity of ticket issuance are selected and appended to the end of the second-level action sequence to obtain the third-level action sequence; The third-level action sequences are sorted according to critical path coverage, subsequent task readiness, print channel release, and status write-back channel release. The sorted action sequences are then truncated according to a preset bundle width to obtain the critical path action set.
[0013] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the step of determining the executable scheduling action for the current period specifically includes: The policy network arranges the action execution order according to the critical path action set, node association features, and ticketing constraint three-value gating label group to obtain the policy action sequence; The value network calculates the readiness of subsequent tasks, release of printing channels, release of state write-back channels, and progress of the longest incomplete dependency path based on the strategy action sequence, critical path node tag set, and incomplete dependency graph. It then obtains the critical path progress evaluation result and selects the first action in the strategy action sequence with the highest critical path progress evaluation result to obtain the executable scheduling action for the current period.
[0014] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the generation of scheduling execution results and updated dependency graphs specifically includes: The algorithm analyzes the action types of the executable scheduled actions in the current period, allocates task queues, execution threads, printing channels, printing buffers, status write-back channels, and local transaction queues according to the action types, and performs reprint status locking for abnormal reprint tasks, performs reverse status marking for reverse processing tasks, maintains the waiting state for hold-wait tasks, and generates scheduling execution results. Based on the scheduling execution results, the status of task nodes, resource nodes, and business serial numbers are corrected, and the three-value gating mark group for ticket issuance constraints is regenerated to obtain the updated dependency graph.
[0015] As a preferred embodiment of the multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals described in this invention, the step of generating the ticket issuance scheduling strategy for the next cycle specifically includes: The ticketing task dependency graph, the executable scheduling actions of the current period, the scheduling execution results, and the updated dependency graph are encapsulated into scheduling experience. The scheduling experience is then filtered according to paid pending ticketing tasks, abnormal reprinting tasks, printing failure tasks, write-back failure tasks, and tasks with a waiting time exceeding the preset waiting time to obtain an experience sample set. Based on the updated dependency graph, it was confirmed that there were no real-time ticketing tasks in the task queue, the printing channel was not occupied, the status write-back channel was not occupied, and there were no pending commit records in the local transaction queue, thus obtaining the network update trigger status. The network update triggers the state-triggered experience sample set to correct the network parameters of the graph attention network, policy network, and value network, resulting in updated network parameters. The graph attention network, policy network, and value network are then configured according to these updated parameters, and the updated dependency graph is processed. The graph attention network corresponding to the updated network parameters extracts node association features according to the three-valued gating label group for ticketing constraints, generating the ticketing scheduling strategy for the next cycle.
[0016] The beneficial effects of this invention are as follows: It constructs a ticketing task dependency graph based on business serial numbers, encompassing ticketing tasks, shared resources, and execution status. This allows for a unified expression of the relationships between bet confirmation, payment verification, ticket generation, ticket printing, receipt verification, and status write-back within the same business serial number. Furthermore, it enables the scheduling basis for competition among different business serial numbers regarding printing channels, printing caches, execution threads, status write-back channels, and local transaction queues. This invention introduces a three-value gating system for ticketing constraints into the graph attention network. It quantifies the execution constraints of pre-tasks, resource request levels, resource restriction levels, and competition relationships among similar task queues into three-value constraint tags, which are dynamically updated according to changes in task status, resource occupancy status, and dependencies. This ensures that node association characteristics not only reflect graph structure associations but also pre-release, cross-serial resource occupancy, and competition constraints among similar tasks within the ticketing business. After generating candidate actions, it can filter out actions that do not meet the conditions for ticketing order, write-back order, serial number mutual exclusion, printing mutual exclusion, reprint locking, and three-value constraints, reducing the possibility of invalid scheduling and business status conflicts. By using topological sorting, calculation of the longest unfinished dependency path, and continuous action deduction through bundle search, this invention can identify action sequences that are more conducive to advancing key ticketing paths among multiple legal candidate actions. During the deduction process, the three-valued gating tag group is continuously updated, so that when the policy network and value network evaluate the executable scheduling actions of the current period, they simultaneously consider the readiness of subsequent tasks, release of printing channels, release of state write-back channels, advancement of the longest unfinished dependency path, and changes in ticketing constraints. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of a multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals.
[0019] Figure 2 A schematic diagram illustrating the construction of a dependency graph for the ticketing task and the generation of candidate actions associated with that graph.
[0020] Figure 3 This diagram illustrates the continuous deduction of legality screening, critical path identification, and bundle search.
[0021] Figure 4 This is a schematic diagram illustrating the closed loop of strategy evaluation, scheduling execution, and network experience update. Detailed Implementation
[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0023] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0024] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0025] Reference Figures 1-4 As one embodiment of the present invention, this embodiment provides a multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals, including the following steps: S1. Associate ticketing tasks, shared resources, and execution status with business serial numbers to construct a ticketing task dependency graph.
[0026] S1.1. At the beginning of a scheduling cycle, retrieve the ticketing tasks with execution statuses of waiting, ready, and executing from the local task buffer, and extract the business serial number, ticketing task type, execution status, resource request relationship, and resource occupation relationship of each ticketing task to form a list of ticketing tasks for the current cycle.
[0027] Among them, the ticket issuance task types are limited to bet confirmation task, payment verification task, ticket generation task, print instruction task, ticket printing task, receipt verification task, status write-back task, abnormal reprint task, reversal processing task, and background synchronization task. The resource application relationship and resource occupation relationship are limited to the printing channel, printing cache, execution thread, status write-back channel, and local transaction queue.
[0028] The ticketing task list for the current period is aggregated according to the business serial number. Ticketing tasks with the same business serial number are grouped into the same ticketing process to obtain a serial task group. In the case where only some ticketing tasks exist under the same business serial number, the serial task group retains the actual ticketing tasks that exist in the current period, and identifies the stage of the ticketing process through the execution status of the ticketing tasks to ensure that the registration of subsequent task nodes can reflect the real ticketing progress of the current period.
[0029] S1.2. Register each ticket issuance task in the flow task group as a task node, and record the business flow number, ticket issuance task type and execution status in the task node; the execution status includes waiting status, ready status, executing status, completed status and abnormal status.
[0030] Among them, the waiting state indicates that the ticketing task has not yet met the execution conditions; the ready state indicates that the ticketing task has met the execution conditions but has not yet occupied shared resources; the executing state indicates that the ticketing task has occupied shared resources and is being processed; the completed state indicates that the ticketing task has completed the corresponding ticketing process and can be used as a prerequisite for subsequent tasks; and the abnormal state indicates that the ticketing task has encountered printing failure, write-back failure, payment verification abnormality, or receipt verification abnormality and needs to trigger an abnormal reprint task or a reversal processing task.
[0031] The printing channel, printing cache, execution thread, status write-back channel, and local transaction queue are registered as resource nodes, and the resource occupancy status is recorded in the resource nodes. Among them, the printing channel is used for ticket printing tasks, the printing cache is used for printing instruction tasks and ticket printing tasks, the execution thread is used for concurrently executable ticket printing tasks, the status write-back channel is used for status write-back tasks and background synchronization tasks, and the local transaction queue is used for status write-back tasks, reversal processing tasks, and background synchronization tasks.
[0032] S1.3. In accordance with the execution order of betting confirmation task, payment verification task, ticket generation task, print instruction task, ticket printing task, receipt verification task, and status write-back task, establish task dependency edges between task nodes within the same transaction task group; for abnormal reprint task, reversal processing task, and background synchronization task, establish task dependency edges according to business transaction number and execution status, so that abnormal reprint task is associated with ticket printing task in abnormal state, reversal processing task is associated with payment verification task in abnormal state, and background synchronization task is associated with status write-back task in completed state.
[0033] Based on resource application and resource occupation relationships, resource association edges are established between task nodes and resource nodes. Among them, task nodes in the waiting and ready states are connected to corresponding resource nodes according to resource application relationships, and task nodes in the execution state are connected to corresponding resource nodes according to resource occupation relationships, so that the resource association edges can distinguish between ticketing tasks that have not yet occupied shared resources and ticketing tasks that are currently occupying shared resources.
[0034] The ticketing task dependency graph for the current period consists of task nodes, resource nodes, task dependency edges, resource association edges, and execution status. The ticketing task dependency graph for the current period preserves the execution order of ticketing tasks within the same business serial number, and preserves the competition relationship between different business serial numbers for printing channels, printing caches, execution threads, status write-back channels, and local transaction queues.
[0035] S2. A graph attention network is used to perform three-value gating of ticket issuance constraints and extract node association features in the ticket issuance task dependency graph. The node association features are then mapped to candidate actions to generate a graph association candidate action set.
[0036] S2.1. The ticketing task dependency graph of the current period is fed into the graph attention network. The graph attention network processes the ticketing task dependency graph in the following order: node encoding layer, dependency attention layer, resource attention layer, similar task attention layer, and attention gating layer. Among them, the node encoding layer is used to encode task nodes, resource nodes, task dependency edges, and resource association edges; the dependency attention layer is used to handle the execution order association between task nodes and predecessor task nodes; the resource attention layer is used to handle the resource occupation association between task nodes and resource nodes; the similar task attention layer is used to handle the queue competition association between similar ticketing tasks; and the attention gating layer is used to merge the three types of association features and retain the node association features related to candidate actions.
[0037] When processing the ticketing task dependency graph, the graph attention network performs a three-value gating label for ticketing constraints. The three-value gating label for ticketing constraints includes a label for the strength of execution constraints, a label for the degree of resource request, a label for the degree of resource restriction, and a label for queue competition. The strength of execution constraints, the degree of resource request, the degree of resource restriction, and the degree of queue competition are combined into a three-value gating label group for ticketing constraints.
[0038] The node encoding layer encodes the task nodes in the ticketing task dependency graph, converting the business serial number, ticketing task type, execution status, resource request relationship, and resource occupation relationship into task node codes. The node encoding layer encodes the resource nodes, converting the resource occupation status of the printing channel, printing cache, execution thread, status write-back channel, and local transaction queue into resource node codes. The node encoding layer encodes the task dependency edges and resource association edges, converting the ticketing task execution order, resource request relationship, and resource occupation relationship into edge codes. The task node codes, resource node codes, and edge codes together constitute the initial node code.
[0039] S2.2. The dependency attention layer identifies the predecessor task node of each task node based on the initial node encoding. The predecessor task node is a task node in the same pipeline task group that points to the current task node through a task dependency edge. The dependency attention layer compares the ticketing task type and execution status of the current task node and the predecessor task node according to the direction of the task dependency edge, and marks the execution constraint strength of the predecessor task node on the current task node as 0, 1 and 2 according to the execution status. Where 0 means that the predecessor task node is in the completed state and the current task node is not blocked by the predecessor task node, 1 means that the predecessor task node is in the executing state and the current task node must wait for the predecessor task node to release the execution result, and 2 means that the predecessor task node is in the waiting state, ready state or abnormal state and the current task node must not enter the execution. When there are multiple predecessor task nodes for the current task node, the dependency attention layer selects the execution constraint strength with the largest value as the execution constraint strength of the current task node, and merges the current task node encoding, the predecessor task node encoding and the execution constraint strength to generate the execution order association feature.
[0040] The resource attention layer identifies the resource nodes connected to each task node based on the initial node encoding, and distinguishes between resource request relationships and resource occupation relationships based on resource association edges. According to the connection status between task nodes and resource nodes, the resource attention layer marks the request level of a task node for shared resources as 0, 1, and 2, where 0 indicates the task node is not connected to the corresponding resource node, 1 indicates the task node is connected to the corresponding resource node through a resource request relationship, and 2 indicates the task node is connected to the corresponding resource node through a resource occupation relationship. According to the resource occupation status of resource nodes, the resource attention layer marks the restriction level of shared resources on task nodes as 0, 1, and 2, where 0 indicates the resource node is not occupied, 1 indicates the resource node is occupied by the business serial number to which the current task node belongs, and 2 indicates the resource node is occupied by other business serial numbers. The resource attention layer generates request and restriction levels for the print channel, print cache, execution thread, status write-back channel, and local transaction queue, and merges the task node encoding, resource node encoding, request level, and restriction level to generate resource occupation association features.
[0041] The same-type task attention layer identifies task nodes with the same ticketing task type based on the initial node encoding, and distinguishes between same-type ticketing tasks within the same ticketing process and between same-type ticketing tasks in different ticketing processes according to the business serial number. The same-type task attention layer marks the queue competition relationship as 0, 1, and 2 according to the resource application relationship, resource occupation relationship, and execution status between similar ticketing tasks. Where 0 indicates that there are no similar ticketing tasks in the waiting, ready, or executing state, 1 indicates that there are similar ticketing tasks but they have not applied for or occupied the same resource node, and 2 indicates that there are similar ticketing tasks and they have applied for or occupied the same resource node. When there are multiple similar ticketing tasks for the current task node, the same-type task attention layer selects the queue competition relationship with the largest value as the queue competition relationship of the current task node, and merges the current task node encoding, similar task node encoding, and queue competition relationship to generate similar task association features.
[0042] The execution constraint strength generated by the dependency attention layer, the resource request degree and resource restriction degree generated by the resource attention layer, and the queue competition relationship generated by the attention layer of similar tasks together form the ticket issuance constraint three-value gating mark group of the current task node. The ticket issuance constraint three-value gating mark group is updated synchronously with the changes in the task node state, resource node occupancy state, task dependency edge and resource association edge.
[0043] S2.3. The attention gating layer performs channel-level concatenation of execution order association features, resource consumption association features, and similar task association features, and performs gating selection according to the ticketing task type and execution status of the task node; the attention gating layer synchronously reads the three-value gating mark group of ticketing constraints during gating selection, and retains the node association features related to ticketing legality and resource competition based on the execution constraint strength, resource application degree, resource restriction degree, and queue competition relationship.
[0044] For task nodes where payment verification is completed but ticket printing is incomplete, the attention gating layer retains the payment verification completion status, printing channel application relationship, printing cache application relationship, and receipt missing status. For task nodes corresponding to abnormal reprint tasks, the attention gating layer retains the business serial number, the ticket printing task association relationship under abnormal status, and the reprint lock status. For task nodes corresponding to background synchronization tasks, the attention gating layer retains the status write-back channel application relationship and the local transaction queue application relationship. The attention gating layer generates node association features based on the gating selection result.
[0045] When generating candidate actions based on node association characteristics, task nodes whose ticketing task type is betting confirmation task, payment verification task, ticket generation task, or print instruction task and whose execution status is ready are mapped to real-time ticketing actions; task nodes whose ticketing task type is ticket printing task and whose execution status is ready are mapped to print execution actions; task nodes whose ticketing task type is abnormal reprint task or reversal processing task are mapped to abnormal handling actions; task nodes whose ticketing task type is status write-back task or background synchronization task and who have a status write-back channel application relationship are mapped to status write-back actions; and task nodes whose execution status is waiting and task nodes whose shared resources are occupied are mapped to hold and wait actions.
[0046] The real-time ticketing action, printing execution action, exception handling action, status write-back action, and hold-wait action are established according to the business serial number, task node, and resource node, and the node association characteristics corresponding to each candidate action are retained to obtain the graph association candidate action set; each candidate action in the graph association candidate action set synchronously carries the ticketing constraint three-value gating mark group of the corresponding task node.
[0047] S3. Screen the candidate action set of graph associations for ticket issuance legality, and perform topological sorting, calculation of the longest incomplete dependency path, and bundle search continuous action deduction on the ticket issuance task dependency graph to generate the critical path action set.
[0048] S3.1. For each candidate action in the candidate action set associated with the analytical graph, find the task node, resource node, task dependency edge, resource association edge and execution status under the same business serial number in the ticketing task dependency graph according to the business serial number corresponding to the candidate action, and obtain the action serial status.
[0049] The action flow status includes payment verification status, receipt verification status, execution status of the same business transaction number, printing channel occupancy status, and abnormal reprint lock status. The payment verification status is determined by the task node corresponding to the payment verification task, the receipt verification status is determined by the task node corresponding to the receipt verification task, the execution status of the same business transaction number is determined by the task node in the execution state within the same transaction task group, the printing channel occupancy status is determined by the resource node corresponding to the printing channel, and the abnormal reprint lock status is determined by the task dependency edge between the abnormal reprint task and the ticket printing task in the abnormal state.
[0050] The action flow status is associated with the three-value gating flag group of ticketing constraints carried by the candidate action to obtain the action flow status with three-value constraints. The action flow status with three-value constraints includes payment verification status, receipt verification status, execution status of the same business flow number, printing channel occupancy status, abnormal reprint lock status, execution constraint strength, resource application degree, resource restriction degree, and queue competition relationship.
[0051] Candidate actions are screened for ticket issuance validity based on the action flow status with three-value constraints. If the payment verification task is not yet completed and the candidate action is a print execution action, the candidate action does not meet the ticket issuance order requirements. If the receipt verification task is not yet completed and the candidate action is a status write-back action, the candidate action does not meet the write-back order requirements. If there are task nodes in the execution state under the same business flow number and the task node corresponding to the candidate action is not in the execution state, the candidate action does not meet the flow mutual exclusion requirements. If the resource node corresponding to the printing channel is in an occupied state and the candidate action is a print execution action, the candidate action does not meet the printing mutual exclusion requirements. Abnormal reprint tasks... When a ticket printing task is not associated with an abnormal state through a task dependency edge, the candidate action does not meet the reprint locking requirement; when the execution constraint strength is 2 and the corresponding task node of the candidate action enters execution, the candidate action does not meet the pre-dependency release requirement; when the resource constraint level is 2 and the candidate action needs to occupy the corresponding resource node, the candidate action does not meet the cross-pipeline resource occupation requirement; when the queue competition relationship is 2 and the candidate action has not advanced the task node in the critical path node marker set, the candidate action does not meet the requirement of prioritizing the advancement of similar competition; retain the candidate actions that meet the requirements of ticketing order, write-back order, pipeline mutual exclusion, printing mutual exclusion, and reprint locking to obtain the set of legal candidate actions.
[0052] S3.2. Remove the task nodes corresponding to the completed state and the task dependency edges connected to the completed task nodes in the ticketing task dependency graph, retain the task nodes corresponding to the waiting state, ready state, executing state, and abnormal state, and retain the resource nodes and resource association edges connected to the task nodes that have not been removed, to obtain the incomplete dependency graph; when the set of legal candidate actions is empty, the waiting action will be kept as a candidate action in the set of legal candidate actions, so that the incomplete dependency graph can still enter the subsequent topology sorting and bundle search continuous action deduction.
[0053] The number of predecessor tasks for each task node in the incomplete dependency graph is counted, where the number of predecessor tasks is the number of task dependency edges pointing to the current task node. Task nodes with 0 predecessor tasks are arranged as topology start nodes. The topology start nodes are expanded sequentially along the task dependency edges. For each expanded task node, the number of predecessor tasks of the corresponding successor task node is reduced. When the number of predecessor tasks is reduced to 0, the successor task node is added to the expansion sequence to obtain the incomplete task topology sequence. When an abnormal state causes the task dependency edge to be unable to continue expanding, the abnormal re-processing task and the reversal processing task corresponding to the abnormal state are used as subsequent expansion nodes to ensure that the incomplete task topology sequence covers the abnormal processing path.
[0054] S3.3. Locate the end nodes corresponding to the ticket printing task, the abnormal reprint task, and the status write-back task in the incomplete task topology sequence to obtain the end task node set; when there are no ticket printing tasks, abnormal reprint tasks, and status write-back tasks in the incomplete task topology sequence, take the task nodes without successor task nodes in the incomplete task topology sequence as the end task node set; trace the task dependency edges in reverse along the end task node set, record the number of incomplete tasks, the printing channel occupancy relationship, the status write-back channel occupancy relationship, and the successor task readiness relationship on each dependency path to obtain the dependency path record.
[0055] The longest incomplete dependency path is selected based on the dependency path records. First, the number of incomplete tasks in the dependency path records is compared, and the dependency path with the largest number of incomplete tasks is selected. When multiple dependency paths have the same number of incomplete tasks, the dependency path with the associated printing channel occupancy relationship is selected first. When multiple dependency paths are associated with printing channel occupancy relationships, the dependency path with the associated status write-back channel occupancy relationship is selected to obtain the longest incomplete dependency path. The task nodes, resource nodes, and subsequent task readiness relationships on the longest incomplete dependency path are marked to obtain the critical path node mark set.
[0056] S3.4. Set the initial conditions for bundle search using the set of legal candidate actions, the incomplete dependency graph, and the set of critical path node markers. Set each legal candidate action as a first-level deduction action to obtain the first-level action branch. For each first-level action branch, calculate the task status, resource consumption, and subsequent task readiness changes according to the candidate action type. The real-time ticketing action changes the corresponding task node from the ready state to the executing state and occupies the execution thread. The printing execution action makes the task node corresponding to the ticket printing task occupy the printing channel and printing cache. The exception handling action makes the exception reprint task and the reversal processing task maintain the exception handling path. The status write-back action makes the task node corresponding to the status write-back task occupy the status write-back channel and the local transaction queue. The hold-wait action maintains the current state of the task node and resource node to obtain the first-level deduction dependency graph.
[0057] After obtaining the first-level derivation dependency graph, based on the changes in task node state, resource node occupancy state, and subsequent task readiness caused by the first-level action branches, the execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship of the task nodes corresponding to the first-level action branches are recalculated, and the ticket issuance constraint three-value gating mark group in the first-level derivation dependency graph is updated.
[0058] S3.5. Re-execute the ticket issuance legality screening in the first-level deduction dependency graph to obtain candidate actions that satisfy the ticket issuance legality, and add the candidate actions that satisfy the ticket issuance legality to the end of the corresponding first-level action branch to obtain the second-level action sequence; continue to calculate the changes in task status, resource release and business serial number status according to the second-level action sequence. Completed task nodes change from executing state to completed state, occupied resource nodes change from occupied state to unoccupied state, and the successor task nodes corresponding to the dependency edges change from waiting state to ready state after the predecessor task nodes are completed, to obtain the second-level deduction dependency graph.
[0059] After obtaining the second-level deduction dependency graph, based on the changes in task node state, resource node release state, business serial number state, and subsequent task readiness caused by the second-level action sequence, the execution constraint strength, resource application degree, resource restriction degree, and queue competition relationship of the corresponding task nodes in the second-level action sequence are recalculated, and the ticket issuance constraint three-value gating mark group in the second-level deduction dependency graph is updated.
[0060] S3.6. Perform ticket issuance legality screening again in the second-level inference dependency graph to obtain candidate actions that meet the ticket issuance legality requirement. Add the candidate actions that meet the ticket issuance legality requirement to the end of the corresponding second-level action sequence to obtain the third-level action sequence. Calculate the number of critical path coverages, the number of subsequent task ready tasks, the number of print channel releases, and the number of status write-back channel releases according to the third-level action sequence. The number of critical path coverages is the number of task nodes in the critical path node marker set involved in the third-level action sequence. The number of subsequent task ready tasks is the number of task nodes whose waiting state is changed to ready state by the third-level action sequence. The number of print channel releases is the number of times the print channel is changed from occupied to unoccupied state by the third-level action sequence. The number of status write-back channel releases is the number of times the status write-back channel is changed from occupied to unoccupied state by the third-level action sequence.
[0061] When calculating the number of critical path coverages, the number of ready subsequent tasks, the number of print channels released, and the number of status write-back channels released in the third-level action sequence, the three-value gating flag group of ticket issuance constraints corresponding to the third-level action sequence is read synchronously. Action sequences with execution constraint strength of 0, resource restriction degree of 0, and queue competition relationship not higher than 1 are prioritized.
[0062] S3.7. Sort the third-level action sequences in the order of critical path coverage, subsequent task readiness, print channel release, and status write-back channel release. First, sort by critical path coverage from largest to smallest. If the critical path coverage is the same, sort by subsequent task readiness from largest to smallest. If the subsequent task readiness is the same, sort by print channel release from largest to smallest. If the print channel release is the same, sort by status write-back channel release from largest to smallest. The bundle width is the smaller value between the number of candidate actions and the number of candidate action types in the legal candidate action set. The number of candidate action types is determined to be 5 by real-time ticketing action, print execution action, exception handling action, status write-back action, and hold-wait action. Extract the sorted third-level action sequences according to the bundle width to obtain the critical path action set.
[0063] S4. Call the policy network and value network to evaluate the critical path action set, determine the executable scheduled actions for the current period, and allocate the task queue, printing channel, status write-back channel and local transaction queue to generate the scheduling execution results and the updated dependency graph.
[0064] S4.1. Match each action sequence in the critical path action set with the node association features in the graph association candidate action set. The matching criteria are business serial number, task node, and resource node. After matching, the policy network rearranges the candidate action sequences in the critical path action set. It does not output the final scheduling result independently for each candidate action, nor does it generate new actions that have not been screened for ticket validity. The policy network uses each candidate action sequence as the sorting object, reads the node association features, action type, business serial number, task node, and resource node corresponding to the candidate action sequence, calculates the sequence sorting score of each candidate action sequence, and arranges the critical path action set from high to low according to the sequence sorting score to obtain the policy action sequence set with policy sorting score.
[0065] The sequence of actions within each candidate action sequence is derived from the continuous action deduction by the bundle search. The policy network only adjusts the priority of different candidate action sequences in the current scheduling cycle. When two candidate action sequences have the same sequence ranking score, the policy network prioritizes the candidate action sequence with more task nodes in the critical path node tag set, and then arranges the candidate action sequence with more subsequent task ready.
[0066] When arranging the execution order of actions in the strategy network, the three-value gating mark group of ticket issuance constraints corresponding to each action sequence in the critical path action set is read synchronously. The execution constraint strength, resource application degree, resource restriction degree and queue competition relationship are used as the action sorting input, so that the strategy action sequence reflects both the node association characteristics and the three-value gating mark group of ticket issuance constraints.
[0067] The value network calculates the critical path progress evaluation results based on the strategy action sequence, the critical path node tag set, and the incomplete dependency graph. The critical path progress evaluation results include the number of subsequent tasks ready, the number of print channels released, the number of state write-back channels released, and the number of the longest incomplete dependency path progressed. Among them, the number of subsequent tasks ready is the number of task nodes whose waiting state is changed to ready state by the strategy action sequence; the number of print channels released is the number of times the strategy action sequence changes the print channel from occupied state to unoccupied state; the number of state write-back channels released is the number of times the strategy action sequence changes the state write-back channel from occupied state to unoccupied state; and the number of the longest incomplete dependency path progressed is the number of task nodes in the critical path node tag set involved in the strategy action sequence.
[0068] The value network outputs a scalar value score for each policy action sequence. The number of subsequent tasks ready, the number of print channels released, the number of state write-back channels released, and the number of the longest incomplete dependency path advanced in the critical path advancement evaluation results are used as input dimensions and process records for the scalar value score, and are not used as the final output vector reward. The scalar value score is used to compare the degree of advancement of different policy action sequences on the current scheduling cycle.
[0069] When calculating the critical path advancement evaluation results in the value network, the three-value gating tag group of ticketing constraints corresponding to the strategy action sequence is read simultaneously. The execution constraint strength, resource restriction degree, and queue competition relationship are used to distinguish the action sequence that can directly advance the longest incomplete dependency path and the action sequence that is restricted by the preceding task, cross-flow resource occupation, and competition of similar tasks.
[0070] S4.2. Based on the scalar value score comparison strategy action sequence set output by the value network, select the strategy action sequence with the highest scalar value score. When multiple strategy action sequences have the same scalar value score, compare them in the following order: the number of longest unfinished dependency paths advanced, the number of subsequent tasks ready, the number of print channels released, and the number of state write-back channels released. First, select the strategy action sequence with the largest number of longest unfinished dependency paths advanced. If the number of longest unfinished dependency paths advanced is the same, select the strategy action sequence with the largest number of subsequent tasks ready. If the number of subsequent tasks ready is the same, select the strategy action sequence with the largest number of print channels released. If the number of print channels released is the same, select the strategy action sequence with the largest number of state write-back channels released. Extract the first action from the selected strategy action sequence to obtain the executable scheduled action for the current period.
[0071] The system analyzes the action types of executable scheduled actions in the current period. When the action type is real-time ticketing, the corresponding task node is added to the task queue, and idle execution threads are allocated to the corresponding task node. When the action type is printing, the corresponding task node occupies the printing channel and printing buffer, and sends a ticket printing command. When the action type is status write-back, the corresponding task node is added to the local transaction queue, and the status write-back channel is committed. When the action type is exception handling and the corresponding task node is an exception reprint task, the reprint status is locked for the exception reprint task. When the action type is exception handling and the corresponding task node is a reversal processing task, the reversal status is marked for the reversal processing task. When the action type is hold-and-wait, the waiting state and resource request relationship of the corresponding task node are maintained.
[0072] S4.3. The scheduling execution result is formed according to the allocation result corresponding to the action type; the scheduling execution result includes the task node status change, resource node occupancy status change and business serial number status change; among them, the task node that is added to the task queue and allocated an idle execution thread changes from the ready state to the executing state, the task node that occupies the printing channel and the printing buffer records the printing channel occupancy status and the printing buffer occupancy status, the task node that submits the status back to the channel records the status back to the channel occupancy status, and the reprint status lock and reversal status flags are recorded to the corresponding business serial number respectively.
[0073] The scheduling execution results also record the number of tasks progressed on the longest incomplete dependency path, the number of subsequent tasks ready, the number of printing channels released, the number of status write-back channels released, changes in the number of printing failure tasks, changes in the number of write-back failure tasks, changes in the number of abnormal reprint tasks, and changes in the number of tasks whose waiting time exceeds the set waiting time. These are used to generate scalar instant rewards and scalar cumulative rewards in the future.
[0074] Based on the scheduling execution results, correct the status of task nodes, resource nodes, and business serial numbers in the incomplete dependency graph; complete task nodes are changed to the completed state, task nodes still being processed remain in the executing state, and task nodes that have not acquired shared resources remain in the waiting or ready state; released resource nodes are changed to the unoccupied state, and resource nodes occupied by the current period's executable scheduling actions are changed to the occupied state; based on the corrected task node status, resource node occupying state, task dependency edges, and resource association edges, recalculate the execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship, and regenerate the ticket issuance constraint three-value gating mark group; the corrected task nodes, resource nodes, task dependency edges, resource association edges, execution status, and ticket issuance constraint three-value gating mark group constitute the updated dependency graph.
[0075] S5. Combine the ticketing task dependency graph, the executable scheduling actions of the current period, the scheduling execution results, and the updated dependency graph to form a scheduling experience. Use the scheduling experience to update the graph attention network, policy network, and value network to generate the ticketing scheduling strategy for the next period.
[0076] S5.1. Encapsulate the ticketing task dependency graph, the executable scheduling action of the current period, the scheduling execution result, and the updated dependency graph into a scheduling experience. The scheduling experience retains the ticketing task dependency relationship before the execution of the executable scheduling action of the current period, the action type of the executable scheduling action of the current period, the business serial number corresponding to the executable scheduling action of the current period, the task node status change in the scheduling execution result, the resource node occupancy status change, and the task status of the next period in the updated dependency graph, so that the scheduling experience can represent a complete ticketing scheduling status change.
[0077] The scheduling experience also retains the three-valued gating tags of ticketing constraints before the execution of executable scheduling actions in the current period and the three-valued gating tags of ticketing constraints in the updated dependency graph. This allows the experience sample set to represent the changes in execution constraint strength, resource request level, resource restriction level, and queue competition relationship before and after a scheduling action. The scheduling experience also retains the critical path action set, the policy action sequence set, the sequence ranking score output by the policy network, the scalar value score output by the value network, and the reward dimension record in the scheduling execution result. This enables the policy network to be trained based on the candidate action sequence rearrangement result, and the value network to be trained based on the scalar cumulative reward.
[0078] Scheduling experience is stored in replay memory, and then filtered according to paid pending ticketing tasks, abnormal reprinting tasks, printing failure tasks, write-back failure tasks, and tasks with waiting time exceeding the set waiting time to obtain an experience sample set. Among them, paid pending ticketing tasks are determined by the payment verification task being in a completed state and the ticketing printing task not being in a completed state; abnormal reprinting tasks are determined by the task node corresponding to the abnormal reprinting task; printing failure tasks are determined by the ticketing printing task being in an abnormal state; write-back failure tasks are determined by the status write-back task being in an abnormal state; and tasks with waiting time exceeding the set waiting time are determined by the difference between the time when the task node enters the waiting state and the start time of the current scheduling cycle. If there is no scheduling experience in the replay memory that meets the filtering conditions, the current scheduling experience is retained as the experience sample set to ensure that the graph attention network, policy network, and value network have usable training samples.
[0079] S5.2. Confirm the running status of the task queue, printing channel, status write-back channel, and local transaction queue based on the updated dependency graph. When the updated dependency graph shows that there are no real-time ticketing tasks in the task queue, the printing channel is not occupied, the status write-back channel is not occupied, and there are no pending records in the local transaction queue, generate a network update trigger state. When the updated dependency graph shows that there are still real-time ticketing tasks in the task queue, the printing channel is occupied, the status write-back channel is occupied, or there are pending records in the local transaction queue, do not generate a network update trigger state, and retain the network parameters of the current graph's attention network, policy network, and value network for the next scheduling cycle to avoid network parameter updates affecting the ticketing tasks that are currently being executed.
[0080] After the network update triggers the state generation, the experience sample set is first arranged in order of business serial number and scheduling cycle, and a scalar instant reward is generated based on the scheduling execution result in each scheduling experience. The scalar instant reward is not a vector reward. The number of subsequent tasks ready, the number of printing channels released, the number of status write-back channels released, the number of the longest unfinished dependency path advanced, the change in the number of printing failure tasks, the change in the number of write-back failure tasks, the change in the number of abnormal reprint tasks, and the change in the number of waiting timeout tasks are all used as the calculation dimensions of the scalar instant reward.
[0081] The weights for scalar instant rewards are fixed as follows: the reward weight for the longest incomplete dependency path advancement is 5, the reward weight for the number of subsequent ready tasks is 3, the reward weight for the number of print channel releases is 2, and the reward weight for the number of status write-back channel releases is 2; the deduction weight for an increase in the number of failed print tasks is 6, the deduction weight for an increase in the number of failed write-back tasks is 5, the deduction weight for an increase in the number of abnormal reprint tasks is 4, and the deduction weight for an increase in the number of timeout waiting tasks is 2; when the corresponding dimension does not change, the reward record for that dimension is 0.
[0082] Each scheduling experience first generates a scalar immediate reward, and then generates a scalar cumulative reward based on the time sequence of consecutive scheduling experiences under the same business serial number. The scalar cumulative reward starts with the scalar immediate reward of the current scheduling experience and adds the discounted scalar immediate rewards of subsequent scheduling experiences, with a fixed discount coefficient of 0.9. When the same business serial number has completed ticket printing and status write-back, or when the abnormal reprint task or reversal processing task has been completed, the accumulation stops. When there are no subsequent scheduling experiences for the current scheduling experience, the scalar cumulative reward is equal to the scalar immediate reward of that scheduling experience.
[0083] After the network update trigger state is generated, the experience sample set is used to correct the network parameters of the graph attention network, policy network, and value network. Specifically, the graph attention network corrects the node association feature extraction parameters based on the ticketing task dependency graph and the updated dependency graph in the experience sample set; the policy network corrects the action ranking parameters based on the current period executable scheduling actions and scheduling execution results in the experience sample set; and the value network corrects the sequence evaluation parameters based on the scheduling execution results, critical path node label set, and updated dependency graph in the experience sample set, thus obtaining the updated network parameters.
[0084] When the graph attention network corrects the node association feature extraction parameters, it uses the three-value gating label group of ticket issuance constraints in the empirical sample set as the gating label training input; when the policy network corrects the action ranking parameters, it uses the execution constraint strength, resource request degree, resource restriction degree and queue competition relationship corresponding to the executable scheduling action in the current period as the action ranking training input; when the value network corrects the sequence evaluation parameters, it uses the change of the three-value gating label group of ticket issuance constraints before and after the scheduling execution result as the sequence evaluation training input.
[0085] The graph attention network uses a ternary gated label classification loss and a node state consistency loss to correct the node association feature extraction parameters. The ternary gated label classification loss is used to make the execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship output by the graph attention network close to the 0, 1, and 2 label results generated by the ticketing task dependency graph rules, respectively. The node state consistency loss is used to make the next cycle task node state and resource node occupancy state predicted by the graph attention network based on the node association features close to the actual state in the updated dependency graph.
[0086] The policy network uses a sequence-ordering cross-entropy loss with cumulative reward weights to correct the action ordering parameters. In each scheduling experience, the candidate action sequence to which the actual action to be executed in the current period belongs is used as the supervision sequence. When the first action of multiple candidate action sequences is the actual action to be executed in the current period, the candidate action sequence with the highest scalar value score is used as the supervision sequence. When the scalar cumulative reward is positive, the policy network increases the ordering probability of the supervision sequence in the policy action sequence set. When the scalar cumulative reward is negative, the policy network decreases the ordering probability of the supervision sequence in the policy action sequence set and increases the ordering probability of other legitimate candidate action sequences in the same critical path action set based on the scalar value score predicted by the value network.
[0087] The value network uses the scalar cumulative return mean square error loss to correct the sequence evaluation parameters. The value network outputs a scalar value score for each policy action sequence and compares the scalar value score with the scalar cumulative return corresponding to the scheduling experience. The greater the difference between the two, the greater the loss of the value network, and the smaller the difference, the smaller the loss of the value network.
[0088] The graph attention network loss, policy network loss, and value network loss are merged with a weight of 1, 1, and 1, and the network parameters of the graph attention network, policy network, and value network are updated to obtain the updated network parameters.
[0089] If the scheduling execution results in the experience sample set show an increase in the number of printing failure tasks, writing back failure tasks, abnormal reprint tasks, or waiting timeout tasks, then the corresponding scheduling experience will reduce the scalar immediate reward according to the deduction weight, and reduce the evaluation results of the policy network and value network for the same action sequence through scalar cumulative reward. If the scheduling execution results in the experience sample set show that the subsequent task enters the ready state, the printing channel is released, the status writing back channel is released, or the longest unfinished dependency path is advanced, then the corresponding scheduling experience will increase the scalar immediate reward according to the reward weight, and increase the evaluation results of the policy network and value network for the same action sequence through scalar cumulative reward.
[0090] Configure the graph attention network, policy network, and value network according to the updated network parameters, and feed the updated dependency graph into the configured graph attention network. The configured graph attention network extracts node association features from the updated dependency graph. The configured graph attention network extracts node association features according to the ticketing constraint three-value gating label group in the updated dependency graph. The configured policy network rearranges the candidate action sequences of the critical path action set for the next scheduling cycle according to the node association features and the ticketing constraint three-value gating label group, and obtains the policy action sequence set for the next scheduling cycle. The configured value network outputs a scalar value score according to the policy action sequence set for the next scheduling cycle, the ticketing constraint three-value gating label group, and the critical path node label set, and selects the policy action sequence with the highest scalar value score as the ticketing scheduling policy for the next cycle.
[0091] In summary, this invention constructs a ticketing task dependency graph based on business serial numbers, encompassing ticketing tasks, shared resources, and execution status. This allows for a unified expression of the relationships between bet confirmation, payment verification, ticket generation, ticket printing, receipt verification, and status write-back within the same business serial number. Furthermore, it enables the scheduling basis for competition among different business serial numbers regarding printing channels, printing caches, execution threads, status write-back channels, and local transaction queues. This invention introduces a three-value gating system for ticketing constraints into the graph attention network. It quantifies the execution constraints of pre-tasks, resource request levels, resource restriction levels, and competition relationships among similar task queues into three-value constraint tags, which are dynamically updated according to changes in task status, resource occupancy status, and dependencies. This ensures that node association characteristics not only reflect graph structure associations but also pre-release, cross-serial resource occupancy, and competition constraints among similar tasks within the ticketing business. After generating candidate actions, it can filter out actions that do not meet the conditions for ticketing order, write-back order, serial number mutual exclusion, printing mutual exclusion, reprint locking, and three-value constraints based on ticketing legality, reducing the possibility of invalid scheduling and business status conflicts. By using topological sorting, calculation of the longest unfinished dependency path, and continuous action deduction through bundle search, this invention can identify action sequences that are more conducive to advancing key ticketing paths among multiple legal candidate actions. During the deduction process, the three-valued gating tag group is continuously updated, so that when the policy network and value network evaluate the executable scheduling actions of the current period, they simultaneously consider the readiness of subsequent tasks, release of printing channels, release of state write-back channels, advancement of the longest unfinished dependency path, and changes in ticketing constraints.
[0092] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals, characterized in that: include, By associating ticketing tasks, shared resources, and execution status with business serial numbers, a ticketing task dependency graph is constructed. A graph attention network is used to perform three-value gating of ticketing constraints and extract node association features in the ticketing task dependency graph. The node association features are then mapped to candidate actions to generate a graph association candidate action set. The candidate action set associated with the graph is screened for ticket issuance legality, and the ticket issuance task dependency graph is topologically sorted, the longest incomplete dependency path is calculated, and continuous action deduction by bundle search is performed to generate the critical path action set. The policy network and value network are invoked to evaluate the critical path action set, determine the executable scheduling actions for the current period, and allocate task queues, printing channels, status write-back channels and local transaction queues to generate scheduling execution results and updated dependency graphs. The scheduling experience is composed of the ticketing task dependency graph, the executable scheduling actions of the current period, the scheduling execution results, and the updated dependency graph. The scheduling experience is then used to update the graph attention network, policy network, and value network to generate the ticketing scheduling strategy for the next period.
2. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 1, characterized in that: The ticketing tasks include bet confirmation, payment verification, ticket generation, print instruction, ticket printing, receipt verification, status write-back, error reprint, reversal processing, and background synchronization. The shared resources include printing channels, printing cache, execution threads, status write-back channels, and local transaction queues. The execution states include waiting, ready, in progress, completed, and abnormal states.
3. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 2, characterized in that: The construction of the ticketing task dependency graph specifically includes: Retrieve ticketing tasks that are in the waiting, ready, or executing states, and group them into a task group by business serial number if they belong to the same ticketing process. Register the ticket issuance task in the pipeline task group as a task node, and register the printing channel, printing cache, execution thread, status write-back channel and local transaction queue as resource nodes; Establish task dependency edges according to the order of ticket issuance tasks, and establish resource association edges according to resource application relationships and resource occupation relationships; The task nodes, resource nodes, task dependency edges, resource association edges, and execution status constitute the ticket issuance task dependency graph.
4. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 3, characterized in that: The generated graph association candidate action set specifically includes: The graph attention network includes a node encoding layer, a dependency attention layer, a resource attention layer, a similar task attention layer, and an attention gating layer; The ticketing task dependency graph is fed into the node encoding layer of the graph attention network to encode task nodes, resource nodes, task dependency edges, and resource association edges respectively, thus obtaining the initial node encoding. The dependency attention layer, resource attention layer, and similar task attention layer calculate execution order association, resource occupation association, and queue competition association respectively based on the initial encoding of the node, and generate execution order association features, resource occupation association features, and similar task association features. The three-value gating flags for ticket issuance constraints include a constraint strength flag, a resource request degree flag, a resource restriction degree flag, and a queue contention relationship flag. The dependency attention layer compares the ticketing task type and execution status of the current task node with those of the preceding task node according to the direction of the task dependency edge to mark the execution constraint strength. When there are multiple preceding task nodes for the current task node, the execution constraint strength with the largest value is selected. The resource attention layer marks the resource request level according to the connection status between task nodes and resource nodes, and marks the resource restriction level according to the resource occupancy status of resource nodes; The attention layer for similar tasks marks queue competition relationships according to the resource request relationship, resource occupation relationship and execution status among similar ticketing tasks. When there are multiple similar ticketing tasks in the current task node, the queue competition relationship with the largest value is selected. The execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship are combined into a three-value gating label group for ticket issuance constraints; The attention gating layer performs channel-level concatenation of execution order association features, resource consumption association features, and similar task association features, and performs gating selection according to the three-value gating label group of ticketing constraints to generate node association features; The node association features are mapped to real-time ticketing actions, print execution actions, exception handling actions, status write-back actions, and hold-and-wait actions, resulting in a set of candidate graph association actions.
5. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 4, characterized in that: The ticket issuance validity screening specifically includes: The analysis diagram associates the candidate actions in the candidate action set with the execution status in the ticketing task dependency diagram, and matches the business serial number corresponding to the candidate action to obtain the action serial status. The action flow state is associated with the ticket issuance constraint ternary gating mark group to obtain the action flow state with ternary constraints; The action flow status with three-value constraints is verified according to the payment verification status, receipt verification status, execution status of the same business serial number, printing channel occupancy status, and abnormal reprint lock status. Candidate actions that do not meet the requirements of ticketing order, write-back order, mutual exclusion of flow, mutual exclusion of printing, and reprint lock are eliminated to obtain a set of legal candidate actions.
6. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 5, characterized in that: The topology sorting and the calculation of the longest incomplete dependency path specifically include: Based on the ticketing task dependency graph and the set of legal candidate actions, remove the task nodes corresponding to the completed state and the task dependency edges connected to the task nodes to obtain the incomplete dependency graph. Count the number of predecessor tasks for each task node in the incomplete dependency graph, and expand the task nodes with zero predecessor tasks along the task dependency edges to obtain the topological sequence of incomplete tasks. Locate the end nodes corresponding to the ticket printing task, the abnormal reprint task, and the status write-back task in the unfinished task topology sequence, and trace the task dependency edges in reverse to obtain the dependency path record. Based on the dependency path records, the dependency path with the longest task progress length, the associated printing channel occupancy relationship, and the status write-back channel occupancy relationship is selected to obtain the longest incomplete dependency path. The corresponding task node, resource node, and subsequent task readiness relationship are marked to obtain the critical path node mark set.
7. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 6, characterized in that: The beam search continuous action deduction includes: The initial conditions for the bundle search are set using the set of legal candidate actions, the incomplete dependency graph, and the set of critical path node markers. Each legal candidate action is set as the first-level derivation action, and the first-level action branch is obtained. The task status, resource consumption, and subsequent task readiness changes are calculated according to the first-level action branch. The execution constraint strength, resource request degree, resource restriction degree, and queue competition relationship of the corresponding task node of the first-level action branch are updated according to the ticketing constraint three-value gating mark group to obtain the first-level deduction dependency graph. Candidate actions that satisfy the validity of ticket issuance are selected from the first-level deduction dependency graph and appended to the end of the first-level action branch to obtain the second-level action sequence; The task status, resource release, and business serial number status changes are calculated according to the second-level action sequence. The execution constraint strength, resource application degree, resource restriction degree, and queue competition relationship of the corresponding task node in the second-level action sequence are updated according to the ticketing constraint three-value gating mark group to obtain the second-level deduction dependency graph. In the second-level inference dependency graph, candidate actions that satisfy the validity of ticket issuance are selected and appended to the end of the second-level action sequence to obtain the third-level action sequence; The third-level action sequences are sorted according to critical path coverage, subsequent task readiness, print channel release, and status write-back channel release. The sorted action sequences are then truncated according to a preset bundle width to obtain the critical path action set.
8. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 7, characterized in that: The determination of the scheduling actions that can be executed in the current period specifically includes: The policy network arranges the action execution order according to the critical path action set, node association features, and ticketing constraint three-value gating label group to obtain the policy action sequence; The value network calculates the readiness of subsequent tasks, release of printing channels, release of state write-back channels, and progress of the longest incomplete dependency path based on the strategy action sequence, critical path node tag set, and incomplete dependency graph. It then obtains the critical path progress evaluation result and selects the first action in the strategy action sequence with the highest critical path progress evaluation result to obtain the executable scheduling action for the current period.
9. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 8, characterized in that: The generation of the scheduling execution result and the updated dependency graph specifically includes: The algorithm analyzes the action types of the executable scheduled actions in the current period, allocates task queues, execution threads, printing channels, printing buffers, status write-back channels, and local transaction queues according to the action types, and performs reprint status locking for abnormal reprint tasks, performs reverse status marking for reverse processing tasks, maintains the waiting state for hold-wait tasks, and generates scheduling execution results. Based on the scheduling execution results, the status of task nodes, resource nodes, and business serial numbers are corrected, and the three-value gating mark group for ticket issuance constraints is regenerated to obtain the updated dependency graph.
10. The multi-task concurrent ticket issuance scheduling optimization method for self-service lottery terminals as described in claim 9, characterized in that: The generation of the ticketing scheduling strategy for the next cycle specifically includes: The ticketing task dependency graph, the executable scheduling actions of the current period, the scheduling execution results, and the updated dependency graph are encapsulated into scheduling experience. The scheduling experience is then filtered according to paid pending ticketing tasks, abnormal reprinting tasks, printing failure tasks, write-back failure tasks, and tasks with a waiting time exceeding the preset waiting time to obtain an experience sample set. Based on the updated dependency graph, it was confirmed that there were no real-time ticketing tasks in the task queue, the printing channel was not occupied, the status write-back channel was not occupied, and there were no pending commit records in the local transaction queue, thus obtaining the network update trigger status. The network update triggers the state triggering experience sample set to correct the network parameters of the graph attention network, policy network, and value network, obtaining the updated network parameters. The graph attention network, policy network, and value network are configured according to the updated network parameters, and the updated dependency graph is processed. The graph attention network corresponding to the updated network parameters extracts the node association features according to the ticketing constraint three-value gating label group, and generates the ticketing scheduling strategy for the next cycle.