Detailed Description
For solving the scheduling problem of the multi-target flexible job shop, a genetic algorithm based on operators such as crossover operators and mutation operators is generally used for solving, due to the blindness of search of the operators, the invention adopts a crossover entropy algorithm for solving, the crossover entropy algorithm belongs to a distribution estimation calculation method, a probability model is maintained, and then the new solution is obtained by sampling the probability model. However, the naive cross entropy algorithm uses a probability model to perform global search, the corresponding local search capability is weak, and the finally obtained result has a further optimization space, so that the invention provides the multi-target flexible job shop scheduling method based on the improved cross entropy algorithm, the method not only can effectively solve the relevant non-dominated solution set, but also has diversity and convergence which are obviously superior to some latest algorithms under certain conditions. The hierarchical multi-target neighborhood search provided by the invention mainly solves two key problems: firstly, the local searching capability of a naive cross entropy algorithm is insufficient; second, consideration of multiple targets in neighborhood searching. The invention mainly comprises the following steps: according to the problem that the local search capability of the cross entropy algorithm is insufficient, a coevolution strategy is used for improving the cross entropy algorithm. The method comprises the following steps of (1) considering the optimization problem of multiple targets for the multi-target flexible job shop scheduling problem: meanwhile, a hierarchical multi-target neighborhood searching strategy is provided, a random weight mode is used as a replacement condition of a solution during neighborhood searching, and the diversity of the population is enhanced on the premise of ensuring certain convergence of the algorithm.
The invention adopts a coevolution strategy to improve a naive cross entropy algorithm, when the algorithm can not obtain a better solution for a plurality of generations, a procedure search operator and a machine search operator are adopted to carry out local search, then hierarchical multi-target neighborhood search is used for further optimization, and when the algorithm can not obtain a better solution for a plurality of generations, a probability model is reused for global search.
The hierarchical multi-target neighborhood search is used for solving the problem that optimization of multiple targets is required to be considered during local search under multi-target flexible job shop scheduling, and is different from single-target flexible job shop scheduling, only the latest completion time is required to be considered during optimization, and the maximum machine load and the total machine load are required to be additionally considered in the multi-target problem. The hierarchical multi-target neighborhood search mainly aims at a multi-target search strategy and a hierarchical search strategy respectively, wherein the multi-target search strategy mainly solves the problem that the local search considers a plurality of targets, the hierarchical search strategy optimizes two sub-problems of the flexible workshop scheduling problem, namely a machine allocation sub-problem and a process sequence sub-problem, and meanwhile, the neighborhood search based on resource switching and the neighborhood search based on idle time are used and have a complementary relationship, wherein the former mainly considers the idle time of other machines, and the latter mainly considers the idle time of the current machine.
In order to achieve the objective of the present invention, the improved cross-entropy algorithm (Co-CEM) based on hierarchical multi-target neighborhood search of the present invention, described with reference to fig. 1 based on the above problem, includes the following steps:
and 001, initializing iteration times M, a strategy switching threshold value n _ switch, a population P, a process probability distribution matrix S, a machine probability distribution matrix Q and an external memory library E.
And 002, carrying out search optimization on the population P and the external memory bank E, and carrying out iteration for M times in total.
And step 003, obtaining a final non-dominated solution set by using non-dominated sorting to the external memory bank E.
The step 001 specifically comprises the following steps:
step 00101, initializing a population P: the method comprises a machine allocation part and a process sequence part for initializing solution vectors in the population P. The machine allocation portion of the solution vector is initialized using 4 machine allocation rules, including 2 global initialization rules, 1 local allocation rule, and 1 random allocation rule. The detailed description is as follows:
(1) global minimum load: selecting the machine with the minimum load from all the machines for distribution each time;
(2) random arrangement: firstly, randomly sequencing process vectors, sequentially traversing the process vectors from left to right, and selecting a machine with the minimum load for each process;
(3) minimum processing time: the working procedure is distributed to the machine with the shortest processing time;
(4) random distribution: each procedure randomly distributes corresponding processing machines;
for the process part in the population P initialization solution vector, the invention uses 3 sort order rules, which are described in detail as follows:
(1) at most remaining man-hours: and performing process distribution according to the remaining working hours of each task. Selecting a task with the minimum remaining working hours from all tasks to distribute the working procedure of the task, and deleting the task from the task set to be distributed if the next working procedure does not exist; randomly selecting one if there are a plurality of tasks with the smallest remaining man-hours;
(2) the most remaining processes: and performing process distribution according to the residual number of processes of each task. Selecting a task with the least number of processes from all the tasks to distribute the process, and if the next process does not exist, deleting the task from the task set to be distributed; randomly selecting one task if a plurality of tasks with the minimum number of processes exist;
(3) random sequencing: randomly distributing the processing sequence of all the working procedures;
00102, initializing a probability distribution matrix (the probability distribution matrix comprises a process probability distribution matrix and a machine probability distribution matrix). Let S be an element of R N×N Is a process probability distribution matrix for generating process vectors, Q ∈ R N×M For a machine probability distribution matrix used to generate machine vectors, where N is the total number of processes and M is the total number of machines, then S [ x, y]The probability of assigning process y to the x-th position of the process vector is shown, and S [ x, y ] is given in the initial state to ensure that the whole solution space can be uniformly sampled]=1/N。Q[x,u]Probability of assigning machine u to the x-th position of machine vector, where m y The number of machines that can process step y is initially as shown in the following equation:
because the precedence relationship between the working procedures of the same task is restricted, the working procedures are towardsThe x-th position of the quantity selectable process cannot be taken arbitrarily from 1, 2.., N, but is related to the process selected by the process vector subscript 0 to x-1. Also, due to the inherent relationship between machine selection and process selection, the machine vector is constrained by the same constraint that the x-th location-selectable machine cannot be taken from all machines at will, but is instead associated with the set of machines that correspond to the process selectable at that location. Aiming at the constraint condition, a procedure vector order _ mask and a machine vector machine _ mask are respectively introduced. Taking an order _ mask vector as an example, defining the order _ mask as an element R N All the processes with selectable current positions are represented, and the values are shown in the following formula:
when a process is selected for the position x of a process vector, an order _ mask is used for screening to obtain a probability distribution vector sample _ vec, then the probability sum is ensured to be 1 through processing, so that the generated process is a feasible solution, and the calculation step is shown as follows:
sample_vec=P[x,:]*order_mask
sample_vec=sample_vec/sum(sample_vec)
sum () represents summation, and once the process vector is determined to the process of the x-th position, the order _ mask is updated to ensure that the subsequently generated process is valid.
Similar processing is adopted for the generation step of the machine vector. Useless solutions in the sampling process are removed through the machine _ mask, and the generated solutions are guaranteed to be effective.
After a new population is obtained through sampling, the cross entropy algorithm selects n _ elite individuals according to the fitness to update a process probability distribution matrix S and a machine probability distribution matrix Q, as shown in the following formula:
wherein alpha and beta are the learning rates of S and Q, respectively,
and
the conditional function for the kth solution in the population is shown in the following formula:
00103 initializing external memory bank
Indicating that the external memory pool is an empty set.
00104, obtaining a new population H according to the procedure search operator and the machine search operator. For the process search operator, if parent individuals m and n exist, the detailed steps are as follows:
step 1: firstly, judging whether m is the same as n, if so, randomly exchanging two working procedures which do not belong to the same task to obtain a new individual and directly returning; otherwise, executing step 2;
step 2: setting the current task number as N, numbering the N tasks, randomly selecting a plurality of tasks from the N tasks to a set u, defining v as a complementary set of the set u, and reselecting if the selected task number is 0 or equal to N;
and step 3: the processes belonging to the set u in the offspring p individuals are sequentially copied to corresponding positions from the parent individuals m, and the remaining processes belonging to the set v are sequentially copied to corresponding positions from the parent individuals n;
and 4, step 4: conversely, the processes belonging to the set u in the child q are sequentially copied from the parent n to the corresponding positions, and the remaining processes belonging to the set v are sequentially copied from the parent m to the corresponding positions.
When the process searching is carried out, in order to avoid obtaining equivalent offspring individuals from the same parent individuals, similarity checking is firstly carried out on the parent individuals, and if the parent individuals and the parent individuals are completely the same, two processes are directly and randomly exchanged to obtain new individuals. The detailed steps of the corresponding machine search operator are as follows:
step 1: and setting the current process number as N, randomly selecting k channels from the N processes to form a set u, and if the number of elements in the set u is 0 or equal to N, reselecting.
Step 2: and (4) exchanging the assigned machines of the parent individuals m and n belonging to the process in the set u to obtain the offspring individuals p and q.
Step 00105, let the population P ← P ≧ H, use mutation operator to deduplicate to the individual with the same target vector, wherein the mutation operator or local search operator used is as follows:
(1) maximum load based machine reallocation operator: from the process of machining on the machine with the largest load, one is randomly selected and redistributed to another machine with a relatively smaller load for machining.
(2) The machine reassignment operator based on the latest completion time: randomly selecting a process on the machine with the latest completion time, and redistributing the process to another machine with a smaller latest completion time for processing.
(3) The key process moves: randomly acquiring a key path for a current individual, randomly finding a key block on the current key path, and randomly selecting a working procedure to move forwards or backwards to the head or tail of the key block.
(4) Key procedure reinsertion: a key process is randomly selected and moved to another processing facility.
00106, screening excellent individuals by using an environment selection operator based on SPEA2, and assigning the excellent individuals to a population P. Since SPEA2 uses density information in the population to better preserve population diversity, it is used as an environment selection operator in the present invention. SPEA2 incorporates some means of ensuring population diversity, such as a specific fitness allocation strategy, density estimation algorithms and modified truncation methods, which first calculate the dominance between each pair of individuals in the population, and then define the associated intensity values str (x), as shown below:
Str(x i )=|{j|j∈P∧x i <x j }|
wherein P represents a population, x i And x j Respectively, the individuals in the population P, Str (x) i ) Representing the number of other individuals for whom the intensity value of an individual dominates. Then, an original fitness value raw (x) is defined, which is defined as follows:
representing the sum of intensity values that dominate the current individual. In addition, an additional density information value Den (x) is defined for identifying individuals having the same Raw value, as shown in the following formula:
wherein k is the square root of the population size,
denotes x
i And the Euclidean distance to other k-th near individuals in the population, wherein the final fitness value is expressed as the sum of the original fitness value and the density information value, and is shown as the following formula:
Fitness(x i )=Raw(x i )+Den(x i )
when the environment selection operator based on SPEA2 is used, firstly, individuals with the fitness value smaller than 1 are preferably selected from candidate solutions, namely, non-dominant solutions, and if the number of the non-dominant solutions is not enough, the individuals with the proper number are sequentially selected according to the fitness value; otherwise, corresponding stage steps are executed to eliminate redundant individuals, namely individuals with smaller Euclidean distance.
And 00107, updating the external memory bank E by using the population P. The updating process of the memory bank is as follows:
step 1: comparing the objective function vector of each good individual with each individual in an external memory bank;
step 2: replace if the individual in the external memory bank is dominant;
and step 3: if the objective function vectors of the two are the same, calculating the Hamming distance of the machine vector, if the Hamming distance is 0, using a variation strategy until different objective function values are contained, and checking whether an alternative individual exists; otherwise, the backward comparison is continued.
The step 002 specifically includes the following steps:
00201, selecting an evolution strategy according to a strategy identifier flag: by sampling the process matrix S and the machine matrix Q or using dynamic crossover operators. The diversity of the population can be enhanced by generating offspring individuals based on a dynamic crossover probability mode, and the corresponding crossover probability gradually changes along with the increase of the iteration times. If the current Iteration number is Iteration and the Total Iteration number is Total _ Iteration, the corresponding crossover probability is P c 1-Iteration/Total _ Iteration, which represents the probability P of selecting one individual from the memory bank and the population to intersect at present c All of them select individuals from the current population to cross with a probability of 1-P c 。
00202, carrying out local search on Q by using a hierarchical multi-target neighborhood search strategy to obtain a new individual K. First, an extraction graph model and related symbols are defined. A disjunctive graph model was originally proposed and applied to job shop scheduling, which is a directed acyclic graph. First, a description FJSP is defined in which (V, U, E) denotes a set of nodes formed by all the processes, and a virtual start node s and an end node E are determined. U denotes a set of all joint arcs (joint edges) that determine the machining priority between the processes. E represents the set of all disjunctive arcs (disjunctive edges) and satisfies
The set of all the extracted arcs on the kth machine is shown, the corresponding processing time is shown below the corresponding node, and the processing time of the virtual start node and the processing time of the virtual end node are both 0.
Fig. 4 shows an extracted graph obtained after determining the allocation machine for a feasible solution and a gantt chart corresponding to the extracted graph. The method is characterized in that a plurality of symbols are defined based on the disjunctive graph, so that the hierarchical multi-target neighborhood searching strategy can be conveniently described later. Defining the node on the analysis graph G to correspond to the process j under the task i, and using the symbol O i,j Denotes that the machining machine is k and the corresponding machining time is t i,j,k 。
Definition of
To represent a process O
i,j At the earliest start time on the machine k,
represents the step O
i,j Without delaying C on machine k
max The latest start time allowed under the conditions of (1). Accordingly, define
Is a process O
i,j At the earliest end time on the machine k,
is a process O
i,j Not postponing C on machine k
max And the latest end time allowed under the condition (1) and satisfies the following formula:
order to
For working on machine k
i,j The pre-processing procedure of (2) is carried out,
for working on machine k
i,j And (4) post-processing. Let PJ
i,j (G) Is a process O
i,j A precursor step of (4), SJ
i,j (G) Is a process O
i,j The subsequent processes of (2). Process O
i,j Is a key process and only
In the directed graph G, the critical path is a path formed by adjacent critical processes. As shown in FIG. 4, there is a critical path (s → O) 2,1 →O 1,1 →O 1,2 →O 1,3 →O 3,3 → e). The key process comprises the following steps: { O 2,1 ,O 1,1 ,O 1,2 ,O 1,3 ,O 3,3 }, key block: { (O) 2,1 ,O 1,1 ),(O 1,2 ),(O 1,3 ,O 3,3 )}. The makespan for this schedule is 16.
A resource switch based neighborhood search is then defined. Defining process ω, the movable time period is the predecessor process PJ
ω The earliest completion time and the subsequent process SJ
ω The latest start time of (c):
then releasing and switching process ω from the current resource to the appropriate resource may result in an improved solution.
Let k be the current processing machine of process ω and t be the corresponding processing time
ω,k The set of machinable machines defining process ω is Ψ
ω To, for
Has working procedures p and q processed on a machine m, and
the process ω can reduce the latest completion time after the resource switch if and only if the earliest end time of p and the latest start time of q satisfy:
if the above equation is not satisfied, the process ω cannot be shifted after the resource switching because the latest completion time cannot be reduced.
Then the critical process ω is defined as well. There is an optimum insertion position if and only if the following:
wherein the content of the first and second substances,
g is obtained by deleting key processes of claim movement from the graph G
- Procedure (2)
The earliest time of completion of the time,
the same is true.
Shows the step v at G
- In the middle, the original latest completion time C is not delayed
max (G) The latest start time under the conditions of (a),
the same is true. t is t
ω,k Representing the processing time of the critical process omega on the machine k.
Finally, define neighborhood based on idle timeAnd (6) searching. The processes p and q are adjacent to each other in FIG. G, and the processing machines are m. If the critical process ω is a machining machine m, then ω has an exchangeable time period of
The idle time period of the process p, q is
The critical process w can then be inserted into the free time period of the processes p, q by a process transformation if and only if the following equation is satisfied:
that is, if the intersection of the two time periods is not 0, then shifting the critical process ω to a new location may reduce the latest completion time.
The hierarchical multi-target neighborhood search strategy comprises two parts: a multi-target oriented search strategy and a hierarchical search strategy.
(1) Multi-objective oriented search strategy
Because multiple indexes are always considered at the same time in the multi-objective FJSP, and the latest completion time is the most difficult to optimize, a multi-objective search strategy is proposed in the patent. Firstly, for the scheduling solution G, psi (G) ═ co is defined
1 ,co
2 ,...,co
n Is the set of all key process steps, and defines pi (G) ═ co
i →M
k I 1, 2.. n is a set of all neighborhood actions, called action set, wherein each neighborhood action is composed of two elements of a process and a target machine, which represents the redistribution of a key process to another machine, wherein n represents the number of key processes, M
k Representing the target machine. To pair
The total machine load variation Δ t and the maximum machine load Δ c can be expressed as follows:
wherein m is
* Representing target machine, m representing source machine, t
co,m* Indicating machine m
* Time required for working the process, t
co,m Indicates the processing time required by the machine m,
represents m
* The total load of (c).
The multi-target-oriented search strategy mainly comprises two stages, namely neighborhood search based on resource switching and neighborhood search based on key procedures. First, since the neighborhood search for resource switching guarantees that the resulting solution may be improved at the latest completion time, it is preferentially used as the first-stage neighborhood search. Then, according to a grading strategy, all actions corresponding to the current scheduling solution G are sorted in a non-descending order according to the Δ t and the Δ c, so that the smaller Δ t is considered preferentially and the Δ c is considered secondly under the condition that the latest completion time is possibly improved. Then, sequentially using a neighborhood search based on resource switching in a first stage for the action set pi (G) obtained after sorting, and if a feasible action is found, ending the search; otherwise, using the neighborhood search based on key process in the second stage to finish the search after finding a feasible action.
(2) Search strategy based on hierarchy
The hierarchical search strategy is mainly used for respectively solving two sub-problems of FJSP machine allocation and process sequence, wherein the first layer uses a multi-target-oriented search strategy to solve the sub-problems of machine allocation, and the second layer uses a neighborhood search strategy based on idle time to solve the sub-problems of process sequence. In addition, the replacement of the old solution by the new solution is accomplished using an aggregation function approach that randomly generates weight vectors: randomly generating a weight vector lambda according to a specific method, and replacing if the dot product of the target vector of the new solution and lambda is smaller than the dot product of the old solution and lambda; otherwise, the replacement is not performed.
The first layer is optimized aiming at idle time of a cross machine, the second layer uses neighborhood search based on the idle time, and the processing sequence of the current working procedure is further optimized on the basis of the first layer of results. Since only the processing sequence between the processes is changed and the machines to which the processes are assigned are not changed, only the latest completion time is affected. The former layer aims at the utilization of larger idle time of a machine in the current scheduling, while the current layer aims at the utilization of smaller idle time of the machine, and a complementary relationship exists between the former layer and the latter layer, so that the local optimization capability of the algorithm can be effectively enhanced.
Step 00203, let P ← P ^ H ^ K, and use mutation operator to remove repeated individual.
Step 00204.P ← screening good individuals for P using SPEA2 based context selection operator.
Step 00205.E '. ae' uses a hierarchical multi-target neighborhood search strategy to perform local search on E.
Step 00206.E ← E'. E, and removing repeated individuals using a mutation operator.
Step 00207.E ← screen for E good individuals using SPEA2 based context selection operator.
Step 00208.E ← updates the external memory bank E with P.
Step 00209.S, Q ← updating the probability matrix using the external memory bank in accordance with flag.
Step 00210. strategy identification flag ← switching evolution strategy if the continuous n _ switch generation does not update the external memory base.
The use of non-dominated sorting to the external memory bank E in step 003 to obtain the final non-dominated solution set is a method well known in the art and will not be described in detail herein.
To verify the effectiveness of the Co-CEM method of the invention, a public data set was used: the Kacem data set comprises 5 use cases and the BRdata use case data set comprises 10 use cases. The number of machines and the number of tasks and specific information of the working procedure under each task are determined by each use case. And respectively comparing Co-CEM with hDPSO, DABC, BEG-NSGA-II and INSBBO algorithms by using the contrast indexes, namely the hyper-volume HV and the reverse generation distance IGD, wherein the bold shows that the contrast algorithms are optimal, and the result is shown in the following table.
TABLE 1 Co-CEM comparison with other algorithm results
First, by comparing HV indicators, it can be seen that Co-CEM achieves relatively optimal results in 5 cases, in total, exceeding hDPSOA in 8 cases, BEG-NSGA-II in 9 cases, INSBBO in 4 cases, and DABC in 1 case. It is noteworthy that in the largest data size Mk10 case, Co-CEM is significantly better than all algorithms compared
Then, comparing IGD indexes, it can be seen that hDPSO is optimal in 2 cases, DABC and INSBBO are superior to other algorithms in 3 cases, and Co-CEM obtains results superior to other algorithms in 6 cases. Meanwhile, Co-CEM exceeds hDPSO in 8 cases, BEG-NSGA-II in all cases, DABC in 2 cases and INSBBO in 5 cases.
In conclusion, the experiment proves that the Co-CEM has certain superiority compared with other algorithms, and can effectively obtain a high-quality solution of the corresponding problem.
The optimization algorithm solves the traditional scheduling problem, thereby ensuring the stability and effectiveness of the production plan of the domestic ship manufacturing enterprise and reducing the blindness of the plan. Except for ship manufacturing, other fields such as power systems and medical resource distribution systems have the above requirements, so that the traditional scheduling problem is solved based on the flexible workshop scheduling model, and the method has important practical significance for the actual production and manufacturing such as national industry 4.0, China manufacturing 2025 and other plans and the people life aspects such as medical systems and power systems.