clear all;
load('D-date.mat')
%b2=pailiezuhe(2,1,5);
%b3=pailiezuhe(3,1,5); %列举出3个一对的所有情况
%b4=pailiezuhe(4,1,5);
%b5=pailiezuhe(5,1,5);
%b6=pailiezuhe(6,1,5);
[m3,n3,a3,b3,l13,w13,l23,w23]=ratio(3,1,5);
[m2,n2,a2,b2,l12,w12,l22,w22]=ratio(2,1,5);
[m4,n4,a4,b4,l14,w14,l24,w24]=ratio(4,1,5);
[m5,n5,a5,b5,l15,w15,l25,w25]=ratio(5,1,5);
[m6,n6,a6,b6,l16,w16,l26,w26]=ratio(6,1,5);
a=[a2;a3;a4;a5;a6];
m=[m2;m3;m4;m5;m6];
n=[n2;n3;n4;n5;n6];
b2=changf(b2);
b3=changf(b3);
b4=changf(b4);
b5=changf(b5);
b=[b2;b3;b4;b5;b6];
[row,col]=find(n~=0);
[r,t]=size(row);
combine=zeros(r,r);
m_new=zeros(r,r);
n_new=zeros(r,r);
l1_new=zeros(r,r);
l2_new=zeros(r,r);
w1_new=zeros(r,r);
w2_new=zeros(r,r);
for i=1:r
for j=1:r
if j~=i
bb1=find(b(row(i,1),:)~=0);
bb2=find(b(row(j,1),:)~=0);
ii=row(i,1);
jj=row(j,1);
l_max=max(d_l(b(ii,bb1)))+max(d_l(b(jj,bb2)));
i_1=fix(y_l(col(i,1))/l_max);
w_sum=max(sum(d_w( b(ii,bb1)')),sum(d_w( b(jj,bb2)')));%计算宽度总长
if (i_1==0)||(w_sum>y_w(col(i,1)))
combine(i,j)=0;
m_new(i,j)=m(row(i,1),col(i,1));
n_new(i,j)=n(row(i,1),col(i,1));
else
s_sum=d_w(b(ii,bb1)')'*d_l(b(ii,bb1)')+d_w(b(jj,bb2)')'*d_l(b(jj,bb2)');
m_new(i,j)=i_1*s_sum/(y_l(col(i,1))*y_w(col(i,1)));
if m_new(i,j)<m(row(i,1),col(i,1))
combine(i,j)=0;
m_new(i,j)=m(row(i,1),col(i,1));
n_new(i,j)=n(row(i,1),col(i,1));
else
combine(i,j)=1;
m_new(i,j)=i_1*s_sum/(y_l(col(i,1))*y_w(col(i,1)));
sum1=s_sum;
shengyu_sum=y_l(col(i,1))-i_1*l_max;
if (y_w(col(i,1))-sum(d_w( b(ii,bb1)'))>=100)&&(max(d_l(b(ii,bb1)))>=50000)
sum1=sum1+(y_w(col(i,1))-sum(d_w( b(ii,bb1)')))*max(d_l(b(ii,bb1)));
l1_new(i,j)=max(d_l(b(ii,bb1)));
w1_new(i,j)=max(d_w(b(ii,bb1)));
elseif (y_w(col(i,1))-sum(d_w( b(ii,bb1)'))>=1000)&&(max(d_l(b(ii,bb1)))>=2000)
sum1=sum1+(y_w(col(i,1))-sum(d_w( b(ii,bb1)')))*max(d_l(b(ii,bb1)));
end
if (y_w(col(j,1))-sum(d_w( b(jj,bb2)'))>=100)&&(sum(d_w( b(jj,bb2)'))>=50000)
sum1=sum1+(y_w(col(j,1))-sum(d_w( b(jj,bb2)')))*sum(d_w( b(jj,bb2)'));
elseif (y_w(col(j,1))-sum(d_w( b(jj,bb2)'))>=1000)&&(sum(d_w( b(jj,bb2)'))>=2000)
sum1=sum1+(y_w(col(j,1))-sum(d_w( b(jj,bb2)')))*sum(d_w( b(jj,bb2)'));
end
sum1=sum1*i_1;
if (shengyu_sum>=2000)&&(y_w(col(i,1))>=1000)
sum1=sum1+shengyu_sum*y_w(col(i,1));
elseif (shengyu_sum>=50000)&&(y_w(col(i,1))>=100)
sum1=sum1+shengyu_sum*y_w(col(i,1));
end
n_new(i,j)=sum1/(y_l(col(i,1))*y_w(col(i,1)));%计算成材率
end
end
end
end
end
[rr,cc]=find(m_new>=0.8);
mmm=length(rr);
date1=zeros(mmm,18);
for i=1:mmm
date1(i,1)=col(rr(i));
if combine(rr(i),cc(i))==1
date1(i,2:7)=b(row(rr(i)),:);
date1(i,8:13)=b(row(cc(i)),:);
bb1=find(b(row(rr(i)),:)~=0);
bb2=find(b(row(cc(i)),:)~=0);
ii=row(rr(i));
jj=row(cc(i));
l_max=max(d_l(b(ii,bb1)))+max(d_l(b(jj,bb2)));
date1(i,16)=fix(y_l(col(rr(i),1))/l_max);
else
date1(i,2:7)=b(row(rr(i)),:);
bb1=find(b(row(rr(i)),:)~=0);
ii=row(rr(i));
l_max=max(d_l(b(ii,bb1)));
date1(i,16)=fix(y_l(col(rr(i),1))/l_max);
end
date1(i,14)=m_new(rr(i),cc(i));
date1(i,15)=n_new(rr(i),cc(i));
end
date1=unique(date1,'rows');
评论0