An Emergency Order Insertion and Rescheduling Method for Flexible Manufacturing Systems Based on Petri Nets

By optimizing the insertion point and process sequencing of emergency orders using a Petri net-based reconstruction model and an improved genetic algorithm, the dynamic scheduling problem of emergency order insertion in a flexible manufacturing system is solved, achieving efficient production scheduling and low deadlock risk.

CN120430583BActive Publication Date: 2026-06-30NANTONG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANTONG UNIV
Filing Date
2025-05-12
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively handle dynamic scheduling issues when urgent orders are inserted in flexible manufacturing systems, leading to decreased production efficiency and increased risk of deadlock.

Method used

By employing a Petri net-based reconstruction model and an improved genetic algorithm, deadlock detection and repair are implemented, the insertion point of emergency orders is optimized, and the work processes are reordered. Combined with the genetic algorithm, the scheduling sequence is optimized to ensure the minimum maximum completion time under deadlock-free conditions.

Benefits of technology

It enables the rapid and efficient handling of urgent order insertions in a flexible manufacturing system, improving production efficiency and scheduling speed, reducing deadlock risk, and increasing processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120430583B_ABST
    Figure CN120430583B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of production scheduling technology for flexible manufacturing systems, specifically relating to a Petri net-based method for rescheduling urgent orders in flexible manufacturing systems. Based on the Petri net model of the flexible manufacturing system, this invention proposes a novel rescheduling strategy; when urgent orders arrive, it proposes a method for reconstructing the Petri net model and classifying and rearranging the processing sequence. In the design of the scheduling strategy, this invention optimizes and improves the genetic algorithm. First, it uses the Tent chaotic mapping method to generate the initial population, making the population distribution more uniform; second, in the selection operation of the inheritance operation, it adopts an elite retention strategy and a roulette wheel method, selecting the better individuals based on their fitness values; in the crossover operation, it uses the POX crossover method, which can effectively expand the range of neighborhood solutions; and in the mutation operation, it uses a non-uniform mutation rate to enhance the algorithm's spatial search capability, enabling it to perform a more comprehensive spatial search.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of production scheduling technology for flexible manufacturing systems, specifically relating to a method for inserting and rescheduling urgent orders in a flexible manufacturing system based on Petri nets. Background Technology

[0002] Flexible Manufacturing Systems (FMS) are advanced automated manufacturing systems centered around CNC machine tools, interconnected with resources through automated transport equipment, and controlled by a central computer. These systems offer high flexibility and can perform a variety of production tasks. Due to the occurrence of unforeseen events in most flexible manufacturing systems, dynamic scheduling has become a new scheduling problem in FMS. In practical FMS systems, various unexpected disturbances may occur, such as machine failures, job cancellations, changes in processing time, urgent orders, and changes in delivery dates. Furthermore, with the emergence of computational intelligence, dynamic scheduling techniques based on intelligent algorithms (such as genetic algorithms, simulated annealing, and tabu search) are widely used to solve dynamic scheduling problems.

[0003] Reference 1 (Dynamic rescheduling in FMS that is simultaneously considering energy consumption and schedule efficiency) by Zhang et al. proposed a dynamic scheduling method for flexible job shops based on genetic algorithms. Inspired by this method, this invention improves upon it by proposing a Petri net-based emergency order insertion and rescheduling method for flexible manufacturing systems. When an emergency order is inserted, the Petri net model is reconstructed, and deadlock detection and repair, along with an improved genetic algorithm, are used to perform online real-time scheduling of the remaining processes after the emergency order insertion, maximizing processing efficiency. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and propose an emergency order insertion and rescheduling method for flexible manufacturing systems based on Petri nets. For flexible manufacturing systems when emergency orders are inserted, the method of this invention can reasonably arrange the order insertion point and reorder the remaining processes. At the same time, it uses an improved genetic algorithm to quickly find a scheduling sequence that meets the requirements, thereby improving production efficiency.

[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution: a method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets, comprising the following steps:

[0006] Step 1) (Establishing a Petri net model of the flexible manufacturing system before the insertion of urgent orders): Based on the processing steps of the workpieces within the flexible manufacturing system and the machine occupancy among the workpieces, construct a Petri net model (N, M0) and its correlation matrix A that can represent the discrete parallel system, and define the following symbols:

[0007] N: A Petri net N = (P, T, F) consisting of circular nodes, square nodes and directed arcs, representing a flexible manufacturing system consisting of m machines that can process n types of workpieces;

[0008] P: Collection of warehouses Where P i0 =P is ∪P if P represents the collection of idle warehouses. is P is the upload buffer for the i-th type of workpiece. if For the corresponding unloading buffer, p ij P represents the location corresponding to the j-th operation of the i-th type of workpiece. r The representative resource library;

[0009] T: Transition set, consisting of all square nodes in N. Each transition t represents the end of the previous process and the beginning of the next process, as well as the release of resources used in the previous process and the request for resources used in the next process.

[0010] F: Directed arc set, representing the processing flow of each workpiece in the system and the resource requirements and release of each processing step during the processing;

[0011] M:P→N is an identifier (N is a set of non-negative integers) representing the processing status of the system. Each number in the identifier represents the number of workpieces or resources contained in each warehouse; where M0 is the initial identifier, indicating that the system has not started processing, the workpieces are in the upload buffer, and the resources are not occupied.

[0012] A: The correlation matrix represents the variation pattern of the number of trusts in each library under each transition in N. It is a matrix with |T| rows and |P| columns.

[0013] Step 2) (Reconstructing the Petri net model after inserting an urgent order): Combine the Petri net model of the urgent order with the original manufacturing system Petri net model to construct a new Petri net model, and update the association matrix and labels. The specific steps are as follows:

[0014] Step 2-1): Let (N, M) a M represents the Petri net model of the original system when an order is inserted. a For the identification of the Petri net model of the original manufacturing system when an emergency order is inserted, (N adM ad For emergency orders, N is a Petri net model. ad =(P add ,T add ,F add Each resource required is a resource from the original manufacturing system, i.e., P. radd ∈P r .

[0015] Step 2-2): The emergency order model (N) ad M ad ) and the original Petri net model (N, M) a ) through shared resource library R add Combining them, we obtain a new Petri net model, namely (N af M af )=(P∪P s ∪P f ∪P r ∪P add ,T∪T add ,F∪F add ),M af (P∪P s ∪P f ∪P r ) = M a (P∪P s ∪P f ∪P r ),M af (P add ) = M ad (P add ).

[0016] This paper focuses on a flexible manufacturing system after the insertion of urgent orders. Under the premise of satisfying process constraints, resource constraints, and control constraints (no deadlock), the objective function of system scheduling is to minimize the maximum completion time, i.e.:

[0017] F = min{MakeSpan} (1)

[0018] MakeSpan = max{C k} (2)

[0019] Among them, C k MakeSpan is the completion time of the last process of the k-th workpiece, where k = 1, 2, ..., p (p is the total number of workpieces); MakeSpan is the maximum time to complete the processing of all workpieces.

[0020] Step 3 (Encoding and Decoding): For each workpiece and its associated process in the flexible manufacturing system, a processing sequence is generated by numbering, and then decoded into a transition sequence. The specific steps are as follows:

[0021] Step 3-1): Number all workpieces and processing paths (since the research object is a flexible manufacturing system, there can be multiple processing paths for each type of workpiece). Use the order in which the workpiece numbers appear to represent the processing order. The number of times each workpiece appears in the code must be equal to the number of its operations. The solution to the problem is encoded as a combination sequence of workpiece numbers and path numbers, called a gene sequence. The gene sequence is composed of operation genes and path genes, with operation genes first, followed by path genes in sequence. Operation genes represent the workpiece processing order, and their total length is the total number of operations required to process all workpieces. Path genes represent path selection, and their total length is the total number of workpieces.

[0022] Step 3-2): Using the above encoding scheme, reverse decoding can be directly achieved, that is, the sequence can be directly decoded into a scheduling sequence that satisfies the operation constraints. The nth occurrence of workpiece i in the process sequence represents the nth operation of workpiece i, and each number is decoded to the corresponding transition in turn. For the same type of workpiece, if the processing paths are different, the transitions obtained during decoding will also be different.

[0023] Step 4) (Pre-scheduled sequence rearrangement): Record the start time of each operation in the pre-scheduled sequence *chrom* before the insertion of the urgent order, and store it in the array *optime*. Array *optime* is the set of start times for all operations in the pre-scheduled sequence, and its length is the total number of operations required to process all workpieces. Sort the elements in array *optime* in ascending order, and update the positions of the elements in the pre-scheduled sequence accordingly, resulting in new arrays *optime* and *chrom*. Due to the asynchronous concurrency characteristics of the flexible manufacturing system, the updated arrays have no effect on the original pre-scheduled sequence; both are equivalent operation sequences.

[0024] Step 4-1): Set i = 1; optimize * =optime;chrom * =chrom;

[0025] Step 4-2): Determine if i is greater than |optime * |-1, if the condition is met, then the rearrangement of the pre-scheduled sequence is completed, |optime * |For array optime * Given the length of the array `optime`, output the new array `optime`. * and chrom * If the condition is not met, proceed to step 4-3.

[0026] Step 4-3): Set j = 1;

[0027] Step 4-4): Determine if j is greater than |optime *If the condition is met (i-1), then complete one iteration, let i = i+1, and re-execute step 4-2); otherwise, execute step 4-5.

[0028] Steps 4-5): Determine the optimal * Is [j] greater than optimal? * [j+1], if the condition is met, then execute steps 4-6);

[0029] Steps 4-6): Swap optima * [j] and optimale * Swap the position of [j+1] with chrom * [j] and chrom * The position of [j+1];

[0030] Step 4-7): Let j = j + 1, and repeat step 4-4);

[0031] Due to the asynchronous and concurrent nature of flexible manufacturing systems, the updated array has no impact on the original pre-scheduled sequence; the two are equivalent process sequences.

[0032] Step 5) (Determine the urgent order insertion point and categorize operations): Based on the urgent order insertion time and the element size in `optime*`, categorize all operations into: completed operations, operations in progress, and incomplete operations. Completed operations: Operations that started before the urgent order arrival time and whose next operation has already started or completed. Operations in progress: Operations that started before the urgent order arrival time and whose next operation has not yet started. Incomplete operations: Operations that have not yet started. The order insertion point is after completed operations and after operations in progress, but before incomplete operations.

[0033] The specific steps are as follows:

[0034] Step 5-1): Set i = 1;

[0035] Step 5-2): Determine if i is greater than |optime * If the conditions are met, the process classification is completed; otherwise, proceed to step 5-3.

[0036] Step 5-3): Determine if t is greater than optimal*[i]. If the condition is met, proceed to step 5-4); otherwise, the operation corresponding to chrom*[i] is an incomplete operation, and proceed to step 5-6.

[0037] Step 5-4): Set j to the index value of the next process of the workpiece corresponding to chrom*[i];

[0038] Step 5-5): Determine if t is greater than optimal*[j]. If the condition is met, the process corresponding to chrom*[i] is a completed process; otherwise, it is a process in progress.

[0039] Step 5-6): Let i = i + 1, and repeat step 5-2.

[0040] Step 6) (Constructing Discrete Mapping Relationships): Establish a mapping relationship between individual positions and process codes. For processes, the principle of scheduling based on the smallest position value is adopted; the smaller the position value of a process, the higher its processing priority. The specific steps are as follows:

[0041] Step 6-1) (Generate a continuous position sequence): During the continuous coding of the process, a position is generated for each process. The position is a sequence of positions within [X]. min ,X max A real number randomly generated within the range, where the position value corresponding to each process represents the priority of that process.

[0042] Step 6-2) (Establish the mapping relationship between discrete and continuous sequences): Each element in the i-th segment of the continuous position sequence corresponds to a transition on the processing path of workpiece i. Its position value represents the priority of the transition. The principle of scheduling the smallest position value first is adopted. The element with the smallest position value corresponds to the first transition on the processing path of workpiece i, the element with the second smallest position value corresponds to the second transition on the processing path of workpiece i, and so on.

[0043] Step 7) (Determine genetic parameters): Determine the various parameters used in the algorithm, including population size Popsize, maximum number of iterations Maxgen, crossover factor CrossFactor, and mutation factor P. m Selection Factor;

[0044] Step 8) (Generate Initial Population): The initial population consists of chromosomes of a fixed size, specifically the population size determined in Step 7). Based on the process classification in Step 5), the initial population retains the completed and ongoing processes of the pre-scheduled sequence, and generates the initial population from different combinations of the remaining process codes.

[0045] The initial population is generated using the Tent mapping rule, which improves the discreteness and uniformity of the sequence, reduces the probability of repetitions, thereby improving search efficiency and maintaining the diversity of the search process. The specific formula is as follows:

[0046]

[0047] X i =X min +z i ×(Xmax -X min (4)

[0048] Where Popsize is the population size, z i Let zi represent the chaotic sequence of the i-th mapping, z0∈[0,1] represent the initial chaotic sequence, β be the chaotic coefficients, and X be the chaotic sequence. i For individual location, X max and X min This defines the upper and lower limits of the search space. The specific steps are as follows:

[0049] Step 8-1): Set i = 1, initial population PopChrom, initial chaotic sequence z0;

[0050] Step 8-2): Determine if i is greater than Popsize. If yes, output the initial population PopChrom; otherwise, proceed to step 8-3).

[0051] Step 8-3): Calculate the chaotic sequence z of the chromosome according to formula (3). i ;

[0052] Step 8-4): According to formula (4) in [X min ,X max Calculate the position X corresponding to the process in the chromosome within the range. i

[0053] Step 8-5): By the position X of each process i Adjust the priority of the work processes.

[0054] Step 8-6): i = i + 1, repeat step 8-2);

[0055] For each randomly generated chromosome, check whether it meets the coding requirements of step 3). If it does not meet the requirements, make corrections.

[0056] Step 9) (Deadlock Detection and Repair): Combine the correlation matrix A' of the reconstructed Petri net model with the initial label M af The decoded sequence is subjected to deadlock detection and repair to ensure that the repaired gene sequence can meet resource constraints, processing order constraints, and control constraints; the specific steps are as follows:

[0057] Step 9-1): Set u = 1 and record the current detected transition number;

[0058] Step 9-2): Determine if u is greater than the length of the transition sequence. If the condition is met, complete the repair of the gene sequence; otherwise, set the u-th transition in the transition sequence to t. α Execute step 9-3);

[0059] Step 9-3): Check transition t α Under the current flag, determine whether to enable it. If enabled, proceed to step 9-4; otherwise, select t. α The next transition is placed before this transition, and t is updated. α Repeat this step;

[0060] Step 9-4): Use a one-step forward look method to determine the transition t. α Whether to allow triggering; if not, select t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3); otherwise, repeat step 9-5.

[0061] Step 9-5): Determine the transition t α Does the corresponding processing step satisfy the processing sequence constraint, i.e., transition t? α Does the corresponding processing step precede the previous processing step?

[0062] If not satisfied, choose t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3); otherwise, repeat step 9-6.

[0063] Step 9-6): Trigger t α Update the current identifier, let u = u + 1, and execute step 9-2.

[0064] Repeat the above steps to complete chromosome detection and repair.

[0065] Step 10) (Calculate processing time and fitness value): (Calculate completion time MakeSpan): Calculate the processing time of the flexible manufacturing system using the time allocation principle of the Gantt chart. Determine the idle time of the machine used in the current process, and compare it with the estimated completion time of the previous process for the corresponding workpiece. Take the larger of the two as the start time of the current process. This time is also the release time of the resources occupied by the previous process and the actual completion time of the previous process. The start time plus the operation time of the current process is the estimated completion time of the current process. After calculating all processes, the completion time of the last process in the system is the completion time MakeSpan of the entire process sequence.

[0066] The fitness value formula is as follows:

[0067]

[0068] Where MaxSpan is the maximum processing time among all individuals in the current population, MinSpan is the minimum processing time among all individuals, k1 and k2 are arbitrary constants, and Adapt is the fitness value of an individual.

[0069] Step 11) (Termination rule judgment): Determine whether the termination rule is met, i.e., gen > Maxgen; if yes, proceed to step 13) and the program ends; if no, execute step 12).

[0070] Step 12) (Genetic Operations): Perform three genetic operations—selection, crossover, and mutation—on the current population to obtain a new generation. Execute steps 12-1) to 12-4). The specific steps are as follows:

[0071] Step 12-1 (Selection Operation): Introduce an elite storage strategy, storing the top 10% of the best individuals in the population based on their fitness values. For the remaining individuals, a roulette wheel selection method is used. The probability of each individual being selected is proportional to its fitness value. The formulas for the probability of an individual being selected and the cumulative probability of a chromosome are as follows:

[0072]

[0073] Generate a random number rand in the range [0,1]. If Q(x) i If )≤rand, it means that the i-th individual is selected. This process is repeated to obtain a population containing Selectnum×Popsize individuals.

[0074] Step 12-2 (Crossover Operation): Generate a random number rand between [0,1]. If rand is less than the crossover factor CrossFactor, then use the POX (precedence operation crossover) method on every two chromosomes in the population. Chromosomes p1 and p2 are crossed to generate two offspring c1 and c2. The crossover process is as follows:

[0075] Step 12-2-1): Randomly divide the workpiece set into two non-empty subsets J1 and J2;

[0076] Step 12-2-2): Copy the operations of the workpieces in workpiece set J1 in p1 to c1, and copy the operations of the workpieces in workpiece set J1 in p2 to c2, keeping their positions.

[0077] Step 12-2-3): Copy the operations of the workpieces in p1 that belong to workpiece set J2 to c2, and copy the operations of the workpieces in p2 that belong to workpiece set J2 to c1, keeping their order.

[0078] Step 12-3 (Mutation Operation): To avoid a decline in the overall quality of the population due to the mutation of superior chromosomes, a non-uniform mutation rate P is adopted. m Enhance the algorithm's spatial search capability to enable a more comprehensive spatial search. In the early iterations, a high mutation rate allows it to quickly cover the solution space. As the iteration progresses, the mutation rate should be reduced to ensure that superior chromosomes are inherited by the next generation. The linear adaptive mutation rate expression is as follows:

[0079]

[0080] Among them, P m0 This represents the initial rate of variation, where ρ is a constant in the interval (0,1).

[0081] For the operation code, a mutation operator that simulates binary encoding is used to change the position of the operation. The specific formula is as follows:

[0082] X new =X i +(X imin +X imax )×δ i (9)

[0083]

[0084] For each path code, select a chromosome and generate a random number rand between [0,1]. If rand is less than the mutation rate, perform a path mutation operation on that individual, as follows:

[0085] Since the first type of workpiece has two processing paths to choose from, when the chromosome mutates, if the first type of workpiece has not undergone the second process, its processing path will be changed.

[0086] Step 12-4): After the genetic operation is completed, merge all parent individuals and offspring obtained through the genetic operation into a new population, i.e., gen = gen + 1; return to step 9) to decode each chromosome in the new population and perform feasibility testing and repair operations. Repeat step 10), sorting by fitness value from largest to smallest, and select the top Popsize individuals.

[0087] Step 13) (Output the optimal solution): After satisfying the termination rule in Step 11), output the chromosome sequence, transition sequence and corresponding processing time MakeSpan of the best individual in the population, and complete the rescheduling of the flexible manufacturing system.

[0088] The emergency order insertion and rescheduling method for a flexible manufacturing system based on Petri nets described in this invention has the following technical advantages compared with existing technologies:

[0089] (1) Based on the Petri net model of flexible manufacturing system, this invention proposes a new rescheduling strategy; when an emergency order arrives, it proposes a method for reconstructing the Petri net model and classifying and rearranging the processing sequence.

[0090] (2) This invention uses a detection and repair algorithm to adjust all chromosomes into feasible chromosomes and decode them into feasible scheduling sequences, ensuring that the flexible manufacturing system can optimize the production process without deadlock, quickly find scheduling sequences that meet the optimization target requirements, improve scheduling speed, and increase production quantity.

[0091] (3) In the design of the scheduling strategy, the genetic algorithm was optimized and improved. First, the Tent chaotic mapping method was used to generate the initial population, so that the population distribution was more uniform. Second, in the selection operation of the heritage operation, the elite retention strategy and the roulette wheel method were used to select the better individuals according to the fitness value. In the crossover operation, the POX (precedence operation crossover) method was used, which can effectively expand the range of neighborhood solutions. In the mutation operation, the non-uniform mutation rate was used to enhance the spatial search capability of the algorithm, so that it can perform a more comprehensive spatial search. Attached Figure Description

[0092] Figure 1 This is a schematic diagram of the rescheduling method for inserting urgent orders into a flexible manufacturing system, as per the present invention.

[0093] Figure 2 This refers to the Petri net model of the tool cutting production unit in Embodiment 1 of the present invention;

[0094] Figure 3 A Petri net model for the new system when emergency orders are inserted;

[0095] Figure 4 Insert a timeline and process classification diagram for urgent orders;

[0096] Figure 5 This is a schematic diagram of discrete mapping relationships;

[0097] Figure 6 This is a diagram illustrating the POX crossover operation;

[0098] Figure 7 This is a schematic diagram of path variation;

[0099] Figure 8 This is the Gantt chart corresponding to the optimal solution. Detailed Implementation

[0100] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, some symbols in the embodiments of this application will be explained first, so that those skilled in the art can understand them.

[0101] This embodiment illustrates the application of an emergency order insertion rescheduling method in a flexible manufacturing system to a tool cutting production unit. The tool cutting production unit utilizes a cutting machine, a handling robot, and a grinding machine to produce two types of tools. Different tool processing sequence codes correspond to different maximum completion times. The optimization objective of its scheduling strategy is to achieve rapid optimization of completion time, total energy consumption, and machine utilization based on an improved genetic algorithm. The specific steps are as follows:

[0102] Step 1) (Establishing a Petri net model of the flexible manufacturing system before emergency order insertion): Establish a Petri net model of the tool processing workshop. The tool processing workshop manufacturing system consists of three types of machines—cutting machines, handling robots, and grinding machines. The system can process two types of tools. The processing sequence for the first type of tool is handling, cutting, grinding, handling; the processing sequence for the second type of tool is handling, cutting, handling. The first type of tool has two processing paths. For the same type of processing operation, different machines can be selected for processing. The two processing paths are distinguished by subscripts. The processing capacities of the five machines r1, r2, r3, r4, and r5 are 1, 2, 2, 2, and 1, respectively. The number of tools of both types to be processed is 5. Each type of tool blank enters the production line through the upload buffer, is cut and ground, and leaves through the unloading buffer after processing. The corresponding Petri net model of this system is as follows: Figure 2 As shown.

[0103] P i0 (i = 1, 2) is the idle library set, representing the buffer that stores the i-th type of tool. Tool blanks are uploaded from the buffer P. is Uploaded to the processing workshop for processing, and after all processing sequences are completed, it enters the unloading buffer P. if P i0 The number of black dots indicates the number of blanks to be processed for this type of workpiece (when the number is large, the black dots are replaced with numbers);

[0104] P = {p ij The set of operations is defined as {i = 1, 2; j = 1, 2, 3, 4, 5}, where p ij p represents the j-th operation of the i-th type of tool. ij The number of black dots indicates the number of tools currently performing this operation, p ij The numbers on the outside indicate the time required for the tool to complete the operation;

[0105] P r ={ri Let i = 1, 2, 3, 4, 5} be the set of resources, where r i Let r represent the i-th machine. i The number of black dots indicates the machine's maximum capacity;

[0106] T={t ij Let {i = 1, 2, 3; j = 1, 2, 3, 4, 5} be the transition set, where t ij t represents the start of the j-th operation for the i-th type of tool. ij+1 This indicates the end of the j-th operation and the beginning of the (j+1)-th operation for the i-th type of tool.

[0107] Specifically, t 11 This indicates that the first type of tool blank is uploaded from the buffer P. 1s Entering the production line, p 11 This represents the first operation of the first type of tool—transfer, which is completed by the transfer robot r1 (from r1 to t). 11 t 11 to p 11 The two arcs indicate the start, starting from p. 11 to t 12 t 12 The two arcs to r1 indicate completion), p 11 The number 4 next to it indicates that the operation takes 4 time units; Figure 2 p in 1s p 2s The numbers in the table represent the number of blanks for the two types of tools: 5, r1, r2, r3, r4, and r5. The black dots represent their processing capacities: 1, 2, 2, 2, and 1, respectively. The absence of black dots in the other operation library indicates that no other operations have started in the initial state. These black dots constitute the initial identifier M0 = 5p. 1s +5p 2s +r1+2r2+2r3+2r4+r5. Figure 2 The specific meaning of each symbol is shown in Table 1.

[0108] Table 1. Meaning of locations and transitions in the Petri net model of the tool processing workshop.

[0109] warehouse meaning change meaning <![CDATA[p 1s ]]> Upload buffer for Category 1 knife blanks <![CDATA[t 11 ]]> The first type of raw materials are transported into the production line. <![CDATA[p 11 ]]> Handling of Class I cutting tools <![CDATA[t 12 、t 22 ]]> After transportation is complete, proceed with the cutting operation. <![CDATA[p 12 、p 22 ]]> Cutting operations of the first type of tool <![CDATA[t 13 、t 23 ]]> After cutting, proceed with the grinding process. <![CDATA[p 13 、p 23 ]]> Sharpening operations for the first type of cutting tools <![CDATA[t 14 、t 24 ]]> After polishing, the material is moved. <![CDATA[p 14 ]]> Handling of Class I cutting tools <![CDATA[t 15 ]]> Once the transfer is complete, proceed to the unloading buffer. <![CDATA[p 1f ]]> Unloading buffer zone for Class I finished cutting tools <![CDATA[p 2s ]]> Upload buffer for Category II knife blanks <![CDATA[t 31 ]]> The second type of raw materials are transported into the production line. <![CDATA[p 31 ]]> Handling of the second type of cutting tools <![CDATA[t 32 ]]> After transportation is complete, proceed with the cutting operation. <![CDATA[p 32 ]]> Cutting operations of the second type of tool <![CDATA[t 33 ]]> Cutting completed, then handling. <![CDATA[p 33 ]]> Handling of the second type of cutting tools <![CDATA[t 34 ]]> Once the transfer is complete, proceed to the unloading buffer. <![CDATA[p 2f ]]> Unloading buffer zone for the second type of finished cutting tool

[0110] Appendix Figure 2 The Petri net shown can also be represented by the following correlation matrix A:

[0111]

[0112] Step 2) (Reconstructing the Petri net model after inserting an urgent order): Combine the Petri net model of the urgent order with the original manufacturing system Petri net model to construct a new Petri net model, and update the association matrix and labels. The specific steps are as follows:

[0113] Step 2-1): Let (N, M) a M represents the Petri net model of the original system when an order is inserted. a For the identification of the Petri net model of the original manufacturing system when an emergency order is inserted, (N ad M ad For emergency orders, N is a Petri net model. ad =(P add ,T add ,F add Each resource required is a resource from the original manufacturing system, i.e., P. radd ∈P r .

[0114] Step 2-2): The emergency order model (N) ad M ad ) and the original Petri net model (N, M) a ) through shared resource library R add Combining them, we obtain a new Petri net model, namely (N af M af )=(P∪P s ∪P f ∪P r ∪P add ,T∪T add ,F∪F add ),M af (P∪P s ∪P f ∪P r ) = M a (P∪P s ∪P f ∪P r ),M af (P add ) = M ad (P add ).

[0115] Specifically, in this example, the processing sequence for urgent orders is handling, grinding, and handling again. The machines used are r5, r3, and r1. The Petri net model of the new system is as follows: Figure 3 As shown, the correlation matrix A' is as follows:

[0116]

[0117] Original system identifier Ma =(2,0,1,1,0,0,0,0,1,1,2,1,0,0,1,0,0,0), the composite system identifier M af =(2,0,1,1,0,0,0,0,1,1,2,1,0,0,1,0,0,0,1,0,0,0,0).

[0118] Step 3 (Encoding and Decoding): For each workpiece and its associated process in the flexible manufacturing system, a processing sequence is generated by numbering, and then decoded into a transition sequence. The specific steps are as follows:

[0119] Step 3-1): Number all workpieces and processing paths (since the research object is a flexible manufacturing system, there can be multiple processing paths for each type of workpiece). Use the order in which the workpiece numbers appear to represent the processing order. The number of times each workpiece appears in the code must be equal to the number of its operations. The solution to the problem is encoded as a combination sequence of workpiece numbers and path numbers, called a gene sequence. The gene sequence is composed of operation genes and path genes, with operation genes first, followed by path genes in sequence. Operation genes represent the workpiece processing order, and their total length is the total number of operations required to process all workpieces. Path genes represent path selection, and their total length is the total number of workpieces.

[0120] Step 3-2): Using the above encoding scheme, reverse decoding can be directly achieved, that is, the sequence can be directly decoded into a scheduling sequence that satisfies the operation constraints. The nth occurrence of workpiece i in the process sequence represents the nth operation of workpiece i, and each number is decoded to the corresponding transition in turn. For the same type of workpiece, if the processing paths are different, the transitions obtained during decoding will also be different.

[0121] according to Figure 2 The model shown has a possible code π = 7,5,5,3,5,3,1,1,1,4,4,2,7,9,2,7,9,1,1,10,7,9,10,8,9,10,8,6,10,2,8,6,2,8,6,2,3,3,6,3,5,5,4,4,4,1,1,1,2,2,1,1,1,1,1. The first 45 digits of this code represent the process sequence, where each digit represents a workpiece number. Numbers 1 to 5 represent the first type of workpiece, and numbers 6 to 10 represent the second type. The appearance of the first 7 in the process sequence signifies the start of the first operation on the blank workpiece 7, i.e., t. 31 The appearance of the second 7 indicates the second operation t of the raw material 7. 32 Triggered by this, and so on, π can be decoded into the following transition sequence: a = t 31 -t 11 -t 22 -t 11 -t 23 -t 12-t 11 -t 12 -t 13 -t 11 -t 22 -t 11 -t 32 -t 31 -t 12 -t 33 -t 32 -t 14 -t 15 -t 31 -t 34 -t 33 -t 32 -t 31 -t 34 -t 33 -t 32 -t 31 -t 34 -t 13 -t 33 -t 32 -t 14 -t 34 -t 33 -t 15 -t 13 -t 14 -t 34 -t 15 -t 24 -t 15 -t 23 -t 24 -t 15 The last 10 numbers are the path selection sequence, representing which machining path each of the 10 tools has selected. Then, step 4 is executed.

[0122] Step 4) (Pre-scheduled sequence rearrangement): Record the start time of each operation in the pre-scheduled sequence *chrom* before the insertion of the urgent order, and store it in the array *optime*. Array *optime* is the set of start times for all operations in the pre-scheduled sequence, and its length is the total number of operations required to process all workpieces. Sort the elements in array *optime* in ascending order, and update the positions of the elements in the pre-scheduled sequence accordingly, resulting in new arrays *optime* and *chrom*. Due to the asynchronous concurrency characteristics of the flexible manufacturing system, the updated arrays have no effect on the original pre-scheduled sequence; both are equivalent operation sequences.

[0123] Specifically, this embodiment includes a deadlock-free pre-scheduling process sequence.

[0124] chrom=3,9,3,4,9,7,3,7,6,4,4,5,5,7,7,9,6,8,9,2,8,10,2,6,6,1,1,8,8,10,4,4,5,3,3,2,5,5,1,2,10,2,1,10,1,2,1,2,1,1,1,1,1,1,1.

[0125] The strain transition sequence is as follows:

[0126] t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 23 -t 32 -t 31 -t 12 -t 13 -t 11 -t 12 -t 33 -t 34 -t 33 -t 32 -t 31 -t 34 -t 11 -t 32 -t 31 -t 12 -t 33 -t 34 -t 11 -t 22 -t 33 -t 34 -t 32 -t 14 -t 15 -t 13 -t 24 -t 15 -t 13 -t 14 -t 15 -t 23 -t 14 -t 33 -t 15 -t 24 -t 34 -t 15 .

[0127] Corresponding set:

[0128] optime=[0,0,4,4,5,5,27,27,27,8,40,8,12,49,55,55,49,49,61,61,55,55,65,71, 77,77,81,81,87,81,81,86,81,86,91,97,119,124,119,135,103,140,140,109,145].

[0129] optime*=[0,0,4,4,5,5,8,8,12,27,27,27,40,49,49,49,55,55,55,55,61,61,65,71, 77,77,81,81,81,81,81,86,86,87,91,97,103,109,119,119,124,135,140,140,145].

[0130] The rearranged pre-scheduling sequence is as follows:

[0131] chrom*=3,9,3,4,9,7,4,5,5,3,7,6,4,7,6,8,7,9,8,10,9,2,2,6,6,1,1,8,10,4,5,4,3,8,3,2,10,10,5,1,5,2,2,1,1,2,1,2,1,1,1,1,1,1,1.

[0132] Corresponding strain transition sequence:

[0133] t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 12 -t 11 -t 12 -t 23 -t 32 -t 31 -t 13 -t 33 -t 32 -t 31 -t 34 -t 33 -t 32 -t 31 -t 34 -t 11 -t 12 -t 33 -t 34 -t 11 -t 22 -t 33 -t 32 -t14 -t 13 -t 15 -t 24 -t 34 -t 15 -t 13 -t 33 -t 34 -t 14 -t 23 -t 15 -t 14 -t 15 -t 24 -t 15 .

[0134] Step 5) (Determine the urgent order insertion point and categorize operations): Based on the urgent order insertion time and the element size in `optime*`, categorize all operations into: completed operations, operations in progress, and incomplete operations. Completed operations: Operations that started before the urgent order arrival time and whose next operation has already started or completed. Operations in progress: Operations that started before the urgent order arrival time and whose next operation has not yet started. Incomplete operations: Operations that have not yet started. The order insertion point is after completed operations and after operations in progress, but before incomplete operations.

[0135] Specifically, such as Figure 4 As shown in the figure, in this embodiment, an emergency order is inserted at 50 units, denoted as workpiece 11. This workpiece has three processing steps: handling, grinding, and handling.

[0136] According to step 7), the process sequence is divided into three segments: completed process (3,9,3,4,7,4,5,7,6,4), interrupted process (9,5,3,7,6,8), and remaining process (7,9,8,10,9,2,2,6,6,1,1,8,10,4,5,4,3,8,3,2,10,10,5,1,5,2,2,1,1).

[0137] Retain the completed and interrupted operations of the pre-scheduled sequence, i.e., (3,9,3,4,9,7,4,5,5,3,7,6,4,7,6,8). Set M... af As the initial identifier, reschedule the remaining processes (7,9,8,10,9,2,2,6,6,1,1,8,10,4,5,4,3,8,3,2,10,10,5,1,5,2,2,1,1) and the emergency order process (11,11,11,11).

[0138] Step 6) (Constructing Discrete Mapping Relationships): Establish a mapping relationship between individual positions and process codes. For processes, the principle of scheduling based on the smallest position value is adopted; the smaller the position value of a process, the higher its processing priority. The specific steps are as follows:

[0139] Step 6-1) (Generate a continuous position sequence): During the continuous coding of the process, a position is generated for each process. The position is a sequence of positions within [X]. min ,X max A real number randomly generated within the range, where the position value corresponding to each process represents the priority of that process.

[0140] Step 6-2) (Establish the mapping relationship between discrete and continuous sequences): Each element in the i-th segment of the continuous position sequence corresponds to a transition on the processing path of workpiece i. Its position value represents the priority of the transition. The principle of scheduling the smallest position value first is adopted. The element with the smallest position value corresponds to the first transition on the processing path of workpiece i, the element with the second smallest position value corresponds to the second transition on the processing path of workpiece i, and so on.

[0141] Specifically, the discrete mapping relationship in this embodiment is as follows: Figure 5 As shown.

[0142] Step 7) (Determine genetic parameters): Determine the various parameters used in the algorithm, including population size Popsize, maximum number of iterations Maxgen, crossover factor CrossFactor, and mutation factor P. m Selection Factor;

[0143] Step 8) (Generate Initial Population): The initial population consists of chromosomes of a fixed size, specifically the population size determined in Step 7). Based on the process classification in Step 5), the initial population retains the completed and ongoing processes of the pre-scheduled sequence, and generates the initial population from different combinations of the remaining process codes.

[0144] The initial population is generated using the Tent mapping rule, which improves the discreteness and uniformity of the sequence, reduces the probability of repetitions, thereby improving search efficiency and maintaining the diversity of the search process. The specific formula is as follows:

[0145]

[0146] X i =X min +z i ×(X max -X min )

[0147] Where T is the population size, z iLet zi represent the chaotic sequence of the i-th mapping, z0∈[0,1] represent the initial chaotic sequence, β be the chaotic coefficients, and X be the chaotic sequence. i For individual location, X max and X min This defines the upper and lower limits of the search space. The specific steps are as follows:

[0148] Step 8-1): Set i = 1, initial population PopChrom, initial chaotic sequence z0;

[0149] Step 8-2): Determine if i is greater than Popsize. If yes, output the initial population PopChrom; otherwise, proceed to step 8-3).

[0150] Step 8-3): Calculate the chaotic sequence z of the chromosome. i ;

[0151] Step 8-4): In [X min ,X max Calculate the position X corresponding to the process in the chromosome within the range. i

[0152] Step 8-5): By the position X of each process i Adjust the priority of the work processes.

[0153] Step 8-6): i = i + 1, repeat step 8-2);

[0154] For each randomly generated chromosome, check whether it meets the coding requirements of step 3). If it does not meet the requirements, make corrections.

[0155] Step 9): Deadlock Detection and Repair: Combining the correlation matrix A' of the reconstructed Petri net model with the initial label M af The decoded sequence is subjected to deadlock detection and repair to ensure that the repaired gene sequence can meet resource constraints, processing order constraints, and control constraints. The specific steps are as follows:

[0156] Step 9-1): Set u = 1 and record the current detected transition number;

[0157] Step 9-2): Determine if u is greater than the length of the transition sequence. If the condition is met, complete the repair of the gene sequence; otherwise, set the u-th transition in the transition sequence to t. α Execute step 9-3);

[0158] Step 9-3): Check transition t α Under the current flag, determine whether to enable it. If enabled, proceed to step 9-4; otherwise, select t. α The next transition is placed before this transition, and t is updated. αRepeat this step;

[0159] Step 9-4): Use a one-step forward look method to determine the transition t. α Whether to allow triggering; if not, select t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3); otherwise, repeat step 9-5. The specific steps are as follows:

[0160] Specifically, select one chromosome

[0161] π=3,9,3,4,9,7,4,5,5,3,7,6,4,7,6,8,7,1,1,10,9,2,2,6,6,11,9,8,8,10, 11,4,5,4,11,3,8,3,2,10,10,11,5,1,5,2,2,1,1,2,1,2,1,1,1,1,1,1,1,1,

[0162] The corresponding transition sequence a =

[0163] t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 12 -t 11 -t 12 -t 23 -t 32 -t 31 -t 13 -t 33 -t 32 -t 31 -t 34 -t 11 -t 12 -t 31 -t 34 -t 11 -t 12 -t 33 -t 34 -t ad1 -t 34 -t 32 -t 33 -t 32 -t ad2 -t 14 -t 13 -t 15 -t ad3 -t 24 -t 34 -t 15 -t 13 -t33 -t 34 -t ad4 -t 14 -t 23 -t 15 -t 14 -t 15 -t 24 -t 15 ,

[0164] Initial identifier M0 = (2,0,1,1,0,1,0,0,1,1,2,1,0,0,1,0,0,0,1,0,0,0,0),

[0165] After determining the transition t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 12 -t 11 -t 12 -t 23 -t 32 -t 31 -t 13 -t 33 -t 32 -t 31 -t 34 -t 11 back,

[0166] That is, M a [t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 12 -t 11 -t 12 -t 23 -t 32 -t 31 -t 13 -t 33 -t 32 -t 31 -t 34 -t 11 >M1,

[0167] Where M1 = (1,0,2,1,0,0,0,0,1,1,2,0,1,1,0,0,0,0,1,0,0,0,0). Now determine the transition t. 11 Whether to allow triggering, change t 11 Pre-operation library p 1sIf both the preceding resource library r1 and the preceding resource library r1 contain tokens, then the transition t 11 Enabled, triggering t under M1 11 That is, M1[t 11 >M2, M2=(0,1,2,1,0,0,0,0,1,1,2,0,1,0,0,0,0,0,1,0,0,0,0), M2 is the deadlock indicator, then transition t 11 It is not allowed to initiate a transition under marker M1; the enabling transition must be selected from subsequent transitions and placed in t. 11 Before that, we need to determine whether the change is permissible to trigger.

[0168] Step 9-5): Determine the transition t α Does the corresponding processing step satisfy the processing sequence constraint, i.e., transition t? α Does the corresponding processing step precede the previous processing step?

[0169] If not satisfied, choose t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3); otherwise, repeat step 9-6.

[0170] The specific constraints on the workpiece processing sequence are as follows:

[0171] Suppose there is an identifier M0, under which t 11 Since it cannot be triggered, from steps 9-4) to 9-6), we can obtain the transition that can be triggered under the current identifier as t. 22 Its index number corresponds to job 3 in the encoding array, which actually means the second process of the third job. This transition is inserted into the currently disabled transition t. 11 Previously, but now if the 16th index in the encoding array is also workpiece 3, the corresponding transition is t. 11 In practice, this means the first process of the third workpiece. After repair, workpiece 3 would proceed with the second process before the first, violating the workpiece's processing sequence. Therefore, a workpiece processing sequence constraint is added during the repair transition to determine if the workpiece corresponding to the selected transition meets the condition.

[0172] Determine the index numbers corresponding to the currently disabled transition and the enabled transition selected in step 9-4). The workpiece number corresponding to the selected enabled transition cannot appear between the workpiece numbers corresponding to these two index numbers in the encoding array.

[0173] Step 9-6): Trigger t α Update the current identifier, let u = u + 1, and execute step 9-2);

[0174] Repeat the above steps to complete chromosome detection and repair.

[0175] Step 10) (Calculate the completion time MakeSpan and fitness value): Calculate the processing time of the flexible manufacturing system using the time allocation principle of the Gantt chart. Determine the idle time of the machines used in the current process, and compare it with the estimated completion time of the previous process for the corresponding workpiece. Take the larger of the two as the start time of the current process. This time is also the release time of the resources occupied by the previous process and the actual completion time of the previous process. The start time plus the operation time of the current process is the estimated completion time of the current process. After calculating all processes, the completion time of the last process in the system is the completion time MakeSpan of the entire process sequence.

[0176] The fitness value formula is as follows:

[0177]

[0178] Where MaxSpan is the maximum processing time among all individuals in the current population, MinSpan is the minimum processing time among all individuals, k1 and k2 are arbitrary constants, and Adapt is the fitness value of an individual. In this example, k1 is 0.1 and k2 is 0.2.

[0179] Step 11) (Termination Rule Judgment): Determine if the termination condition gen > Maxgen is met, where gen is the current iteration count of the population and Maxgen is the maximum iteration count. If the termination condition is met, proceed to step 13); otherwise, proceed to step 12.

[0180] Step 12) (Genetic Operations): Perform three genetic operations—selection, crossover, and mutation—on the current population to obtain a new generation. Execute steps 12-1) to 12-4). The specific steps are as follows:

[0181] Step 12-1 (Selection Operation): Introduce an elite storage strategy, storing the top 10% of the best individuals in the population based on their fitness values. For the remaining individuals, a roulette wheel selection method is used. The probability of each individual being selected is proportional to its fitness function value. The formulas for the probability of an individual being selected and the cumulative probability of a chromosome are as follows:

[0182]

[0183] Generate a random number rand in the range [0,1]. If Q(x) i If ) ≤ rand, it means that the i-th individual is selected, and this process is repeated to obtain a population containing Selectnum × Popsize individuals. Here, Selectnum is the selection factor, and Popsize is the population size. In this example, Selectnum is 0.3 and Popsize is 200.

[0184] Step 12-2): Crossover operation. Generate a random number rand between [0,1]. If rand is less than the crossover factor, then use the POX (precedence operation crossover) method on every two chromosomes in the population. Chromosomes p1 and p2 are crossed to generate two offspring c1 and c2. The crossover diagram is shown below. Figure 6 As shown, the crossover process is as follows:

[0185] Step 12-2-1): Randomly divide the workpiece set into two non-empty subsets J1 and J2;

[0186] Step 12-2-2): Copy the operations of the workpieces in workpiece set J1 in p1 to c1, and copy the operations of the workpieces in workpiece set J1 in p2 to c2, keeping their positions.

[0187] Step 12-2-3): Copy the operations of the workpieces in p1 that belong to workpiece set J2 to c2, and copy the operations of the workpieces in p2 that belong to workpiece set J2 to c1, keeping their order.

[0188] In this example, the cross factor is 0.7;

[0189] Step 12-3 (Mutation Operation): To avoid the decline in the overall quality of the population due to the mutation of excellent chromosomes, a non-uniform mutation rate P is adopted. m Enhance the algorithm's spatial search capability to enable a more comprehensive spatial search. In the early iterations, a high mutation rate allows it to quickly cover the solution space. As the iteration progresses, the mutation rate should be reduced to ensure that superior chromosomes are inherited by the next generation. The linear adaptive mutation rate expression is as follows:

[0190]

[0191] Among them, P m0 Let ρ represent the initial rate of variation, and ρ be a constant within the interval (0,1). In this example, the initial rate of variation is P. m0 The value is 0.3, and ρ is 0.5.

[0192] For the process code, a mutation operator that simulates binary encoding is used to change the position of the process.

[0193] X new =X i +(X imin +X imax )×δ i

[0194]

[0195] For each path code, select a chromosome and generate a random number rand between [0,1]. If rand is less than the mutation rate, perform a mutation operation on that individual, as follows:

[0196] Since the first type of workpiece has two processing paths to choose from, when a mutation occurs, if the first type of workpiece has not undergone the second process, its processing path will be changed. The path mutation is as follows: Figure 7 As shown.

[0197] Step 12-4): After the genetic operation is completed, merge all parent individuals and offspring obtained through the genetic operation into a new population, i.e., gen = gen + 1; return to step 9) to decode each chromosome in the new population and perform feasibility testing and repair operations. Repeat step 10), sorting by fitness value from largest to smallest, and select the top Popsize individuals.

[0198] Step 13) (Output the optimal solution): After satisfying the termination rule in Step 11), output the chromosome sequence, transition sequence and corresponding processing time MakeSpan of the best individual in the population, and complete the rescheduling of the flexible manufacturing system.

[0199] Specifically, the simulation parameters in this embodiment are set as follows: the maximum number of iterations (Maxgen) is 200, the population size (Popsize) is 200, and the optimal chromosome is output after iteration.

[0200] π=3,9,3,4,9,7,4,5,5,3,7,6,4,7,6,8,7,9,9,1,8,3,5,1,2,2,8,8,3,10,10 ,4,4,11,11,5,10,1,10,11,2,5,1,11,6,6,1,2,2,1,1,2,1,1,1,1,1,1,1,1.

[0201] Corresponding strain transition sequence

[0202] a = t 11 -t 31 -t 22 -t 11 -t 32 -t 31 -t 12 -t 11 -t 12 -t 23 -t 32 -t 31 -t 13 -t 33 -t 32 -t 31 -t 34 -t33 -t 34 -t 11 -t 32 -t 24 -t 13 -t 12 -t 11 -t 12 -t 33 -t 34 -t 15 -t 31 -t 32 -t 14 -t 15 -t ad1 -t ad2 -t 14 -t 33 -t 13 -t 34 -t ad3 -t 13 -t 15 -t 14 -t ad4 -t 33 -t 34 -t 15 -t 14 -t 15 .

[0203] The corresponding maximum completion time, MakeSpan, is 152. The Gantt chart corresponding to the optimal solution is as follows: Figure 8 As shown.

[0204] By comparing with the algorithm in Reference 1, the optimal solution obtained in this embodiment is shown in Table 2:

[0205] Table 2 Comparison of Algorithm Optimization Results Over Multiple Rounds

[0206]

[0207]

[0208] Analysis shows that the improved genetic algorithm used in this invention has achieved better values ​​in the optimization objective, indicating that the improvement strategy adopted in this invention has a significant effect on improving the algorithm's search ability in the solution space and its ability to escape local optima.

[0209] The specific implementation schemes described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific implementation schemes of the present invention and are not intended to limit the scope of the present invention. Any equivalent changes and modifications made by those skilled in the art without departing from the concept and principles of the present invention should fall within the scope of protection of the present invention.

Claims

1. A method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets, characterized in that, Includes the following steps: Step 1: Establish a Petri net model of the flexible manufacturing system before the insertion of urgent orders: Based on the processing steps of the workpieces within the flexible manufacturing system and the machine occupancy between each workpiece, construct a Petri net model (N, M0) and its correlation matrix A that can represent the discrete parallel system, and define the following symbols: N: A Petri net N = (P, T, F) consisting of circular nodes, square nodes and directed arcs, representing a flexible manufacturing system consisting of m machines that can process n types of workpieces; P: Collection of warehouses Where P i0 =P is ∪P if P represents the collection of idle warehouses. is P is the upload buffer for the i-th type of workpiece. if For the corresponding unloading buffer, p ij P represents the location corresponding to the j-th operation of the i-th type of workpiece. r The collection represents the resources gathered in the repository; T: Transition set, consisting of all square nodes in N. Each transition t represents the end of the previous process and the beginning of the next process, as well as the release of resources used in the previous process and the request for resources used in the next process. F: Directed arc set, representing the processing flow of each workpiece in the system and the resource requirements and release of each processing step during the processing; M: P→N is an identifier, where N is a set of non-negative integers representing the processing status of the system. Each number in the identifier represents the number of workpieces or resources contained in each warehouse. M0 is the initial identifier, indicating that the system has not started processing, the workpieces are in the upload buffer, and the resources are not occupied. A: The correlation matrix represents the variation pattern of the number of trusts in each library under each transition in N. It is a matrix with |T| rows and |P| columns. Step 2: Reconstruct the Petri net model after inserting an emergency order: Combine the Petri net model of the emergency order with the original manufacturing system Petri net model to construct a new Petri net model; For a flexible manufacturing system after the insertion of urgent orders, under the premise of satisfying process constraints, resource constraints, and control constraints, and avoiding deadlock, the objective function of system scheduling is to minimize the maximum completion time, i.e.: F = min{MakeSpan} NakeSpan=max{C k } Among them, C k Let be the completion time of the last operation of the k-th workpiece, k = 1, 2, ..., p, where p is the total number of workpieces; MakeSpan is the maximum time to complete the processing of all workpieces. Step 3, Encoding and Decoding: Number each workpiece and its process in the flexible manufacturing system to generate a processing sequence, and decode it into a transition sequence; Step 4: Rearrange the pre-scheduled sequence: Record the start time of each operation in the pre-scheduled sequence chrom before the insertion of the urgent order, and store it in the array optimal. The array optimal is the set of start times of all operations in the pre-scheduled sequence, and its length is the total number of operations required to process all workpieces. Sort the elements in the array optimal in ascending order, and update the element positions in the pre-scheduled sequence according to the changes in element positions, to obtain new arrays optimal* and chrom*. Due to the asynchronous concurrency characteristics of the flexible manufacturing system, the updated arrays have no effect on the original pre-scheduled sequence, and the two are equivalent operation sequences. Step 5: Determine the emergency order insertion point and classify the operations: Based on the comparison between the emergency order insertion time and the element size in `optime*`, all operations are divided into: completed operations, operations in progress, and incomplete operations; Completed operations: Operations whose start time is before the arrival time of the emergency order and whose next operation has started or been completed; Operations in progress: Operations whose start time is before the arrival time of the emergency order and whose next operation has not yet started; Incomplete operations: Operations that have not yet started; The emergency order insertion point is after completed operations and operations in progress, and before incomplete operations. Step 6: Construct discrete mapping relationship: Construct the mapping relationship between individual positions and process codes. For processes, the principle of scheduling the process with the smallest position value is adopted. The smaller the position value of the process, the higher the processing priority. Step 7: Determine genetic parameters: Determine the various parameters used in the algorithm, including population size (Popsize), maximum number of iterations (Maxgen), crossover factor (CrossFactor), and mutation factor (P). m Selection Factor; Step 8: Generate the initial population: The initial population consists of chromosomes of a fixed size, specifically the population size determined in Step 7; according to the process classification in Step 5, the initial population retains the completed and ongoing processes of the pre-scheduled sequence, and generates the initial population from different combinations of the remaining process codes; Step 9, Deadlock Detection and Repair: Combining the correlation matrix A' of the reconstructed Petri net model and the initial label M af The decoded sequence is subjected to deadlock detection and repair to ensure that the repaired gene sequence can meet resource constraints, processing order constraints and control constraints. Step 10: Calculate the completion time MakeSpan and fitness value: Calculate the processing time of the flexible manufacturing system using the time allocation principle of the Gantt chart, determine the idle time of the machine used in the current process, compare it with the estimated completion time of the previous process of the corresponding workpiece, and take the larger of the two as the start time of the current process. This time is also the release time of the resources occupied by the previous process and the actual completion time of the previous process. The start time plus the operation time of the current process is the estimated completion time of the current process. After calculating all processes, the completion time of the last process of the system is the completion time MakeSpan of the entire process sequence. The fitness value formula is as follows: Where MaxSpan is the maximum processing time among all individuals in the current population, MinSpan is the minimum processing time among all individuals, k1 and k2 are arbitrary constants; Adapt is the fitness value of an individual. Step 11: Termination condition judgment: Determine whether the termination condition gen > Maxgen is met, where gen is the number of iterations of the current population and Maxgen is the maximum number of iterations; if the termination condition is met, proceed to step 13 and output the optimal individual; otherwise, proceed to step 12. Step 12, Genetic Operations: Genetic operations include selection, crossover, and mutation. After the genetic operations are completed, all parent individuals and offspring obtained through the genetic operations are merged into a new population, i.e., gen = gen + 1. Return to step 9 to perform deadlock detection and repair operations on each chromosome in the new population. Step 13: Output the optimal solution: After satisfying the termination rule in step 11, output the chromosome sequence, transition sequence and corresponding completion time MakeSpan of the best individual in the population, and complete the rescheduling of the flexible manufacturing system.

2. The method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets according to claim 1, characterized in that, Step 1 combines the Petri net model of the emergency order with the original Petri net model of the manufacturing system to construct a new Petri net model. The specific steps are as follows: Step 2-1: Let (N, M) a M is the Petri net model of the original system when an emergency order is inserted. a For the identification of the Petri net model of the original manufacturing system when an emergency order is inserted, (N ad M ad For emergency orders, N is a Petri net model. ad =(P add ,T add ,F add Each resource required is a resource from the original manufacturing system, i.e., P. radd ∈P r ; Step 2-2: Convert the emergency order model (N) ad M ad ) and the original Petri net model (N, M) a ) through shared resource library P radd Combining them, we obtain a new Petri net model, namely (N af M af )=(P∪P s ∪P f ∪P r ∪P add ,T∪T add ,F∪F add ),M af (P∪P s ∪P f ∪P r ) = M a (P∪P s ∪P f ∪P r ),M af (P add ) = M ad (P add ).

3. The method for emergency order insertion and rescheduling in a Petri net-based flexible manufacturing system according to claim 2, characterized in that, In step 3, each workpiece and its process in the flexible manufacturing system is numbered to generate a processing sequence, and then decoded into a transition sequence. The specific steps are as follows: Step 3-1: Number all the workpieces and processing paths to be processed. Use the order in which the workpiece numbers appear to represent the processing order. The number of times each workpiece appears in the code must be equal to the number of its operations. The code for the solution is a combination sequence of workpiece numbers and path numbers, called the gene sequence. The gene sequence is composed of operation genes and path genes, with operation genes first, followed by path genes in sequence. The operation genes represent the workpiece processing order, and their total length is the total number of operations required to process all workpieces. The path genes represent the path selection, and their total length is the total number of workpieces. Step 3-2: Using the above encoding scheme, we can directly reverse decode, that is, directly decode the sequence into a scheduling sequence that satisfies the operation constraints. The nth occurrence of workpiece i in the process sequence represents the nth operation of workpiece i. We decode each number to the corresponding transition in turn. For the same type of workpiece, if the processing paths are different, the transitions obtained during decoding will also be different.

4. The method for emergency order insertion and rescheduling in a Petri net-based flexible manufacturing system according to claim 3, characterized in that, In step 4, the pre-scheduled sequence is reordered, and the start time of each operation in the pre-scheduled sequence is recorded and stored in the array `optime`. The array `optime` is the set of start times for all operations in the pre-scheduled sequence, and its length is the total number of operations required to process all workpieces. The elements in the array `optime` are sorted in ascending order, and the positions of the elements in the pre-scheduled sequence are updated simultaneously according to the changes in the element positions, resulting in a new array `optime`. * and chrom * The specific steps are as follows: Step 4-1: Set i = 1; optimize * =optime;chrom * =chrom; Step 4-2: Determine if i is greater than |optime * |-1, if the condition is met, then the rearrangement of the pre-scheduled sequence is completed, |optime * |For array optime * Given the length of the array `optime`, output the new array `optime`. * and chrom * If the condition is not met, proceed to step 4-3. Step 4-3: Set j = 1; Step 4-4: Determine if j is greater than |optime * If the condition is met (i-1), then complete one iteration, let i = i+1, and repeat step 4-2; otherwise, execute step 4-5. Steps 4-5: Determine the optimal * Is [j] greater than optimal? * [j+1], if the condition is met, proceed to steps 4-6; Steps 4-6: Swap optima * [j] and optimale * Swap the position of [j+1] with chrom * [j] and chrom * The position of [j+1]; Step 4-7: Let j = j + 1, and repeat step 4-4; due to the asynchronous concurrency characteristics of the flexible manufacturing system, the updated array has no effect on the original pre-scheduled sequence, and the two are equivalent process sequences.

5. The method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets according to claim 4, characterized in that, In step 5, based on the comparison between the emergency order insertion time t and the element size in `optime*`, all processes are divided into: completed processes, processes in progress, and incomplete processes. The order insertion point is after completed processes and processes in progress, and before incomplete processes. The specific steps are as follows: Step 5-1: Set i = 1; Step 5-2: Determine if i is greater than |optime * If the conditions are met, the process classification is completed; otherwise, proceed to step 5-3. Step 5-3: Determine if t is greater than optimal*[i]. If the condition is met, proceed to step 5-4; otherwise, the operation corresponding to chrom*[i] is an incomplete operation, and proceed to step 5-6. Step 5-4: Set j to the index value of the next process of the workpiece corresponding to chrom*[i]; Step 5-5: Determine if t is greater than optimal*[j]. If the condition is met, the process corresponding to chrom*[i] is a completed process; otherwise, it is a process in progress. Step 5-6: Let i = i + 1, and repeat step 5-2.

6. The emergency order insertion and rescheduling method for a flexible manufacturing system based on Petri nets according to claim 5, characterized in that, In step 6, the mapping relationship between individual positions and process codes is established during coding. The specific steps are as follows: Step 6-1: Generate a continuous position sequence: During the continuous coding of the process, a position is generated for each process. The position is a sequence of positions within [X...]. min ,X max A real number randomly generated within the range, where the position value corresponding to each process represents the priority of the corresponding process; Step 6-2: Establish the mapping relationship between discrete and continuous sequences: Each element in the i-th segment of the continuous position sequence corresponds to a transition on the processing path of workpiece i. Its position value represents the priority of the transition. The principle of scheduling the smallest position value first is adopted. The element with the smallest position value corresponds to the first transition on the processing path of workpiece i, the element with the second smallest position value corresponds to the second transition on the processing path of workpiece i, and so on.

7. The method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets according to claim 6, characterized in that, In step 8, an initial population is generated. The initial population consists of chromosomes of a fixed size, specifically the population size determined in step 7. Based on the process classification in step 5, the initial population retains the completed and ongoing processes of the pre-scheduled sequence. The initial population is generated from different combinations of the remaining process codes, as detailed below: The initial population is generated using the Tent mapping rule, which improves the discreteness and uniformity of the sequence, reduces the probability of repetitions, thereby improving search efficiency and maintaining the diversity of the search process. The specific formula is as follows: X i =X min +z i ×(X max -X min ) Where Popsize is the population size, z i Let zi represent the chaotic sequence of the i-th mapping, z0∈[0,1] represent the initial chaotic sequence, β be the chaotic coefficients, and X be the chaotic sequence. i For individual location, X max and X min To define the upper and lower limits of the search space, the specific steps are as follows: Step 8-1: Set i = 1, initial population PopChrom, initial chaotic sequence z0; Step 8-2: Determine if i is greater than Popsize. If yes, output the initial population PopChrom; otherwise, proceed to step 8-3. Step 8-3: Calculate the chaotic sequence z of the chromosome. i ; Step 8-4: In [X min ,X max Calculate the position X corresponding to the process in the chromosome within the range. i ; Step 8-5: Using the position X of each process... i Adjust the priority of the work processes; Step 8-6: Let i = i+1, and repeat step 8-2; check whether each randomly generated chromosome meets the encoding requirements of step 3. If it does not meet the requirements, make corrections.

8. The method for emergency order insertion and rescheduling in a Petri net-based flexible manufacturing system according to claim 7, characterized in that, In step 9, the correlation matrix A' of the reconstructed Petri net and the initial label M are combined. af The decoded sequence is subjected to deadlock detection and repair to ensure that the repaired gene sequence can meet control constraints and resource constraints. The specific steps are as follows: Step 9-1: Set u=1 and record the current detected transition number; Step 9-2: Determine if u is greater than the length of the transition sequence. If the condition is met, complete the repair of the gene sequence; otherwise, set the u-th transition in the transition sequence to t. α Perform step 9-3; Step 9-3: Check transition t α Under the current flag, determine whether to enable it. If enabled, proceed to step 9-4; otherwise, select t. α The next transition is placed before this transition, and t is updated. α Repeat this step; Step 9-4: Use a one-step look-ahead method to determine the transition t α Whether to allow triggering; if not, select t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3; otherwise, repeat step 9-5. Step 9-5: Determine the transition t α Does the corresponding processing step satisfy the processing sequence constraint? If not, select t. α The next transition is placed before this transition, and t is updated. α If the condition is not met, repeat step 9-3; otherwise, repeat step 9-6. Step 9-6): Trigger t α Update the current identifier, let u = u + 1, and execute step 9-2; Repeat the above steps to complete the detection and repair of chromosome deadlock.

9. The method for emergency order insertion and rescheduling in a flexible manufacturing system based on Petri nets according to claim 8, characterized in that, In step 12, genetic operations are performed on the chromosomes in the population to obtain a new generation of the population. The genetic operations include selection, crossover, and mutation, and the specific steps are as follows: Step 12-1, Selection Operation: An elite storage strategy is introduced, storing the top 10% of the best individuals in the population based on their fitness values. For the remaining individuals, a roulette wheel selection method is used. The probability of each individual being selected is proportional to its fitness value. The formulas for the probability of an individual being selected and the cumulative probability of a chromosome are as follows: Generate a random number rand in the range [0,1]. If Q(x) i If )≤rand, it means that the i-th individual is selected. This process is repeated to obtain a population containing Selectnum×Popsize individuals. Step 12-2, Crossover Operation: Generate a random number rand between [0,1]. If rand is less than the crossover factor CrossFactor, then use the POX (precedence operation crossover) method on every two chromosomes in the population. Chromosomes p1 and p2 are crossed to generate two offspring c1 and c2. The crossover process is as follows: Step 12-2-1: Randomly divide the workpiece set into two non-empty subsets J1 and J2; Step 12-2-2: Copy the operations of the workpieces in workpiece set J1 in p1 to c1, and copy the operations of the workpieces in workpiece set J1 in p2 to c2, keeping their positions. Step 12-2-3: Copy the operations of the workpieces in p1 that belong to workpiece set J2 to c2, and copy the operations of the workpieces in p2 that belong to workpiece set J2 to c1, keeping their order. Step 12-3, Mutation Operation: To avoid the decline in overall population quality due to the mutation of superior chromosomes, a non-uniform mutation rate P is adopted. m To enhance the algorithm's spatial search capability, enabling it to perform a more comprehensive spatial search; a high mutation rate in the early iterations allows it to quickly cover the solution space; as the iteration process progresses, the mutation rate should be reduced to ensure that superior chromosomes can be inherited by the next generation. The linear adaptive mutation rate expression is as follows: Among them, P m0 Let ρ represent the initial rate of variation, and ρ be a constant in the interval (0,1). For the operation code, a mutation operator that simulates binary encoding is used to change the position of the operation. The specific formula is as follows: X new =X i +(X imin +X imax )×δ i For each path code, select a chromosome and generate a random number rand between [0,1]. If rand is less than the mutation rate, perform a mutation operation on that individual, as follows: Since the first type of workpiece has two processing paths to choose from, when the chromosome mutates, if the first type of workpiece has not undergone the second process, its processing path will be changed. Step 12-4: After the genetic operation is completed, merge all parent individuals and offspring obtained through the genetic operation into a new population, i.e., gen = gen + 1; return to step 9 to decode each chromosome in the new population and perform feasibility detection and repair operations, repeat step 10, sort them according to fitness value from largest to smallest, and select the top Popsize individuals.