Resource scheduling method, device and electronic equipment
By adjusting the operation sequence of the genetic algorithm and the initial population generation strategy, the problem of difficult to obtain the optimal solution in resource scheduling in the prior art is solved, and more efficient resource scheduling is achieved.
Patent Information
- Application Number
- CN202210395853.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-03-21
- Filing Date
- 2022-04-15
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2042-04-15
AI Technical Summary
In resource scheduling, existing genetic algorithms are difficult to obtain optimal solutions due to the small initial population size and low chromosome coverage.
By changing the operating process sequence of the genetic algorithm, we change from selection, crossing, mutation to selection, mutation, and crossing, and only a small number of chromosomes are generated in the initial stage, and the population is expanded by crossing.
The data processing volume during mutation is reduced, the calculation amount of generating a large number of chromosomes at the beginning is reduced, the processing speed of genetic algorithms is improved, and the probability of obtaining the optimal solution is improved.
Smart Images

Figure CN114757417B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of optimizing evolutionary quality, and in particular to a resource scheduling method, device, electronic device and computer-readable storage medium. Background Art
[0002] At present, when faced with complex engineering and technical problems such as resource scheduling of retired power battery disassembly lines, genetic algorithms can usually be used to solve them, thereby obtaining a more applicable process adjustment or scheduling solution. The process generally includes: the first step is to initialize the population and calculate the fitness value of the chromosome; the second step is to determine whether to terminate the loop; the third step is to perform a series of operations such as selection, crossover, and mutation on the initialized population in turn to obtain a new population; the fourth step is to calculate the fitness value of the chromosome in the new population, and iterate the second to third steps until the end of the loop to determine the final result. Since the process always maintains the size of an initial population, and in order to avoid an increase in the amount of calculation, the size of the initial population is generally small, resulting in a low chromosome coverage rate, which makes the probability of containing the optimal chromosome relatively low, and it is difficult to obtain the optimal solution, that is, it is difficult to obtain the optimal solution in the engineering problem represented by the optimal chromosome. Summary of the invention
[0003] To solve the existing technical problems, the embodiments of the present invention provide a resource scheduling method, device, electronic device and computer-readable storage medium.
[0004] In a first aspect, an embodiment of the present invention provides a resource scheduling method, comprising: obtaining processing time data and constructing a plurality of chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosome represents the workpiece to be processed by each machine in each process and the processing order; determining a fitness function, the fitness function is used to calculate the total processing time for completing all processes for all workpieces; generating an initial population containing at least the plurality of chromosomes, and calculating the fitness value of each chromosome in the initial population based on the processing time data and the fitness function; taking the initial population as the first population, and performing the fitness function on the chromosomes; The first population cyclically executes the genetic process until the genetic process converges, and the chromosome corresponding to the minimum fitness value is taken as the optimal solution, and the workpiece to be processed is processed according to the optimal solution; the genetic process includes: based on the principle that the smaller the fitness value, the better the corresponding chromosome, performing a selection operation on the first population to obtain a second population; performing a mutation operation on the second population to obtain a third population; performing a crossover operation on the third population to obtain a fourth population; calculating the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function; when the genetic process has not converged, taking the third population and the fourth population as the first population.
[0005] Optionally, constructing multiple chromosomes includes: using matrix coding to generate multiple matrices, the first dimension of each matrix is each workpiece to be processed, the second dimension of each matrix is the matrix of each process, and the multiple matrices are used as the multiple chromosomes; the first dimension is the row of the matrix, and the second dimension is the column of the matrix; or, the first dimension is the column of the matrix, and the second dimension is the row of the matrix; wherein any element in each matrix is a randomly generated real number, the integer part of any element represents the machine used for the corresponding workpiece to be processed, and the decimal part of any element represents the processing order of the corresponding workpiece to be processed on the machine used.
[0006] Optionally, generating an initial population including at least the multiple chromosomes includes: using the multiple chromosomes as the initial population; or performing the crossover operation on the multiple chromosomes to obtain multiple new chromosomes, and using the multiple chromosomes and the multiple new chromosomes as the initial population.
[0007] Optionally, based on the principle that the smaller the fitness value, the better the corresponding chromosome, a selection operation is performed on the first population to obtain a second population, including: sequentially and non-repetitively comparing the fitness values of two adjacent chromosomes in the first population, retaining the chromosome with the smaller fitness value between the two, to obtain the second population.
[0008] Optionally, when the genetic process has not converged, the third population and the fourth population are used as the first population, including: when there is no chromosome that is used as the expected optimal chromosome of the current round multiple times in the genetic process and the genetic process does not meet the number of cycles, the third population and the fourth population are used as the first population; the expected optimal chromosome of the current round represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round.
[0009] Optionally, in the case that no chromosome is used as the expected optimal chromosome of the current round multiple times during the genetic process, and the genetic process does not meet the number of cycles, the third population and the fourth population are used as the first population, including: comparing the current minimum fitness value with the expected optimal fitness value; the current minimum fitness value is the minimum value of the fitness value of each chromosome in the third population and the fourth population in the genetic process of the current round; the expected optimal fitness value is used to refer to the optimal fitness value that can be determined at present; when the current minimum fitness value is less than the expected optimal fitness value, the expected optimal fitness value is updated with the current minimum fitness value, and the expected optimal chromosome is updated with the chromosome corresponding to the current minimum fitness value, And clear the record of the number of the expected optimal chromosome, and use the third population and the fourth population as the first population; when the current minimum fitness value is equal to the expected optimal fitness value, determine whether the chromosome corresponding to the current minimum fitness value is consistent with the expected optimal chromosome, if so, increase the record of the number of the expected optimal chromosome, if not, update the expected optimal chromosome with the chromosome corresponding to the current minimum fitness value, and clear the record of the number of the expected optimal chromosome; use the third population and the fourth population as the first population; when the current minimum fitness value is greater than the expected optimal fitness value, maintain the expected optimal fitness value and the expected optimal chromosome unchanged, and use the third population and the fourth population as the first population.
[0010] Optionally, the genetic process is cyclically performed on the first population until the genetic process converges, and the chromosome corresponding to the minimum fitness value is taken as the optimal solution, including: cyclically performing the genetic process on the first population until the genetic process has satisfied the number of cycles, and taking the chromosome corresponding to the minimum fitness value when the number of cycles is satisfied as the optimal solution; or, cyclically performing the genetic process on the first population, when a certain chromosome is used as the expected optimal chromosome multiple times, taking the chromosome that is used as the expected optimal chromosome multiple times as the optimal solution; wherein the expected optimal chromosome represents a better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round; the fitness value corresponding to the expected optimal chromosome is the expected optimal fitness value, and the expected optimal fitness value represents the smaller value between the minimum value of the fitness values in the third population and the fourth population and the expected optimal fitness value in the previous round.
[0011] Optionally, before cyclically executing the genetic process on the first population, the method further includes: presetting a mutation probability and a crossover probability, the mutation probability being used to determine whether to perform a mutation operation on the chromosome, and the crossover probability being used to determine whether to perform a crossover operation on the chromosome; performing a mutation operation on the second population includes: generating a mutation random number for each chromosome in the second population respectively, and when the mutation random number is less than the mutation probability, performing a mutation operation on the chromosome in the second population corresponding to the mutation random number; performing a crossover operation on the third population includes: sequentially and non-repetitively generating a crossover random number for two adjacent chromosomes in the third population, and when the crossover random number is less than the crossover probability, performing at least a partial row crossover operation on the two adjacent chromosomes corresponding to the crossover random number.
[0012] In a second aspect, an embodiment of the present invention further provides a resource scheduling device, including: an acquisition module, a determination function module, a calculation module and a loop module.
[0013] The acquisition module is used to acquire processing time data and construct multiple chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosome represents the workpiece to be processed by each machine in each process and the processing order.
[0014] The function determination module is used to determine a fitness function, and the fitness function is used to calculate the total processing time for completing all processes for all workpieces.
[0015] The calculation module is used to generate an initial population including at least the plurality of chromosomes, and calculate the fitness value of each chromosome in the initial population based on the processing time data and the fitness function.
[0016] The circulation module is used to take the initial population as the first population, cyclically execute the genetic process on the first population until the genetic process converges, take the chromosome corresponding to the minimum fitness value as the optimal solution, and process the workpiece to be processed according to the optimal solution.
[0017] The loop module includes: a selection unit, a mutation unit, a crossover unit, a calculation unit and a sorting unit.
[0018] The selection unit is used to perform a selection operation on the first population to obtain a second population based on the principle that the smaller the fitness value, the better the corresponding chromosome.
[0019] The mutation unit is used to perform a mutation operation on the second population to obtain a third population.
[0020] The crossover unit is used to perform a crossover operation on the third population to obtain a fourth population.
[0021] The calculation unit is used to calculate the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function.
[0022] The sorting unit is used for taking the third population and the fourth population as the first population when the genetic process has not converged.
[0023] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and the computer program, when executed by the processor, implements the steps of any one of the resource scheduling methods described above.
[0024] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in any one of the resource scheduling methods described above.
[0025] The resource scheduling method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention, when facing certain complex resource scheduling problems, change the inherent operation process sequence of the traditional genetic algorithm, and change the traditional sequence from selection, crossover and mutation to selection, mutation and crossover. This method can greatly reduce the amount of data required to be processed during mutation. At the same time, there is no need to generate a large number of chromosomes in the initial stage of generating multiple chromosomes. Instead, only a small number of chromosomes can be generated, and the purpose of expanding the population can be achieved through crossover, which reduces the amount of calculation caused by the initial generation of a large number of chromosomes, improves the processing speed of the entire genetic algorithm, and also expands the scale of chromosomes processed during subsequent selection and mutation operations, making it easier for the genetic algorithm to obtain the optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.
[0027] Figure 1 A flow chart of a resource scheduling method provided by an embodiment of the present invention is shown;
[0028] Figure 2 A flow chart of the genetic process in an embodiment of the present invention is shown;
[0029] Figure 3 A specific flow chart of a resource scheduling method provided by an embodiment of the present invention is shown;
[0030] Figure 4 A schematic diagram showing the structure of a resource scheduling device provided by an embodiment of the present invention is shown;
[0031] Figure 5 A schematic structural diagram of an electronic device for executing a resource scheduling method provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0032] The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0033] The resource scheduling problem faced by the embodiment of the present invention refers to the use of multiple resources to realize the processing of multiple workpieces, and multiple processes are involved in the process of processing each workpiece. Taking the resource scheduling problem of the retired power battery disassembly line as an example, the resource can be the machine in the retired power battery disassembly problem, the workpiece is the retired power battery to be disassembled, and the processing corresponds to the disassembly. The resource scheduling problem can be specifically described as: in a retired power battery disassembly system, multiple machines are set up to disassemble multiple batteries; each battery can correspond to one or more processes, and the process sequence of the system disassembling the battery is predetermined; each process can be processed by multiple different machines, and the processing time of the process varies with the performance of the machine. The scheduling goal to be determined by the embodiment of the present invention is: to select the most suitable machine for each process, determine the optimal processing sequence and start time of each battery disassembly process on each machine, so that certain performance indicators of the system are optimized (such as the shortest processing time). In addition, the following constraints must be met during the processing: 1. The same machine can only disassemble one battery at the same time; 2. The same process of the same battery can only be processed by one machine at the same time; 3. Each process of each battery cannot be interrupted once processing starts; 4. Different batteries have the same priority; 5. There is no order constraint between processes of different batteries, but there is a order constraint between processes of the same battery; 6. All batteries can be processed at time zero.
[0034] Figure 1 FIG. 1 is a flow chart of a resource scheduling method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps 101-104.
[0035] Step 101: Obtain processing time data and construct multiple chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosome represents the workpiece to be processed by each machine in each process and the processing order.
[0036] Among them, the processing time of each machine for each workpiece to be processed in different processes can be obtained, that is, the time consumed by each workpiece to be processed by different machines in different processes, and the obtained time data are used as processing time data. Among them, the algorithm commonly used to deal with this type of resource scheduling problem can adopt a genetic algorithm, and randomly construct multiple chromosomes according to the number of workpieces to be processed, the number of required processes, and the number of machines that can be used in each process contained in the processing time data. Among them, each randomly constructed chromosome includes the workpiece to be processed by each available machine in each process and the processing order of the machine processing the workpiece. In the embodiment of the present invention, each chromosome can represent a feasible scheduling scheme corresponding to the resource scheduling method, and different chromosomes represent different scheduling schemes. Among them, one can be selected from a variety of different encoding methods to construct multiple chromosomes. For example, the selected encoding method can be real number encoding, bit string encoding, ordered string encoding, binary encoding, etc.
[0037] For example, for the resource scheduling problem of a certain processing workshop, there are 12 workpieces to be processed. Each workpiece needs to go through 3 processes according to the process flow. Each process is processed by 3 machines M1-M9 with different performances. The processing time of each workpiece using different machines in each process can be obtained, and then the processing time data is generated. The processing time data is shown in the following Table 1. This resource scheduling problem includes 12 workpieces and 3 processes. 3 machines can be used in each process. Based on this, a scheduling scheme can be randomly generated to schedule these 3 machines to complete 3 processes for 12 workpieces. Each scheduling scheme is represented in the form of a chromosome.
[0038]
[0039]
[0040] Table 1 Processing time data table
[0041] Step 102: Determine a fitness function, where the fitness function is used to calculate the total processing time required to complete all processes for all workpieces.
[0042] In the embodiment of the present invention, the fitness function for solving the engineering problem can be determined according to the engineering problem to be solved, and the solution corresponding to the fitness function can be called the fitness value. Among them, the fitness function is usually obtained by converting the objective function in a certain rule, and the basic requirement of the fitness function is that the fitness function is a continuous function. The fitness value is the only basis for individual selection in the evolutionary process. The fitness value can be used to evaluate the quality of the chromosome (feasible solution), and the fitness value is a non-negative number. The fitness value is related to the adaptability of the chromosome (feasible solution). For example, when the minimum fitness value needs to be solved, the size of the fitness value is inversely proportional to the quality of the chromosome adaptability, that is, the smaller the fitness value, the better the chromosome. Among them, the commonly used methods for constructing the fitness function are: target bearing number mapping method, scale transformation method, etc.
[0043] For example, since the goal that the scheduling scheme to be determined in the embodiment of the present invention should achieve is: the total processing time required to process all workpieces is the shortest, a fitness function can be determined based on the goal. The fitness function is a function used to calculate the total processing time for processing all workpieces (including each required process). By solving the fitness function, a corresponding fitness value can be obtained, and the fitness value is the total processing time. If the example in step 101 is used, the calculated total processing time (such as the start time of the first process of processing the first workpiece to the completion time of the third process of processing the twelfth workpiece, the first to twelfth workpieces are all unrelated to the workpiece number in Table 1) can be used as the fitness function, and the fitness value obtained by each chromosome (scheduling scheme) according to the fitness function represents the total processing time used by the chromosome (scheduling scheme) after processing each process of the 12 workpieces. Since the smaller the fitness value, the shorter the total processing time, the genetic algorithm is used to solve the minimum value of the fitness function to obtain the chromosome corresponding to the minimum total processing time, that is, the optimal solution (optimal scheduling plan).
[0044] Step 103: Generate an initial population including at least a plurality of chromosomes, and calculate the fitness value of each chromosome in the initial population based on the processing time data and the fitness function.
[0045] In the embodiment of the present invention, an initial population can be generated for the constructed multiple chromosomes, and the initial population is a population that has not entered any cycle initially, and the initial population is a population that at least includes the constructed chromosomes. For example, the initial population can be a population directly composed of the multiple chromosomes constructed in the above step 101, or a population that includes other chromosomes in addition to the chromosomes constructed in the above step 101. Among them, for the processing time data obtained in the above step 101 and the fitness function determined in the above step 102, the processing time data can be used as the value input to the fitness function and used for calculation, and each chromosome in the initial population is calculated by the fitness function to obtain the fitness value of each chromosome in the initial population.
[0046] Step 104: The initial population is taken as the first population, and the genetic process is cyclically executed on the first population until the genetic process converges, and the chromosome corresponding to the minimum fitness value is taken as the optimal solution, and the workpiece to be processed is processed according to the optimal solution.
[0047] Among them, the genetic process iteration is to iterate the first population for multiple rounds, the initial value of the first population is the initial population, and through each genetic process executed, a global search is performed on all chromosomes in the first population of the current round to determine whether there is a chromosome in the first population of the current round that is closer to solving the resource scheduling problem. For example, it is determined whether there is a chromosome in the first population of the current round whose fitness value is the minimum fitness value. The minimum fitness value can represent the minimum value of all fitness values in the first population corresponding to each round of genetic process in the multiple rounds of genetic processes that have been experienced. When the genetic process reaches a convergence state after multiple genetic processes, the chromosome corresponding to the minimum fitness value corresponding to the convergence can be used as the optimal solution to solve the resource scheduling problem. For example, the scheduling scheme corresponding to the minimum value of the total processing time corresponding to the convergence state is used as the optimal solution. After that, the workpiece to be processed can be processed according to the optimal solution (i.e., the scheduling scheme).
[0048] Among them, see Figure 2 As shown, the genetic process may include the following steps 1041-1045.
[0049] Step 1041: Based on the principle that the smaller the fitness value, the better the corresponding chromosome, a selection operation is performed on the first population to obtain a second population.
[0050] Among them, since the embodiment of the present invention needs to determine a scheduling scheme with the shortest total processing time, therefore, for the determined fitness function that can calculate the total processing time, the smaller the fitness value calculated by the fitness function, the shorter the total processing time, and it can be determined that the chromosome corresponding to the smaller fitness value is a more optimal scheduling scheme that is more in line with expectations, such as a scheduling scheme with the shortest total processing time. Based on this principle, the selection operation involved in the traditional genetic algorithm can be performed on the first population, for example, the selection probability is preset in advance, and the fitness values of two adjacent chromosomes that need to be selected are compared for all chromosomes in the first population according to the selection probability, and the chromosome with the smaller fitness value of the two chromosomes selected after comparison and the chromosome that does not need to be selected are combined to generate a new population, and the population is used as the second population.
[0051] For example, there are 200 chromosomes in the first population. Based on the selection probability, the fitness values of two adjacent chromosomes that need to be selected are compared, such as chromosome 1 and chromosome 2, chromosome 5 and chromosome 6... chromosome 199 and chromosome 200. The chromosome with the smaller fitness value between the two and the chromosome that does not need to be selected based on the selection probability are selected, such as chromosome 2 (chromosome with a smaller fitness value), chromosome 3 (chromosome that does not need to be selected), chromosome 4 (chromosome that does not need to be selected), chromosome 6 (chromosome with a smaller fitness value),... chromosome 199 (chromosome with a smaller fitness value), and these chromosomes are used as the second population.
[0052] Step 1042: Perform a mutation operation on the second population to obtain a third population.
[0053] In the embodiment of the present invention, the mutation operation involved in the traditional genetic algorithm can be performed on the second population obtained in the above step 1041, that is, for all chromosomes in the second population, some chromosomes are randomly selected for mutation, and the mutated chromosomes and the chromosomes that are not selected for the mutation operation are used as the third population. Among them, in order not to destroy and disrupt the population that is closer to convergence, but to make the current population closer to convergence through a more subtle mutation operation, the mutation operation can only be performed on a smaller number of chromosomes, and the mutation operation is a non-original value mutation. For example, in order to ensure that the current population (such as the second population) can contain chromosomes that are closer to the optimal solution in the third population after the non-original value mutation operation, only one chromosome in the second population can be subjected to non-original value mutation, that is, a certain element in a certain chromosome is replaced with other elements to obtain a new chromosome, and the obtained new chromosome and the remaining chromosomes that have not been subjected to the mutation operation are combined to generate the third population.
[0054] Step 1043: Perform a crossover operation on the third population to obtain a fourth population.
[0055] Among them, after obtaining the third population, the crossover operation involved in the traditional genetic algorithm can be performed on the third population. The crossover operation can also select two adjacent chromosomes from all the chromosomes in the third population to crossover and exchange some elements. For example, the third population has a total of 100 chromosomes, and crossover and exchange some elements for two adjacent chromosomes respectively, such as for chromosome 1 and chromosome 2, for chromosome 3 and chromosome 4...for chromosome 99 and chromosome 100, crossover and exchange some elements between two adjacent chromosomes to generate the fourth population. For example, the elements to be crossover and exchanged can be elements No. 1 to No. 6 of every two adjacent chromosomes. The crossover operation is performed in such a way of exchanging elements at fixed positions of two adjacent chromosomes, and the chromosomes after crossover are used as the fourth population.
[0056] Step 1044: Calculate the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function.
[0057] In an embodiment of the present invention, after the fourth population is obtained through selection operation, mutation operation and crossover operation, the fitness value of each chromosome in the third population and the fourth population can be obtained by using the initially obtained processing time data and fitness function.
[0058] Step 1045: When the genetic process does not converge, the third population and the fourth population are used as the first population.
[0059] After obtaining the fitness values of all chromosomes in the third and fourth populations, these fitness values can be used to measure whether the genetic process has reached a convergence state. If the genetic process has not reached convergence, the third and fourth populations obtained this time are merged and used as the first population for the next round of genetic process. If the genetic process has reached convergence, the above step 104 is executed.
[0060] When facing certain complex resource scheduling problems, the embodiment of the present invention changes the inherent operation process sequence of the traditional genetic algorithm, and changes the traditional sequence from selection, crossover, and mutation to selection, mutation, and crossover. This method can greatly reduce the amount of data required to be processed during mutation. At the same time, there is no need to generate a large number of chromosomes in the initial stage of generating multiple chromosomes. Instead, only a small number of chromosomes can be generated, and the purpose of expanding the population can be achieved through crossover, which reduces the amount of calculation caused by the initial generation of a large number of chromosomes, improves the processing speed of the entire genetic algorithm, and also expands the scale of chromosomes processed during subsequent selection and mutation operations, making it easier for the genetic algorithm to obtain the optimal solution.
[0061] Optionally, constructing multiple chromosomes may include the following step A.
[0062] Step A: Use matrix coding to generate multiple matrices, the first dimension of each matrix is each workpiece to be processed, the second dimension of each matrix is the matrix of each process, and the multiple matrices are used as multiple chromosomes; the first dimension is the row of the matrix, and the second dimension is the column of the matrix; or, the first dimension is the column of the matrix, and the second dimension is the row of the matrix.
[0063] Among them, any element in each matrix is a randomly generated real number, the integer part of any element represents the machine used for the corresponding workpiece to be processed, and the decimal part of any element represents the processing order of the corresponding workpiece to be processed on the used machine.
[0064] Because different permutations and combinations of elements in the same encoding method will construct different chromosomes; different encoding methods not only change the chromosome arrangement form and the decoding method of the algorithm, but also have a great impact on the quality and efficiency of the algorithm. Therefore, it is particularly important to design a simple and feasible encoding scheme that is suitable for the problem to be solved. The embodiment of the present invention adopts a matrix encoding method. Through this encoding method, the first dimension is each workpiece to be processed and the second dimension is a matrix of each required process for the workpiece to be processed, the processing process, the machines that can be used during processing, and the order in which each machine is used to process each workpiece to be processed involved in the actual resource scheduling problem. Each matrix can represent a chromosome, and the process of generating multiple matrices is the process of generating multiple chromosomes. Among them, the first dimension can be the row of the matrix, and the second dimension can be the column of the matrix; or, the first dimension can also be the column of the matrix, and the second dimension can also be the row of the matrix, which is not limited in this embodiment. In an embodiment of the present invention, the elements contained in each matrix can be a randomly generated real number, that is, a random real number with an integer part and a decimal part is used as an element in the matrix, wherein, since the number of machines is not fixed, it is more reasonable to use an integer to represent it. Therefore, the integer part of the real number can be used to represent the machines that can be used for the workpiece to be processed, and the decimal part of the real number can be used to represent the processing order of the workpiece to be processed on a certain machine used by it, wherein, in the first process, the processing order can be arranged in order from small to large according to the randomly generated decimals, but in the second and third processes, it is necessary to combine whether the workpiece has been processed in the previous process to further determine the processing order of the workpiece in the second and third processes.
[0065] For example, as shown in Table 1, there are 12 workpieces to be processed, there are 3 processes, and there are 9 machines that can be used for processing, namely M1-M9, and there are an average of three machines that can be used in each process (such as the first process can correspond to the three machines M1-M3, the second process can correspond to the three machines M4-M6, and the third process can correspond to the three machines M7-M9). Based on these data, multiple matrices can be generated, and each matrix can be a 12*3 matrix. The rows of the matrix correspond to the 12 workpieces to be processed, and the columns correspond to the 3 processes. Specifically, it can be seen in the following formula (1-1); any element x in each matrix can be a randomly generated real number, such as the integer part of any element x in the matrix can be used to represent the element x corresponding to. The serial number of the machine used for the workpiece in a certain process. Since there are 9 machines that can be used in the embodiment of the present invention, and each process corresponds to 3 machines, the integer part of any element x in the matrix can be represented by a number 1-9. For example, the integer part of each element in the first column (first process) of the matrix ranges from [1,3], the integer part of each element in the second column (second process) ranges from [4,6], and the integer part of each element in the third column (third process) ranges from [7,9]. The decimal part of any element x in the matrix can be used to represent the processing order of a machine used in the corresponding process for the workpiece corresponding to the element x, which can be represented by a number 0-9, and the smaller the value, the earlier the processing order. For example, the element in the first row and first column of the matrix can be 1.2, which means that the first workpiece to be processed can use the first machine (M1) in the first process, and the processing order on the machine is 2. The processing order 2 does not mean that the processing order of the workpiece must be 2. Since the decimals are randomly generated, if the minimum value of the generated decimals is 2, then the processing order of the workpiece on the machine is actually the first to be processed.
[0066]
[0067] The matrix coding method adopted in the embodiment of the present invention can determine the number of rows and columns of the matrix used according to the number of data, and regards the matrix as a whole as a genetic individual (chromosome). There is no need to expand the matrix into a string of elements, which can ensure the integrity of the individual gene; and the matrix generated by the matrix coding method has a two-dimensional data structure that enjoys a larger representation space than the one-dimensional data structure, and the crossover and mutation that can be performed by the obtained matrix (chromosome) are more flexible and diversified, thereby increasing the ability to perform subsequent genetic operations, alleviating the occupancy rate of computer memory, and further improving the search efficiency for finding the optimal solution.
[0068] Optionally, generating an initial population comprising at least a plurality of chromosomes may include the following steps B1 or B2.
[0069] Step B1: Use multiple chromosomes as the initial population.
[0070] The initial population is the population generated for the first time, and the initial population is composed of chromosomes, which can be a population directly obtained by merging multiple chromosomes generated in the above step 101. For example, 400 chromosomes can be generated in step 101, and these 400 chromosomes are directly taken as a whole to obtain an initial population of 400.
[0071] Step B2: Perform a crossover operation on the multiple chromosomes to obtain multiple new chromosomes, and use the multiple chromosomes and the multiple new chromosomes as the initial population.
[0072] Under normal circumstances, a population size that is too small will cause a congenital deficiency of effective alleles, and the probability of generating an optimal chromosome is extremely small; a population size that is too large will cause a significant decrease in the convergence speed, so it is necessary to control the number of chromosomes in the generated initial population to a more reasonable size. Preferably, a chromosome with a smaller number can be constructed in the above step 101, and a crossover operation is first performed on the generated multiple chromosomes to expand the number of chromosomes, and the multiple chromosomes initially constructed and the multiple new chromosomes obtained after the crossover operation are taken as a whole, which can be called the initial population. Among them, the crossover operation can be the operation used in the traditional genetic algorithm, for example, the partial elements of two adjacent chromosomes in the multiple chromosomes are cross-exchanged, so as to obtain multiple new chromosomes different from the multiple chromosomes. This can effectively avoid increasing the amount of calculation when generating multiple chromosomes, and can also expand the number of chromosomes contained in the obtained initial population, so that the chromosome coverage rate is higher, and then the probability of containing the optimal chromosome in the initial population is higher.
[0073] Optionally, based on the principle that the smaller the fitness value, the better the corresponding chromosome, performing a selection operation on the first population to obtain the second population may include the following step C.
[0074] Step C: Compare the fitness values of two adjacent chromosomes in the first population in sequence and without repetition, retain the chromosome with the smaller fitness value between the two, and obtain the second population.
[0075] Among them, after obtaining the first population, a selection operation can be performed on the first population. The selection operation adopted in the embodiment of the present invention can be performed directly on two adjacent chromosomes in the first population according to the arrangement order of the chromosomes (such as the positive order from the first chromosome to the last chromosome, or the reverse order from the last chromosome to the first chromosome). The selection operation, and these two adjacent chromosomes will no longer repeat the operation with any other chromosomes after completing one selection operation. The specific process of the selection operation is to compare the fitness values of the two adjacent chromosomes, and retain the chromosome with a smaller fitness value until each chromosome in the first population has undergone a selection process, and the chromosome with a smaller fitness value that is retained is used as the second population.
[0076] For example, the first population has a total of 400 chromosomes. The fitness values of two adjacent chromosomes are compared in order from the 1st chromosome to the 400th chromosome, such as comparing the fitness values of chromosome 1 and chromosome 2, comparing the fitness values of chromosome 3 and chromosome 4... comparing the fitness values of chromosome 399 and chromosome 400. The chromosome with the smaller fitness value between every two adjacent chromosomes is retained, and a second population consisting of 200 chromosomes is obtained.
[0077] The selection operation adopted in the embodiment of the present invention is different from the selection operation in the traditional genetic algorithm. The selection operation in the traditional genetic algorithm needs to set a selection probability in advance, and determines which chromosomes in the population are selected and the number of chromosomes to be selected based on the selection probability. Since the traditional method sets the selection probability, some chromosomes will inevitably not be selected, and these chromosomes that have not undergone the selection operation will be retained and inherited, thus failing to improve the population. However, the embodiment of the present invention does not need to set the selection probability before performing the selection operation, that is, each chromosome in the first population has the opportunity to perform a selection operation, which can increase the possibility of retaining the optimal chromosome.
[0078] Optionally, when the genetic process does not converge, taking the third population and the fourth population as the first population may include the following step D.
[0079] Step D: In the case that no chromosome is used as the expected optimal chromosome of the current round multiple times during the genetic process and the genetic process does not meet the number of cycles, the third population and the fourth population are used as the first population; the expected optimal chromosome of the current round represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round.
[0080] In the embodiment of the present invention, the current round represents the ongoing genetic process; the expected optimal chromosome can represent the optimal chromosome expected to be obtained, such as a certain optimal scheduling scheme expected to be obtained for the resource scheduling problem to be solved; the expected optimal chromosome of the current round means that when the genetic process is executed to obtain the third population and the fourth population, the optimal chromosome in the third population and the fourth population is compared with the expected optimal chromosome in the genetic process of the previous round, and the better chromosome of the two. Among them, the optimal chromosome in the third population and the fourth population refers to: the chromosome corresponding to the minimum fitness value of all chromosomes in the third population and the fourth population in the current round; and each round of the genetic process will obtain an expected optimal chromosome. In the embodiment of the present invention, in the entire multi-round genetic process, if no chromosome is used as the expected optimal chromosome of the current round for multiple times, and the current round does not reach the required number of cycles, it is considered that the genetic process has not reached a convergence state, and the third population and the fourth population of the current round are used as the first population to enter the next round of genetic process.
[0081] For example, in the entire multi-round genetic process, there is no chromosome that is repeated multiple times (such as 30 times) as the expected optimal chromosome of the current round, and the current round does not meet the required number of cycles (such as 200 times), it is determined that the genetic process of the current round has converged, and the third population and the fourth population corresponding to the current round are used as the first population.
[0082] In each round of the genetic process, the embodiment of the present invention determines whether the genetic process of the current round has converged and whether it is necessary to enter the next cycle by comparing the optimal chromosomes in the third population and the fourth population in the current round with the expected optimal chromosomes in the previous round, thereby making the steps of the genetic process of multiple rounds clearer and more specific.
[0083] Optionally, when a certain chromosome does not serve as the expected optimal chromosome of the current round multiple times during the genetic process and the genetic process does not meet the number of cycles, taking the third population and the fourth population as the first population may include the following step E; and may include step E1 or E2 or E3 under different circumstances.
[0084] Step E: Compare the current minimum fitness value with the expected optimal fitness value; the current minimum fitness value is the minimum fitness value of each chromosome in the third population and the fourth population during the current round of genetic process; the expected optimal fitness value is used to refer to the optimal fitness value that can be determined at present.
[0085] In the embodiment of the present invention, when the genetic process is executed to the stage where the fitness values of all chromosomes in the third population and the fourth population have been obtained, the minimum value of the fitness values of all chromosomes in the third population and the fourth population in the current round, that is, the current minimum fitness value, can be determined first, and then the current minimum fitness value can be compared with the expected optimal fitness value. Wherein, in the genetic process of multiple rounds, the expected optimal fitness value used to compare with the current minimum fitness value in each round is: before comparing with the current minimum fitness value, the optimal fitness value that can be determined at this moment. For example, the minimum fitness value (that is, the expected optimal fitness value) determined by comparison during the second cycle is 30, that is, the only expected optimal fitness value corresponding to the second cycle is 30, then when entering the third cycle, if the current minimum fitness value corresponding to the third cycle is 29, the optimal fitness value that can be determined at this moment is the minimum fitness value 30 determined by the second cycle, and then the current minimum fitness value 29 can be compared with the expected optimal fitness value 30 at this time.
[0086] Step E1: When the current minimum fitness value is less than the expected optimal fitness value, the expected optimal fitness value is updated with the current minimum fitness value, the expected optimal chromosome is updated with the chromosome corresponding to the current minimum fitness value, and the number of expected optimal chromosomes is cleared, and the third population and the fourth population are used as the first population.
[0087] In an embodiment of the present invention, when the current minimum fitness value is less than the expected optimal fitness value, that is, when the minimum value of the fitness values of all chromosomes in the third population and the fourth population in the current round is less than the optimal fitness value that can be determined before the comparison, the optimal fitness value (expected optimal fitness value) that can be determined before the comparison is updated with the current minimum fitness value, and the chromosome corresponding to the current minimum fitness value (that is, the chromosome with the smallest fitness value in the third population and the fourth population in the current round) is used to update the chromosome corresponding to the optimal fitness value that can be determined before the comparison (such as the chromosome corresponding to the expected optimal fitness value, that is, the expected optimal chromosome), and at the same time, the record of the number of expected optimal chromosomes is cleared, and the record of the number of expected optimal chromosomes is used to indicate the number of rounds in which the expected optimal chromosome remains unchanged, and the third population and the fourth population are used as the first population to enter the next round of cycles.
[0088] For example, if the minimum value (current minimum fitness value) of the fitness values of all chromosomes in the third and fourth populations of the current round is 29, the corresponding chromosome is b; the optimal fitness value (expected optimal fitness value) that can be determined before comparison is 30, and the corresponding chromosome is a. By comparison, it can be determined that the current minimum fitness value is less than the expected optimal fitness value. In this case, the expected optimal fitness value 30 can be updated with the current minimum fitness value 29, that is, the expected optimal fitness value after comparison is updated from 30 to 29; and the chromosome b corresponding to the current minimum fitness value 29 is used to update the chromosome a corresponding to the expected optimal fitness value 30, that is, the expected optimal chromosome after comparison is updated from chromosome a to chromosome b; and the counter for recording the expected optimal chromosome can be cleared. And, the third population and the fourth population are used as the first population to enter the next round of cycles. Among them, clearing is used to indicate that the genetic process of the current round has produced a chromosome that is better than the expected optimal chromosome recorded previously, so the better chromosome should be counted again.
[0089] Step E2: When the current minimum fitness value is equal to the expected optimal fitness value, determine whether the chromosome corresponding to the current minimum fitness value is consistent with the expected optimal chromosome. If so, increase the number record of the expected optimal chromosome. If not, update the expected optimal chromosome with the chromosome corresponding to the current minimum fitness value, and clear the number record of the expected optimal chromosome. Take the third population and the fourth population as the first population.
[0090] Among them, the fitness values obtained by calculation for the same chromosome must be the same, and different chromosomes can also obtain the same fitness value through calculation. That is to say, one fitness value can correspond to multiple different chromosomes. For example, there can be multiple different scheduling schemes that can achieve a certain total processing time during processing. In an embodiment of the present invention, when the current minimum fitness value is equal to the expected optimal fitness value, that is, when the minimum value of the fitness values of all chromosomes in the third population and the fourth population in the current round is equal to the optimal fitness value that can be determined before the comparison, it can be determined whether the chromosome corresponding to the current minimum fitness value is the same as the chromosome corresponding to the optimal fitness value that can be determined before the comparison (the expected optimal chromosome). If the two are the same, it means that the expected optimal chromosome has been repeated in the current round and has not changed. Therefore, the number record of the expected optimal chromosome can be increased, and the third population and the fourth population are used as the first population; if the two are different, it means that the chromosome corresponding to the current minimum fitness value is another feasible solution different from the expected optimal chromosome. The chromosome corresponding to the current minimum fitness value can be used to update the expected optimal chromosome, and the number record of the expected optimal chromosome is cleared. The third population and the fourth population are used as the first population for entering the next round of cycles.
[0091] For example, if the minimum value (current minimum fitness value) of the fitness values of all chromosomes in the third and fourth populations of the current round is 29, and the optimal fitness value (expected optimal fitness value) that can be determined before comparison is 29, it can be determined by comparison that the current minimum fitness value is equal to the expected optimal fitness value. In this case, it can be determined whether the chromosome corresponding to the current minimum fitness value 29 is the same as the chromosome corresponding to the optimal fitness value 29 that can be determined before comparison (expected optimal chromosome). If the two are the same and are both chromosome a, the counter used to record the number of expected optimal chromosomes can be directly increased by one; if the chromosome corresponding to the current minimum fitness value 29 is b and the chromosome corresponding to the optimal fitness value 29 that can be determined before comparison (expected optimal chromosome) is a, and the two are different, the chromosome b corresponding to the current minimum fitness value can be used to update the expected optimal chromosome from a to b, and the counter used to record the expected optimal chromosome number is cleared, and the third population and the fourth population are used as the first population to enter the next round of cycles.
[0092] Step E3: When the current minimum fitness value is greater than the expected optimal fitness value, the expected optimal fitness value and the expected optimal chromosome are maintained unchanged, and the third population and the fourth population are used as the first population.
[0093] In an embodiment of the present invention, when the current minimum fitness value is greater than the expected optimal fitness value, that is, when the minimum value of the fitness values of all chromosomes in the third population and the fourth population in the current round is greater than the optimal fitness value that can be determined before the comparison, it means that the current minimum fitness value obtained in the current round of the cycle is inferior to the expected optimal fitness value obtained before, and accordingly, the chromosome corresponding to the current minimum fitness value must also be inferior to the expected optimal chromosome corresponding to the expected optimal fitness value. In this case, the expected optimal fitness value that is better in comparison and its corresponding expected optimal chromosome can be kept unchanged, that is, without any updating or clearing operations, the third population and the fourth population are directly used as the first population to enter the next round of the cycle.
[0094] Optionally, cyclically executing the genetic process on the first population until the genetic process converges, and taking the chromosome corresponding to the minimum fitness value as the optimal solution may include the following steps F1 or F2.
[0095] Step F1: cyclically execute the genetic process on the first population until the genetic process has satisfied the number of cycles, and take the chromosome corresponding to the minimum fitness value when satisfying the number of cycles as the optimal solution.
[0096] Among them, in the genetic process of executing multiple rounds of the first population in a loop, when the genetic process reaches a converged state, it can be determined that it is no longer necessary to continue to execute the next round of the genetic process, that is, the loop can be jumped out at this time. In the embodiment of the present invention, the number of cycles meeting a certain value can be regarded as the genetic process reaching convergence. For example, when the genetic process of executing multiple rounds of the first population in a loop has been executed 200 times, it can be considered that the genetic process has converged at this time (in fact, it may not have converged yet, but it can be considered that it has converged at this time and does not need to continue iterating), and it is not necessary to enter the next round of the loop, and the entire loop process can be directly jumped out. At this time, the minimum value of the minimum fitness values corresponding to each round in all rounds experienced during convergence (such as 200 times) can be taken as the minimum fitness value when the number of cycles is met, and the chromosome corresponding to the minimum fitness value when the number of cycles is met can be taken as the optimal solution; alternatively, the minimum value of the fitness values of all chromosomes in the current round can be compared with the expected optimal fitness value of the previous round, and the smaller value between the two can be selected as the minimum fitness value when the number of cycles is met, and the chromosome corresponding to the minimum fitness value when the number of cycles is met can be taken as the optimal solution.
[0097] Step F2: cyclically execute the genetic process for the first population, and when a certain chromosome is used as the expected optimal chromosome multiple times, the chromosome used as the expected optimal chromosome multiple times is used as the optimal solution. The expected optimal chromosome represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round; the fitness value corresponding to the expected optimal chromosome is the expected optimal fitness value, and the expected optimal fitness value represents the smaller value between the minimum value of the fitness values in the third population and the fourth population and the expected optimal fitness value in the previous round.
[0098] Alternatively, in an embodiment of the present invention, when there is a chromosome that is used as the expected optimal chromosome many times in the genetic process of multiple rounds, the genetic process can be regarded as having reached convergence. For example, when the genetic process of multiple rounds is cyclically executed on the first population, when a certain chromosome appears as the expected optimal chromosome many times (such as 30 times), it can be considered that the genetic process has converged at this time, and there is no need to enter the next round of the cycle, and the entire cycle process can be directly jumped out. At this time, the chromosome that is used as the expected optimal chromosome many times (such as 30 times) corresponding to the convergence can be used as the optimal solution.
[0099] The embodiment of the present invention adopts two methods to determine whether the genetic process converges. One is to use the law that multiple rounds of genetic processes will gradually converge after iterating through a certain number of cycles. When the cycle process cycles to the number of cycles, it can be determined that the entire genetic process converges at this time; the other is that when there is a chromosome that can be used as the expected optimal chromosome many times in the cycle process, it can also be considered that the entire genetic process converges at this time, that is, as long as a chromosome has been used as the expected optimal chromosome many times in the genetic process of the current round, even if it has not cycled to the cycle round when the genetic process is usually close to convergence, it can be determined in advance that the genetic process has reached convergence. This method can control the progress of the entire genetic process more flexibly, and can make a more accurate judgment on whether it converges.
[0100] Optionally, before executing the genetic process on the first population cycle, the method may further include: presetting a mutation probability and a crossover probability, wherein the mutation probability is used to determine whether to perform a mutation operation on the chromosome, and the crossover probability is used to determine whether to perform a crossover operation on the chromosome.
[0101] In an embodiment of the present invention, the mutation probability and the crossover probability can be preset in advance before performing the mutation operation and the crossover operation. The mutation probability and the crossover probability are preset so as to determine whether the currently targeted chromosome needs to be subjected to the mutation operation and the crossover operation through the corresponding probabilities; and based on the mutation probability, the number of chromosomes that can be mutated in the population on which the mutation operation is performed can be determined. Similarly, based on the crossover probability, the number of chromosomes that can be crossed in the population on which the crossover operation is performed can also be determined.
[0102] Normally, if the value of the mutation probability is too small, it is not easy to generate a new chromosome structure; if the value is too large, the genetic algorithm will become a pure random search algorithm, and it will not be able to perform targeted search and step-by-step optimization. Therefore, the implementation of the present invention can set the mutation probability to a relatively small value, such as about 0.05. Such a value can generate new chromosomes through mutation, and there is no excessive number of chromosomes that are mutated, which leads to the situation that the random search cannot be converged. The larger the value of the crossover probability, the faster the new chromosomes are generated, so the possibility of the structure of the better chromosome being destroyed will be higher; if the crossover probability is set too small, the search process will be slow or even stagnant. Therefore, the embodiment of the present invention can set the crossover probability to a relatively large value, such as about 0.9. Such a value can quickly generate new chromosomes and reduce the situation of better chromosomes being destroyed, and at the same time can improve the search speed.
[0103] The performing of the mutation operation on the second population includes: generating a mutation random number for each chromosome in the second population respectively, and when the mutation random number is less than the mutation probability, performing the mutation operation on the chromosome in the second population corresponding to the mutation random number.
[0104] In an embodiment of the present invention, after the mutation probability is preset, a mutation random number can be randomly generated for each chromosome in the second population, and the mutation random number is compared with the preset mutation probability. If the mutation random number of a chromosome is less than the preset mutation probability, the mutation operation is performed on the chromosome; if the mutation random number of a chromosome is not less than the preset mutation probability, the mutation operation is not performed on the chromosome.
[0105] Performing a crossover operation on the third population includes: sequentially and non-repetitively generating a crossover random number for two adjacent chromosomes in the third population, and when the crossover random number is less than the crossover probability, performing at least a partial row crossover operation on the two adjacent chromosomes corresponding to the crossover random number.
[0106] In the embodiment of the present invention, after the crossover probability is preset, a crossover random number can be randomly generated for each two adjacent chromosomes in the third population, wherein the two adjacent chromosomes selected each time can be selected according to the arrangement order of the chromosomes (such as the positive order from the first chromosome to the last chromosome, or the reverse order from the last chromosome to the first chromosome), and after the two adjacent chromosomes are selected and the corresponding crossover random numbers are generated, the crossover random numbers will no longer be repeatedly generated with other chromosomes. In the embodiment of the present invention, the crossover random number can be compared with the preset crossover probability. If the crossover random number of two adjacent chromosomes is less than the preset crossover probability, a crossover operation is performed on the two adjacent chromosomes, and the crossover operation is to cross-exchange the elements corresponding to some rows of the two adjacent chromosomes (i.e., row crossover); if the crossover random number of two adjacent chromosomes is not less than the preset crossover probability, the crossover operation is not performed on the two adjacent chromosomes.
[0107] The embodiment of the present invention can control the proportion of new genes introduced into the population by presetting the mutation probability, thereby affecting the diversity of the population; by presetting the crossover probability, it can prevent premature convergence while improving the convergence speed. This method can not only control the genetic process to gradually move towards a state closer to convergence, but also improve the speed of searching for better chromosomes; and, by selecting a row crossover method to perform the crossover operation, in the actual resource scheduling engineering problem to be solved, for example, when different processes are regarded as different columns, if the traditional column crossover method is used, it is impossible to disrupt the processing order of each workpiece in different processes, but by using the row crossover method proposed by the present method, the processing order of different workpieces in the first process can be disrupted, thereby affecting the subsequent processing order of the second and third processes, thereby enriching the population size.
[0108] The resource scheduling method flow is described in detail below through an embodiment. Figure 3 As shown, the method includes the following steps 301-315.
[0109] Step 301: Obtain processing time data and randomly construct 200 chromosomes.
[0110] The processing time data is the processing time corresponding to each process when each machine performs each process on each workpiece to be processed; the chromosome represents the workpieces to be processed by different machines in each process and their processing order.
[0111] Step 302: determine the fitness function, and set the expected optimal fitness value, the expected optimal chromosome, and a counter for recording the expected optimal chromosome.
[0112] The fitness function is used to calculate the total processing time of all workpieces. The expected optimal fitness value and the expected optimal chromosome can be empty when initially set.
[0113] Step 303: Perform a crossover operation on the 200 chromosomes to obtain 200 new chromosomes, and use the 200 chromosomes and the 200 new chromosomes obtained by the crossover as the initial population.
[0114] Among them, the size of the initial population is 400.
[0115] Step 304: Take the initial population as the first population, calculate the fitness values of the 400 chromosomes in the first population, and obtain 400 fitness values corresponding to the 400 chromosomes.
[0116] The fitness value may be calculated based on the determined fitness function and the acquired processing time data, which will not be described in detail here.
[0117] Step 305: Perform a selection operation on the 400 chromosomes in the first population to obtain a second population with 200 chromosomes.
[0118] Step 306: Perform a mutation operation on the 200 chromosomes in the second population to obtain a third population with 200 chromosomes.
[0119] Step 307: Perform a crossover operation on the 200 chromosomes in the third population to obtain a fourth population with 200 chromosomes, calculate the fitness values of a total of 400 chromosomes in the third and fourth populations, and select the minimum value of the 400 fitness values as the current minimum fitness value.
[0120] Step 308: Determine whether the current minimum fitness value is less than the expected optimal fitness value. If so, execute step 309; if so, execute step 310; if so, execute step 313.
[0121] Step 309: Replace the expected optimal fitness value with the current minimum fitness value, and update the expected optimal chromosome to the chromosome corresponding to the current minimum fitness value, and clear the counter for recording the expected optimal chromosome, and continue to execute step 313.
[0122] Step 310: Determine whether the chromosome corresponding to the current minimum fitness value is consistent with the expected optimal chromosome. If so, execute step 311; otherwise, execute step 312.
[0123] Step 311: add one to the value of the counter used to record the expected optimal chromosome, and proceed to step 313.
[0124] Step 312: Replace the expected optimal chromosome with the chromosome corresponding to the current minimum fitness value, and clear the counter used to record the expected optimal chromosome, and continue to execute step 313.
[0125] Step 313: The third population and the fourth population are used as the first population, and step 305 is executed repeatedly until the counter value reaches 30 or the number of cycles reaches 200.
[0126] Step 314: The chromosome corresponding to when the counter value is 30, that is, the chromosome that is the expected optimal chromosome for the 30th time, is taken as the optimal solution; or when no chromosome is taken as the expected optimal chromosome for a total of 30 times, the chromosome corresponding to the minimum fitness value corresponding to 200 cycles is taken as the optimal solution.
[0127] Step 315: Process the workpiece according to the optimal solution.
[0128] The resource scheduling method provided by the embodiment of the present invention is described in detail above. The method can also be implemented by a corresponding device. The resource scheduling device provided by the embodiment of the present invention is described in detail below.
[0129] Figure 4 FIG. 1 is a schematic diagram showing the structure of a resource scheduling device provided by an embodiment of the present invention. Figure 4 As shown, the resource scheduling device includes: an acquisition module 41, a determination function module 42, a calculation module 43 and a circulation module 44.
[0130] The acquisition module 41 is used to acquire processing time data and construct multiple chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosome represents the workpiece to be processed by each machine in each process and the processing order.
[0131] The function determination module 42 is used to determine a fitness function, and the fitness function is used to calculate the total processing time for completing all processes for all workpieces.
[0132] The calculation module 43 is used to generate an initial population including at least the plurality of chromosomes, and calculate the fitness value of each chromosome in the initial population based on the processing time data and the fitness function.
[0133] The loop module 44 is used to use the initial population as the first population, cyclically execute the genetic process on the first population until the genetic process converges, use the chromosome corresponding to the minimum fitness value as the optimal solution, and process the workpiece to be processed according to the optimal solution.
[0134] The circulation module 44 includes: a selection unit, a mutation unit, a crossover unit, a calculation unit and an arrangement unit.
[0135] The selection unit is used to perform a selection operation on the first population to obtain a second population based on the principle that the smaller the fitness value, the better the corresponding chromosome.
[0136] The mutation unit is used to perform a mutation operation on the second population to obtain a third population.
[0137] The crossover unit is used to perform a crossover operation on the third population to obtain a fourth population.
[0138] The calculation unit is used to calculate the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function.
[0139] The sorting unit is used for taking the third population and the fourth population as the first population when the genetic process has not converged.
[0140] Optionally, the acquisition module 41 includes: a construction unit.
[0141] The construction unit is used to generate multiple matrices using matrix coding, the first dimension of each matrix is each workpiece to be processed, the second dimension of each matrix is the matrix of each process, and the multiple matrices are used as the multiple chromosomes; the first dimension is the row of the matrix, and the second dimension is the column of the matrix; or, the first dimension is the column of the matrix, and the second dimension is the row of the matrix. Wherein, any element in each matrix is a randomly generated real number, the integer part of any element represents the machine used by the corresponding workpiece to be processed, and the decimal part of any element represents the processing order of the corresponding workpiece to be processed on the machine used.
[0142] Optionally, the calculation module 43 includes: a first component unit or a first component unit.
[0143] The first building unit is used to use the multiple chromosomes as the initial population.
[0144] The second assembly unit is used to perform the crossover operation on the multiple chromosomes to obtain multiple new chromosomes, and use the multiple chromosomes and the multiple new chromosomes as the initial population.
[0145] Optionally, the selection unit is used to compare the fitness values of two adjacent chromosomes in the first population in sequence and without repetition, retain the chromosome with the smaller fitness value between the two, and obtain the second population.
[0146] Optionally, the sorting unit is used to use the third population and the fourth population as the first population when there is no chromosome that is used as the expected optimal chromosome of the current round multiple times during the genetic process and the genetic process does not meet the number of cycles; the expected optimal chromosome of the current round represents the best chromosome in the third population and the fourth population and the better chromosome in the expected optimal chromosome of the previous round.
[0147] Optionally, the sorting unit includes: a comparison subunit, an update subunit, a judgment subunit and a maintenance subunit.
[0148] The comparison subunit is used to compare the current minimum fitness value with the expected optimal fitness value; the current minimum fitness value is the minimum fitness value of each chromosome in the third population and the fourth population during the genetic process of the current round; the expected optimal fitness value is used to refer to the optimal fitness value that can be determined currently.
[0149] The updating subunit is used to update the expected optimal fitness value with the current minimum fitness value when the current minimum fitness value is less than the expected optimal fitness value, update the expected optimal chromosome with the chromosome corresponding to the current minimum fitness value, and clear the record of the number of the expected optimal chromosomes, and use the third population and the fourth population as the first population.
[0150] The judgment subunit is used to judge whether the chromosome corresponding to the current minimum fitness value is consistent with the expected optimal chromosome when the current minimum fitness value is equal to the expected optimal fitness value. If so, the number record of the expected optimal chromosome is increased; if not, the expected optimal chromosome is updated with the chromosome corresponding to the current minimum fitness value, and the number record of the expected optimal chromosome is cleared; the third population and the fourth population are used as the first population.
[0151] The maintaining subunit is used for maintaining the expected optimal fitness value and the expected optimal chromosome unchanged when the current minimum fitness value is greater than the expected optimal fitness value, and taking the third population and the fourth population as the first population.
[0152] Optionally, the circulation module 44 includes: a first circulation unit or a second circulation unit.
[0153] The first cycle unit is used to cyclically execute the genetic process on the first population until the genetic process has met the cycle number, and the chromosome corresponding to the minimum fitness value when the cycle number is met is taken as the optimal solution.
[0154] The second cycle unit is used to cyclically execute the genetic process on the first population, and when a certain chromosome is used as the expected optimal chromosome multiple times, the chromosome that is used as the expected optimal chromosome multiple times is used as the optimal solution; wherein the expected optimal chromosome represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round; the fitness value corresponding to the expected optimal chromosome is the expected optimal fitness value, and the expected optimal fitness value represents the smaller value between the minimum value of the fitness values in the third population and the fourth population and the expected optimal fitness value in the previous round.
[0155] Optionally, the device further includes: a preset module.
[0156] The preset module is used to preset the mutation probability and the crossover probability, wherein the mutation probability is used to determine whether to perform a mutation operation on the chromosome, and the crossover probability is used to determine whether to perform a crossover operation on the chromosome.
[0157] The mutation unit is used to generate a mutation random number for each chromosome in the second population respectively, and when the mutation random number is less than the mutation probability, perform a mutation operation on the chromosome in the second population corresponding to the mutation random number.
[0158] The crossover unit is used to sequentially and non-repetitively generate a crossover random number for two adjacent chromosomes in the third population, and when the crossover random number is less than the crossover probability, perform at least a partial row crossover operation on the two adjacent chromosomes corresponding to the crossover random number.
[0159] The device provided by the embodiment of the present invention, when facing certain complex resource scheduling problems, changes the inherent operation process sequence of the traditional genetic algorithm, and changes the traditional sequence from selection, crossover, and mutation to selection, mutation, and crossover. The device can greatly reduce the amount of data required to be processed during mutation. At the same time, there is no need to generate a large number of chromosomes in the initial stage of generating multiple chromosomes. Instead, only a small number of chromosomes can be generated, and the purpose of expanding the population is achieved through crossover, which reduces the amount of calculation caused by the initial generation of a large number of chromosomes, improves the processing speed of the entire genetic algorithm, and also expands the scale of chromosomes processed during subsequent selection and mutation operations, making it easier for the genetic algorithm to obtain the optimal solution.
[0160] In addition, an embodiment of the present invention further provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor. The transceiver, the memory, and the processor are respectively connected via a bus. When the computer program is executed by the processor, each process of the above-mentioned resource scheduling method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0161] For details, see Figure 5 As shown, an embodiment of the present invention further provides an electronic device, which includes a bus 1110 , a processor 1120 , a transceiver 1130 , a bus interface 1140 , a memory 1150 and a user interface 1160 .
[0162] In the embodiment of the present invention, the electronic device further includes: a computer program stored in the memory 1150 and executable on the processor 1120, and when the computer program is executed by the processor 1120, each process of the above-mentioned resource scheduling method embodiment is implemented.
[0163] The transceiver 1130 is configured to receive and send data under the control of the processor 1120 .
[0164] In an embodiment of the present invention, the bus architecture (represented by bus 1110), bus 1110 may include any number of interconnected buses and bridges, and bus 1110 connects various circuits including one or more processors represented by processor 1120 and a memory represented by memory 1150.
[0165] Bus 1110 represents one or more of any of several types of bus structures, including a memory bus and memory controller, a peripheral bus, an Accelerate Graphical Port (AGP), a processor, or a local bus using any of a variety of bus architectures. By way of example and not limitation, such architectures include: Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA), Peripheral Component Interconnect (PCI) bus.
[0166] The processor 1120 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment may be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processors include: a general-purpose processor, a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a programmable logic array (PLA), a microcontroller unit (MCU) or other programmable logic devices, discrete gates, transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. For example, the processor may be a single-core processor or a multi-core processor, and the processor may be integrated into a single chip or located in multiple different chips.
[0167] Processor 1120 can be a microprocessor or any conventional processor. The method steps disclosed in conjunction with the embodiments of the present invention can be directly executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a readable storage medium known in the art, such as a random access memory (RAM), a flash memory (FlashMemory), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a register, etc. The readable storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware.
[0168] The bus 1110 may also connect various other circuits such as peripheral devices, voltage regulators or power management circuits, and the bus interface 1140 provides an interface between the bus 1110 and the transceiver 1130, which are well known in the art. Therefore, the embodiments of the present invention will not be further described.
[0169] The transceiver 1130 may be one element or multiple elements, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices on a transmission medium. For example, the transceiver 1130 receives external data from other devices, and the transceiver 1130 is used to send data processed by the processor 1120 to other devices. Depending on the nature of the computer system, a user interface 1160 may also be provided, such as a touch screen, a physical keyboard, a display, a mouse, a speaker, a microphone, a trackball, a joystick, and a stylus.
[0170] It should be understood that in an embodiment of the present invention, the memory 1150 may further include a memory remotely arranged relative to the processor 1120, and these remotely arranged memories may be connected to the server through a network. One or more parts of the above-mentioned network may be an ad hoc network, an intranet, an extranet, a virtual private network (VPN), a local area network (LAN), a wireless local area network (WLAN), a wide area network (WAN), a wireless wide area network (WWAN), a metropolitan area network (MAN), the Internet, a public switched telephone network (PSTN), a plain old telephone service network (POTS), a cellular telephone network, a wireless network, a wireless fidelity (Wi-Fi) network, and a combination of two or more of the above-mentioned networks. For example, the cellular telephone network and the wireless network can be a Global System for Mobile Communications (GSM) system, a Code Division Multiple Access (CDMA) system, a Worldwide Interoperability for Microwave Access (WiMAX) system, a General Packet Radio Service (GPRS) system, a Wideband Code Division Multiple Access (WCDMA) system, a Long Term Evolution (LTE) system, a LTE Frequency Division Duplex (FDD) system, a LTE Time Division Duplex (TDD) system, an Advanced Long Term Evolution (LTE-A) system, a Universal Mobile Telecommunications (UMTS) system, an Enhanced Mobile Broadband (Enhance Mobile Broadband, eMBB) system, a massive Machine Type of Communication (mMTC) system, an Ultra-Reliable Low Latency Communications (UltraReliable Low Latency Communications, uRLLC) system, etc.
[0171] It should be understood that the memory 1150 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory includes: a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
[0172] Volatile memory includes: Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as: Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM) and Direct Rambus RAM (DRRAM). The memory 1150 of the electronic device described in the embodiment of the present invention includes but is not limited to the above and any other suitable types of memory.
[0173] In the embodiment of the present invention, the memory 1150 stores the following elements of the operating system 1151 and the application program 1152: executable modules, data structures, or subsets thereof, or extended sets thereof.
[0174] Specifically, the operating system 1151 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 1152 includes various applications, such as a media player (Media Player) and a browser (Browser), which are used to implement various application services. The program for implementing the method of the embodiment of the present invention may be included in the application 1152. The application 1152 includes applets, objects, components, logic, data structures, and other computer system executable instructions that perform specific tasks or implement specific abstract data types.
[0175] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned resource scheduling method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0176] Computer readable storage media include: permanent and non-permanent, removable and non-removable media, which are tangible devices that can retain and store instructions for use by instruction execution devices. Computer readable storage media include: electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, and any suitable combination of the above. Computer readable storage media include: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette storage, magnetic tape disk storage or other magnetic storage devices, memory sticks, mechanical encoding devices (such as punched cards or raised structures in grooves with instructions recorded thereon) or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined in the embodiments of the present invention, computer-readable storage media do not include temporary signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (such as light pulses passing through fiber optic cables), or electrical signals transmitted through wires.
[0177] In the several embodiments provided in the present application, it should be understood that the disclosed devices, electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0178] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one location or distributed on multiple network units. Some or all of the units may be selected according to actual needs to solve the problem to be solved by the embodiments of the present invention.
[0179] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0180] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (including: a personal computer, a server, a data center or other network device) to perform all or part of the steps of the method described in each embodiment of the present invention. The above-mentioned storage medium includes various media that can store program codes as listed above.
[0181] In the description of the embodiments of the present invention, those skilled in the art should know that the embodiments of the present invention can be implemented as methods, devices, electronic devices and computer-readable storage media. Therefore, the embodiments of the present invention can be specifically implemented in the following forms: complete hardware, complete software (including firmware, resident software, microcode, etc.), a combination of hardware and software. In addition, in some embodiments, the embodiments of the present invention can also be implemented in the form of a computer program product in one or more computer-readable storage media, and the computer-readable storage medium contains computer program code.
[0182] The above-mentioned computer-readable storage medium may adopt any combination of one or more computer-readable storage media. Computer-readable storage media include: electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM), flash memories, optical fibers, compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices or any combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device, or device.
[0183] The computer program code contained in the above-mentioned computer-readable storage medium can be transmitted using any appropriate medium, including: wireless, wire, optical cable, radio frequency (RF) or any suitable combination thereof.
[0184] The computer program code for performing the operation of the embodiments of the present invention can be written in assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or in one or more programming languages or a combination thereof, wherein the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as C language or a similar programming language. The computer program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, and completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer or to an external computer through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0185] The embodiments of the present invention describe the provided methods, devices, and electronic devices through flowcharts and / or block diagrams.
[0186] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions. These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer-readable program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified by the boxes in the flowchart and / or block diagram.
[0187] These computer-readable program instructions may also be stored in a computer-readable storage medium that enables a computer or other programmable data processing device to work in a specific manner. In this way, the instructions stored in the computer-readable storage medium produce an instruction device product including functions / operations specified in the blocks in the flowchart and / or block diagram.
[0188] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable data processing apparatus to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0189] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the embodiment of the present invention, which should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.
Claims
1. A resource scheduling method, characterized in that: include: Acquire processing time data and construct a plurality of chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosomes represent the workpiece to be processed by each machine and the processing order in each process; Determining a fitness function, wherein the fitness function is used to calculate the total processing time for completing all processes for all workpieces; Generate an initial population including at least the plurality of chromosomes, and calculate the fitness value of each chromosome in the initial population based on the processing time data and the fitness function; The initial population is used as a first population, and a genetic process is cyclically performed on the first population until the genetic process converges, and the chromosome corresponding to the minimum fitness value is used as an optimal solution, and the workpiece to be processed is processed according to the optimal solution; The genetic process includes: Comparing the fitness values of two adjacent chromosomes in the first population in sequence and without repetition, retaining the chromosome with the smaller fitness value between the two, to obtain a second population; Randomly selecting chromosomes from the second population to perform mutation operation to obtain a third population; the third population includes the mutated chromosomes and the chromosomes not selected from the second population; Performing a crossover operation on the third population to obtain a fourth population; Calculating the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function; In the case that the genetic process does not converge, the third population and the fourth population are used as the first population.
2. The method according to claim 1, characterized in that The constructing of multiple chromosomes comprises: A plurality of matrices are generated by using matrix coding, wherein the first dimension of each matrix is each workpiece to be processed, and the second dimension of each matrix is each process, and the plurality of matrices are used as the plurality of chromosomes; the first dimension is the row of the matrix, and the second dimension is the column of the matrix; or, the first dimension is the column of the matrix, and the second dimension is the row of the matrix; Among them, any element in each of the matrices is a randomly generated real number, the integer part of any element represents the machine used for the corresponding workpiece to be processed, and the decimal part of any element represents the processing order of the corresponding workpiece to be processed on the used machine.
3. The method according to claim 1, characterized in that The generating of an initial population at least comprising the plurality of chromosomes comprises: Using the plurality of chromosomes as the initial population; or, The crossover operation is performed on the multiple chromosomes to obtain multiple new chromosomes, and the multiple chromosomes and the multiple new chromosomes are used as the initial population.
4. The method according to claim 1, characterized in that: When the genetic process does not converge, the third population and the fourth population are used as the first population, comprising: In the case that no chromosome is used as the expected optimal chromosome of the current round multiple times during the genetic process and the genetic process does not meet the number of cycles, the third population and the fourth population are used as the first population; the expected optimal chromosome of the current round represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round.
5. The method according to claim 4, characterized in that In the genetic process, when no chromosome is used as the expected optimal chromosome of the current round multiple times and the genetic process does not meet the cycle number, the third population and the fourth population are used as the first population, including: Comparing the current minimum fitness value with the expected optimal fitness value; the current minimum fitness value is the minimum fitness value of each chromosome in the third population and the fourth population in the genetic process of the current round; the expected optimal fitness value is used to refer to the optimal fitness value that can be determined currently; In the case where the current minimum fitness value is less than the expected optimal fitness value, the expected optimal fitness value is updated with the current minimum fitness value, the expected optimal chromosome is updated with the chromosome corresponding to the current minimum fitness value, and the number record of the expected optimal chromosome is cleared, and the third population and the fourth population are used as the first population; In the case where the current minimum fitness value is equal to the expected optimal fitness value, determining whether the chromosome corresponding to the current minimum fitness value is consistent with the expected optimal chromosome, if so, increasing the number record of the expected optimal chromosome, if not, updating the expected optimal chromosome with the chromosome corresponding to the current minimum fitness value, and clearing the number record of the expected optimal chromosome; taking the third population and the fourth population as the first population; When the current minimum fitness value is greater than the expected optimal fitness value, the expected optimal fitness value and the expected optimal chromosome are maintained unchanged, and the third population and the fourth population are used as the first population.
6. The method according to claim 1, characterized in that The step of cyclically executing the genetic process on the first population until the genetic process converges, and taking the chromosome corresponding to the minimum fitness value as the optimal solution, includes: Cyclic execution of the genetic process on the first population until the genetic process has satisfied the number of cycles, and taking the chromosome corresponding to the minimum fitness value when satisfying the number of cycles as the optimal solution; or cyclically executing the genetic process on the first population, and when a certain chromosome is used as the expected optimal chromosome multiple times, taking the chromosome used as the expected optimal chromosome multiple times as the optimal solution; Among them, the expected optimal chromosome represents the better chromosome between the best chromosomes in the third population and the fourth population and the expected optimal chromosome in the previous round; the fitness value corresponding to the expected optimal chromosome is the expected optimal fitness value, and the expected optimal fitness value represents the smaller value between the minimum value of the fitness values in the third population and the fourth population and the expected optimal fitness value in the previous round.
7. The method according to claim 1, characterized in that Before the genetic process is cyclically performed on the first population, the method further includes: presetting a mutation probability and a crossover probability, wherein the mutation probability is used to determine whether to perform a mutation operation on the chromosome, and the crossover probability is used to determine whether to perform a crossover operation on the chromosome; The randomly selecting a chromosome from the second population for mutation operation comprises: generating a mutation random number for each chromosome in the second population respectively, and when the mutation random number is less than the mutation probability, performing a mutation operation on the chromosome in the second population corresponding to the mutation random number; The performing of the crossover operation on the third population includes: sequentially and non-repetitively generating a crossover random number for two adjacent chromosomes in the third population, and when the crossover random number is less than the crossover probability, performing at least a partial row crossover operation on the two adjacent chromosomes corresponding to the crossover random number.
8. A resource scheduling device, characterized in that: include: Acquisition module, determination function module, calculation module and loop module; The acquisition module is used to acquire processing time data and construct a plurality of chromosomes; the processing time data includes the processing time corresponding to each process when each machine performs at least part of the process on each workpiece to be processed, and the chromosome represents the workpiece to be processed by each machine in each process and the processing order; The determination function module is used to determine a fitness function, and the fitness function is used to calculate the total processing time for completing all processes for all workpieces; The calculation module is used to generate an initial population including at least the plurality of chromosomes, and calculate the fitness value of each chromosome in the initial population based on the processing time data and the fitness function; The circulation module is used to use the initial population as the first population, cyclically execute the genetic process on the first population until the genetic process converges, use the chromosome corresponding to the minimum fitness value as the optimal solution, and process the workpiece to be processed according to the optimal solution; The circulation module includes: a selection unit, a mutation unit, a crossover unit, a calculation unit and a sorting unit; The selection unit is used to compare the fitness values of two adjacent chromosomes in the first population in sequence and without repetition, retain the chromosome with the smaller fitness value between the two, and obtain the second population; The mutation unit is used to randomly select chromosomes from the second population to perform mutation operation to obtain a third population; the third population includes the mutated chromosomes and the chromosomes not selected from the second population; The crossover unit is used to perform a crossover operation on the third population to obtain a fourth population; The calculation unit is used to calculate the fitness value of each chromosome in the third population and the fourth population according to the processing time data and the fitness function; The sorting unit is used for taking the third population and the fourth population as the first population when the genetic process has not converged.
9. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps in the resource scheduling method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the resource scheduling method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Flexible job shop order insertion dynamic scheduling optimization method
CN107831745A
Multi-target flexible job shop scheduling method based on improved ecological niche genetic algorithm
CN111222642A
Printing and binding job scheduling optimization method based on genetic algorithm
CN111985647A