我正在使用GA优化模糊系统中隶属函数的参数。
我创建一个健身功能:

function y = gafuzzy(x)
global FISsys
global allData
global realResult

FISsys = readfis('aCAess.fis');
allData = importdata('ab.mat');
realResult = importdata('ad.mat');

FISsys.input(1,1).mf(1,1).params = [x(1) x(2) x(3)];
FISsys.input(1,1).mf(1,2).params = [x(4) x(5) x(6)];

FISsys.input(1,2).mf(1,1).params = [x(7) x(8) x(9)];
FISsys.input(1,2).mf(1,2).params = [x(10) x(11) x(12)];

FISsys.output.mf(1,1).params = [x(13) x(14) x(15)];
FISsys.output.mf(1,2).params = [x(16) x(17) x(18)];

c = evalfis(allData,FISsys);
e=sum(abs(c-realResult));
y = e;

end


线性不等式的[15 * 18]矩阵为:

A = [1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1;
0,1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,-1,0]


b [15 * 1]向量是:

b = [0;0;0;0;0;0;0;0;0;0;0;0;0;0;0]


但是当我运行GA时,出现以下错误:
fisTriangleMf()中的参数非法-> a> b

为什么?

最佳答案

通常,在三角形MF中,第一个数字(此处为a(显示左顶点))应小于第二个数字,此处为b(顶部顶点)。因此,您可以拥有一个像[-1 0 1]的三角形MF,但不能像[0 -1 1]。

在您的代码中,我认为有时您不满足这些地方之一中的不平等问题:

[x(1) < x(2) < x(3)];
[x(4) < x(5) < x(6)];
[x(7) < x(8) < x(9)];
[x(10) < x(11) < x(12)];
....


如果程序将这些值随机化,则可以通过检查和替换轻松地将它们绑定到代码中,例如:

if x(1) >= x(2)
     tmp = x(1);
     x(1) = x(2);
     x(2) = tmp;
end

关于matlab - 遗传算法优化模糊推理的MF,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20950006/

10-09 02:49