模糊choquet积分介绍

如果有4个投入,则这4个投入的二进制编码可以设置为,
%1 0 0 0 x1
%0 1 0 0 x2
%1 1 0 0 x12
%0 0 1 0 x3
%1 0 1 0 x13
%0 1 1 0 x23
%1 1 1 0 x123
%0 0 0 1 x4
%1 0 0 1 x14
%0 1 0 1 x24
%1 1 0 1 x124
%0 0 1 1 x34
%1 0 1 1 x134
%0 1 1 1 x234
%1 1 1 1 x1234

clear all;
%number of inputs
N = 4;
% g = [ x1  x2  x12 x3  x13 x23 x123 x4  x14 x24 x124 x34 x134 x234 x1234 ]
g =   [ 0.1 0.2 0.2 0.3 0.3 0.3 0.3  0.4 0.4 0.4 0.4  0.4 0.4  0.4  1 ];

%计算h(x1)=0.2, h(x2)=0.3, h(x3)=0.7 and h(x4)=0.2的choquet积分

choquet_integral([0.2 0.3 0.7 0.2],g)

function [res] = choquet_integral(inputs,FM)
	% for discrete (finite X), first sort our inputs
	[SortVal, SortInd] = sort( inputs,2,'descend'); 
	% append 0 for difference form below
	SortVal = [SortVal zeros(size(inputs,1),1)]; 
	% get the correct indices
	i = cumsum(2.^(SortInd-1),2);
	% compute the integral	
	res = sum(FM(i).*(SortVal(:,1:end-1)-SortVal(:,2:end)),2);
end 
%使用OWA算子计算模糊集结
[g] = fi_owa(ones(1,4)./4)'
choquet_integral( [0.2 0.3 0.7 0.2] , g )

function [FMbinary] = fi_owa( weights )
	% how many inputs? (N)
	nInputs = length(weights);
	% how many variables to make?
	vars = 1:2.^nInputs-1;
	% do our decimal to binary 
	varsBin = de2bi(vars, nInputs);
	% get the number of layers
	layers = sum(varsBin,2);
	% compute the resultant binary encoded fuzzy measure
	FMbinary = arrayfun(@(x) sum(weights(1:x)), layers); 
end 

function [res] = choquet_integral(inputs,FM)
	% for discrete (finite X), first sort our inputs
	[SortVal, SortInd] = sort(inputs,2,'descend'); 
	% append 0 for difference form below
	SortVal = [SortVal zeros(size(inputs,1),1)]; 
	% get the correct indices
	i = cumsum(2.^(SortInd-1),2);
	% compute the integral	
	res = sum(FM(i).*(SortVal(:,1:end-1)-SortVal(:,2:end)),2);
end 

你可能感兴趣的:(matlab,算法)