麻烦各位高手指教,这个程序一直报declaration expected but end of file found这个错误
program VRPTW;
{$APPTYPE CONSOLE}
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
const inf = 99999999; eps = 1E-8;
type item = integer;
var FN:string; f:System.Text;
procedure T_VRPTW_ANT_RUN;
const maxn = 500;ruo = 0.7; Q=10;
label loop;
type item2 = Real48;
arr1 = array of array of item;
arr2 = array of array of item2;
arr3 = array of boolean;
arr4 = array of item;
arr5 = array of item2;
var n,i,j,k,l,ii,jj,count,s,maxcount,tweight,index,model,
qq,capa,m,last,selected,tm,weight:item;
tmax,tmin:item2;
datatype:byte;
w,route,opt,cycle:arr1;
t,dt:arr2;
ch:arr3;
x,y:arr5;
len,tlen,nearest,series,demand,kcount,tkcount:arr4;
function PValue(i,j,k:item):item2;
var l:item;
sum:item2;
begin
sum:=0;
for l:=2 to n do
if(capa >= demand[l]) and (ch[l]) and (cycle[k,l] = 0) and(l <> i) then
sum:=sum + t[i,j]/w[i,l];
if(sum > eps) and (cycle[k,j] = 0) and (j <> i) then
sum:=t[i,j]/w[i,j]/sum;
PValue:=sum;
end;
procedure TwoOpt(p:item);
var ahead,i,i1,i2,index,j,j1,j2,last,limit,max,next,s1,s2,t1,t2,maxtemp:item;
pt:arr4;
begin
SetLength(pt,n+1);
t1:=1;
t2:=1;
s1:=1;
s2:=1;
for i:=1 to p-1 do
pt[route[k,i]]:=route[k,i+1];
pt[route[k,p]]:=route[k,l];
repeat
maxtemp:=0;
i1:=1;
for i:=1 to p-2 do
begin //1
if i=1 then limit:=p-1
else limit:=p;
i2:=pt[i1];
j1:=pt[i2];
for j:=i+2 to limit do
begin //2
j2:=pt[j1];
max:=w[i1,i2]+w[j1,j2]-(w[i1,i2]+w[i2,j2]);
if(max > maxtemp) then
begin//3
s1:=i1;
s2:=i2;
t1:=j1;
t2:=j2;
maxtemp:=max;
end; //3
j1:=j2;
end;//2
i1:=i2;
end;//1
if(maxtemp > 0) then
begin//1
pt[s1]:=t1;
next:=s2;
last:=t2;
repeat
ahead:=pt[next];
pt[next]:=last;
last:=next;
next:=ahead;
until next=t2;
end;//1
until(maxtemp=0);
index:=1;
for i:=1 to p do
begin
route[k,i]:=index;
index:=pt[index];
end;
end;
procedure AntMove;
label lop,select,check,next;
var a,j,k:item;
begin
k:=1;
capa:=qq;
last:=n-1;
for j:=1 to last do
series[j]:=j+1;
for j:=1 to last do
ch[j]:=true;
for j:=1 to last do
kcount[j]:=0;
lop:
nearest[k]:=1;
for j:=1 to n do
cycle[k,j]:=0;
select:
a:=nearest[k];
j:=1;
while j<last do
begin
index:=0;
selected:=random(last) + 1;
if(capa >= demand[series[selected]]) then
begin
index:=series[selected];
if(random < PValue(a,index,k)) then goto check;
index:=series[selected];
end;
j:=j + 1;
end;
if index=0 then goto next;
check:
cycle[k,nearest[k]]:=index;
nearest[k]:=cycle[k,nearest[k]];
ch[index]:=false;
capa:=capa-demand[index];
kcount[k]:=kcount[k]+1;
last:=last-1;
for j:=selected to last do
series[j]:=series[j+1];
if last >= 1 then goto select;
next:
if last >= 1 then
begin
k:=k+1;
capa:=qq;
goto lop;
end;
m := k;
end;