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.
Procedure GravaArq(ListBox1:TListBox;<br />
Label9,Label10,Label11: Tlabel;<br />
GroupBox2:TGroupBox);<br />
Var Linha, Compl: String;<br />
ArcR, ArcNR, MAnR, Sorteio: Integer;<br />
Begin<br />
{Gerar o Arquivo Contendo o Grafo *****************}<br />
If Copy(ArqNome,Length(ArqNome)-3,1)='.'<br />
Then ArqNomeTxt := ArqNome<br />
Else ArqNomeTxt := ArqNome+'.Txt';<br />
AssignFile(Re<strong>de</strong>,ArqNomeTxt);<br />
ReWrite(Re<strong>de</strong>);<br />
WriteLn(Re<strong>de</strong>,M,' ',N,' ',NL,' ',NC,' ',MA,' ',ME,' ',CppCost,' ',AddCost);<br />
NomeAbr := ArqNome;<br />
If Length(NomeAbr) > 22<br />
Then Delete(NomeAbr,1,Length(NomeAbr)-22);<br />
NomeAbr := Copy(NomeAbr,1, Length(NomeAbr)-4);<br />
GroupBox2.Caption := 'Grafo ativo : ...'+NomeAbr;<br />
Label9.Caption := 'Nós: '+IntToStr(N);<br />
Label10.Caption := '<strong>Arcos</strong>: '+IntToStr(MA);<br />
Label11.Caption := 'Arestas: '+IntToStr(ME);<br />
GroupBox2.Update;<br />
ListBox1.enabled := True;<br />
ListBox1.Color := clWindow;<br />
ListBox1.Items.Clear;<br />
ListBox1.Items.Add ('Links='+IntToStr(M)+' No<strong>de</strong>s='+IntToStr(N));<br />
ListBox1.Items.Add (' CppCost='+IntToStr(CppCost)+' AddCost='+IntToStr(AddCost));<br />
MAnR:=Round((M*PAnR)/100.0); //Num <strong>de</strong> arcos não-rqueridos a serem marcados<br />
If MAnR>MA then MAnR:=MA;<br />
ArcR:=0; //Num provisorio <strong>de</strong> arcos requeridos<br />
ArcNR:=0; // " " " não "<br />
For I:=1 To M Do<br />
Begin<br />
K:=2*I-1;<br />
If Link[K].Tipo=-1<br />
Then K:=Link[K].ArcContra;<br />
If (Link[K].Tipo=0) And (Link[K].Too