Background
Compared with the common mechanical equipment, the large mechanical equipment has a plurality of specialities, the manufacturing equipment for producing the large mechanical equipment such as a motor with a large fan blade or an engine of a large bus is expensive, small in quantity and single, the storage order of the line edge storage capacity of raw materials is generally the number, and the production process is not smooth due to the fact that the line body blocking phenomenon is easily generated in the special production and manufacturing environment, so that the production efficiency is reduced, and even the product quality is reduced. Therefore, the urgency and the significance of scientific production scheduling in the field of production of large mechanical equipment in the complex scene are shown.
The existing mathematical models such as genetic algorithm, simulated annealing algorithm or particle swarm algorithm for production scheduling are established based on an ideal state, the complexity of the problems of raw material library capacity limitation, line side library capacity and line body blockage is not considered, the problem of simple production scheduling is solved ideally, but the practical and effective guiding significance cannot be brought to the production and processing process of large-scale mechanical equipment.
Disclosure of Invention
The invention provides a complex scene production scheduling method and system based on a quantum evolutionary algorithm, which are applied to the field of production scheduling of large-scale mechanical equipment with complex scenes represented by reservoir capacity constraint and line blockage, and aims to solve the problems that the existing production scheduling method for large-scale mechanical equipment production is too ideal, short in production scheduling time, low in utilization rate of reservoir capacity raw materials and the like.
In order to achieve the purpose, the invention adopts the following technical scheme:
a complex scene scheduling method based on a quantum evolution algorithm comprises the following steps:
step (1): initializing a quantum population: initializing quantum population evolution algebra, initializing quantum bit codes and initializing quantum chromosome number;
step (2): quantum yield scheduling and fitness evaluation: setting a quantum target function, and solving the quantum target function under the constraint condition of considering the production and manufacturing environment of large-scale mechanical equipment; generating a binary control variable of a target function by the quantum population, performing scheduling according to the generated binary control variable and corresponding to the sequence of work order tasks, and calculating the completion time of the work order of the whole large-scale mechanical equipment according to the scheduling sequence, namely the fitness value of the quantum;
and (3): comparing the fitness values, and determining an optimal solution through the minimum fitness value; saving the optimal solution; judging whether an end condition is reached, and if the end condition is reached, outputting an optimal solution; if the ending condition is not met, jumping to the step (4);
and (4): quantum updating: updating the quantum population by using a quantum revolving gate; and (4) returning to the step (2) to recalculate the fitness value of the quantum and continuing optimizing.
The large mechanical equipment comprises: one or two machining devices are generally purchased due to high price, and the phenomenon of line body blockage is easy to occur in the production process.
The complex scene refers to the production and manufacturing environment of large mechanical equipment: the production raw material storage capacity is limited, the storage quantity of the line side storage capacity is in the order of several, and the quantity of the raw material transportation devices is limited and in the order of several; the phenomenon of line blockage occurs frequently.
The quantum population initialization in the step (1) comprises the following steps:
step (1-1): initializing an evolution algebra t as 0;
step (1-2): initializing qubit encoding: and determining the machine selected by the work order task of the large mechanical equipment and the sequence of online processing to obtain a better quantum target function.
Two variables need to be defined during initialization:
the first variable indicates whether the jth process of the work order i is processed on the kth machine, and is denoted as variable aijkVariable a if machine k is selectedijk Value 1, variable a if machine k is not selectedijkThe value is 0;
the second variable represents the processing sequence of the jth step of the work order i as l and is denoted as variable bijlWhen the jth process of the work order i starts to be on-line at the ith processing sequence, the variable bijlIs marked as 1, otherwise variable bijlIs 0.
Let A be [ a ═ a111,a112,…,aijk,…]A state for storing whether or not the jth process of the work order i is processed on the kth machine;
let B be [ B ]111,b112,…,bijl,…]A state of whether the jth procedure for storing the work order i starts on-line processing at the ith processing sequence or not;
and sequentially splicing the A and the B to obtain the quantum bit codes of the work orders of the large mechanical equipment, and marking as X.
X=A+B=[a111,a112,…,aijk,…,b111,b112,…,bijl,…] (1)
Wherein "+" in the formula (1) represents sequential splicing, aijk、bijlRespectively taking 0 or 1, and X is a binary sequence.
And the work order task, the processing equipment and the processing procedure information are contained in the binary sequence X by the coding mode.
Specifically, a qubit is represented as:
the state of a qubit is represented as: phi>=α|0〉+β|1>,
Where |0 > and |1 > represent the two basic states of the qubit; α and β are complex numbers representing the probability amplitude of the qubit states, α2Is the probability, β, that the qubit is in state 02The amplitude and angle of alpha and beta are randomly selected for the probability that the qubit is in state 1, but the | alpha! Y2+|β|2=1;
Let q denote the chromosome individual, then the quantum chromosome represented by m quantum bits is
Wherein, | αi|2+|βi|21,2, …, m; m represents the length of a single chromosome qubit, and m is calculated as follows:
m is the total number of work order tasks multiplied by the number of devices plus the total number of work order tasks2 (3)
Equation (1) is expressed as a quantum bit:
step (1-3): initializing a population: the chromosome population is associated with an evolution generation t, and the quantum chromosome population of the t generation is set as follows:
then equation (2) translates to:
in the formula, j represents the number of chromosomes, j is 1,2, … n, and n is the size of the chromosome population, namely the total number of chromosomes.
In a single iteration, the larger the number of chromosomes, the easier it is to obtain a globally optimal solution, but the calculation speed is slow.
The smaller the number of chromosomes, the faster the calculation speed, but the easier it is to fall into a locally optimal solution.
Generally, the number of chromosomes is set to be between 40 and 100, and the number of the chromosomes is 60.
Then equation (4) is associated with the evolution algebra t and then transformed into:
in the step (2), the quantum fitness, namely the quantum target function, is a positive scheduling strategy in a limited library capacity scene, and a processed order is expected to be delivered as early as possible.
Quantum objective function:
minf(X)=Min∑all work orders(finishing time of work order plan for Large machine-starting time of work order plan for Large machine) (8)
X is called binary control variable of the objective function and is a group of binary sequences, and the smaller the quantum objective function value is, the better the quantum objective function value is.
The quantum fitness calculation is a process of obtaining the online processing time and the offline time of the work order task on each machine according to a single chromosome value, and can also be called as a process of scheduling according to the work order task sequence given by the chromosome.
The numerical value of each dimension in a single chromosome in the chromosome population corresponds to one work order task, and each chromosome comprises the sequence information of all the current work order tasks to be arranged.
The machining time is determined by the type of the machined machine or the type of the stock position and the work order product attribute of the work order task, and the machining time is known information of scheduling.
The calculation of the quantity sub-target function in the step (2) needs to consider the constraint conditions of the production and manufacturing environment of the large mechanical equipment.
The constraint conditions are specifically as follows: in the process of determining the processing time of the work order by selecting the machine, the sequential logic relationship of the work order tasks of the large-scale mechanical equipment in the process of processing the work order is considered, once the work order tasks start to be interrupted, the single work order task cannot span the unavailable time of the machine to be processed twice, the single work order task cannot be divided into two storage positions for temporary storage in a process gap, only one work order task can be processed by the single machine at the same time, and the machine can only process workpieces in the available time period.
The constraints are formulated as follows:
in formula (9), aijkA state indicating whether the jth process of the work order i is processed by the kth machine; bijlA state indicating whether the jth process of the work order i is processed in the ith processing sequence, wherein the processing state is 0 or 1;
called a sequence operator, indicates the sequence number of each element in the array,
b
ijused for storing all the states of the processing sequence of the work order task of the jth procedure of the ith work order,
is an array b
ijThe transpose of (a) is performed,
represents taking b
ijThe sequence number corresponding to the element with the middle state of 1,
dimension of and b
ijThe same;
b
i(j+1)used for storing all the states of the processing sequence of the work order task of the j +1 procedure of the ith work order,
is an array b
i(j+1)The transpose of (a) is performed,
represents taking b
i(j+1)The sequence number corresponding to the element with the middle state of 1,
dimension of and b
i(j+1)The same is true.
First constraint aijk,bijlIs 0 or 1, is true for all i, j, k and l, ensuring the feasibility of chromosome coding;
second constraint
The work order task sequence is guaranteed to be processed according to the logic sequence of work order task processing;
third constraint
All the work order tasks are established in sequence, and all the work order tasks are guaranteed to be processed only once;
fourth constraint
All i and j are established, and a single work order task is guaranteed to be processed on one machine.
The fitness evaluation of step (2) generates a binary control variable X of the objective function from the quantum chromosome population Q (t),
obtained by the formula (7) and the formula (10),
in formula (11)
For one binary bit in the binary control variable,
taking values:
wherein gamma is a random number and takes any value in [0, 1 ].
And performing scheduling according to the sequence of the work order tasks corresponding to the generated binary control variable X, and calculating the completion time of the work order of the whole large-scale mechanical equipment according to the scheduling sequence, namely the quantum fitness value.
The production scheduling principle is as follows: and the scheduling including the inventory capacity scene adopts a blank scheduling method with a time window. In the scheduling process, time is considered as a dimension, all occupied machine resources, each bay and transport are considered as containers, and each machine, bay and transport has a time window available in a limited time. According to the practical situation of the production line, a warehousing procedure of the line side warehouse is added between the two procedures, the available machine is used as a line side warehouse position, and the time used by the line side warehouse warehousing procedure is set to be a negligible time interval, such as 1 second. And meanwhile, corresponding work order tasks are added according to different work orders.
Initializing a time window which can be put in storage in the original production according to the machine startup or the processing calendar of a production line, initializing a time window according to available time by a storage position, wherein the time window comprises one or more available time periods, and a machine or the storage position is used for processing or storing a workpiece in each available time period.
The production scheduling step in the step (2) is as follows:
step (201): quantum decoding: analyzing the transmitted single quantum into the production scheduling sequence of the work order task;
step (202): establishing a queue to be scheduled L0, and storing the decoded task scheduling sequence of workers into a queue to be scheduled L0;
step (203): judging whether the queue L0 to be scheduled is empty, if so, finishing scheduling, calculating a fitness value, and ending; if not, the head work order task of the queue to be scheduled L0 is taken, and the step (204) is carried out;
a step (204): judging whether the current work order task is an assembly work order; if yes, entering step (205); if not, go to step (206);
step (205): judging whether the workpieces required by the designated library position are complete, if so, entering a step (206); if not, go to step (207);
step (206): judging whether the feasible time period is empty or not; if not, determining the available time and the machining starting time, and updating the feasible time period set; establishing a queued queue L1, putting the currently queued work order task at the tail of L1, and returning to the step (203); if yes, go to step (208);
step (207): judging whether the queue L0 to be scheduled is empty, if so, failing to schedule, setting the fitness value to be positive and infinite, and ending; if not, taking the head work order task of the queue L0 to be scheduled as the current work order task, then putting the work order task being processed into the head position of the queue L0 to be scheduled, and returning to the step (204);
a step (208): judging whether L1 is empty, if so, failing to arrange production, setting the fitness value to be positive infinity, and ending; and if not, putting the work order task being processed into the head position of the L0, taking the L1 tail work order task as the current work order task, updating the feasible time slot set, and returning to the step (206).
The step (3) compares the fitness values corresponding to the minimum fitness value
Saving the optimal solution to B (t) for the optimal solution; judging whether an end condition is reached, and if the end condition is reached, outputting an optimal solution; if the ending condition is not met, jumping to the step (4);
and B (t) is used for storing population optimal solutions, including local optimal solutions.
And (3) ending the step under the condition that the set maximum quantum updating times and/or the preset ideal threshold value of the scheduling time are/is reached.
The quantum updating of the step (4) comprises the following steps:
step (4-1): let t be t +1, generate X from Q (t-1), compute the quantum target function from the binary sequence of X;
step (4-2): the population q (t) is updated with a quantum rotating gate.
The quantum rotating gate adopts a similar Givens orthogonal matrix form, and a formula is as follows:
in the formula
A quantum rotation gate for the ith quantum bit of the jth chromosome with an evolutionary algebra of t,
all the parameters are parameters of the revolving door,
the magnitude of the rotation angle is a fixed value of 0.02 pi, and the rotation direction of the rotation angle is determined according to table 1.
TABLE 1 rotation Angle LUT
In Table 1
For one binary bit in the binary control variable,
the binary bit of the position corresponding to the optimal solution stored in B (t).
The quantum revolving gate updating formula is as follows:
the updated qubits need to be satisfied,
step (4-3): and (3) returning to the step (2) to calculate the fitness value of the updated quantum, and storing X corresponding to the minimum fitness value in B (t).
A complex scene scheduling system based on a quantum evolutionary algorithm comprises: a memory, a processor, and a computer program stored on the memory and executed on the processor, the processor implementing the following steps when executing the computer program:
step (1): initializing a quantum population: initializing quantum population evolution algebra, initializing quantum bit codes and initializing quantum chromosome number;
step (2): quantum yield scheduling and fitness evaluation: setting a quantum target function, and solving the quantum target function under the constraint condition of considering the production and manufacturing environment of large-scale mechanical equipment; generating a binary control variable of a target function by the quantum population, performing scheduling according to the generated binary control variable and corresponding to the sequence of work order tasks, and calculating the completion time of the work order of the whole large-scale mechanical equipment according to the scheduling sequence, namely the fitness value of the quantum;
and (3): comparing the fitness values, and determining an optimal solution through the minimum fitness value; saving the optimal solution; judging whether an end condition is reached, and if the end condition is reached, outputting an optimal solution; if the ending condition is not met, jumping to the step (4);
and (4): quantum updating: updating the quantum population by using a quantum revolving gate; and (4) returning to the step (2) to recalculate the fitness value of the quantum and continuing optimizing.
The invention has the beneficial effects that:
1. the evolutionary algorithm is applied to the field of production scheduling of large-scale mechanical equipment, and meets the requirement that local optimization and global optimization are used for searching for an optimal solution in a balanced state, so that production scheduling of the large-scale mechanical equipment is realized.
2. The scheduling of large-scale mechanical equipment adopts a quantum evolutionary algorithm, input data are converted into quantum information, the deployment process of the algorithm is easy to transplant to the field of quantum computers, and the operation speed of the algorithm is innovatively improved on a quantum computer platform.
3. The method is not based on an ideal state model, the complex production scenes such as a line side library and a transportation device are deployed to fit the actual production under the library capacity constraint condition, and the production schedule of the large mechanical equipment realized by the method has guiding significance for the actual production.
4. The invention provides an innovative quantum bit coding method, which simultaneously codes a work order task, processing equipment and a processing procedure; and considering the storage capacity constraint conditions, transportation and other environments, and providing a production scheduling step suitable for a large-scale mechanical equipment production line.
Detailed Description
The invention is further described with reference to the following figures and examples.
As shown in fig. 1, the complex scene scheduling method based on the quantum evolutionary algorithm includes the following steps:
initializing a quantum population; initializing quantum population evolution algebra, initializing quantum bit codes and initializing quantum chromosome number;
step (1-1) initializes an evolution algebra t to 0.
Step (1-2) initializing quantum bit coding: and determining the machine selected by the work order task of the large mechanical equipment and the sequence of online processing to obtain a better quantum target function.
Two variables need to be defined during initialization:
the first variable indicates whether the jth process of the work order i is processed on the kth machine, and is denoted as variable aijkVariable a if machine k is selectedijkThe value is 1, if the machine k is not selected, the value of the variable is 0;
the second variable represents the processing sequence of the jth step of the work order i as l and is denoted as variable bijlWhen the jth process of the work order i starts the on-line processing at the ith processing sequence, the variable bijlIs marked as 1, otherwise variable bijlIs 0.
Let A be [ a ═ a111,a112,…,aijk,…]A state for storing whether or not the jth process of the work order i is processed on the kth machine;
let B be [ B ]111,b112,…,bijl,…]J-th step for storing the work order iA state of whether or not the on-line processing is started at the l-th processing sequence;
and sequentially splicing the A and the B to obtain the quantum bit codes of the work orders of the large mechanical equipment, and marking as X.
X=A+B=[a111,a112,…,aijk,…,b111,b112,…,bijl,…] (1)
Wherein "+" in the formula (1) represents sequential splicing, aijk、bijlIf 0 or 1 is taken, X is a binary sequence.
And the work order task, the processing equipment and the processing procedure information are contained in the binary sequence X by the coding mode.
Specifically, a qubit is represented as:
the state of a qubit is represented as: phi>=α|0〉+β|1>,
Where |0 > and |1 > represent the two basic states of the qubit; α and β are complex numbers representing the probability amplitude of the qubit states, α2Is the probability, β, that the qubit is in state 02The amplitude and angle of alpha and beta are randomly selected for the probability that the qubit is in state 1, but the | alpha! Y2+|β|2=1;
Let q denote the chromosome individual, then the quantum chromosome represented by m quantum bits is
Wherein, | αi|2+|βi|21,2, …, m; m represents the length of a single chromosome qubit, and the calculation formula of m is as follows:
m is the total number of work order tasks multiplied by the number of devices plus the total number of work order tasks2 (3)
Equation (1) is expressed as a quantum bit:
step (1-3): initializing a population: the chromosome population is associated with an evolution generation t, and the chromosome population of the t generation is set as follows:
then equation (2) translates to:
wherein j represents the chromosome number, m represents the length of a single quantum chromosome, and n is the size of the chromosome population, namely the total number of chromosomes.
In a single iteration, the larger the number of chromosomes, the easier it is to obtain a globally optimal solution, but the calculation speed is slow.
The smaller the number of chromosomes, the faster the calculation speed, but the easier it is to fall into a locally optimal solution.
Generally, the number of chromosomes is set to be between 40 and 100, and the number of the chromosomes is 60.
Then equation (4) is associated with the evolution algebra t and then transformed into:
evaluating the fitness of quantum scheduling; the scheduling strategy adopted in the limited storage capacity scene is a forward scheduling strategy, and the processed order is expected to be delivered as early as possible.
The evaluation of the quantum objective function needs to take into account the constraints of the manufacturing environment of the large mechanical equipment.
The quantum target function is:
minf(X)=Min∑all work orders(finishing time of work order plan for Large machine-starting time of work order plan for Large machine) (8)
In the formula, X is called a binary control variable of the objective function, and is a set of binary sequences, and the smaller the quantum objective function value is, the better the quantum objective function value is.
The quantum fitness calculation is a process of obtaining the online processing time and the offline time of the work order task on each machine according to a single chromosome value, and can also be called as a process of scheduling according to the work order task sequence given by the chromosome.
The numerical value of each dimension in a single chromosome in the chromosome population corresponds to one work order task, and each chromosome comprises the sequence information of all the current work order tasks to be arranged.
The machining time is determined by the type of the machined machine or the type of the stock position and the work order product attribute of the work order task, and the machining time is known information of scheduling.
The calculation of the quantity sub-target function in the step (2) needs to consider the constraint conditions of the production and manufacturing environment of the large mechanical equipment.
The constraint conditions are specifically as follows: in the process of determining the processing time of the work order by selecting the machine, the sequential logic relationship of the work order tasks of the large-scale mechanical equipment in the process of processing the work order is considered, once the work order tasks start to be interrupted, the single work order task cannot span the unavailable time of the machine to be processed twice, the single work order task cannot be divided into two storage positions for temporary storage in a process gap, only one work order task can be processed by the single machine at the same time, and the machine can only process workpieces in the available time period.
The constraints are formulated as follows:
in formula (9), aijkA state indicating whether the jth process of the work order i is processed by the kth machine; bijlA state indicating whether the jth process of the work order i is processed in the ith processing sequence, wherein the processing state is 0 or 1;
called sequential operator, representing elements in an arrayThe sequence number in (1) is (b),
b
ijused for storing all the states of the processing sequence of the work order task of the jth procedure of the ith work order,
is an array b
ijThe transpose of (a) is performed,
represents taking b
ijThe sequence number corresponding to the element with the middle state of 1,
dimension of and b
ijThe same;
b
i(j+1)used for storing all the states of the processing sequence of the work order task of the j +1 procedure of the ith work order,
is an array b
i(j+1)The transpose of (a) is performed,
represents taking b
i(j+1)The sequence number corresponding to the element with the middle state of 1,
dimension of and b
i(j+1)The same is true.
First constraint aijk,bijlIs 0 or 1, is true for all i, j, k and l, ensuring the feasibility of chromosome coding;
second constraint
The work order task sequence is guaranteed to be processed according to the logic sequence of work order task processing;
third constraint
All the work order tasks are established in sequence, and all the work order tasks are guaranteed to be processed only once;
fourth constraint
All i and j are established, and a single work order task is guaranteed to be processed on one machine.
The fitness evaluation in the step (2) needs to generate a binary control variable X of an objective function from the quantum chromosome population Q (t),
obtained by the formula (7) and the formula (10),
in formula (11)
For one binary bit in the binary control variable,
taking values:
wherein gamma is a random number and takes any value in [0, 1 ].
And performing scheduling according to the sequence of the work order tasks corresponding to the generated binary control variable X, and calculating the completion time of the work order of the whole large-scale mechanical equipment according to the scheduling sequence, namely the quantum fitness value.
Step (2): quantum production scheduling and fitness evaluation;
as shown in fig. 2, the scheduling step in step (2) is as follows:
step (201): quantum decoding: analyzing the transmitted single quantum into the production scheduling sequence of the work order task;
step (202): establishing a queue to be scheduled L0, and storing the decoded task scheduling sequence of workers into a queue to be scheduled L0;
step (203): judging whether the queue L0 to be scheduled is empty, if so, finishing scheduling, calculating a fitness value, and ending; if not, the head work order task of the queue to be scheduled L0 is taken, and the step (204) is carried out;
a step (204): judging whether the current work order task is an assembly work order; if yes, entering step (205); if not, go to step (206);
step (205): judging whether the workpieces required by the designated library position are complete, if so, entering a step (206); if not, go to step (207);
step (206): judging whether the feasible time period is empty or not; if not, determining the available time and the machining starting time, and updating the feasible time period set; establishing a queued queue L1, putting the currently queued work order task at the tail of L1, and returning to the step (203); if yes, go to step (208);
step (207): judging whether the queue L0 to be scheduled is empty, if so, failing to schedule, setting the fitness value to be positive and infinite, and ending; if not, taking the head work order task of the queue L0 to be scheduled as the current work order task, then putting the work order task being processed into the head position of the queue L0 to be scheduled, and returning to the step (204);
a step (208): judging whether L1 is empty, if so, failing to arrange production, setting the fitness value to be positive infinity, and ending; and if not, putting the work order task being processed into the head position of the L0, taking the L1 tail work order task as the current work order task, updating the feasible time slot set, and returning to the step (206).
Special case processing: if the quantum group is not excluded in the whole generation of calculation, the generation of quantum is initialized continuously, optimization is continued until an end condition is reached, and the chromosome population iteration is stopped. The scheduling strategy has two categories, one is constraint first and the other is result first. Under the constraint priority strategy, if the result is not discharged, the return available time is insufficient, and the production discharge fails. Under the strategy of result priority, the cut-to time is set to be positive and infinite in sequence according to the order priority, and chromosome population optimization is restarted under the condition until a feasible scheduling strategy is found.
And (3): comparing the fitness values corresponding to the smallest fitness value
Saving the optimal solution to B (t) for the optimal solution; judging whether an end condition is reached, and if the end condition is reached, outputting an optimal solution; if the ending condition is not met, jumping to the step (4);
and B (t) is used for storing population optimal solutions, including local optimal solutions.
And (3) ending the step under the condition that the set maximum quantum updating times and/or the preset ideal threshold value of the scheduling time are/is reached.
And (4): quantum updating, comprising the following steps:
step (4-1): let t be t +1, generate X from Q (t-1), compute the quantum target function from the binary sequence of X;
step (4-2): the population q (t) is updated with a quantum rotating gate.
The quantum rotating gate adopts a similar Givens orthogonal matrix form, and the formula is as follows:
in the formula
A quantum rotation gate for the ith quantum bit of the jth chromosome with an evolutionary algebra of t,
in order to be able to rotate the parameters of the door,
the magnitude of the rotation angle is a fixed value of 0.02 pi, and the rotation direction of the rotation angle is determined according to table 1.
TABLE 1 rotation Angle LUT
In Table 1
For one binary bit in the binary control variable,
the binary bit of the position corresponding to the optimal solution stored in B (t).
The quantum revolving gate updating formula is as follows:
the updated qubits need to be satisfied,
step (4-3): and (3) returning to the step (2) to calculate the fitness value of the updated quantum, and storing X corresponding to the minimum fitness value in B (t).
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.