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.
Ponto1x:=xs-dy*LargSeta;<br />
Ponto1y:=ys+dx*LargSeta;<br />
Ponto2x:=xs+dy*LargSeta;<br />
Ponto2y:=ys-dx*LargSeta;<br />
Ponto3x:=Round((x2-x1)*0.93)+x1;<br />
Ponto3y:=Round((y2-y1)*0.93)+y1;<br />
If dx*dy=0 Then<br />
begin<br />
Ponto3x:=Round((x2-x1)*0.90)+x1;<br />
Ponto3y:=Round((y2-y1)*0.90)+y1;<br />
end;<br />
PaintBox1.Canvas.Polygon([point(ponto1x,ponto1y),point(ponto2x,ponto2y),<br />
point(ponto3x,ponto3y)]);<br />
end;<br />
Procedure CalculaCompArco;<br />
// Calcula comprimento <strong>de</strong> cada link, em função do tamanho do grafo<br />
begin<br />
PenaNormal:=3; // Espessura da caneta<br />
PenaDiag:=2;<br />
If BotaoAcionado=0 then<br />
begin<br />
CompArco:=1;<br />
Exit;<br />
end;<br />
CompArco:=min((Screen.Width div (NC+1)), (Screen.Height div (NL+1)));<br />
Raio:=CompArco div 25; // Raio dos nós<br />
If Raio < 2 Then Raio := 2;<br />
If CompArco < 100 Then<br />
begin<br />
PenaNormal:=1;<br />
PenaDiag:=1;<br />
end;<br />
end;<br />
procedure DesenhaGrafo(ArqNome:String;PaintBox1:TPaintBox);<br />
// Desenha um grafo dado no arquivo ArqNome<br />
var II,x,y:Integer;<br />
a,Link,Noi,I,J,Nof,I1,J1,d:Integer;<br />
Simbolo: String[1];<br />
InicioRota,FimRota: Integer;<br />
ArcoArtificial: Boolean;<br />
begin<br />
Form10.Visible:=true;<br />
AssignFile(Re<strong>de</strong>,ArqNome);<br />
Reset(Re<strong>de</strong>);<br />
If BotaoAcionado=2 Then // Se o grafo está contido num arquivo <strong>de</strong> grafo transformado<br />
Repeat<br />
ReadLn(Re<strong>de</strong>,Simbolo);<br />
Until Simbolo = '$';<br />
Read(Re<strong>de</strong>,M,N,NL,NC,MA,ME);<br />
i:=0;<br />
Repeat<br />
Read(Re<strong>de</strong>,Simbolo);<br />
i:=i+1;<br />
Until (Simbolo='#') or (i>50);<br />
If Simbolo='#'<br />
then ReadLn(Re<strong>de</strong>,InicioRota,FimRota)<br />
else begin<br />
ReadLn(Re<strong>de</strong>);<br />
InicioRota:=1;<br />
FimRota:=1;<br />
end;<br />
Falha:=false;<br />
162