Algoritmos Heurísticos de Cobertura de Arcos
Algoritmos Heurísticos de Cobertura de Arcos
Algoritmos Heurísticos de Cobertura de Arcos
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
FimRotaCoordI,FimRotaCoordJ,Requerido: Integer;<br />
a,Tip,Noi,I,J,Nof,I1,J1,d,JJ: Integer;<br />
N1,N2,N3,Custo: Integer;<br />
St1:String[1];<br />
begin<br />
InicioRota:=StrToInt(Form1.Edit11.Text);<br />
FimRota:=StrToInt(Form1.Edit12.Text);<br />
Assign(Re<strong>de</strong>,ArqNome);<br />
Reset(Re<strong>de</strong>);<br />
ArqTemp:='ArqTemp.Txt';<br />
AssignFile(Re<strong>de</strong>Temp,ArqTemp);<br />
ReWrite(Re<strong>de</strong>Temp);<br />
ReadLn(Re<strong>de</strong>,M1,N,NL,NC,MA,ME);<br />
WriteLn(Re<strong>de</strong>Temp,M1+1,' ', N,' ',NL,' ',NC,' ',MA+1,' '<br />
,ME,' ',' # ',InicioRota,' ',FimRota);<br />
InicioRotaCoordI:=-1;<br />
InicioRotaCoordJ:=-1;<br />
FimRotaCoordI:=-1;<br />
FimRotaCoordJ:=-1;<br />
Rural:=false;<br />
For II:=1 To M1 Do<br />
Begin<br />
Requerido:=1;<br />
Read(Re<strong>de</strong>,a,Tip,Noi,I,J,Nof,I1,J1,d);<br />
St1:=' ';<br />
JJ:=0;<br />
Repeat<br />
JJ:=JJ+1;<br />
Read(Re<strong>de</strong>,St1);<br />
Until (St1='$') or (JJ>50);<br />
If St1 = '$' then Read(Re<strong>de</strong>,Requerido);<br />
If Requerido=0 Then Rural:=true;<br />
ReadLn(Re<strong>de</strong>);<br />
N1:=Noi;<br />
Writeln(Re<strong>de</strong>Temp,a,' ',Tip,' ',Noi,' ',I,' ',J,' '<br />
,Nof,' ',I1,' ',J1,' ',d, ' ',Requerido);<br />
N1:=Noi; // I<strong>de</strong>ntificando as coor<strong>de</strong>nadas do InicioRota, FimRota<br />
If Noi=InicioRota then<br />
begin<br />
InicioRotaCoordI:=I;<br />
InicioRotaCoordJ:=J;<br />
end;<br />
If Nof=FimRota then<br />
begin<br />
FimRotaCoordI:=I1;<br />
FimRotaCoordJ:=J1;<br />
end;<br />
If (Tip=0) and (Noi=FimRota) then<br />
begin<br />
FimRotaCoordI:=I;<br />
FimRotaCoordJ:=J;<br />
end;<br />
If (Tip=0) and (Nof=InicioRota) then<br />
begin<br />
InicioRotaCoordI:=I1;<br />
InicioRotaCoordJ:=J1;<br />
end;<br />
End;<br />
If (InicioRotaCoordI=-1) Or (FimRotaCoordI=-1) Then<br />
begin<br />
Application.messagebox('Inicio ou Final especificado para a rota inválido','Programa será<br />
fechado!',MB_OK);<br />
Halt;<br />
end;<br />
Writeln(Re<strong>de</strong>Temp,a+1,' 1 ',FimRota,' ',FimRotaCoordI,' ',FimRotaCoordJ,' '<br />
154