### [workshop scheduling] solving multi-objective production scheduling problem based on MATLAB immune genetic algorithm [including Matlab source code 710]

Matlab scientific research 2021-08-10 09:14:58 阅读数:772

workshop scheduling solving multi-objective multi

## One 、 Introduction to production scheduling

Job shop scheduling refers to a given machining task , According to the existing production conditions , Allocate limited system resources , Arrange the processing steps of the product , Make a performance index optimal . In the actual production process , The constraints involved mainly include ： The processing capacity of the machine , Number of machines , Number of products processed , Processing sequence of products , Delivery time of products , Quantity of raw materials for production , Cost limit , Machine fault , Production date, etc . The performance indexes considered mainly include ： Shortest product delivery time , Minimum processing time , The shortest production cycle , Least cost , The highest equipment utilization , The actual production process generally needs to balance multiple performance indexes [1].

## Two 、 Introduction to immune algorithm

1 introduction
“Immune”( Immunity ) The word is derived from Latin . Long ago , People have noticed that when patients with infectious diseases recover , It will have different degrees of immunity to the disease . In medicine , Immunity refers to a physiological response of the body to contact antigenic foreign bodies .1958 Australian scholar Burnet First proposed and immune algorithm (Immune Algorithm, I A) Related theories ―― Clonal selection principle [1] .1973 year Jer ne Propose a model of immune system [2] , He was based on Burnet Clonal selection theory , Created the unique network theory , The mathematical framework of immune system is given , Differential equation modeling is used to simulate the dynamic changes of lymphocytes .
1986 year Farm al The dynamic model of immune system constructed by et al. Based on the theory of immune network , It shows the possibility of combining the immune system with other artificial intelligence methods , Pioneered the study of the immune system . They first used a set of randomly generated differential equations to establish
Artificial immune system , Then, the inappropriate differential equations in the equations are removed by using the fitness threshold filtering method , For the retained differential equations, the crossover method is used 、 variation 、 Reversal and other genetic operations produce new differential equations , After continuous iterative calculation , Until we find the best set of differential equations .
From then on , The research on immune algorithm has attracted more and more scholars' interest in the world . For decades, , Related research results have involved nonlinear optimization 、 Combinatorial optimization 、 Control engineering 、 robot 、 Troubleshooting 、 Image processing and many other fields [3-6]. Immune algorithm imitates biological immune mechanism , Combined with the evolutionary mechanism of genes , A new intelligent optimization algorithm constructed artificially . It has the characteristics of the general immune system , Adopt group search strategy , By iterative calculation , Finally, the optimal solution of the problem is obtained with a large probability . Compared with other algorithms , Immune algorithm makes use of its own diversity and maintenance mechanism , It ensures the diversity of the population , It overcomes the general optimization process ( Especially the multi peak optimization process ) It is inevitable that “ precocious ” problem , The global optimal solution can be obtained . The immune algorithm is adaptive 、 Randomness 、 Parallelism 、 Global convergence 、 Advantages such as population diversity .

2 Immune algorithm theory
Biological immune system is a complex adaptive system . The immune system can recognize pathogens , Have the ability to learn 、 Memory and pattern recognition , Therefore, we can learn from its information processing mechanism to solve scientific and engineering problems . Immune algorithm is based on biological immune system
It is proposed that pathogens produce antibodies against pathogens , Therefore, a new research direction of intelligent optimization method based on immune principle was born .

2.1 Biological immune system
Traditional immunity refers to the body's defense against infection , Modern immunity refers to the recognition and elimination of antigenic foreign bodies by the body's immune system , So as to maintain the physiological balance and stable function of the body . Immunity is a physiological response of the body , When pathogens ( That's antigen ) When entering the human body , These antigens will stimulate immune cells ( lymph B cells 、T cells ) Produce a special protein antibody against the pathogenic organism . The antibody can destroy the pathogenic organism , And after the pathogen is eliminated , Still in the human body . When the same pathogen invades the human body again , The
Pathogenic organisms will be quickly destroyed by the remaining antibodies in the body [7].
Immunology related concepts
Immunity
Immunity refers to the sum of biological effects produced in the process of recognition and response of the body to itself and foreign bodies , Under normal circumstances, it is a physiological function to maintain the stability of the body's circulation . The organism recognizes allogeneic antigens , Produce an immune response to it and clear ; The body does not produce its own antigens
Immune response .
antigen
Antigen is a substance that can stimulate the body to produce immune response and bind to response products . It's not an integral part of the immune system , But it is the initiating factor in initiating the immune response .
antibody
Antibody is an immune molecule that can specifically recognize and clear antigens , Among them, globulin substances with anti-bacterial and anti toxin immune functions , Therefore, antibodies are also called immunoglobulin molecules , It is from B Produced by plasma cells differentiated from cells .
T Cells and B cells
T Cells and B Cells are the main component of lymphocytes .B When cells are stimulated by antigens , It can proliferate and differentiate into a large number of plasma cells , Plasma cells have the function of synthesizing and secreting antibodies . however ,B Cells cannot recognize most antigens , It must be aided by the ability to recognize antigens
T Cells to assist B Cell activation , Produce antibodies .
Biological immune system mechanism
The biological immune system consists of immune molecules 、 A complex system of immune tissues and cells . These tissues and organs that make up the immune system are distributed throughout the human body , Used to complete various immune defense functions , They are known as lymphoid organs and lymphoid tissues .
Immune recognition
Immune recognition is the main function of the immune system , The essence of recognition is to distinguish “ own ” and “ Not myself ”. Immune recognition is realized by the combination of antigen receptor and antigen on lymphocytes .
Immune learning
Immune recognition is also a learning process , As a result of learning, the individual affinity of immune cells is improved 、 The scale of the group expanded , And the optimal individual is preserved in the form of immune memory .
Immune memory
When the immune system first encounters an antigen , Lymphocytes need some time to adjust to better recognize antigens , After recognition, the memory information of the antigen is retained in the form of optimal antibody . When the immune system encounters the same or structurally similar antigen again
when , Under the action of associative memory , Its response speed is greatly improved .
Clone selection
Immune response and proliferation of immune cells occur above a specific matching threshold . When lymphocytes recognize antigens ,B Cells are activated and proliferate to produce clones B cells , The cloned cells then undergo a process of mutation , Produce antibodies specific to the antigen .
Individual diversity
According to Immunology , The immune system has 100 Many different proteins , However, the external potential antigens and the pattern types to be recognized are 1000 Varied . To achieve antigen recognition of an order of magnitude much larger than itself , An effective diversity individual generation mechanism is needed . Biological diversity of antibodies
The mechanism mainly includes the combinatorial reorganization of immune receptor library 、 Somatic high-frequency mutation and gene transformation .
The distributed characteristics of immune system depend on the distributed characteristics of pathogens , That is, pathogens are scattered inside the body . Because the immune response mechanism is through local cell interaction, there is no centralized control , Therefore, the distributed immune system further enhances its adaptive characteristics
sex . All these important information processing characteristics of immune system provide strong support for the application in the field of information and Computing .

2.2 Immune algorithm concept
Immune algorithm is a new intelligent search algorithm inspired by biological immune system . It is a combination of deterministic and random selection and has “ Exploration ” And “ Exploitation ” Ability heuristic random search algorithm . The immune algorithm corresponds the problem to be optimized in the optimization problem to the antigen in the immune response , Feasible solution corresponding antibody (B cells ), The mass of feasible solution corresponds to the affinity between immune cells and antigen . In this way, the optimization process of the optimization problem can be corresponding to the process of biological immune system recognizing antigen and realizing antibody evolution , The evolutionary process in biological immune response is abstracted as a mathematical evolutionary optimization process , Form an intelligent optimization algorithm .
Immune algorithm is abstracted from the mechanism of biological immune system , Many concepts and operators in the algorithm correspond to the concepts and immune mechanism in the immune system . The corresponding relationship between immune algorithm and biological immune system concept is shown in table 1 Shown . Because antibodies are made of B Cells produce
Of , In the immune algorithm, antibodies and B Cells do not distinguish , All correspond to the feasible solution of the optimization problem .
surface 1 The corresponding relationship between immune algorithm and biological immune system

According to the above correspondence , Simulating the process of biological immune response, an immune algorithm for optimization calculation is formed . The algorithm mainly includes the following modules ：
(1) Antigen recognition and initial antibody production . According to the characteristics of the problem to be optimized, an appropriate antibody coding rule is designed , Under this coding rule, the prior knowledge of the problem is used to generate the initial antibody population .
(2) Antibody evaluation . The quality of antibody was evaluated , The evaluation criteria were antibody affinity and individual concentration , The evaluated high-quality antibody will be subjected to evolutionary immune operation , Inferior antibodies will be updated .
(3) Immune operation . Use immune selection 、 clone 、 variation 、 Clone suppression 、 Operators such as population refresh simulate various immune operations in biological immune response , Form evolutionary rules and methods based on the clonal selection principle of biological immune system , Realize the optimization search of various optimization problems
Cable .

2.3 Characteristics of immune algorithm
Immune algorithm is inspired by immunology , An adaptive intelligent system that simulates the function and principle of biological immune system to solve complex problems , It retains some characteristics of the biological immune system [8], Include ：
(1) Global search capabilities . The immune algorithm, which imitates the immune response process, is an optimization algorithm with global search ability , Immune algorithm uses mutation operator and population refresh operator to continuously generate new individuals while locally searching the neighborhood of high-quality antibody , Explore feasible solutions
New area of the interval , Ensure that the algorithm searches in the complete feasible solution interval , It has global convergence performance .
(2) Diversity preserving mechanism . Immune algorithm draws lessons from the diversity maintenance mechanism of biological immune system , Calculate the concentration of antibody , The results of concentration calculation are used as an important standard to evaluate the quality of antibody individuals ： It inhibits high concentrations of antibodies , Ensure that the antibody population has good diversity , This is also an important aspect to ensure the global convergence performance of the algorithm .
(3) Strong robustness . The immune algorithm based on biological immune mechanism does not aim at specific problems , Moreover, the setting of algorithm parameters and the quality of initial solution are not emphasized , Using its heuristic intelligent search mechanism , Even if it starts from a poor solution population , Finally, the global optimal solution of the problem can also be searched , The dependence on the problem and the initial solution is not strong , It has strong adaptability and robustness .
(4) Parallel distributed search mechanism . The immune algorithm does not need centralized control , Parallel processing can be realized . and , The optimization process of immune algorithm is a multi process parallel optimization , While searching for the optimal solution of the problem, multiple suboptimal solutions of the problem can be obtained , That is, in addition to finding the best solution to the problem , Some better alternatives will be obtained , It is especially suitable for multimodal optimization problems .

2.4 Immune algorithm operator
It is similar to other intelligent optimization algorithms such as genetic algorithm , The evolutionary optimization process of immune algorithm is also realized by operators . The operators of immune algorithm include ： Affinity evaluation operator 、 Antibody concentration evaluation operator 、 Excitation calculation operator 、 Immune selection operator 、 Clone operator 、 variation
operator 、 Clone suppression operator and population refresh operator [9]. Because the coding method of the algorithm may be real number coding 、 Discrete coding, etc , The algorithm operators under different coding methods will also be different .
Affinity evaluation operator
Affinity characterizes the binding strength between immune cells and antigens , It is similar to the fitness in genetic algorithm . The affinity evaluation operator is usually a function aff(x) ：SER, among S Is the feasible solution interval of the problem ,R Is a real number field . The input to the function is an antibody individual ( Feasible solution ), The output is the affinity evaluation result . The evaluation of affinity is related to the specific problem , For different optimization problems , We should understand the essence of the problem , The affinity evaluation function is defined according to the characteristics of the problem . Generally, function optimization problems can be solved by function value or simple treatment of function value ( Take the reciprocal 、 Opposite number, etc ) As an affinity evaluation , For combinatorial optimization problems or more complex optimization problems in applications , It requires specific analysis of specific problems .
Antibody concentration evaluation operator
Antibody concentration represents the diversity of antibody population . High antibody concentrations mean that very similar individuals are abundant in the population , Then the optimization search will focus on a region of the feasible solution interval , It is not conducive to global optimization . Therefore, the optimization algorithm should suppress the individuals with high concentration
system , Ensure individual diversity .
Antibody concentration is usually defined as ：

Immune selection operator
The immune selection operator determines which antibodies are selected to enter the clone selection operation according to the excitation degree of the antibody . In the antibody population, antibody individuals with high motivation have better quality , More likely to be selected for clone selection , More search value in the search space .
Clone operator

Discrete coding algorithm mutation operator
Discrete coding algorithm is mainly binary coding , The mutation strategy is to randomly select a few bits from the antibody string of the mutation source , Change the value of bits ( Take the opposite ), Make it fall in the neighborhood of discrete spatial variation source .
Clone suppression operator
Clone suppression operator is used to reselect the mutated clones , Inhibit antibodies with low affinity , Retain antibodies with high affinity into new antibody populations . In the process of clonal inhibition , The source antibody operated by the clone operator and the clone are obtained by the action of the mutation operator
When the antibody group forms a set , The clone suppression operation will retain the antibody with the highest affinity in this collection , Inhibit other antibodies .
Because the source antibody operated by the clonal mutation operator is the high-quality antibody in the population , The temporary antibody set operated by the clone suppression operator contains the parent's source antibody , Therefore, the operator operation of immune algorithm implies the optimal individual retention mechanism .
Population refresh operator
The population refresh operator is used to refresh the antibodies with low incentive in the population , Remove these antibodies from the antibody population and replace them with randomly generated new antibodies , It is helpful to maintain the diversity of antibodies , Achieve global search , Explore new feasible solution space regions .

3 Types of immune algorithms
3.1 Clonal selection algorithm
Castro A clonal selection algorithm based on clonal selection theory of immune system is proposed [10] , The algorithm is an evolutionary algorithm that simulates the learning process of immune system . The production of antibodies by immune response is the learning process of the immune system , The antigen is matched by some B Cell recognition , these B cell division , The resulting sub B Cells change on the basis of mother cells , To find a better match with the antigen B cells , A better match with the antigen B Cells divide again …… And so on and so on , Finally, we found a complete match with the antigen B cells ,B Cells become plasma cells to produce antibodies , This process is the clone selection process , Clonal selection algorithm simulates this process for optimization .
3.2 Immune genetic algorithm
Chun Et al. Proposed an immune algorithm , In essence, it is an improved genetic algorithm [11] . The selection operation of genetic algorithm is improved according to the theory of somatic cell and immune network , Thus maintaining the diversity of the group , Improve the global optimization ability of the algorithm . By adding immune memory to the algorithm
function , The convergence speed of the algorithm is improved . Immune genetic algorithm regards antigen as objective function , Consider antibodies as a viable solution to the problem , The affinity between antibody and antigen is regarded as the fitness of feasible solution . The concept of antibody concentration is introduced into immune genetic algorithm , And use information entropy to describe , Represents the number of similar feasible solutions in the group . The immune genetic algorithm selects the operation according to the affinity between antibody and antigen and the concentration of antibody , The antibody with high affinity and low concentration has a high selection rate , This inhibits the high concentration of antibodies in the population , Maintain the diversity of the group .
3.3 Reverse selection algorithm
In the immune system T Cells develop in the thymus , Immature that reacts with its own proteins T The cells are destroyed , So mature T Cells have the nature to tolerate themselves , Does not react with its own proteins , Only react with foreign proteins , To identify “ own ” And “ Not myself ”, This is the so-called reverse selection principle .Forrest Based on the principle of reverse selection, a reverse selection algorithm is proposed , Used for anomaly detection
measuring [12]. The algorithm mainly includes two steps ： First , Generate a set of detectors , Each detector does not match the protected data ： secondly , Constantly compare each detector in the set with the protected data , If the detector matches the protected data , Then it is determined that the data has changed .

3.4 Vaccine immune algorithm
Jiao Licheng and others proposed a vaccine based immune algorithm based on the theory of immune system [13]. The algorithm adds immune operator to genetic algorithm , To improve the convergence speed of the algorithm and prevent population degradation . Immune operator includes two parts: vaccination and immune selection , The former is to improve affinity , The latter is to prevent population degradation . Theoretical analysis shows that the immune algorithm is convergent .
The basic steps of vaccine immune algorithm are ： Randomly generated NP Individuals form the initial parent group ; Vaccine extraction based on prior knowledge ; Calculate the affinity of all individuals in the current parent population , And judge the stop conditions ： Mutate the current parent population , Produce offspring
Groups ： Vaccinate the offspring population , The new species group is obtained ; Immune selection of new populations , Get a new generation of father , And enter the immune cycle .

4 Immune algorithm flow
At present, there is no unified immune algorithm and block diagram , The following describes a method containing 4.2.4 This section describes the algorithm flow of immune operator , It is divided into the following steps ：
(1) First, antigen recognition , That is to understand the problem to be optimized , Analyze the feasibility of the problem , Extract prior knowledge , Construct an appropriate affinity function , And formulate various constraints .
(2) Then produce the initial antibody group , The feasible solution of the problem is expressed as an antibody in the solution space by coding , An initial population is generated randomly in the solution space .
(3) Evaluate the affinity of each feasible solution in the population .
(4) Determine whether the algorithm termination conditions are met ： If the conditions are met , Then the algorithm optimization process is terminated , Output calculation results ： otherwise , Continue the optimization operation .
(5) Calculate antibody concentration and excitation .
(6) Immune treatment , Including immune selection 、 clone 、 Mutation and clonal inhibition .

Immune selection ： Select high-quality antibody according to the calculation results of antibody affinity and concentration in the population , Activate it ：
clone ： Clone and replicate the activated antibody , Get several copies ; variation ： Mutate the cloned copy , Make it have affinity mutation ;
Clone suppression ： Re select the variation results , Inhibit antibodies with low affinity , The variation results with high affinity were retained .
(7) Population refresh , The random generated new antibody is used to replace the antibody with low incentive in the population , Form a new generation of antibodies , Go to the next step (3).
The operation flow of immune algorithm is shown in Fig 1 Shown .

The evolutionary operation in immune algorithm is realized by evolutionary operator based on immune principle , Such as immune selection 、 clone 、 Variation, etc . Moreover, the calculation of antibody concentration and excitation degree are added to the algorithm , The antibody concentration was used as a standard to evaluate individual quality , Conducive to maintaining individual diversity , Realize global optimization .

5 Key parameter description
The main parameters of immune algorithm are introduced below , It plays an important role in program design and debugging . The immune algorithm mainly includes the following key parameters ：
Antibody population size NP
The antibody population retains the diversity of immune cells , Intuitively , The larger the population , The better the global search ability of immune algorithm , However, the amount of computation of each generation of the algorithm increases accordingly . In most problems ,NP take 10~100 A more appropriate , Generally not more than 200.
Immune selection ratio
The greater the number of antibodies selected by immunization , Will produce more clones , The stronger its search ability , But it will increase the amount of computation per generation . Generally, we can take the antibody population size NP Of 10%~50%.
Multiple of antibody clone amplification
The multiple of cloning determines the number of cells cloned and expanded , This determines the search ability of the algorithm , Mainly local search ability . The larger the number of clone multiples , The better the local search ability , The global search ability has also been improved , But the amount of calculation also increases , Usually take 5~
10 times .
Population refresh ratio
The elimination and renewal of cells is an important mechanism for antibody diversity , Therefore, it has an important impact on the global search ability of immune algorithm . The updated antibody of each generation generally does not exceed the antibody population 50%.
Max evolutionary Algebra G
Max evolutionary Algebra G Is a parameter that represents the end condition of the immune algorithm , It means that the immune algorithm stops running after running to the specified evolutionary Algebra , The best individual in the current group is output as the optimal solution of the problem . commonly 6 take 100~500.

## 3、 ... and 、 Partial source code

``````%% Clear the environment
clc;clear
load scheduleData Jm T JmNumber Q
% working procedure Time
%% The basic parameters
NIND=40; % Number of individuals
MAXGEN=80; % Maximum hereditary algebra
GGAP=0.9; % Generation gap
XOVR=0.8; % Cross rate
MUTR=0.1; % Variation rate
gen=0; % Generation counter
%PNumber Number of workpieces MNumber Number of processes
[PNumber MNumber]=size(Jm);
trace=zeros(2, MAXGEN); % The initial value of the optimization result
WNumber=PNumber*MNumber; % Total number of processes
%% initialization
Number=zeros(1,PNumber); % PNumber Number of workpieces
for i=1:PNumber
Number(i)=MNumber; %MNumber Number of processes
end
% Code 2 layer , The first process , Second floor machine
Chrom=zeros(NIND,2*WNumber);
for j=1:NIND
WPNumberTemp=Number;
for i=1:WNumber
% Random production process
val=unidrnd(PNumber);
while WPNumberTemp(val)==0
val=unidrnd(PNumber);
end
% The first layer of code represents the operation
Chrom(j,i)= val;
WPNumberTemp(val)=WPNumberTemp(val)-1;
% The first 2 The layer code represents the machine
Temp=Jm{val,MNumber-WPNumberTemp(val)};
SizeTemp=length(Temp);
% Random production process machine
Chrom(j,i+WNumber)= unidrnd(SizeTemp);
end
end
% Calculate objective function value
[PVal ObjV P S]=cal(Chrom,JmNumber,T,Jm);
%% Circular search
while gen<MAXGEN
% Assign fitness values
FitnV=ranking(ObjV);
% Select operation
SelCh=select('rws', Chrom, FitnV, GGAP);
% Cross operation
SelCh=across(SelCh,XOVR,Jm,T);
% Mutation operation
SelCh=aberranceJm(SelCh,MUTR,Jm,T);
% Calculate the target fitness value
[PVal ObjVSel P S]=cal(SelCh,JmNumber,T,Jm);
% Reinsert the new species group
[Chrom ObjV] =reins(Chrom, SelCh,1, 1, ObjV, ObjVSel);
% The generation counter is incremented
gen=gen+1;
% Save the optimal value
trace(1, gen)=min(ObjV);
trace(2, gen)=mean(ObjV);
% Record the best value
if gen==1
Val1=PVal;
Val2=P;
MinVal=min(ObjV);% Minimum time
STemp=S;
end
% Record The smallest process
if MinVal> trace(1,gen)
Val1=PVal;
Val2=P;
MinVal=trace(1,gen);
STemp=S;
end
end
% Current best value
PVal=Val1; % Process time
P=Val2; % working procedure
S=STemp; % Scheduling genes contain machine genes
%% Describe the change of solution
figure(1)
plot(trace(1,:));
hold on;
plot(trace(2,:),'-.');grid;
legend(' Change of solution ',' Changes in population mean ');
%% Show 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)); % working procedure
b=((val-a)/100); % workpiece
Temp=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;
function NewChrom=across(Chrom,XOVR,Jm,T)
% Chrom=[1 3 2 3 1 2 1 3 2;
% 1 1 2 3 3 1 2 3 2;
% 1 3 2 3 2 2 1 3 1;
% 1 3 3 3 1 2 1 2 2;
% ];
% XOVR=0.7;
[NIND,WNumber]=size(Chrom);
WNumber=WNumber/2;
NewChrom=Chrom;% Initialize the new group
[PNumber MNumber]=size(Jm);
Number=zeros(1,PNumber);
for i=1:PNumber
Number(i)=1;
end
% Randomly selected crossover individuals ( Shuffle the deck cross )
SelNum=randperm(NIND);
Num=floor(NIND/2);% Cross individual matching number
for i=1:2:Num
if XOVR>rand;
Pos=unidrnd(WNumber);% Cross location
while Pos==1
Pos=unidrnd(WNumber);
end
% Take two crossed individuals
S1=Chrom(SelNum(i),1:WNumber);
S2=Chrom(SelNum(i+1),1:WNumber);
S11=S2;S22=S1; % Initialize a new individual
% In the middle of a new individual COPY
S11(1:Pos)=S1(1:Pos);
S22(1:Pos)=S2(1:Pos);
% Compare S11 relative S1,S22 relative S2 Redundant and missing genes
S3=S11;S4=S1;
S5=S22;S6=S2;
for j=1:WNumber
Pos1=find(S4==S3(j),1);
Pos2=find(S6==S5(j),1);
if Pos1>0
S3(j)=0;
S4(Pos1)=0;
end
if Pos2>0
S5(j)=0;
S6(Pos2)=0;
end
end
for j=1:WNumber
if S3(j)~=0 % Extra genes
Pos1=find(S11==S3(j),1);
Pos2=find(S4,1);% Look for missing genes
S11(Pos1)=S4(Pos2);% Repair excess genes with missing genes
S4(Pos2)=0;
end
if S5(j)~=0
Pos1=find(S22==S5(j),1);
Pos2=find(S6,1);
S22(Pos1)=S6(Pos2);
S6(Pos2)=0;
end
end
% Save the machine before crossing gene
S1=Chrom(SelNum(i),:);
S2=Chrom(SelNum(i+1),:);
for k=1:WNumber
Pos1=Find(S11(k),S1);
S11(WNumber+k)=S1(WNumber+Pos1);
S1(Pos1)=0;
Pos1=Find(S22(k),S2);
S22(WNumber+k)=S2(WNumber+Pos1);
S2(Pos1)=0;
end
```

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.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
```

## 5、 ... and 、matlab Edition and references

1 matlab edition
2014a

2 reference
[1] Baoziyang , Yu Jizhou , Poplar . Intelligent optimization algorithm and its application MATLAB example （ The first 2 edition ）[M]. Electronic industry press ,2016.
[2] Zhang Yan , Wu Shuigen .MATLAB Optimization algorithm source code [M]. tsinghua university press ,2017.