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.
Se f1>0, a cópia será orientada <strong>de</strong> inicio para o fim<br />
// Se f1=0, a cópia será orientada no sentido contrário<br />
var xs,ys,xt,yt,temp,dx,dy,Desloc: Integer;<br />
begin<br />
If f1=0<br />
then begin<br />
temp:=x1;<br />
x1:=x2;<br />
x2:=temp;<br />
temp:=y1;<br />
y1:=y2;<br />
y2:=temp;<br />
f2:=f2-1;<br />
end<br />
else f1:=f1-1;<br />
PaintBox1.Canvas.Pen.Width:=1;<br />
PaintBox1.Canvas.Pen.Color:=ClRed;<br />
PaintBox1.Canvas.MoveTo(x1, y1);<br />
PaintBox1.Canvas.LineTo(x2, y2);<br />
PaintBox1.Canvas.Pen.Width:=2;<br />
xs:=Round((x2-x1)*0.85)+x1;<br />
xt:=Round((x2-x1)*0.95)+x1;<br />
ys:=Round((y2-y1)*0.85)+y1;<br />
yt:=Round((y2-y1)*0.95)+y1;<br />
If (x1 = x2) or (y1 = y2) then<br />
begin<br />
xs:=Round((x2-x1)*0.80)+x1;<br />
ys:=Round((y2-y1)*0.80)+y1;<br />
xt:=Round((x2-x1)*0.90)+x1;<br />
yt:=Round((y2-y1)*0.90)+y1;<br />
end;<br />
PaintBox1.Canvas.MoveTo(xs,ys);<br />
PaintBox1.Canvas.LineTo(xt,yt);<br />
end;<br />
Procedure AchaCoordCopiak(k,x1,y1,x2,y2:Integer; var xc1,yc1,xc2,yc2 :Integer);<br />
// Acha as coor<strong>de</strong>nadas <strong>de</strong> inicio e fim <strong>de</strong> uma duplicação<br />
var Delta,d:integer;<br />
begin<br />
Delta:=CompArco div 25; //Delta: distancia da copia para link original<br />
If Delta < 5 then Delta:=Delta+1;<br />
Case k of //k: representa a k-ésima que está sendo traçada<br />
1: Delta := Delta;<br />
2: Delta := -Delta;<br />
3: Delta := 2*Delta;<br />
4: Delta := -2*Delta;<br />
5: Delta := 3*Delta;<br />
6: Delta := -3*Delta;<br />
end;<br />
d := Round(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+0.0));<br />
xc1:=Round(x1+0.05*(x2-x1)+Delta*(y2-y1+0.0)/d);<br />
yc1:=Round(y1+0.05*(y2-y1)-Delta*(x2-x1+0.0)/d);<br />
xc2:=Round(x1+0.95*(x2-x1)+Delta*(y2-y1+0.0)/d);<br />
yc2:=Round(y1+0.95*(y2-y1)-Delta*(x2-x1+0.0)/d);<br />
end;<br />
procedure DesenhaGrafoSolucao(ArqNome:String;PaintBox1:TPaintBox);<br />
// Desenha a solução <strong>de</strong> roteiro, a partir <strong>de</strong> um arquivo<br />
// <strong>de</strong> solução gerado na NegCircuit<br />
var II,x,y:Integer;<br />
a,Link,Noi,I,J,Nof,I1,J1,d,Freq1,Freq2:Integer;<br />
k,NumCopias,xc1,yc1,xc2,yc2:Integer;<br />
164