09.05.2013 Views

Algoritmos Heurísticos de Cobertura de Arcos

Algoritmos Heurísticos de Cobertura de Arcos

Algoritmos Heurísticos de Cobertura de Arcos

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If ((Rota[II].Tipo = 'D') and (II < NumLink)) then<br />

begin<br />

Noi:=Rota[II].Noi;<br />

Nof:=Rota[II].Nof;<br />

For i:=II+1 to NumLink do<br />

If ((Noi=Rota[i].Noi) and (Nof=Rota[i].Nof))<br />

then If Rota[i].Tipo 'D'<br />

then begin<br />

RegTemp:= Rota[II];<br />

Rota[II]:=Rota[i];<br />

Rota[i]:=RegTemp;<br />

end;<br />

end;<br />

end;<br />

For II := 1 To NumLink do<br />

begin // procurando ver quantas vezes cada link aparece no roteiro<br />

Noi:=Rota[II].Noi;<br />

Nof:=Rota[II].Nof;<br />

For i:=1 to II do<br />

begin<br />

If (((Noi=Rota[i].Noi) and (Nof=Rota[i].Nof)) or<br />

((Noi=Rota[i].Nof) and (Nof=Rota[i].Noi)))<br />

then begin<br />

Rota[II].FreqTotal := Rota[II].FreqTotal +1;<br />

If iII Then Rota[i].FreqTotal := Rota[i].FreqTotal +1;<br />

end;<br />

end;<br />

Rota[II].Or<strong>de</strong>m := Rota[II].FreqTotal;<br />

end;<br />

Velocida<strong>de</strong> := Form1.SpinEdit1.Value;<br />

VelInversa:= 4000 div Velocida<strong>de</strong>; // 4000: constante para calibragem da velocida<strong>de</strong><br />

Demora:=Delay(10000); // <strong>de</strong>mora inicial para começar o movimento<br />

For II := 1 To NumLink do // Movimentar cada link na sequencia do roteiro<br />

begin<br />

x1:= No[Rota[II].Noi].cj*CompArco; // coor<strong>de</strong>nada x do Noi<br />

y1:= No[Rota[II].Noi].ci*CompArco; // coor<strong>de</strong>nada y do Noi<br />

x2:= No[Rota[II].Nof].cj*CompArco; // coor<strong>de</strong>nada x do Nof<br />

y2:= No[Rota[II].Nof].ci*CompArco; // coor<strong>de</strong>nada y do Nof<br />

If ((Rota[II].Tipo = '+') Or (Rota[II].Tipo = '-'))<br />

Then MovimentaAresta(Rota[II].Or<strong>de</strong>m,x1,y1,x2,y2,PaintBox1);<br />

If Rota[II].Tipo = '>'<br />

Then MovimentaArco(Rota[II].Or<strong>de</strong>m,x1,y1,x2,y2,PaintBox1);<br />

If Rota[II].Tipo = 'D'<br />

Then If Rota[II].FreqTotal > 1<br />

Then MovimentaCopia(Rota[II].Or<strong>de</strong>m,Rota[II].FreqTotal,x1,y1,x2,y2,PaintBox1)<br />

Else begin<br />

Freq1:=1;<br />

Freq2:=0;<br />

AchaCoordCopiak(Freq1,x1,y1,x2,y2,xc1,yc1,xc2,yc2);<br />

Delay(50*VelInversa);<br />

CriaCopia(Freq1,Freq2,xc1,yc1,xc2,yc2,PaintBox1);<br />

Delay(50*VelInversa);<br />

end;<br />

Freq1:=1;<br />

Freq2:=0;<br />

Or<strong>de</strong>m:= Rota[II].Or<strong>de</strong>m-1;<br />

If Or<strong>de</strong>m > 0 Then<br />

begin<br />

AchaCoordCopiak(Or<strong>de</strong>m,x1,y1,x2,y2,xc1,yc1,xc2,yc2);<br />

CriaCopia(Freq1,Freq2,xc1,yc1,xc2,yc2,PaintBox1);<br />

end;<br />

end;<br />

For I:=1 To NL Do // re<strong>de</strong>senha os nós<br />

For J:=1 To NC Do<br />

169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!