Курсовая работа: Транспортная задача по критериям стоимости и времени
procedure Opornplan(StringGrid1:TStringGrid; var x,z:Tmatr);
var i,j:integer;
c1:TMatr;
begin
Setlength(x,Length(c),Length(c[1]));
Setlength(c1,Length(x)*Length(x[1]),3);
For i:=0 to Length(x)-1 do
for j:=0 to Length(x[1])-1 do
begin
c1[(Length(x[1]))*i+j,0]:=c[i,j];
c1[(Length(x[1]))*i+j,1]:=i;
c1[(Length(x[1]))*i+j,2]:=j;
end;
Setlength(z,1,3);
//Сортировка
For i:=0 to Length(c1)-2 do
for j:=0 to Length(c1)-2 do
if c1[j,0]>c1[j+1,0] then
begin
z[0]:=c1[j+1];
c1[j+1]:=c1[j];
c1[j]:=z[0];
end;
for i:=0 to Length(x)-1 do
for j:=0 to Length(x[1])-1 do
x[i,j]:=-1;
For i:=0 to Length(x)*Length(x[1])-1 do
if x[c1[i,1],c1[i,2]]=-1 then
begin