Приложение. Исходный код системы (по модулям).
end;
if MCon='1' then
begin
Series2.Clear;
Series4.Clear;
Series5.Clear;
Label1.Caption:='Параметр не имеет смысла с 1 блоком.';
end;
Label3.Caption:='Количество блоков задач - '+Mcon;
Label5.Caption:='Обшее количество участников '+IntToStr(Query1.RecordCount)+'.';
Label4.Caption:='Максимальный балл равен '+IntToStr(NumI)+'.';
if MCon<>'1' then
begin
Query1.First;
for i:=1 to Query1.RecordCount do
begin
p1[i]:=Query1.FieldValues['PARAM1'];
p2[i]:=Query1.FieldValues['PARAM2'];
p3[i]:=Query1.FieldValues['PARAM3'];
Query1.Next;
end;
kl:=0;
j:=1;
kz:=Query1.RecordCount;
nz:=0;
gr:=0;
for i:=1 to kz do
begin
with Query1 do
begin
Active:=False;
SQL.Clear;
SQL.Add('Select * from "'+Form1.Table1.TableName+'"');
SQL.Add('where (PARAM1='+FloatToStr(p1[j])+') and (PARAM2='+FloatToStr(p2[j])+') and (PARAM3='+FloatToStr(p3[j])+')');
ExecSQL;
Active:=True;
kl:=Query1.RecordCount;
if kl=1 then j:=j+1;
if kl>1 then
begin
j:=j+kl;
nz:=nz+kl;
gr:=gr+1;
end;
end;
end;
Label2.Caption:='Коэффициент мест - '+FloatToStr(Okrugl((kz-nz+gr)/kz,2))+'.';
end
else Label2.Caption:='Для одного блока не рассчитывается.';
//This is a demo-code for KN & KP
try
with Query1 do
begin
Active:=False;
SQL.Clear;
SQL.Add('Select * from "'+Form1.Table1.TableName+'"');
ExecSQL;
end;
Query1.Active:=True;
Chart1.Enabled:=True;
except
Application.MessageBox('Ошибка инициализации БД. Возможно не установлен BDE, или база не открыта.','Ошибка',mb_Ok+MB_ICONHAND);
Chart1.Enabled:=False;
Exit;
end;
sbl1:=0; srbl1:=0;
sbl2:=0; srbl2:=0;
sbl3:=0; srbl3:=0;
dx1:=0; dx2:=0; dx3:=0;
sdxq1:=0; sdxq2:=0; sdxq3:=0;
sigm1:=0; sigm2:=0; sigm3:=0;
Query1.First;
if MCon='2' then
begin
for i:=1 to Query1.RecordCount do
begin
block1:=Query1.FieldValues['MARK1']+Query1.FieldValues['MARK2']+Query1.FieldValues['MARK3'];
block2:=Query1.FieldValues['MARK4']+Query1.FieldValues['MARK5']+Query1.FieldValues['MARK6'];
sbl1:=sbl1+block1;
sbl2:=sbl2+block2;
Query1.Next;
end;
srbl1:=sbl1/Query1.RecordCount;
srbl2:=sbl2/Query1.RecordCount;
Query1.First;
for i:=1 to Query1.RecordCount do
begin
block1:=Query1.FieldValues['MARK1']+Query1.FieldValues['MARK2']+Query1.FieldValues['MARK3'];
block2:=Query1.FieldValues['MARK4']+Query1.FieldValues['MARK5']+Query1.FieldValues['MARK6'];
dx1:=dx1+sqr(block1-srbl1);
dx2:=dx2+sqr(block2-srbl2);
Query1.Next;
end;
sdxq1:=dx1/Query1.RecordCount;
sdxq2:=dx2/Query1.RecordCount;
sigm1:=sqrt(sdxq1);
sigm2:=sqrt(sdxq2);
m:=StrToFloat(maxb);
kn[1]:=((m-srbl1)*((m-srbl1)*srbl1-sqr(sigm1))/(m*sqr(sigm1)-(m-srbl1)*srbl1))-1;
kp[1]:=1-((srbl1*((m-srbl1)*srbl1-sqr(sigm1)))/(m*sqr(sigm1)-(m-srbl1)*srbl1));
kn[2]:=((m-srbl2)*((m-srbl2)*srbl2-sqr(sigm2))/(m*sqr(sigm2)-(m-srbl2)*srbl2))-1;
kp[2]:=1-((srbl2*((m-srbl2)*srbl2-sqr(sigm2)))/(m*sqr(sigm2)-(m-srbl2)*srbl2));
Series3.Clear;
for i:=1 to 2 do
Series3.AddXY(kn[i],kp[i]);
end;
if MCon='1' then
begin
for i:=1 to Query1.RecordCount do
begin
block1:=Query1.FieldValues['SUMMARK'];
sbl1:=sbl1+block1;
Query1.Next;
end;
srbl1:=sbl1/Query1.RecordCount;
Query1.First;
for i:=1 to Query1.RecordCount do
begin
block1:=Query1.FieldValues['SUMMARK'];
dx1:=dx1+sqr(block1-srbl1);
Query1.Next;
end;
sdxq1:=dx1/Query1.RecordCount;
sigm1:=sqrt(sdxq1);
m:=StrToFloat(maxb);
kn[1]:=((m-srbl1)*((m-srbl1)*srbl1-sqr(sigm1))/(m*sqr(sigm1)-(m-srbl1)*srbl1))-1;