Job shop scheduling problem description
Job Shop Scheduling (JSP) is one of the most classic NP-hard problems. Its application fields are extremely wide, involving aircraft carrier scheduling, airport aircraft scheduling, port and dock cargo ship scheduling, automobile processing assembly line and so on.
A processing system has M machines and requires N jobs to be processed. Among them, job I contains the number of procedures for Li. , then L is the total working number of the task set. Among them, the processing time of each process has been determined, and each operation must be processed in accordance with the sequence of the process. The task of scheduling is to arrange the processing scheduling of all jobs, so that the performance index can be optimized when the constraints are satisfied.
Job shop scheduling needs to consider the following constraints:
Cons1: Each process is processed on the designated machine and can only begin after the completion of its previous process;
Cons2: A machine can process only one job at a time;
Cons3: Each job can only be processed 1 time on 1 machine;
Cons4: The working sequence and processing time of each job are known and will not change with the change of processing sequencing.
Problem instances
The following is an example of the job-shop scheduling problem, where each process is marked with a pair of values (m, P), where M means that the current process must be processed on the MTH machine, and P means the processing time required by the MTH machine to process the current process. (Note: Machine and job numbers start from 0)
Jop0 = [(0, 3), (1, 2), (2)]
Jop1 = [(0, 2), (2, 1), (1, 4)]
Jop2 = [(1, 4), (2, 3)]
In this example, job JOP0 has three processes: its first process is labeled (0,3), which means that the first process must be processed on machine 0 and requires 3 units of processing time; Its second process is marked with (1,2), which means that the second process must be processed on the first machine, and requires 2 units of processing time; Same thing with the rest. In total, there are eight processes in this example.
A feasible solution of the problem is that L= a permutation of 8 process start times, which satisfies the constraints of the problem. Here is an example of a possible solution (note: this solution is not optimal) :
%% Clean environment CLC; Clear %% Load scheduleData Jm T JmNumber % Process time %% NIND=40; % count MAXGEN=50; % maximum genetic algebra GGAP=0.9; Generation gap XOVR % = 0.8; % crossover rate MUTR=0.6; % variation gen=0; [PNumber MNumber]=size(Jm); trace=zeros(2, MAXGEN); % Initial search result WNumber=PNumber*MNumber; Number=zeros(1,PNumber); % PNumber Number of artifacts for I =1:PNumber Number(I)=MNumber; Chrom=zeros(NIND,2*WNumber); for j=1:NIND WPNumberTemp=Number; For I =1:WNumber % val=unidrnd(PNumber); while WPNumberTemp(val)==0 val=unidrnd(PNumber); Chrom(j, I)= val; WPNumberTemp(val)=WPNumberTemp(val)-1; Temp=Jm{val, mnumber-wpnumberTemp (val)}; SizeTemp=length(Temp); % Chrom(j, I +WNumber)= unidrnd(SizeTemp); [PVal ObjV P S]= CAL (Chrom,JmNumber,T,Jm); While gen<MAXGEN % allocates fitness value FitnV=ranking(ObjV); SelCh=select(' RWS ', Chrom, FitnV, GGAP); SelCh=across(SelCh,XOVR,Jm,T); SelCh=aberranceJm(SelCh,MUTR,Jm,T); % calculate target fitness value [PVal ObjVSel P S]= CAL (SelCh,JmNumber,T,Jm); % REINS (Chrom ObjV) = REINS (Chrom, SelCh,1, ObjV, ObjVSel); % counter increment gen=gen+1; % trace(1, gen)=min(ObjV); trace(2, gen)=mean(ObjV); If gen==1 Val1=PVal; Val2=P; MinVal=min(ObjV); % Minimum time STemp=S; If MinVal>trace(1,gen) Val1=PVal; Val2=P; MinVal=trace(1,gen); STemp=S; End end % PVal=Val1; % process time P=Val2; S = % process STemp; Figure (1) plot(trace(1,:)); hold on; plot(trace(2,:),'-.'); grid; Legend (' change of solution ',' change of population mean '); %% shows the optimal solution figure(2); MP=S(1,PNumber*MNumber+1:PNumber*MNumber*2); for i=1:WNumber val= P(1,i); a=(mod(val,100)); B = % process ((val - a) / 100); Temp = % workpiece Jm {b, a}; mText=Temp(MP(1,i)); x1=PVal(1,i); x2=PVal(2,i); y1=mText-1; y2=mText; plotRec(x1,x2,mText); plotRec(PVal(1,i),PVal(2,i),mText); hold on; fill([x1,x2,x2,x1],[y1,y1,y2,y2],[1-1/b,1/b,b/PNumber]); The text ((x1 + x2) / 2, mText - 0.25, num2str (P (I))); endCopy the code
Complete code added QQ1575304183