A petri net scale evaluation method based on identification compression
Patent Information
- Application Number
- CN202311548985.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2043-11-20
AI Technical Summary
随着Petri网规模的愈发复杂以及初始标识的变化,就有可能出现状态空间“爆炸”的现象
[0044]本发明提供一种基于标识压缩的Petri网规模评估方法,利用CUDA计算平台上GPU并行计算的优势来计算新的可达标识,并对新的可达标识进行压缩,从而通过减小每个新的可达标识占用的内存,减小了可达集占用的空间,有利于提高可达集的计算上限,使Petri网规模评估结果更加准确。
Smart Images

Figure CN117573349B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of automated manufacturing system analysis technology, specifically relating to a Petri net size evaluation method based on identifier compression. Background Technology
[0002] Petri net modeling can accurately represent the initial state, resource allocation, occurrence of events or actions, and failures in distributed systems. Transitional emission can depict the state changes of complex systems. Therefore, applying Petri net modeling theory to the modeling of such systems is of paramount importance.
[0003] When analyzing models based on Petri nets, reachability graphs are an effective approach. Constructing a reachability graph requires obtaining the set of enabling transitions based on the current identifiers and calculating the new identifier set. As the Petri net becomes increasingly complex and the initial identifiers change, a state space "explosion" may occur. Serial computation can no longer meet the computation time requirements, and directly using CUDA (Compute Unified Device Architecture) for parallelization, besides considering the contention for shared resources among multiple threads, also leads to errors because uncompressed identifiers occupy a large amount of memory during data transfer between the host and device.
[0004] It is evident that the parallelization approach alone has significantly accelerated the computation of large-scale Petri net systems. However, this method requires substantial memory and places certain demands on computing power. When calculating the reachability graph of complex Petri net models, there is an urgent need for a faster, memory-friendly solution method with a high upper bound. Summary of the Invention
[0005] To address the aforementioned problems in the existing technology, this invention provides a Petri net size evaluation method based on identifier compression. The technical problem to be solved by this invention is achieved through the following technical solution:
[0006] This invention provides a Petri net size evaluation method based on identifier compression, comprising:
[0007] The Petri net was simulated, and the logic for generating the enable transition set and the logic for calculating the new reachability identifier were obtained.
[0008] Based on the enable transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated and the subtasks are divided into different threads so that each thread can obtain the new reachability identifier through parallel computation.
[0009] Compress the new reachability identifier;
[0010] The obtained compressed reachability identifiers are stored in a hash table to form a reachability set;
[0011] The time spent solving the reachable set and the number of compressed reachable identifiers contained in the reachable set are statistically analyzed.
[0012] In one embodiment of the present invention, the steps of simulating a Petri net and dividing it into enabling transition set generation logic and new reachability identifier calculation logic include:
[0013] After simulating the Petri net to obtain the Petri net model, relevant information about the Petri net is obtained.
[0014] Based on the relevant information and the current reachability identifier of the Petri net model, the logic for generating the enable transition set and the logic for calculating the new reachability identifier are divided.
[0015] The relevant information includes: the initial identifier M0 generated based on the initial number of tokens set in each location, the pre-association matrix pre and post-association matrix between transition locations, the number of locations placeNum and the number of transitions transNum corresponding to the calculation of the reachable set.
[0016] In one embodiment of the present invention, based on the enabled transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated, and the subtasks are divided into different threads so that each thread can obtain the new reachability identifier through parallel computation. This includes the following steps:
[0017] Set the GPU device number used by the kernel function for computing the reachable set, the number of thread blocks to be started, and the number of threads in each thread block for executing parallel subtasks, and copy the relevant information from the host to the device.
[0018] Based on the relevant information, the enable launch logic, and the new reachability identifier calculation logic, parallel subtasks are generated, and the thread block is divided into multiple threads according to the number of threads;
[0019] The parallel subtasks are distributed to the multiple threads so that each thread computes the parallel subtasks and obtains a new reachable identifier.
[0020] In one embodiment of the present invention, the step of compressing the new reachability identifier includes:
[0021] Based on the number of locations of the new reachable identifier, allocate memory space with the same number of bits as that number of locations;
[0022] Each of the new reachable identifiers is taken as the current location in turn, and it is determined whether the number of tokens of the current location is 0; if so, the corresponding position of the current location in the memory space is set to 0, otherwise, the corresponding position of the current location in the memory space is set to 1.
[0023] After traversing all locations of the new reachable identifier, a compression result is obtained; the compression result includes the binary representation of the flag bits and the token count information, the token count information including at least the number of non-zero tokens in the new reachable identifier;
[0024] The compression result is then subjected to run-length encoding compression to obtain a compressed reachability identifier.
[0025] In one embodiment of the present invention, the step of compressing the new reachability identifier includes:
[0026] Calculate all linearly independent P-invariants of the Petri net model;
[0027] Based on the number of locations of the new reachable identifier, allocate memory space with the same number of bits as that number of locations;
[0028] Each of the new reachable identifiers is taken as the current location in turn, and it is determined whether the number of tokens in the current location forms a P-invariant with the number of tokens in other locations; if so, the corresponding position of the current location in the memory space is set to 0.
[0029] Conversely, if the token count of the current repository is 0, then the corresponding position of the current repository in the memory space is set to 0; otherwise, the corresponding position of the current repository in the memory space is set to 1.
[0030] After traversing all locations of the new reachable identifier, a compression result is obtained; the compression result includes the binary representation of the flag bits and the token count information, the token count information including at least the number of non-zero tokens in the new reachable identifier;
[0031] The compression result is then subjected to run-length encoding compression to obtain a compressed reachability identifier.
[0032] In one embodiment of the present invention, the token count information further includes the number of consecutive occurrences of the same token count in the new reachability identifier;
[0033] When the number of tokens in the current repository is not 0, after the step of setting the corresponding position of the current repository in the memory space to 1, the method further includes:
[0034] Search for the previous repository with a non-zero token count, and determine if the token count in that repository is the same as the token count in the current repository; if not, save the non-zero token count in the previous repository and the number of consecutive occurrences of that token count.
[0035] If so, increment the counter by 1 and return to the step of searching for the last repository with a non-zero token count.
[0036] In one embodiment of the present invention, the step of storing the obtained compressed reachable identifiers into a hash table to form a reachable set includes:
[0037] The obtained compressed reachable identifiers are stored in a hash table with linked lists or red-black trees as hash buckets, forming a reachable set.
[0038] In one embodiment of the present invention, the step of storing the obtained compressed reachable identifiers into a hash table with linked lists or red-black trees as hash buckets to form a reachable set includes:
[0039] Calculate the hash value of the compressed reachable identifier and determine the hash bucket to which the hash value is mapped;
[0040] Determine if the hash bucket is empty; if so, store the compressed reachable identifier in the hash bucket; otherwise, check for duplicates in the compressed reachable identifier.
[0041] When the hash bucket does not contain a reachable identifier that is the same as the compressed reachable identifier, the compressed reachable identifier is stored in the hash bucket.
[0042] In one embodiment of the present invention, the Petri net is a bounded net.
[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0044] This invention provides a Petri net size evaluation method based on identifier compression. It utilizes the advantages of GPU parallel computing on the CUDA computing platform to calculate new reachable identifiers and compresses them. By reducing the memory occupied by each new reachable identifier, the space occupied by the reachable set is reduced, which helps to improve the computational upper limit of the reachable set and makes the Petri net size evaluation results more accurate.
[0045] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0046] Figure 1 This is a flowchart of a Petri net size evaluation method based on identifier compression provided in an embodiment of the present invention;
[0047] Figure 2 This is a schematic diagram of a Petri net model provided in an embodiment of the present invention;
[0048] Figure 3 This is a flowchart of a compressed new reachability identifier provided in an embodiment of the present invention;
[0049] Figure 4 This is a schematic diagram of another Petri net model provided in an embodiment of the present invention;
[0050] Figure 5 This is another flowchart of the compressed new reachability identifier provided in the embodiments of the present invention. Detailed Implementation
[0051] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0052] Figure 1 This is a flowchart of a Petri net size evaluation method based on identifier compression provided in an embodiment of the present invention. Figure 1 As shown, this embodiment of the invention provides a Petri net size evaluation method based on identifier compression, including:
[0053] S1. Simulate the Petri net and divide it into the enable transition set generation logic and the new reachability identifier calculation logic;
[0054] S2. Based on the enable transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated and divided into different threads so that each thread can obtain the new reachability identifier through parallel computation.
[0055] S3, Compress the new reachability marker;
[0056] S4. Store the obtained compressed reachability identifiers into a hash table to form a reachability set;
[0057] S5. Calculate the time spent solving for the reachable set and the number of compressed reachable identifiers contained in the reachable set.
[0058] It should be noted that the Petri net in this embodiment is a bounded net, meaning that the number of reachable identifiers calculated is limited. This allows us to verify the feasibility of the above evaluation method by comparing the memory space occupied by reachable identifiers before and after compression.
[0059] Optionally, step S1, which involves simulating the Petri net and dividing it into the steps of generating the enable transition set and calculating the new reachability identifier, includes:
[0060] S101. Simulate the Petri net to obtain the Petri net model, and then obtain relevant information about the Petri net.
[0061] S102. Based on relevant information and the current reachability identifier of the Petri net model, the logic for generating the enable transition set and the logic for calculating the new reachability identifier are divided.
[0062] The relevant information includes: the initial identifier M0 generated based on the initial number of tokens set in each location, the pre-association matrix pre and post-association matrix between transition locations, the number of locations placeNum and the number of transitions transNum corresponding to the calculation of the reachable set.
[0063] In this embodiment, after simulating the Petri net model, relevant information is obtained based on the Petri net model, including: the initial identifier M0 of the initial number of tokens set in each place of the Petri net model, the pre-association matrix pre and post-association matrix between transition places, the place number placeNum and the number of transitions transNum corresponding to the calculation. Figure 2 This is a schematic diagram of a Petri net model provided in an embodiment of the present invention, as shown below. Figure 2 As shown, p0, p1, ..., p 13 The 14 locations in the Petri net model are represented by t0, t1, ..., t9, which represent 10 transitions. The number of dots (·) in each location represents its token count. The number of reachable sets varies significantly as the initial identifier M0 changes.
[0064] After obtaining the relevant information, the logic for generating the enable transition set and the logic for calculating the new reachability identifier can be obtained. When obtaining the logic for generating the enable transition set, all transitions are traversed, and the number of tokens in the current place is compared with the value of the corresponding position of a transition in the preceding association matrix pre. If the number of tokens in the current place is less than the value of the corresponding position of a transition in the preceding association matrix pre, it means that it is not enabled; otherwise, all enable transitions are obtained in sequence. This is called the logic for generating the enable transition set.
[0065] Based on the logic for enabling the transition set generation, this transition is further emitted, and a new reachability identifier is calculated using the new reachability identifier calculation logic. Specifically, based on the pre-association matrix `pre` and the post-association matrix `post`, the new reachability identifier calculation logic is determined as follows:
[0066] M new =M old -pre(t)+post(t);
[0067] In the formula, t represents the transition of this launch, and M oldM represents the old reachability identifier. new This indicates a new reachability identifier.
[0068] In step S2, based on the enable transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated and assigned to different threads so that each thread can obtain the new reachability identifier through parallel computation. This includes:
[0069] S201. Set the GPU device number used by the kernel function for computing the reachable set, the number of thread blocks to be opened, and the number of threads in each thread block for executing parallel subtasks, and copy the relevant information from the host to the device.
[0070] S202. Based on relevant information, enable emission logic, and new reachability identifier calculation logic, generate parallel subtasks and divide the thread block into multiple threads according to the number of threads;
[0071] S203. Distribute the parallel subtasks to multiple threads so that each thread can compute the parallel subtasks and obtain new reachability identifiers.
[0072] Specifically, the GPU device number to be executed for the parallel subtasks is selected, the corresponding thread block and the number of threads in each thread block are started, and then the relevant information is copied from the CPU to the GPU. The time when the kernel function is started is recorded as the start time. In steps S202 to S203, subtasks are generated based on the relevant information, the enable transition set generation logic, and the new reachability identifier calculation logic. The kernel function distributes the subtasks to multiple threads, so that each thread can determine in parallel whether the current transition is enabled and the process of emitting the transition when it is enabled, thereby calculating the new reachability identifier.
[0073] This embodiment fully utilizes the advantages of GPU parallel computing, which can effectively avoid errors in calculation results caused by competition for shared resources among multiple threads.
[0074] Figure 3 This is a flowchart illustrating a compressed new reachability identifier provided in an embodiment of the present invention. Please refer to [link / reference]. Figure 3 In step S3, the step of compressing the new reachability identifier includes:
[0075] S3011. Based on the number of new reachable locations, allocate memory space with the same number of bits as the number of locations.
[0076] S3012. Sequentially take each place in the new reachable identifier as the current place and determine whether the number of tokens in the current place is 0; if yes, set the corresponding position of the current place in the memory space to 0, otherwise set the corresponding position of the current place in the memory space to 1.
[0077] S3013. After traversing all locations of the new reachable identifier, a compression result is obtained. The compression result includes the binary representation of the flag bits and the token count information, which includes at least the number of non-zero tokens in the new reachable identifier.
[0078] S3014. Perform run-length encoding compression on the compression result to obtain the compression reachability identifier.
[0079] Furthermore, the token count information also includes the number of consecutive occurrences of the same token count in the new reachable identifier;
[0080] When the number of tokens in the current repository is not 0, after setting the corresponding position of the current repository in memory to 1, the following steps are also included:
[0081] Search for the previous repository with a non-zero token count, and determine if the token count in that repository is the same as the token count in the current repository; if not, save the non-zero token count in the previous repository and the number of consecutive occurrences of that token count.
[0082] If so, increment the counter by 1 and return to the step of searching for the last repository with a non-zero token count.
[0083] Figure 4 This is a schematic diagram of another Petri net model provided in an embodiment of the present invention. See also... Figure 4 In this embodiment, a new reachability identifier [5,0,0,0,0,5,0,0,0,0,5,5,5,5] is used. T For example, if the number of locations is 14, then 14 bits of memory space are needed. For each location in the new reachability identifier, if the token count is 0, the corresponding bit in the memory space is set to 0; if the token count is not 0, the corresponding bit in the memory space is set to 1. Therefore, the first compression result is 10000100001111, which is 8463 in decimal. Next, based on the first compression result, run-length encoding is used for further compression, resulting in a compressed reachability identifier of 1000000000000101, which is 32773 in decimal.
[0084] To ensure that a new reachable identifier can be recovered from a compressed reachable identifier, it is also necessary to obtain the number of consecutive occurrences of non-zero tokens in the repository as token count information. For example, for the new reachable identifier [5,0,0,0,0,5,0,0,0,0,5,5,5,5,5] TBy searching, we can determine that the non-zero library number 5 appears 6 times consecutively. Therefore, we need to save this non-zero library number 5. In order to identify 5 as a token number, we set the first bit to 1 as a flag, and then save the number of times 5 appears based on the counter value. The final result can be represented as [8463,32773,6]. T .
[0085] Figure 5 This is a flowchart illustrating a compressed new reachability identifier provided in an embodiment of the present invention. Optionally, as... Figure 5 As shown, this embodiment of the invention also provides another new method for compressing reachability identifiers. In step S3, the step of compressing the new reachability identifier includes:
[0086] S3021. Calculate all linearly independent P-invariants of the Petri net model;
[0087] S3022. Based on the number of locations of the new reachable identifier, allocate memory space with the same number of bits as that number of locations;
[0088] S3023. Sequentially take each place in the new reachable identifier as the current place, and determine whether the token count of the current place forms a P-invariant with the token counts of other places; if yes, set the corresponding position of the current place in the memory space to 0; otherwise, further determine whether the token count of the current place is 0; if yes, set the corresponding position of the current place in the memory space to 0; otherwise, set the corresponding position of the current place in the memory space to 1.
[0089] S3024. After traversing all locations of the new reachable identifier, a compression result is obtained. The compression result includes the binary representation of the flag bits and the token count information, which includes at least the number of non-zero tokens in the new reachable identifier.
[0090] S3025. Perform run-length encoding compression on the compression result to obtain the compression reachability identifier.
[0091] In this embodiment, firstly, all linearly independent P-invariants of the Petri net model are calculated, so as to... Figure 3 Taking the Petri net model shown as an example, P4, P9, P 10 P 11 P 12 P 13 These six libraries are considered P-invariants, that is, P4, P9, P... 10 P 11 P 12 P 13The token counts for these six locations can be linearly calculated from the token counts of the other locations, so there's no need to store this information. For example, in a Petri net model with m locations, if there are n linearly independent P-invariants, then only the information for mn locations needs to be stored. Therefore, the new reachability identifier [5,0,0,0,0,5,0,0,0,0,5,5,5,5] can still be used. T For example, there are two possibilities when the value is set to 0 during the first compression process: one is that the token count of the repository corresponding to this position is 0, and the other is that the P-invariant condition is met at this position, resulting in [5,0,0,0,0,5,0,0,0,5,5,5,5]. T The result of one compression is 10000100000000.
[0092] Similarly, in this embodiment, the token count information also includes the number of consecutive occurrences of the same token count in the new reachable identifier;
[0093] When the number of tokens in the current repository is not 0, after setting the corresponding position of the current repository in memory to 1, the following steps are also included:
[0094] Search for the previous repository with a non-zero token count, and determine if the token count in that repository is the same as the token count in the current repository; if not, save the non-zero token count in the previous repository and the number of consecutive occurrences of that token count.
[0095] If so, increment the counter by 1 and return to the step of searching for the last repository with a non-zero token count.
[0096] Optionally, step S4, which involves storing the obtained compressed reachable identifiers in a hash table to form a reachable set, includes:
[0097] The obtained compressed reachable identifiers are stored in a hash table with linked lists or red-black trees as hash buckets, forming a reachable set.
[0098] Specifically, the steps of storing the obtained compressed reachable identifiers into a hash table with linked lists or red-black trees as hash buckets to form a reachable set include:
[0099] Calculate the hash value of the compressed reachable identifier and determine the hash bucket to which the hash value is mapped;
[0100] Check if the hash bucket is empty; if it is, store the compressed reachable identifier in the hash bucket; otherwise, check for duplicates in the compressed reachable identifier.
[0101] If the hash bucket does not contain a reachable identifier that is the same as the compressed reachable identifier, the compressed reachable identifier will be stored in the hash bucket.
[0102] To avoid contention for shared resources caused by multiple threads accessing the same hash bucket when using CUDA, this embodiment uses double atomic locking. First, the CAS instruction in CUDA is used to check if the lock value corresponding to the current index is 0. If it is 0, the lock is attempted, and the deduplication check is performed. If the deduplication check passes, the CAS instruction is used again to confirm the lock, thus minimizing the possibility of multiple threads accessing the same hash bucket simultaneously.
[0103] Furthermore, if only linked lists are used for hash buckets, in extreme cases, a single hash bucket can store a large number of elements. During deduplication, the time complexity becomes O(n), significantly impacting system performance. Based on these considerations, this embodiment can also selectively use red-black trees instead of linked lists. Red-black trees are a relatively efficient data structure, with a time complexity of O(logn) for adding, deleting, and modifying elements. After determining that the compressed reachable identifier does not exist in the current hash bucket, it is stored in the corresponding red-black tree. Specifically, starting from the root node, the parameters of the already stored compressed reachable identifier and the compressed reachable identifier to be added are compared. If the parameter of the already stored compressed reachable identifier is less than the parameter of the compressed reachable identifier to be added, the compressed reachable identifier to be added is moved to the left subtree; otherwise, it is moved to the right subtree. Subsequently, the comparison continues with the root node of the current subtree until the compressed reachable identifier to be added is stored in the root node of the red-black tree.
[0104] It's important to note that if the red-black tree to be inserted is empty, the compressed reachable identifier is directly inserted as the root node of the red-black tree, and its color is set to black. The operation of assigning color to nodes during insertion needs to be determined according to the definition of a red-black tree. If the premise of a balanced binary tree is not met, self-balancing is performed during insertion, using rotations and color changes to satisfy the properties of a red-black tree. If a node changes color, the tree above that node needs to be corrected. In extreme cases, it may be necessary to process all paths from leaf nodes to the root node.
[0105] It is evident that this approach further satisfies the computation time requirements, optimizes the storage structure, and improves resource utilization, enabling Petri net size evaluation results to be more efficient and accurate.
[0106] As can be seen from the above embodiments, the beneficial effects of the present invention are as follows:
[0107] This invention provides a Petri net size evaluation method based on identifier compression. It utilizes the advantages of GPU parallel computing on the CUDA computing platform to calculate new reachable identifiers and compresses them. By reducing the memory occupied by each new reachable identifier, the space occupied by the reachable set is reduced, which helps to improve the computational upper limit of the reachable set and makes the Petri net size evaluation results more accurate.
[0108] In the description of this invention, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0109] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A Petri net scale evaluation method based on identification compression, characterized in that, include: The Petri net was simulated, and the logic for generating the enable transition set and the logic for calculating the new reachability identifier were obtained. Based on the enable transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated and the subtasks are divided into different threads so that each thread can obtain the new reachability identifier through parallel computation. Compress the new reachability identifier; The obtained compressed reachability identifiers are stored in a hash table to form a reachability set; The time spent solving for the reachable set and the number of compressed reachable identifiers contained in the reachable set are statistically analyzed. The step of compressing the new reachability identifier includes: Calculate all linearly independent P-invariants of the Petri net model; Based on the number of locations of the new reachable identifier, allocate memory space with the same number of bits as that number of locations; Each of the new reachable identifiers is taken as the current location in turn, and it is determined whether the number of tokens in the current location forms a P-invariant with the number of tokens in other locations; if so, the corresponding position of the current location in the memory space is set to 0. Conversely, it further determines whether the number of tokens in the current repository is 0; if so, the corresponding position of the current repository in the memory space is set to 0, otherwise, the corresponding position of the current repository in the memory space is set to 1. After traversing all locations of the new reachable identifier, a compression result is obtained; the compression result includes the binary representation of the flag bits and the token count information, the token count information including at least the number of non-zero tokens in the new reachable identifier; The compression result is then subjected to run-length encoding compression to obtain a compressed reachability identifier.
2. The place / transition Petri net based identification compression based scale evaluation method according to claim 1, characterized in that, The simulation of Petri nets and the steps for obtaining the enabling transition set generation logic and the new reachability identifier calculation logic include: After simulating the Petri net to obtain the Petri net model, relevant information about the Petri net is obtained. Based on the relevant information and the current reachability identifier of the Petri net model, the logic for generating the enable transition set and the logic for calculating the new reachability identifier are divided. The related information includes initial identification generated based on initial token numbers set in each library , pre-matrix, post-matrix, corresponding library number placeNum and transition number transNum when calculating the reachable set.
3. The Petri net size evaluation method based on identifier compression according to claim 2, characterized in that, Based on the enabled transition set generation logic and the new reachability identifier calculation logic, multiple subtasks are separated and divided into different threads so that each thread can obtain the new reachability identifier through parallel computation. The steps include: Set the GPU device number used by the kernel function for computing the reachable set, the number of thread blocks to be opened, and the number of threads in each thread block for executing parallel subtasks, and copy the relevant information from the host to the device. Based on the relevant information, the enable launch logic, and the new reachability identifier calculation logic, parallel subtasks are generated, and the thread block is divided into multiple threads according to the number of threads; The parallel subtasks are distributed to the multiple threads so that each thread computes the parallel subtasks and obtains a new reachable identifier.
4. The Petri net size evaluation method based on identifier compression according to claim 1, characterized in that, The step of compressing the new reachability identifier includes: Based on the number of locations of the new reachable identifier, allocate memory space with the same number of bits as that number of locations; Each of the new reachable identifiers is taken as the current location in turn, and it is determined whether the number of tokens of the current location is 0; if so, the corresponding position of the current location in the memory space is set to 0, otherwise, the corresponding position of the current location in the memory space is set to 1. After traversing all locations of the new reachable identifier, a compression result is obtained; the compression result includes the binary representation of the flag bits and the token count information, the token count information including at least the number of non-zero tokens in the new reachable identifier; The compression result is then subjected to run-length encoding compression to obtain a compressed reachability identifier.
5. The Petri net size evaluation method based on identifier compression according to claim 1, characterized in that, The token count information also includes the number of consecutive occurrences of the same token count in the new reachability identifier; When the number of tokens in the current repository is not 0, after the step of setting the corresponding position of the current repository in the memory space to 1, the method further includes: Search for the previous repository with a non-zero token count, and determine if the token count in that repository is the same as the token count in the current repository; if not, save the non-zero token count in the previous repository and the number of consecutive occurrences of that token count. If so, increment the counter by 1 and return to the step of searching for the last repository with a non-zero token count.
6. The Petri net size evaluation method based on identifier compression according to claim 1, characterized in that, The steps of storing the obtained compressed reachable identifiers into a hash table to form a reachable set include: The obtained compressed reachable identifiers are stored in a hash table with linked lists or red-black trees as hash buckets, forming a reachable set.
7. The Petri net size evaluation method based on identifier compression according to claim 6, characterized in that, The steps of storing the obtained compressed reachable identifiers into a hash table with linked lists or red-black trees as hash buckets to form a reachable set include: Calculate the hash value of the compressed reachable identifier and determine the hash bucket to which the hash value is mapped; Determine if the hash bucket is empty; if so, store the compressed reachable identifier in the hash bucket; otherwise, check for duplicates in the compressed reachable identifier. When the hash bucket does not contain a reachable identifier that is the same as the compressed reachable identifier, the compressed reachable identifier is stored in the hash bucket.
8. The Petri net size evaluation method based on identifier compression according to claim 1, characterized in that, The Petri net is a bounded net.
Citation Information
Patent Citations
Automatic manufacturing system Petri net state generation method based on GPU parallel computing
CN110059378A
CUDA (compute unified device architecture)-based Petri network scale evaluation method for automatic manufacturing system
CN116205056A