Не могу разобраца в одной процедуре исходного кода программы. Где здесь исполняется критерий оптимума. Кто может опишите эту процедуру.
procedure SimplexMetod(n:boolean);
var Count,Count2,MinC,MinR:integer;
MinEl,zna4,zna4TMP,zna4TMP2:double;
boo,reshil:boolean;
begin
reshil:=false;
repeat
boo:=false;
for count:=1 to form1.StringGrid4.ColCount -1 do
if strtofloat(form1.StringGrid4.Cells [count,1])<0 then boo:=true;
if boo then
begin
MinC:=2;
zna4:=strtofloat(form1.StringGrid4.Cells [2,1]);
for count:=2 to form1.StringGrid4.ColCount -1 do
if strtofloat(form1.StringGrid4.Cells [count,1])<zna4 then
begin
zna4:=strtofloat(form1.StringGrid4.Cells [count,1]);
MinC:=count;
end;
zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,2]);
zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,2]);
MinEl:=zna4TMP/zna4TMP2;
MinR:=2;
for Count:=2 to form1.StringGrid4.RowCount -1 do
begin
zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,count]);
zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,count]);
if zna4TMP2>0 then
begin
zna4:=zna4TMP/zna4TMP2;
if zna4<MinEl then
begin
MinEl:=zna4;
MinR:=Count;
end;
end;
end;
MinEl:=strtofloat(form1.StringGrid4.Cells[MinC,MinR]);
for count:=1 to form1.StringGrid4.ColCount -1 do
form1.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form1.StringGrid4.Cells[count,MinR])/MinEl);
for count:=1 to form1.StringGrid4.ColCount -1 do
for Count2:=1 to form1.StringGrid4.RowCount -1 do
if (count<>MinC)and(count2<>MinR) then
form1.StringGrid4.Cells [count,count2]:=floattostr(strtofloat(form1.StringGrid4.Cells [count,count2])-strtofloat(form1.StringGrid4.Cells [count,MinR])*strtofloat(form1.StringGrid4.Cells [MinC,count2]));
form1.StringGrid4.Cells[0,MinR]:=form1.StringGrid4.Cells[MinC,0];
for count:=1 to form1.StringGrid4.RowCount - 1 do
if form1.StringGrid4.Cells [MinC,0]= form1.StringGrid4.Cells [0,count] then
form1.StringGrid4.Cells [MinC,count]:='1'
else
form1.StringGrid4.Cells [MinC,count]:='0';
end
else
begin
form1.Label5.Caption :='Рішення найдене!!!';
reshil:=true;
end;
until reshil or n;
end;