Chương 3. ĐÁNH GIÁ KẾT QUẢ HỌC TẬP CỦA HỌC SINH BẰNG CÁCH SỬ DỤNG HÀM THUỘC VÀ LUẬT MỜ
3.4. Chương trình máy tính
n=10; % So hoc sinh
% Ma tran do chinh xác
A=[0.59 0.35 1 0.66 0.11 0.08 0.84 0.23 0.4 0.24;
0.01 0.27 0.14 0.04 0.88 0.16 0.04 0.22 0.81 0.53;
0.77 0.69 0.97 0.71 0.17 0.86 0.87 0.42 0.91 0.74;
0.73 0.72 0.18 0.16 0.50 0.02 0.32 0.92 0.90 0.25;
0.93 0.49 0.08 0.81 0.65 0.93 0.39 0.51 0.97 0.61];
% Ma tran thoi gian tra loi
T=[0.7 0.4 0.1 1 0.7 0.2 0.7 0.6 0.4 0.9;
1 0 0.9 0.3 1 0.3 0.2 0.8 0 0.3;
0 0.1 0 0.1 0.9 1 0.2 0.3 0.1 0.4;
0.2 0.1 0 1 1 0.3 0.4 0.8 0.7 0.5;
0 0.1 1 1 0.6 1 0.8 0.2 0.8 0.2];
% Ma tran diem cho moi cau hoi G=[10;
15;
20;
25;
30];
% Ma tran do quan trong IM=[0 0 0 0 1;
0 0.33 0.67 0 0;
0 0 0 0.15 0.85;
1 0 0 0 0;
0 0.07 0.93 0 0];
% Ma tran do phuc tap C=[0 0.85 0.15 0 0;
0 0 0.33 0.67 0;
0 0 0 0.69 0.31;
0.56 0.44 0 0 0;
0 0 0.67 0.3 0];
Hàm timmax.m
function [max]=timmax(x1,x2,x3,x4,x5,x6,x7) max=x1;
if max<x2 max=x2;
end;
if max<x3 max=x3;
end;
if max<x4 max=x4;
end;
if max<x5 max=x5;
end;
if max<x6 max=x6;
end;
if max<x7 max=x7;
end;
Hàm thực hiện bước 5 và bước 6: buoc56.m function [SOD]=B(vt,k)
%Xay dung ma tran EA (3 HS co cung tong diem)
load('tam');
EA=0;
for j2=1:k
ja=KQ(1,vt-1+j2);
for i=1:m
EA(i,j2)=A(i,ja);
end;
end;
%Tinh tong chenh lech SOD cua cac HS co cung tong diem SOD=0;
for j2=1:k
SOD(1,j2)=KQ(1,vt-1+j2);
SOD(2,j2)=0;
for i=1:m t1=0;
for p=1:k
t1=t1+EA(i,j2)-EA(i,p);
end;
SOD(2,j2)=SOD(2,j2)+t1*G(i)*(1.5+adv(i));
end;
end;
%Sap xep mang SOD for j1=1:k-1
for j2=j1+1:k
if SOD(2,j2)>SOD(2,j1) tg=SOD(2,j2);
SOD(2,j2)=SOD(2,j1);
SOD(2,j1)=tg;
tg=SOD(1,j2);
SOD(1,j2)=SOD(1,j1);
SOD(1,j1)=tg;
end;
end;
end;
Chương trình chính: chuong3.m dlvao_C3;
%Tinh tong so diem cho tung hoc sinh KQ=0;
for j=1:n KQ(1,j)=j;
KQ(2,j)=0;
for i=1:m
KQ(2,j)=KQ(2,j)+A(i,j)*G(i);
end;
end;
%Sap xep mang ket qua for j1=1:n-1
for j2=j1+1:n
if KQ(2,j2)>KQ(2,j1) tg=KQ(2,j2);
KQ(2,j2)=KQ(2,j1);
KQ(2,j1)=tg;
tg=KQ(1,j2);
KQ(1,j2)=KQ(1,j1);
KQ(1,j1)=tg;
end;
end;
end;
KQ1=KQ;
%Tinh do chinh xac trung binh va thoi gian tra loi trung binh
ArgA=0; ArgT=0;
for i=1:m
ArgA(i)=sum(A(i,:))/n;
ArgT(i)=sum(T(i,:))/n;
end;
%Tinh FA, FT FA=0;
for i=1:m
if ArgA(i)<0.1 FA(i,1)=1;
end;
if ArgA(i)>0.9 FA(i,5)=1;
end;
j1=1;
for j=0.1:0.2:0.7
if (j<ArgA(i))&(ArgA(i)<=j+0.2) FA(i,j1)= -5*ArgA(i) + (j+0.2)/0.2;
FA(i,j1+1)= 5*ArgA(i) - j/0.2;
end;
j1=j1+1;
end;
end;
FT=0;
for i=1:m
if ArgT(i)<0.1 FT(i,1)=1;
end;
if ArgT(i)>0.9
FT(i,5)=1;
else
FT(i,5)=0;
end;
j1=1;
for j=0.1:0.2:0.7
if (j<ArgT(i))&(ArgT(i)<=j+0.2) FT(i,j1)= -5*ArgT(i) + (j+0.2)/0.2;
FT(i,j1+1)= 5*ArgT(i) - j/0.2;
end;
j1=j1+1;
end;
end;
%Xay dung ma tran D D=0;
tA=0.6; tT=0.4; %tA la trong so cua do chinh xac, tT la trong so cua thoi gian tra loi
for i=1:m
D(i,1)= timmax(tA*FA(i,4)+tT*FT(i,1),tA*FA(i,5)+tT*FT(i,1),...
tA*FA(i,5)+tT*FT(i,2),0,0,0,0);
D(i,2)= timmax(tA*FA(i,2)+tT*FT(i,1),tA*FA(i,3)+tT*FT(i,1),...
tA*FA(i,3)+tT*FT(i,2),tA*FA(i,4)+tT*FT(i,2),...
tA*FA(i,4)+tT*FT(i,3),tA*FA(i,5)+tT*FT(i,3),tA*FA(i,5)+tT*FT(i,4));
D(i,3)= timmax(tA*FA(i,1)+tT*FT(i,1),tA*FA(i,2)+tT*FT(i,2),...
tA*FA(i,3)+tT*FT(i,3),tA*FA(i,4)+tT*FT(i,4),tA*FA(i,5)+tT*FT(i,5),0,0);
D(i,4)= timmax(tA*FA(i,1)+tT*FT(i,2),tA*FA(i,1)+tT*FT(i,3),...
tA*FA(i,2)+tT*FT(i,3),tA*FA(i,2)+tT*FT(i,4),...
tA*FA(i,3)+tT*FT(i,4),tA*FA(i,3)+tT*FT(i,5),tA*FA(i,4)+tT*FT(i,5));
D(i,5)= timmax(tA*FA(i,1)+tT*FT(i,4),tA*FA(i,1)+tT*FT(i,5),...
tA*FA(i,2)+tT*FT(i,5),0,0,0,0);
end;
%Xay dung ma tran CO CO=0;
tD=0.7; tC=0.3; %tD la trong so cua do kho, tC la trong so cua do phuc tap for i=1:m
CO(i,1)= timmax(tD*D(i,1)+tC*C(i,1),tD*D(i,1)+tC*C(i,2),...
tD*D(i,2)+tC*C(i,1),0,0,0,0);
CO(i,2)= timmax(tD*D(i,1)+tC*C(i,3),tD*D(i,1)+tC*C(i,4),...
tD*D(i,2)+tC*C(i,2),tD*D(i,2)+tC*C(i,3),...
tD*D(i,3)+tC*C(i,1),tD*D(i,3)+tC*C(i,2),tD*D(i,4)+tC*C(i,1));
CO(i,3)= timmax(tD*D(i,1)+tC*C(i,5),tD*D(i,2)+tC*C(i,4),...
tD*D(i,3)+tC*C(i,3),tD*D(i,4)+tC*C(i,2),tD*D(i,5)+tC*C(i,1),0,0);
CO(i,4)= timmax(tD*D(i,2)+tC*C(i,5),tD*D(i,3)+tC*C(i,4),...
tD*D(i,3)+tC*C(i,5),tD*D(i,4)+tC*C(i,3),...
tD*D(i,4)+tC*C(i,4),tD*D(i,5)+tC*C(i,2),tD*D(i,5)+tC*C(i,3));
CO(i,5)= timmax(tD*D(i,4)+tC*C(i,5),tD*D(i,5)+tC*C(i,4),...
tD*D(i,5)+tC*C(i,5),0,0,0,0);
end;
%Xay dung ma tran V V=0;
tIM=0.5; tCO=0.5; %tIM la trong so cua do q.trong, tCO la trong so cua chi phi for i=1:m
V(i,1)= timmax(tIM*IM(i,1)+tCO*CO(i,1),tIM*IM(i,1)+tCO*CO(i,2), tIM*IM(i,2)+tCO*CO(i,1),0,0,0,0);
V(i,2)= timmax(tIM*IM(i,1)+tCO*CO(i,3),tIM*IM(i,1)+tCO*CO(i,4), tIM*IM(i,2)+tCO*CO(i,2),tIM*IM(i,2)+tCO*CO(i,3),
tIM*IM(i,3)+tCO*CO(i,1),tIM*IM(i,3)+tCO*CO(i,2), tIM*IM(i,4)+tCO*CO(i,1));
V(i,3)= timmax(tIM*IM(i,1)+tCO*CO(i,5),tIM*IM(i,2)+tCO*CO(i,4), tIM*IM(i,3)+tCO*CO(i,3),tIM*IM(i,4)+tCO*CO(i,2),
tIM*IM(i,5)+tCO*CO(i,1),0,0);
V(i,4)= timmax(tIM*IM(i,2)+tCO*CO(i,5),tIM*IM(i,3)+tCO*CO(i,4), tIM*IM(i,3)+tCO*CO(i,5),tIM*IM(i,4)+tCO*CO(i,3),...
tIM*IM(i,4)+tCO*CO(i,4),tIM*IM(i,5)+tCO*CO(i,2), tIM*IM(i,5)+tCO*CO(i,3));
V(i,5)= timmax(tIM*IM(i,4)+tCO*CO(i,5),tIM*IM(i,5)+tCO*CO(i,4), tIM*IM(i,5)+tCO*CO(i,5),0,0,0,0);
end;
%Tinh dieu chinh gia tri cuoi cung cua cau hoi for i=1:m
adv(i)=(0.1*V(i,1)+0.3*V(i,2)+0.5*V(i,3)+0.7*V(i,4)+0.9*V(i,5))/
(0.1+0.3+0.5+0.7+0.9);
end;
save('tam','m','A','G','KQ','adv');
%Tim cac hoc sinh co cung tong diem va xu ly
vt=0; %Vi tri cu hoc sinh dau tien trong so nhung hoc sinh co cung tong diem j=1;
while j<n
if KQ(2,j)==KQ(2,j+1) vt=j;
while (KQ(2,j)==KQ(2,j+1))&(j<n) j=j+1;
end;
k=j-vt+1; %So hoc sinh co cung tong diem SOD=Buoc56(vt,k);
%Cap nhat lai thu tu vao mang KQ for j2=0:k-1
KQ(1,vt+j2)=SOD(1,j2+1);
end;
end;
j=j+1;
end;