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.
NumUsed:=NumUsed+1;<br />
Link[ArcContra].ModCost:=-Cost;<br />
End;<br />
If (NumUsado=0) And (NumContra>1) Then<br />
Begin<br />
Link[ArcContra].NumUsed:=Link[ArcContra].NumUsed-1;<br />
If (Link[ArcContra].NumUsed=1) Then<br />
Begin<br />
If Tipo=0 Then ModCost:=Cost;<br />
If Tipo=-1 Then ModCost:=Inf-1;<br />
End;<br />
End;<br />
If (NumUsado=1) And (NumContra=1) Then<br />
Begin<br />
ModCost:=Cost;<br />
Link[ArcContra].NumUsed:=0;<br />
Link[ArcContra].ModCost:=Cost;<br />
End;<br />
End;<br />
End;<br />
Procedure OrientaGrafo;<br />
Var I,N1,N2,NNU,CMin,CardCad:Integer;<br />
ExisteNoNaoUsado:Boolean;<br />
VetNU,Ca<strong>de</strong>ia: TVet;<br />
Texto:String;<br />
Begin<br />
NNU:=-1;<br />
ExisteNoNaoUsado:=true;<br />
While ExisteNoNaoUsado Do<br />
Begin<br />
EscolhaDoisNosNaoUsados(N1,N2,NNU,VetNU);<br />
Form1.StatusBar1.SimpleText := 'Orientando links a partir <strong>de</strong> nós não usados '+IntToStr(N1)+' '+<br />
IntToStr(N2);<br />
If NNU1 Then<br />
Begin<br />
Form1.StatusBar1.SimpleText := 'Re-Orientando links a partir do linke usado '+IntToStr(I);<br />
N1:=Link[I].From;<br />
N2:=Link[I].Too;<br />
AchaCaminhoMinimo(N1,N2,CMin,CardCad,Ca<strong>de</strong>ia);<br />
AtualizaCustosCa<strong>de</strong>ia(CardCad,Ca<strong>de</strong>ia);<br />
AchaCaminhoMinimo(N2,N1,CMin,CardCad,Ca<strong>de</strong>ia);<br />
AtualizaCustosCa<strong>de</strong>ia(CardCad,Ca<strong>de</strong>ia);<br />
144