Flexible workshop scheduling method based on genetic annealing algorithm

By applying a scheduling method based on genetic annealing algorithm in a flexible working workshop, the problem that manual scheduling cannot meet modern production efficiency requirements is solved, and more efficient and quality workshop scheduling is achieved.

CN119806076APending Publication Date: 2025-04-11HARBIN SHIP BOILER TURBINE RESEARCH INSTITUTE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411929729.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Manual scheduling production cannot meet the requirements of modern production efficiency, especially in flexible operation workshops where constraints exist between processes, and the prior art is difficult to effectively solve the scheduling problem.

Method used

A flexible workshop scheduling method based on genetic annealing algorithm is used to optimize workshop scheduling through encoding and decoding, initializing population and fitness calculation, as well as selection, crossover and mutation operations, and meet the constraints between processes.

Benefits of technology

Compared with artificial bee colony algorithms, the selection, crossover and mutation operations of genetic algorithms can better meet the needs of flexible operation workshops with constraints between processes, improve the quality and efficiency of scheduling, and reduce the probability of falling into local optimality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806076A_ABST
    Figure CN119806076A_ABST
Patent Text Reader

Abstract

The invention discloses a flexible workshop scheduling method based on a genetic annealing algorithm, and relates to a flexible workshop scheduling method. The invention aims to solve the problem that manual scheduling production cannot meet the requirement on production efficiency at present. The method comprises the following steps: step 1, problem description; step 2, constructing an objective function; and step 3, providing a genetic annealing algorithm. The invention belongs to the technical field of flexible job shop scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a flexible job shop scheduling method, belonging to the technical field of flexible job shop scheduling. Background Art

[0002] With the continuous improvement of customer requirements and workshop production requirements, the constraint conditions for workshop production are also increasing at an equal ratio, and manual scheduling production can no longer meet the requirements of the current era for production efficiency. For the traditional Chinese medicine industry, the flexible job shop scheduling in the workshop can be described as having N kinds of raw materials to be processed {j1, j2,..., j n}, each raw material has corresponding process requirements, there are M process operations {M1, M2,..., M m}, and there are constraint conditions between the corresponding operations. For example, the processing order of the operations corresponding to M2, M3, and M4 must meet the sequential requirements: M2 > M3 > M4, and the subsequent order cannot exceed the previous order, and there are no order requirements for other operations. Such a flexible job shop with constraint conditions between operations is undoubtedly a more complex NP-hard problem. For a flexible job shop with constraint conditions between operations, the genetic algorithm has higher quality than the artificial bee colony algorithm. The selection, crossover, and mutation operations in the genetic algorithm can better meet the requirements of a flexible job shop with constraint conditions between operations. Summary of the Invention

[0003] In order to solve the problem that manual scheduling production can no longer meet the requirements of the current era for production efficiency, the present invention further provides a flexible job shop scheduling method based on a genetic annealing algorithm.

[0004] The technical solution adopted by the present invention to solve the above problems is: the steps of the present invention include:

[0005] Step 1, problem description;

[0006] According to the requirements of the on-site flexible job shop, the flexible job shop scheduling problem is generally described as: there are m types of work sections, 5 < m < 10, there are k types of raw materials, corresponding to n jobs, n > 50, and each raw material requires MT i time to complete, MT i is a random number, and each job is completed on the equipment, and constraint conditions are given;

[0007] Step 2, constructing an objective function;

[0008] Denote N as the number of jobs, M as the number of equipment, i as each job i ∈ {1, 2, 3,..., N}, j as each equipment ∈ {1, 2, 3,..., M}, and t ij represents the working time of the i-th job on the j-th workbench, and H jT represents the sum of the non-working time of the jth device from the start of work to the end of all work. i It represents the time taken by the jth workstation to complete all tasks;

[0009] Assuming that a job cannot be interrupted during processing in one section to be processed in another section, the same raw material cannot be processed on two devices at the same time, and the same machine cannot process two raw materials at the same time, then:

[0010]

[0011] The objective function of this flexible job scheduling problem is expressed as follows:

[0012]

[0013] Formula ① indicates that the time consumption of the jth device is equal to the sum of the working time of each job and the idle time of the device. Formula ② indicates the objective function of the workshop scheduling problem, which is to minimize the time consumption of the device with the longest working time among the M devices.

[0014] Step 3: Propose a genetic annealing algorithm.

[0015] Furthermore, the constraints in step 1 include:

[0016] (1) Each device corresponds to a process;

[0017] (2) Each device shall not be used more than once per operation;

[0018] (3) The order in which each operation and each raw material utilize each piece of equipment may be different;

[0019] (4) The processing sequence of the corresponding processes on the No. 2, 3, and 4 equipment must meet the sequence requirements: 2>3>4, the latter process cannot precede the former process, and there is no sequence requirement for other processes;

[0020] (5) Any operation has no priority for preemptive processing and must be subject to production sequence scheduling;

[0021] (6) No new jobs can be added during the processing of the job, and the processing of the job cannot be temporarily canceled;

[0022] (7) The next stage of each operation can only be started after the current stage is completed.

[0023] Furthermore, the constraints in step 2 are:

[0024] (1) Each device corresponds to one process;

[0025] (2) Each operation is produced no more than once on each piece of equipment, that is, each process of each operation is processed only once;

[0026] Let L represent each process to be processed, so l∈{1,2,...,M},

[0027]

[0028] Formula ③ means that each device corresponds to a process, and a job needs to be processed on each device, and only once, so l = j, and l, j∈{1,2,...,M}, when the jth device finishes work, the jth job of all jobs has been completed, and when all M devices have completed their tasks, the Mth processes of all jobs have been completed, and production is over;

[0029] (3) There are constraints in the workspace. The processing order of some items must meet the required sequence requirements. The processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4. The latter sequence cannot exceed the former sequence. There is no sequence requirement for other processes. Record C ij The start time of the i-th job on the j-th machine is the start time of the j-th process, E ij The end time of processing of the i-th job on the j-th machine;

[0030] C ij +t ij =E ij ④,

[0031] C i2 +t i2 <C i3 ⑤,

[0032] C i3 +t i3 <C i4 ⑥,

[0033] Formula ④ ensures that the end time of each job on each device is the sum of the start time of the job on this device and the processing time of the job on this device; Formulas ⑤ and ⑥ ensure that constraint condition (3) holds. If it is assumed that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4; the latter sequence cannot exceed the former sequence, and there is no sequence requirement for other processes, then taking the time point when production just starts as the starting point, the start time of the i-th job on the second device plus the working time of the i-th job on the second device must be less than the start time of the i-th job on the third device; similarly, the start time of the i-th job on the third device plus the working time of the i-th job on the third device must be less than the start time of the i-th job on the fourth device; that is, the processes with lower priority on the same device must be processed after the processes with higher priority are completed;

[0034] (4) A job cannot be processed on two devices at the same time;

[0035] Remember j Indicates the current working time of each device.

[0036] C ij =min(ming j ,maxE iJ )⑦,

[0037] Formula ⑦ ensures that when scheduling work, the process previously scheduled for this work has reached the end time and is scheduled to the equipment that is not currently working.

[0038] Furthermore, the steps of the genetic annealing algorithm in step 3 include:

[0039] Step 301, encoding and decoding;

[0040] Using N jobs corresponding to k kinds of raw materials to process and encode on M equipment;

[0041] Decoding is performed by processing n jobs corresponding to k kinds of raw materials on M devices;

[0042] Step 302, initializing the population and fitness calculation;

[0043] Step 303: genetic operation;

[0044] Genetic operations include selection, crossover and mutation.

[0045] Furthermore, the N operations corresponding to the k kinds of raw materials are processed on M devices for encoding, which specifically includes:

[0046] Use N jobs to work on M devices to construct chromosomes. The total amount of DNA on each chromosome is N×M, which is composed of M genes {1, 2, ..., N}. Therefore, arrange the N jobs into a sequence {1, 2, ..., N}. If there are M devices, merge the M sequences {1, 2, ..., N} into one sequence {1, 2, ..., N, 1, 2, ..., N, ... N}, and repeatedly swap the numbers corresponding to two random numbers to form a random sequence;

[0047] The decoding of n jobs corresponding to k kinds of raw materials on M devices includes:

[0048] Assume that the workshop scheduling problem is N=3, M=2, and the 3 jobs are numbered 1-3. Each number from 1-3 is randomly generated twice as a chromosome and recorded as array b[6]. Assume that j=b[i], i represents the number of tasks to be scheduled i∈{1,2,…,N×M}, j represents the jth job of the ith scheduled task, b[6]=[1,3,3,2,2,1], and the jobs are scheduled from left to right. b[1]=1 means that the first job to be scheduled is job 1, and b[2]=3 means The second scheduled job is the third job. Similarly, when it is scheduled to b[5], the number of i in b[1] to b[4] is the number of processes that have been completed for job i; therefore, if b[6] = [1,3,3,2,2,1], the first process of the first job is completed first, followed by the first process of the third job, followed by the second process of the third job, followed by the first process of the second job, followed by the second process of the second job, and finally the second process of the first job is completed. The first and second processes do not represent which equipment is being worked on.

[0049] Furthermore, the initialization of the population and fitness calculation in step 302 specifically includes:

[0050] Randomly generate L chromosomes containing N×M genes to form an initial population, each chromosome represents an individual, that is, each chromosome is a feasible scheduling solution for the flexible job shop assignment task;

[0051] The difficulty of solving the flexible job shop scheduling problem lies in the fitness calculation. Aiming at its complex and changeable constraints, the following design strategy is given. According to the encoding method, the chromosome {1,2,…,N,1,2,…,N,…N} is represented by j=b[i], i∈{1,2,3,...,N×M}, and the scheduling method is that i is scheduled sequentially from 1 to N×M, j={1,2,3,...,N}, i is the current scheduled process, j is each job, and the number of processes arranged is the number of jobs in the chromosome before the current process;

[0052] According to the constraints between processes, determine the equipment that can perform the current j work; assuming that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4, the latter sequence cannot exceed the former sequence, and other processes have no sequence requirements, then before arranging the scheduling, first determine whether process 2 is completed and whether equipment 3 and 4 are available equipment under the current i;

[0053] Then determine the running progress of the available equipment, that is, the end time E of the previous work running. (i-1)j , assign the current work to the workbench minE with the smallest end time (i-1)jRepeat the above operation until all the work is arranged, record the final end time of each machine, and find the workbench with the largest end time, transform its end time and use it as the fitness value for evaluation.

[0054] Furthermore, the specific steps of the selection operation are:

[0055] Step 1: Calculate the sum P of the fitness of chromosomes in the population;

[0056] Step 2, i=1;

[0057] Step 3: Randomly generate a random number P between 0 and 1;

[0058] Step 4: Calculate the k of each individual according to the formula i value;

[0059]

[0060] Step 5: Determine the randomly generated random numbers P and k between 0 and 1 i The value of k i >p, then the individual is selected as the offspring population, otherwise the individual is abandoned;

[0061] Step 6, i=i+1;

[0062] Step 7: Repeat steps 3 to 6 until all individuals in the population are selected, and let i = 1.

[0063] Furthermore, the specific steps of the crossover operation are:

[0064] Step (1), randomly generate two random numbers between 0 and 1 as parent chromosomes 1 and 2;

[0065] Step (ii), select a random number m from a sequence of 1 to N×M;

[0066] Step (iii), take out the genes from m to 480 in the parent generation 1 and record them as the ff[] array, and record the genes from 1 to m in the parent generation 1 as the father1[] array;

[0067] Step (iv), calculate the number of each task i in the ff[] array respectively;

[0068] Step (V), extract the corresponding operations in step 4 from left to right in parent generation 2 until the number of operations calculated in step 4 is reached, for example, 12, 9, 3, 8, 6 are extracted as shown in the figure, and the arrangement order of the extracted genes in parent generation 2 is kept unchanged, and the arrangement is recorded as ff1 array in the coding arrangement form of parent generation 2;

[0069] Step (VI): Sort the remaining genes in Parent 2 in their original sorting order and denote them as the father2[] array;

[0070] Step (VII): Merge the father1[] array with the ff[] array to form the chromosome of Offspring 1, and at the same time merge the father2[] array with the ff1[] array to form the chromosome of Offspring 2.

[0071] Furthermore, the steps of the mutation operation are as follows: Swap the positions of two segments of genes in a chromosome of the parent to form a new offspring individual. That is, randomly generate a random integer between 1 and 1, that is, randomly select an individual in the population, randomly generate two random numbers m1 and m2 in the sequence from 1 to N×M. Determine the job numbers corresponding to the values b[m1] and b[m2]. If b[m1] = b[m2], then swapping the two genes will not generate a new individual, so discard the randomly generated m1 and m2 this time, and regenerate two new random numbers m1 and m2 in the sequence from 1 to N×M, and re-determine whether the job numbers represented by b[m1] and b[m2] are the same. On the contrary, if b[m1]!= b[m2], then swap the two genes to generate a new individual to ensure the mutation operation proceeds.

[0072] The beneficial effects of the present invention are as follows: The present invention has higher quality compared to the artificial bee colony algorithm and the genetic algorithm. The selection, crossover, and mutation operations in the genetic algorithm can better meet the requirements of the flexible job shop with constrained processes; the present invention introduces the simulated annealing algorithm to reduce the probability of falling into local optima and increase the global search ability; the present invention searches for information through population evolution and makes greedy selections, and retains individuals with high fitness with a high probability to preserve genes that are more in line with the conditions; the present invention evaluates chromosomes mainly relying on fitness values without relying on other knowledge about the search space and other methods to ensure the authenticity and accuracy of the solutions of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 is a schematic diagram of the roulette wheel in the present invention;

[0074] Figure 2 is a schematic diagram of the crossover operation in the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0075] Detailed Embodiment 1: The specific steps include:

[0076] Step 1: Problem description;

[0077] According to the requirements of the on-site flexible workshop, the flexible job shop scheduling problem is described in a generalized way: There are m types of work sections, 5 < m < 10, there are k types of raw materials, corresponding to n jobs, n > 50, and each type of raw material requires MT i time to complete, MT iis a random number, each job is completed on the device, and constraints are given; the constraints include:

[0078] (1) Each device corresponds to a process;

[0079] (2) Each device shall not be used more than once per operation;

[0080] (3) The order in which each operation and each raw material utilize each piece of equipment may be different;

[0081] (4) The processing sequence of the corresponding processes on the No. 2, 3, and 4 equipment must meet the sequence requirements: 2>3>4, the latter process cannot precede the former process, and there is no sequence requirement for other processes;

[0082] (5) Any operation has no priority for preemptive processing and must be subject to production sequence scheduling;

[0083] (6) No new jobs can be added during the processing of the job, and the processing of the job cannot be temporarily canceled;

[0084] (7) Each operation can start the next stage only after the current stage is completed;

[0085] Step 2: Construct the objective function;

[0086] Let N represent the number of jobs, M represent the number of devices, i represent each job i∈{1, 2, 3, ..., N}, j represent each device ∈{1, 2, 3, ..., M}, t ij represents the working time of the i-th job on the j-th workbench, H j T represents the sum of the non-working time of the jth device from the start of work to the end of all work. i It represents the time taken by the jth workstation to complete all tasks;

[0087] Assuming that a job cannot be interrupted during processing in one section to be processed in another section, the same raw material cannot be processed on two devices at the same time, and the same machine cannot process two raw materials at the same time, then:

[0088]

[0089] The objective function of this flexible job scheduling problem is expressed as follows:

[0090]

[0091] Formula ① indicates that the time consumption of the jth device is equal to the sum of the working time of each job and the idle time of the device. Formula ② indicates the objective function of the workshop scheduling problem, which is to minimize the time consumption of the device with the longest working time among the M devices. The constraints are:

[0092] (1) Each device corresponds to one process;

[0093] (2) Each operation is produced no more than once on each piece of equipment, that is, each process of each operation is processed only once;

[0094] Let L represent each process to be processed, so l∈{1,2,...,M},

[0095]

[0096] Formula ③ means that each device corresponds to a process, and a job needs to be processed on each device, and only once, so l = j, and l, j∈{1,2,...,M}, when the jth device finishes work, the jth job of all jobs has been completed, and when all M devices have completed their tasks, the Mth processes of all jobs have been completed, and production is over;

[0097] (3) There are constraints in the workspace. The processing order of some items must meet the required sequence requirements. The processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4. The latter sequence cannot exceed the former sequence. There is no sequence requirement for other processes. Record C ij The start time of the i-th job on the j-th machine is the start time of the j-th process, E ij The end time of processing of the i-th job on the j-th machine;

[0098] C ij +t ij =E ij ④,

[0099] C i2 +t i2 <C i3 ⑤,

[0100] C i3 +t i3 <C i4 ⑥,

[0101] Formula ④ ensures that the end time of each job on each device is the sum of the start time of the job on this device and the processing time of the job on this device; Formulas ⑤ and ⑥ ensure that constraint condition (3) holds. If it is assumed that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4; the latter sequence cannot exceed the former sequence, and there is no sequence requirement for other processes, then taking the time point when production just starts as the starting point, the start time of the i-th job on the second device plus the working time of the i-th job on the second device must be less than the start time of the i-th job on the third device; similarly, the start time of the i-th job on the third device plus the working time of the i-th job on the third device must be less than the start time of the i-th job on the fourth device; that is, the processes with lower priority on the same device must be processed after the processes with higher priority are completed;

[0102] (4) A job cannot be processed on two devices at the same time;

[0103] Remember j Indicates the current working time of each device.

[0104] C ij =min(ming j ,maxE iJ ) ⑦,

[0105] Formula ⑦ ensures that when arranging work between jobs, the process previously arranged for this job has reached the end time, and is arranged to the equipment that is not currently working;

[0106] Step 3: Propose a genetic annealing algorithm; the specific steps include:

[0107] Step 301, encoding and decoding;

[0108] Using N jobs corresponding to k kinds of raw materials to process and encode on M devices; specifically, using N jobs to work on M devices to construct chromosomes, the total amount of DNA on each chromosome is N×M, which is composed of M genes {1, 2, ..., N}, so the N jobs are arranged into a sequence {1, 2, ..., N}, and there are M devices in total, so the M sequences {1, 2, ..., N} are merged into a sequence {1, 2, ..., N, 1, 2, ..., N, ... N}, and the numbers corresponding to two random numbers are repeatedly exchanged to form a random sequence;

[0109] Decoding is performed by processing n jobs corresponding to k kinds of raw materials on M equipment; specifically, assuming that the workshop scheduling problem is N=3, M=2, and the job numbers of the 3 jobs are 1-3. Each number 1-3 is randomly generated twice as a chromosome and recorded as an array b[6]. Assuming j=b[i], i represents the number of tasks to be scheduled i∈{1,2,…,N×M}, j represents the i-th scheduled task as the j-th job, b[6]=[1,3,3,2,2,1], and the jobs are scheduled from left to right. b[1]=1 means that the first job to be scheduled is For the first job, b[2]=3 means that the second scheduled job is the third job. Similarly, when it is scheduled to b[5], the number of i in b[1] to b[4] is the number of processes that have been completed for job i. Therefore, if b[6]=[1,3,3,2,2,1], the first process of the first job is completed first, then the first process of the third job is completed, then the second process of the third job is completed, then the first process of the second job is completed, then the second process of the second job is completed, and the second process of the first job is completed. The first and second processes do not represent which equipment is being worked on.

[0110] Step 302, initializing the population and calculating fitness;

[0111] Randomly generate L chromosomes containing N×M genes to form an initial population, each chromosome represents an individual, that is, each chromosome is a feasible scheduling solution for the flexible job shop assignment task;

[0112] The difficulty of solving the flexible job shop scheduling problem lies in the fitness calculation. Aiming at its complex and changeable constraints, the following design strategy is given. According to the encoding method, the chromosome {1, 2, ..., N, 1, 2, ..., N, ... N} is represented by j = b[i], i∈{1, 2, 3, ..., N×M}, and the scheduling method is that i is scheduled sequentially from 1 to N×M, j = {1, 2, 3, ..., N}, i is the current scheduled process, j is each job, and the number of processes to be arranged is the number of jobs in the chromosome before the current process;

[0113] According to the constraints between processes, determine the equipment that can perform the current j work; assuming that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4, the latter sequence cannot exceed the former sequence, and other processes have no sequence requirements, then before arranging the scheduling, first determine whether process 2 is completed and whether equipment 3 and 4 are available equipment under the current i;

[0114] Then determine the running progress of the available equipment, that is, the end time E of the previous work running. (i-1)j , assign the current work to the workbench minE with the smallest end time (i-1)jRepeat the above operation until all the work is arranged, record the final end time of each machine, find the workbench with the largest end time, transform its end time and use it as the fitness value for evaluation;

[0115] Step 303: genetic operation;

[0116] Genetic operations include selection, crossover, and mutation operations;

[0117] Use the traditional roulette wheel method to select offspring chromosomes and write a function selection() to select individuals. Let the fitness of each chromosome in the population, i.e., each individual, be p i , the sum of the fitness of each chromosome in the population is H, a number between 0 and 1 is randomly generated and recorded as P, and the probability of each individual being selected is recorded as f i ;

[0118]

[0119] The above formula indicates that the probability of each individual being selected is the ratio of its fitness to the total fitness. The specific operation adopts the roulette selection algorithm;

[0120] The specific steps for selecting an operation are:

[0121] Step 1: Calculate the sum P of the fitness of chromosomes in the population;

[0122] Step 2, i=1;

[0123] Step 3: Randomly generate a random number P between 0 and 1;

[0124] Step 4: Calculate the k of each individual according to the formula i value;

[0125]

[0126] Step 5: Determine the randomly generated random numbers P and k between 0 and 1 i The value of k i >p, then the individual is selected as the offspring population, otherwise the individual is abandoned;

[0127] Step 6, i=i+1;

[0128] Step 7: Repeat steps 3 to 6 until all individuals in the population are selected, and record i = 1;

[0129] The specific steps of the crossover operation are:

[0130] Step (1), randomly generate two random numbers between 0 and 1 as parent chromosomes 1 and 2;

[0131] Step (ii), select a random number m from a sequence of 1 to N×M;

[0132] Step (iii), take out the genes from m to 480 in the parent generation 1 and record them as the ff[] array, and record the genes from 1 to m in the parent generation 1 as the father1[] array;

[0133] Step (iv), calculate the number of each task i in the ff[] array respectively;

[0134] Step (V), extract the corresponding operations in step 4 from left to right in parent generation 2 until the number of operations calculated in step 4 is reached, for example, extract 12, 9, 3, 8, 6 as shown in the figure, and keep the arrangement order of the extracted genes in parent generation 2 unchanged, and arrange them in the encoding arrangement form of parent generation 2 and record them as ff1 array;

[0135] Step (six), sort the remaining genes in the father 2 in their own order and record them as the father2[] array;

[0136] Step (VII), merge the father1[] array with the ff[] array to record them as chromosomes of offspring 1, and merge the father2[] array with the ff1[] array to record them as chromosomes of offspring 2;

[0137] The steps of mutation operation are as follows: swap the two gene segments of a chromosome in the parent generation to form a new offspring individual, that is, randomly generate a random integer between 1 and 1, that is, randomly select an individual in the population, randomly generate two random numbers m1 and m2 in the sequence of 1 to N×M, and judge the operation number corresponding to the value b[m1] and b[m2]. If b[m1]=b[m2], the exchange of the two genes will not produce a new individual, then discard the randomly generated m1 and m2, regenerate two new random numbers m1 and m2 in the sequence of 1 to N×M, and re-judge whether the operation numbers represented by b[m1] and b[m2] are the same. Otherwise, if b[m1]!=b[m2], the two genes are exchanged to produce a new individual to ensure the mutation operation.

[0138] Among them, genetic operations also include output functions and parameter settings;

[0139] The output functions include:

[0140] In the genetic algorithm, at i=1, iteration begins, and genetic operations such as selection, crossover, and mutation are performed until the number of iterations reaches the iteration requirement and the result is output. A record() function is written to record the optimal solution and determine whether the conditions are met. A showresult() function is written to output the final result. A clock() function is added to the main function to calculate the program running time, and the final start processing time of each job of each device is output. The final time of each device, the time of the longest device, the time of the shortest device, the difference between the two, the number of each device's work and the algorithm running time are output to compare the algorithm's running efficiency and algorithm stability.

[0141] The parameter settings include:

[0142] The number of individuals in the population, the value of 1, the number of iterations, and the different settings of the crossover operator and mutation operator all affect the quality of the algorithm's optimal solution. When applying the genetic annealing algorithm, if the number of individuals in the population is large, that is, the value of l is large, then the time for each flexible job shop scheduling is too long, affecting the efficiency of the algorithm. On the contrary, if the number of individuals in the population is small, that is, the value of 1 is small, then each flexible job shop scheduling may not find all excellent gene segments in crossover and mutation, affecting the diversity of the population, and thus affecting the result of the optimal solution. The crossover operator is a key factor in controlling the number of crossover operations. If the number of crossover operators is too large, the crossover operation will be frequent, which will increase the possibility of destroying the excellent gene segments in the chromosome and destroy the generation of the relative optimal solution. On the contrary, if the crossover operator is too small, the number of chromosomes participating in the crossover operation in each iteration is small, which is not conducive to finding excellent gene segments and affecting the diversity of genes. Let h represent the number of individuals, that is, the number of chromosomes that have gene segment crossover, SUM represents the number of chromosomes in the population, and CROSSP represents the crossover factor. The following formula indicates that in one iteration, the number of individuals, that is, the number of chromosomes that have gene segment crossover is determined by the crossover operator and the population size.

[0143] h=SUM×CROSSP

[0144] The mutation operator is a key factor in controlling the mutation operation. The mutation operator has the same principle as the crossover operator. If it is too large, it will lead to frequent mutation operations and destroy the generation of excellent gene segments. If it is too small, it will lead to a high possibility of falling into the local optimum, unable to escape the local optimum, and unable to find the relatively global optimal solution, thus affecting the generation of the optimal result of the algorithm.

[0145] The specific steps are as follows: a random number between 0 and 1 is randomly generated during each iteration. When the random number is greater than the mutation operator, a mutation operation is performed in this iteration. Conversely, when the random number is less than the mutation operator, no mutation operation is performed in this iteration.

[0146] Similarly, the number of iterations in the algorithm is also crucial. If the number of iterations is too large, the algorithm will continue to iterate after finding the relatively global optimal solution, which greatly affects the efficiency of the algorithm. On the contrary, if the number of iterations is small, the algorithm may only find the local optimal solution, which affects the result of the algorithm's optimal solution. Therefore, the simulated annealing algorithm ends the iteration when the fitness value difference of the optimal individuals in the 10 generations of the population is small during the iteration process, thereby greatly improving the efficiency of the algorithm and finding the relatively optimal solution of the algorithm.

[0147] In the crossover operation, two new offspring individuals are generated by crossing two parent individuals. Assuming there are N workers and M devices, the above encoding method must meet the following conditions: the chromosome of each individual in the population has and only has M {1, 2, ..., N} genes.

[0148] Due to the encoding method, chromosome b[i] must contain M N jobs. Assume that there are N = 60 jobs and M = 8 workstations, that is, b[i] is composed of 8 numbers from 1 to 60. Any crossover will destroy the chromosome structure and make the chromosome invalid. Therefore, the same number of job numbers must be exchanged to ensure the validity of the chromosome. A function cross() is written to perform the crossover operation in the genetic algorithm. The crossover operation finds the same data segments and exchanges the two gene segments to different chromosomes in the original order.

[0149] In the initialization of the population and fitness calculation, assuming that there are N = 60 workers and M = 8 workstations, the steps for calculating fitness are as follows:

[0150] Step 1: i=1;

[0151] Step 2: Create an e[i][j] array to store the work progress of each workbench after the current work is completed;

[0152] Step 3: Create an array b[i]=j to store the genes of the current chromosome, i.e. the scheduling order of the flexible workshop operations;

[0153] Step 4: Determine the devices that can perform work in the current state i, for example, when j = b[i]], determine the devices that can perform the current work j;

[0154] Step 5: Store the number of currently processable processes in the c[] array, and the c[ii] array stores the equipment that can perform the current work;

[0155] Step 6: Calculate the running progress of the device that can currently perform work j, assign the current work to the device l with the smallest progress, and calculate the required working time t of work j. ij Add the end time E of the previous workbench l (i-1)J , recorded in the e[1][j] array is the end time of the operation of workbench 1 at this time;

[0156] Step 7: The num variable stores the number of workstations that have completed the current job j, which is recorded in the f[1][h] array (i.e. the order of completion of job j) for output;

[0157] Step 8: i=i+1;

[0158] Step 9: Repeat steps 4 to 7 until the number of iterations is reached

[0159] Step 10: Write a function Comparetime() to assign the final end time of each workstation to the g[ii] array

[0160] Step 11: Write a function evaluation() to evaluate the genetic algorithm and sort the chromosomes in the population by fitness.

[0161] Example: Assume that there are only 5 tasks and 4 devices, of which 3 and 4 require processing order 3>4, and the random work order is 5312221......, and the duration of each task is equal to its number.

[0162] The work arrangement is shown in Table 3.1:

[0163] Table 3.1 Schematic diagram of work arrangement

[0164]

[0165] Since we assume that the duration of each task is equal to its number, we have t ij =i.

[0166] i=1. Among the four devices, since the processing order of devices 3 and 4 is 3>4, the 4# device is not a working device. Therefore, when i=1, the available processes are 1# device, 2# device, and 3# device, and the progress is 0. Therefore, the process 1 of work 5 is in 1# device, and the progress of 1# device is updated to 5.

[0167] i=2. Similarly, the available processes are 1# equipment, 2# equipment, and 3# equipment. However, the process of 1# equipment is 5. Therefore, process 1 of work 3 is in 2# equipment, and the process of 2# equipment is updated to 3.

[0168] i=3. Similarly, the available processes are 1# equipment, 2# equipment, and 3# equipment. However, the process of 1# equipment is 5 and the process of 2# equipment is 3. Therefore, process 1 of job 1 is in 3# equipment, and the process of 3# equipment is updated to 1.

[0169] i=4, b[4]=2, so the job to be scheduled is job 2, and the available equipment is 1#, 2#, and 3#, and their corresponding processes are 5, 3, and 1, respectively. Therefore, process 1 of job 2 is on 3# equipment;

[0170] i=5, b[5]=2, so the job to be arranged is job 2. Since job 2 has been completed on equipment 3#, the available equipment is equipment 1#, equipment 2#, and equipment 4#. Since the constraint condition requires the processing order 3>4, the formula is as follows. Therefore, the process of equipment 1# is 5, the process of equipment 2# is 3, and the process of equipment 4# is greater than or equal to the process of equipment 3# in processing job 2. Therefore, the process of equipment 4# is 3, so process 2 of job 2 is on equipment 2#.

[0171] C i3 +t i3 <C i4 …………………………………………(3-8)

[0172] i=6, b[6]=2. Due to formula (3-8), the job that needs to be scheduled is job 2. The available equipment is 1# equipment and 4# equipment, and their corresponding processes are 5 and 3 respectively. Therefore, process 3 of job 2 is on 4# equipment. At this time, the end time of job 2 is 5, so the process of updating 4# equipment is 5+2=7.

[0173] i=7, b[7]=1, so the work to be arranged is work 1. According to the above strategy, process 2 of work 1 is on device 1#, and the process of updating device 1# is 6.

[0174] Therefore, the revised and supplemented work schedule is as follows Table 3.2:

[0175] Table 3.2 Schematic diagram of revised work arrangements

[0176]

[0177] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent replacement and improvement made to the above embodiments without departing from the content of the technical solution of the present invention, based on the technical essence of the present invention, within the spirit and principles of the present invention, still fall within the protection scope of the technical solution of the present invention.

Claims

1. A flexible workshop scheduling method based on genetic annealing algorithm, characterized in that: The specific steps include: Step 1: Problem description; According to the requirements of the on-site flexible workshop, the flexible job shop scheduling problem is described generally: there are m types of work sections, where 5 < m < 10, there are k types of raw materials, corresponding to n jobs, n > 50, and each type of raw material requires MT i time to complete, MT i is a random number, and each job is completed on the equipment, and the constraint conditions are given; Step 2: Construct the objective function; Let N represent the number of jobs, M represent the number of devices, i represent each job i∈{1,2,3,…,N}, j represent each device∈{1,2,3,…,M}, t ij represents the working time of the i-th job on the j-th workbench, H i T represents the sum of the non-working time of the jth device from the start of work to the end of all work. i It represents the time taken by the jth workstation to complete all tasks; Assuming that a job cannot be interrupted during processing in one section to be processed in another section, the same raw material cannot be processed on two devices at the same time, and the same machine cannot process two raw materials at the same time, then: The objective function of this flexible job scheduling problem is expressed as follows: Formula ① indicates that the time consumption of the jth device is equal to the sum of the working time of each job and the idle time of the device. Formula ② indicates the objective function of the workshop scheduling problem, which is to minimize the time consumption of the device with the longest working time among the M devices. Step 3: Propose a genetic annealing algorithm.

2. A flexible shop floor scheduling method based on genetic annealing algorithm according to claim 1, characterized in that: The constraints in step 1 include: (1) Each device corresponds to a process; (2) Each device shall not be used more than once per operation; (3) The order in which each operation and each raw material utilize each piece of equipment may be different; (4) The processing sequence of the corresponding processes on the No. 2, 3, and 4 equipment must meet the sequence requirements: 2>3>4, the latter process cannot precede the former process, and there is no sequence requirement for other processes; (5) Any operation has no priority for preemptive processing and must be subject to production sequence scheduling; (6) No new jobs can be added during the processing of the job, and the processing of the job cannot be temporarily canceled; (7) The next stage of each operation can only be started after the current stage is completed.

3. The flexible shop scheduling method based on genetic annealing algorithm according to claim 1 is characterized in that: The constraints in step 2 are: (1) Each device corresponds to one process; (2) Each operation is produced no more than once on each piece of equipment, that is, each process of each operation is processed only once; Let L represent each process to be processed, so l∈{1,2,...,M}, Formula ③ means that each device corresponds to a process, and a job needs to be processed on each device, and only once, so l = j, and l, j∈{1,2,...,M}, when the jth device finishes work, the jth job of all jobs has been completed, and when all M devices have completed their tasks, the Mth processes of all jobs have been completed, and production is over; (3) There are constraints in the workspace. The processing order of some items must meet the required sequence requirements. The processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4. The latter sequence cannot exceed the former sequence. There is no sequence requirement for other processes. Record C ij The start time of the i-th job on the j-th machine is the start time of the j-th process, E ij The end time of processing of the i-th job on the j-th machine; C ij +t ij =E ij ④, C i2 +t i2 <C i3 ⑤, C i3 +t i3 <C i4 ⑥, Formula ④ ensures that the end time of each job on each device is the sum of the start time of the job on this device and the processing time of the job on this device; Formulas ⑤ and ⑥ ensure that constraint condition (3) holds. If it is assumed that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4; the latter sequence cannot exceed the former sequence, and there is no sequence requirement for other processes, then taking the time point when production just starts as the starting point, the start time of the i-th job on the second device plus the working time of the i-th job on the second device must be less than the start time of the i-th job on the third device; similarly, the start time of the i-th job on the third device plus the working time of the i-th job on the third device must be less than the start time of the i-th job on the fourth device; that is, the processes with lower priority on the same device must be processed after the processes with higher priority are completed; (4) A job cannot be processed on two devices at the same time; Remember j Indicates the current working time of each device. C ij =min(min j ,maxE iJ )⑦, Formula ⑦ ensures that when scheduling work, the process previously scheduled for this work has reached the end time and is scheduled to the equipment that is not currently working.

4. The flexible shop scheduling method based on genetic annealing algorithm according to claim 1 is characterized in that: The steps of the genetic annealing algorithm in step 3 include: Step 301, encoding and decoding; Using N jobs corresponding to k kinds of raw materials to process and encode on M equipment; Decoding is performed by processing n jobs corresponding to k kinds of raw materials on M devices; Step 302, initializing the population and fitness calculation; Step 303: genetic operation; Genetic operations include selection, crossover and mutation.

5. A flexible shop floor scheduling method based on genetic annealing algorithm according to claim 4, characterized in that: The coding of N operations corresponding to k kinds of raw materials on M equipment includes: Use N jobs to work on M devices to construct chromosomes. The total amount of DNA on each chromosome is N×M, which is composed of M genes {1, 2, ..., N}. Therefore, arrange the N jobs into a sequence {1, 2, ..., N}. If there are M devices, merge the M sequences {1, 2, ..., N} into one sequence {1, 2, ..., N, 1, 2, ..., N, ... N}, and repeatedly swap the numbers corresponding to two random numbers to form a random sequence; The decoding of n jobs corresponding to k kinds of raw materials on M devices includes: Assume that the workshop scheduling problem is N=3, M=2, and the 3 jobs are numbered 1-3. Each number from 1-3 is randomly generated twice as a chromosome and recorded as array b[6]. Assume that j=b[i], i represents the number of tasks to be scheduled i∈{1,2,…,N×M}, j represents the jth job of the ith scheduled task, b[6]=[1,3,3,2,2,1], and the jobs are scheduled from left to right. b[1]=1 means that the first job to be scheduled is job 1, and b[2]=3 means The second scheduled job is the third job. Similarly, when it is scheduled to b[5], the number of i in b[1] to b[4] is the number of processes that have been completed for job i; therefore, if b[6] = [1,3,3,2,2,1], the first process of the first job is completed first, followed by the first process of the third job, followed by the second process of the third job, followed by the first process of the second job, followed by the second process of the second job, and finally the second process of the first job is completed. The first and second processes do not represent which equipment is being worked on.

6. A flexible shop scheduling method based on genetic annealing algorithm according to claim 4, characterized in that: Initializing the population and calculating the fitness in step 302 specifically includes: Randomly generate L chromosomes containing N×M genes to form an initial population, each chromosome represents an individual, that is, each chromosome is a feasible scheduling solution for the flexible job shop assignment task; The difficulty of solving the flexible job shop scheduling problem lies in the fitness calculation. Aiming at its complex and changeable constraints, the following design strategy is given. According to the encoding method, the chromosome {1,2,…,N,1,2,…,N,…N} is represented by j=b[i], i∈{1,2,3,...,N×M}, and the scheduling method is that i is scheduled sequentially from 1 to N×M, j={1,2,3,...,N}, i is the current scheduled process, j is each job, and the number of processes arranged is the number of jobs in the chromosome before the current process; According to the constraints between processes, determine the equipment that can perform the current j work; assuming that the processing order of the processes corresponding to M2, M3, and M4 must meet the sequence requirements: M2>M3>M4, the latter sequence cannot exceed the former sequence, and other processes have no sequence requirements, then before arranging the scheduling, first determine whether process 2 is completed and whether equipment 3 and 4 are available equipment under the current i; Then determine the running progress of the available equipment, that is, the end time E of the previous work running. (i-1)j , assign the current work to the workbench min E with the smallest end time (i-1)j Repeat the above operation until all the work is arranged, record the final end time of each machine, and find the workbench with the largest end time, transform its end time and use it as the fitness value for evaluation.

7. The flexible shop scheduling method based on genetic annealing algorithm according to claim 4 is characterized in that: The specific steps for selecting an operation are: Step 1: Calculate the sum P of the fitness of chromosomes in the population; Step 2, i=1; Step 3: Randomly generate a random number P between 0 and 1; Step 4: Calculate the k of each individual according to the formula i value; Step 5: Determine the randomly generated random numbers P and k between 0 and 1 i The value of k i >p, then the individual is selected as the offspring population, otherwise the individual is abandoned; Step 6, i=i+1; Step 7: Repeat steps 3 to 6 until all individuals in the population are selected, and let i = 1.

8. The flexible shop scheduling method based on genetic annealing algorithm according to claim 4 is characterized in that: The specific steps of the crossover operation are: Step (1), randomly generate two random numbers between 0 and 1 as parent chromosomes 1 and 2; Step (ii), select a random number m from a sequence of 1 to N×M; Step (iii), take out the genes from m to 480 in the parent generation 1 and record them as the ff[] array, and record the genes from 1 to m in the parent generation 1 as the father1[] array; Step (iv), calculate the number of each task i in the ff[] array respectively; Step (V), extract the corresponding operations in step 4 from left to right in parent generation 2 until the number of operations calculated in step 4 is reached, for example, 12, 9, 3, 8, 6 are extracted as shown in the figure, and the arrangement order of the extracted genes in parent generation 2 is kept unchanged, and the arrangement is recorded as ff1 array in the coding arrangement form of parent generation 2; Step (six), sort the remaining genes in the father 2 in their own order and record them as the father2[] array; Step (seven): merge the father1[] array and the ff[] array to record them as chromosomes of offspring 1, and merge the father2[] array and the ff1[] array to record them as chromosomes of offspring 2.

9. The flexible shop scheduling method based on genetic annealing algorithm according to claim 4 is characterized in that: The steps of mutation operation are as follows: swap the two gene segments of a chromosome in the parent generation to form a new offspring individual, that is, randomly generate a random integer between 1 and l, that is, randomly select an individual in the population, randomly generate two random numbers m1 and m2 in the sequence of 1 to N×M, and judge the operation number corresponding to the value b[m1] and b[m2]. If b[m1]=b[m2], the exchange of the two genes will not produce a new individual, then discard the randomly generated m1 and m2, regenerate two new random numbers m1 and m2 in the sequence of 1 to N×M, and re-judge whether the operation numbers represented by b[m1] and b[m2] are the same. Otherwise, if b[m1]!=b[m2], the two genes are exchanged to produce a new individual to ensure the mutation operation.