A list,
1 Fault detection
Immune algorithm is based on how to calculate the similarity between antigen and antibody, antibody and antibody, so immune algorithm has a unique advantage in dealing with similarity.
The fault detection and diagnosis model based on artificial immunity is shown in the figure.
In this model, an N – dimensional eigenvector is used to represent the data of system working state. In order to reduce the time complexity, the detection of system working status is divided into the following two levels:
(1) Abnormal detection: Responsible for reporting abnormal working status of the system.
(2) Fault diagnosis: determine the type and location of the fault.
Self, which describes the normal functioning of the system, is the first type of antigen, used to produce primitive antibodies; Non-self, which describes the abnormal functioning of the system, acts as a type II antigen and is used to stimulate the antibody to mutate and clone evolution, leading to its maturation.
The following uses immune algorithm to illustrate the acquisition technology of diagnostic knowledge.
2 cases
A group of fault codes and three kinds of fault codes are randomly set up, and the fault is obtained by immune algorithm
The probability that codes belong to the fault type codes
Ii. Source code
clear all;
clc
global popsize length min max N code;
N=11; % Number of decimal coded digits per chromosome M=110; % Evolution algebra popsize=20; % set the initial parameter, population size length=10; % length is the binary coding bit of each gene chromlength=N*length; % String length (individual length), binary encoding length of chromosome PC =0.7; % Set the crossover probability. In this example, the crossover probability is a constant value. If you want to set the changing crossover probability, you can express it by expression or write a crossover probability function, for example, the value obtained by neural network training is used as the crossover probability PM =0.3; % set the probability of variation to bound={- 100.*ones(popsize,1),zeros(popsize,1)}; min=bound{1}; max=bound{2}; pop=initpop(popsize,chromlength); % runs the initialization function to randomly generate the initial population ymax=500;
K=1; P % results are (I *popsie) monitors (antibody) plot(1:M,favg)
title('Individual fitness trends')
xlabel('Number of iterations')
ylabel('Individual fitness')
function [bestindividual,bestfit]=best(pop,fitvalue)
global popsize N length;
bestindividual=pop(1, :); bestfit=fitvalue(1);
Cmin=0;
for i=1:popsize
if objvalue(i)+Cmin>0Temp =Cmin+ objValue (I);else
temp=0;
end
fitvalue(i)=temp; End end function [newPOP]=mutation(pop, PM) global popsize N length;for i=1:popsize
ifMpoint =round(rand*N*length); % individual variation positionif mpoint<=0
mpoint=1;
end
newpop(i,:)=pop(i,:);
if newpop(i,mpoint)= =0
newpop(i,mpoint)=1;
else
newpop(i,mpoint)=0;
end
function newpop=crossover(pop,pc,k)
global N length M;
pc=pc-(M-k)/M*1/20;
A=1:N*length;
% A=randcross(A,N,length);
for i=1:length n1=A(i); n2=i+10;
for j=1:N
temp1=pop(n1,(j- 1)*length+cpoint+1:j*length); temp2=pop(n2,(j- 1)*length+cpoint+1:j*length);
pop(n1,(j- 1)*length+cpoint+1:j*length)=temp2; pop(n2,(j- 1)*length+cpoint+1:j*length)=temp1;
end
Copy the code
3. Operation results
The specific operation result is shown in the diagram of failure data set in complete code. The probability P values of failure data belonging to three failure types are as follows: P= 0.800000000000 0.050000000000 1.000000000000 This indicates that the probability of fault data belonging to fault 1 is 80%, the probability of fault 2 is 5%, and the probability of fault 3 is 100%.
Fourth, note
Version: 2014 a