[workshop scheduling] solving the workshop scheduling problem based on MATLAB improved leapfrog algorithm [including Matlab source code phase 073]

Matlab scientific research 2021-08-10 09:14:31 阅读数:878

本文一共[544]字,预计阅读时长:1分钟~
workshop scheduling solving workshop scheduling

One 、 brief introduction

Job shop scheduling problem description
Job shop scheduling problem (Job Shop Scheduling, JSP) Are some of the most classic NP-hard One of the problems . Its application fields are extremely wide , Involving aircraft carrier scheduling , Airport aircraft dispatch , Port terminal cargo ship dispatching , Automobile processing line, etc .

JSP Problem description : A processing system has M Taiwan machine , Required processing N Homework , among , Homework i The number of operations included is Li. Make , be L Is the total work ordinal number of the task set . among , The processing time of each process has been determined , And each operation must be processed according to the sequence of processes . The task of scheduling is to arrange the processing scheduling and sorting of all jobs , While the constraints are met , Optimize the performance index .

Job shop scheduling needs to consider the following constraints :

Cons1: Each process is processed on the designated machine , And the processing can only be started after the previous process is completed ;

Cons2: At some point 1 This machine can only process 1 Homework ;

Cons3: Each job can only be in 1 On this machine 1 Time ;

Cons4: The process sequence and processing time of each operation are known , It does not change with the change of machining order .

Problem instance
An example of job shop scheduling problem is given below , Each process is marked with a pair of values (m,p), among ,m Indicates that the current operation must be performed on the m Processing on a machine ,p It means the first one m The processing time required for this machine to process the current operation .( notes : The machine and job numbers are from 0 Start )
jop0=[(0,3),(1,2),(2,2)]
jop1=[(0,2),(2,1),(1,4)]
jop2=[(1,4),(2,3)]
In this case , Homework jop0 Yes 3 Process : It's the first 1 The process is marked with (0,3), It means the second 1 The next process must be in the 0 Processing on a machine , And we need 3 Unit processing time ; It's the first 2 The process is marked with (1,2), It means the second 2 The next process must be in the 1 Processing on a machine , And we need 2 Unit processing time ; The rest is the same . in general , In this case, there are 8 Process .
A feasible solution to this problem is L=8 An arrangement of the start time of a process , And satisfy the constraints of the problem . The following figure shows a feasible solution ( notes : The solution is not the optimal solution ) An example of :
 Insert picture description here
Leapfrog algorithm (SFLA) It is a new post heuristic population evolutionary algorithm , It has efficient computing performance and excellent global search ability . The basic principle of hybrid leapfrog algorithm is described , In view of the large change of individual spatial position before and after the update operation caused by the local update strategy of the algorithm , The problem of reducing the convergence rate , An improved leapfrog algorithm based on threshold selection strategy is proposed . Through the strategy of not updating the individual component that does not meet the threshold condition , Reduces individual spatial differences , Thus, the performance of the algorithm is improved . Numerical experiments show the effectiveness of the improved algorithm , The threshold parameters of the improved algorithm are calibrated

characteristic
SFLA from Eusuff and Lansey In order to solve the combinatorial optimization problem 2003 First proposed in . As a new bionic intelligent optimization algorithm ,SFLA Combined with meme based (meme) Evolutionary meme algorithm (MA,memeticalgorithm) And particle swarm optimization algorithm based on group behavior (PSO,particle swarm optimization)2 Advantages of population intelligent optimization algorithm . The algorithm has simple concept , Few parameters are adjusted , Fast calculation , Strong global search and optimization ability , Easy to implement features . Hybrid leapfrog algorithm is mainly used to solve multi-objective optimization problems , For example, water allocation 、 Pier maintenance 、 Workshop operation flow arrangement and other engineering practical application problems .

principle
The idea of leapfrog algorithm is : A group of frogs live in a wetland . Many stones are scattered in the wetland , Frogs jump by looking for different stones to find places with more food . Each frog realizes the exchange of information through cultural exchange . Each frog has its own culture . The culture of each frog is defined as a solution to the problem . The whole frog population in the wetland is divided into different sub groups , Each sub group has its own culture , Execute local search strategy . Each individual in the subgroup has its own culture , And affect other individuals , Also influenced by other individuals , And evolve with the evolution of sub groups . When the sub population evolves to a certain stage , Then exchange ideas among various subgroups ( Global information exchange ) Realize the mixed operation between subgroups , Until the set conditions are met .

mathematical model
Algorithm parameters Like other optimization algorithms ,SFLA It also has some necessary calculation parameters , Include F: The number of frogs ;m: The number of ethnic groups ;n: The number of frogs in the population ;Smax: Maximum allowable runout step size ;Px: Global best solution ;Pb: Local best solution ;Pw: Local worst solution ;q: Number of frogs in sub population ;LS: Local meta evolution times and SF: Number of overall thought exchanges, etc . Update strategy For frog groups , The solution with global best fitness is expressed as U g; For each subgroup , The solution with the best fitness is expressed as UB, The solution of the worst fitness is expressed as UW. First, a local search is performed for each sub population , That is to update the frog individual with the worst fitness in the sub population , The update strategy is Frog update distance Ds=rand()*(Pb-Pw) (1) Updated Frog newDw=oldPw+Ds(-Dmax≦Ds≦Dmax) (2) among , Ds Represents the adjustment vector of individual frogs , Dmax Indicates the maximum step size allowed for individual frog changes . If set Uw=[1 3 5 4 2], UB=[2 1 5 3 4], Maximum step size allowed to change Dmax =3, if rand=0.5 , be U q(1) =1+min{int[0.5 × (2−1)],3}=1; U q(2) =3+max{int[0.5×(1−3)], −3}=2; A new solution can be obtained after completing the update strategy according to the same operation U q=[1 2 5 4 3].

The process
Global search process step l initialization . Determine the number of frogs 、 The population and the number of frogs in each population . step 2 Randomly generate the initial frog swarm , Calculate the fitness of each frog . step 3 Sort in descending order according to the fitness value and record the best solution Px, And divide the frogs into groups . hold F A frog is assigned to m Ethnic groups Y,Y,Y…,Y In the middle , Each ethnic group contains n Frog , Thus making Yk=[X(j),f(j)|X(j)=X(k+m*(j-1), f(j)=f(k+m*(j-1),j=1,…,n,k=1,…,m]. here X(j) Represents the... In the frog flock j frog ,f(j) It means the first one j The objective function value of a frog . step 4 according to SFLA Algorithm formula , Meta evolution in each population . step 5 Mix ethnic groups . After a round of meta evolution in each population , Reorder and divide the frogs in each population, and record the global best solution Px. step 6 Check the calculation stop condition . If the convergence condition of the algorithm is satisfied , Then stop the algorithm execution process , Otherwise go to step 3. generally , If the algorithm after several consecutive global ideas exchange , If the best solution is not significantly improved, stop the algorithm . In some cases , The maximum function evaluation times can also be used as the stopping criterion of the algorithm . Local search process The local search process is based on the above steps 4 Further development of , The specific process as follows : step 4—1 set up im=O, here im It's the counter of the population . Used to compare with the total number of ethnic groups m Compare . set up iN=0, here iN It's a counter to local evolution , Used with Ls Compare . step 4-2 According to the type (1) In the l,,1 Choose from a group q A frog enters the sub population , determine Pb and Pw And set up im=im+1. step 4-3 set up iN=iN+1. step 4—4 According to the type (2) Sum formula (3) Improve the position of the worst frog in the sub population . step 4—5 If step 4—4 Improved the position of the worst Frog ( Explain ), Replace the worst frog position with the newly generated position . Otherwise, use Px Substitute (2) Medium PB, Re update the worst frog location . step 4—6 If step 4-5 Did not improve the position of the worst Frog , Then a frog at any position in the wetland is randomly generated to replace the worst Frog . step 4—7 If iN<LS, Then go to step 4-3. step 4—8 If im<m, Then go to step 4-2, Otherwise, go to the steps of the global search process 5. Algorithm stop condition SFLA Two strategies are usually used to control the execution time of the algorithm : 1) Recent K After the overall thought exchange process , The global best solution has not been significantly improved ; 2) The pre-defined function evaluation times of the algorithm have reached . 3) There are standard test results . No matter which stop condition is met , The algorithm has to be forced out of the whole circular search process .

Two 、 Source code


clc
clear all
close all
%--------------------------------------------------------------------------
% problem : N Pieces ,M Deterministic flow shop scheduling problem with two machines
% Number of jobs N=20, Number of machines M=10 when , A finite number of optimal solutions fval=14.9263,
% x = [16 4 18 15 12 11 2 1 6 7 3 5 20 ...
% 10 8 14 13 19 17 9]
N = 20 % Number of jobs ( Solution vector length )
M = 10 % Number of machines
rand('state',N+M); % Fixed time matrix
T = rand(M,N); % Generate time matrix , Row number M1 Number of machines , Number of columns N Is the number of pieces
rand('state',sum(100*clock)); % Seed recovery random
%--------------------------------------------------------------------------
% Required parameters
popsize = 50; % Population size
maxgen = 50; % Max evolutionary Algebra
method = 4 % Method selection ,1 - Pseudo parallel niche adaptive genetic algorithm (PPNSA)
% 2 - Hybrid leapfrog algorithm + Mutation operator (SFLA+MO)
% 3 - Batch leapfrog algorithm (BFLA), by SFLA The improved algorithm
% 4 - PPNSA+ The disturbance operator ( Last choice algorithm , Convergence rate , It is easy to jump out of the local minimum )
% 5 - SFLA+MO+ The disturbance operator ( Secondary selection algorithm , Fast convergence , Most likely to fall into local minima )
% 6 - BFLA+ The disturbance operator ( Preferred algorithm , Convergence rate , May fall into local minima )
type = 1; % Initialization mode ,1 - Random initialization ( Default settings )
% 2 - Heuristic initialization
%--------------------------------------------------------------------------
% Function call
[X,fval,F] = SFLA(T,popsize,maxgen,method,type);
% Hybrid leapfrog algorithm (Shuffled Frog-Leaping Alogrihtm,SFLA)
% Input parameters :
% T - Time matrix
% popsize - Population size
% maxgen - Max evolutionary Algebra
% method - Method selection ,1 - Pseudo parallel niche adaptive genetic algorithm (PPNSA)
% 2 - Hybrid leapfrog algorithm + Mutation operator (SFLA+MO)
% 3 - Batch leapfrog algorithm (BFLA), by SFLA The improved algorithm
% 4 - PPNSA+ The disturbance operator ( Last choice algorithm , Convergence rate , It is easy to jump out of the local minimum )
% 5 - SFLA+MO+ The disturbance operator ( Secondary selection algorithm , Fast convergence , Most likely to fall into local minima )
% 6 - BFLA+ The disturbance operator ( Preferred algorithm , Convergence rate , May fall into local minima )
% type - Initialization mode ,1 - Random initialization ( Default settings )
% 2 - Heuristic initialization
% Output parameters :
% X - The solution corresponding to the optimal fitness
% fval - Optimal fitness value
% F - The optimal , Average , Worst fitness
%--------------------------------------------------------------------------
% The results are plotted
figure(1)
FigSche(X,T);
figure(2);
plot(1:maxgen,F,'.-'); grid on;
legend(' The optimal ',' Average ',' The worst ',3);
xlabel(' Evolution algebra '); ylabel(' Fitness ');
set(gcf,'position',[700 200 500 400])
set(gca,'XLim',[1 maxgen]);
title([' Number of jobs :',num2str(N),' Number of machines :',num2str(M),', optimal value :',num2str(fval)]);

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.

3、 ... and 、 Running results

 Insert picture description here
 Insert picture description here

Four 、 remarks

edition :2014a

版权声明:本文为[Matlab scientific research]所创,转载请带上原文链接,感谢。 https://car.inotgo.com/2021/08/20210810091259267x.html