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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

o arco artificial no final da lista<br />

WriteLn(Re<strong>de</strong>,'$ Arquivo Original (Links Requeridos)');<br />

AssignFile(Re<strong>de</strong>Orig,ArqTemp);<br />

Reset(Re<strong>de</strong>Orig);<br />

II:=0;<br />

Read(Re<strong>de</strong>Orig,M1Orig,N,NL,NC,i,i);<br />

Write(Re<strong>de</strong>,M1,' ',N,' ',NL,' ',NC,' ',MA,' ',ME,' ');<br />

ReadLn(Re<strong>de</strong>Orig,Linha);<br />

WriteLn(Re<strong>de</strong>,Linha);<br />

For JJ:= 1 To M1Orig do<br />

begin<br />

Readln(Re<strong>de</strong>Orig,a,Tip,Noi,I,J,Nof,I1,J1,d,Requerido);<br />

If Requerido = 1 then<br />

begin<br />

II:=II+1;<br />

Writeln(Re<strong>de</strong>,II,' ',Tip,' ',Noi,' ',I,' ',J,' ',Nof,' '<br />

,I1,' ',J1,' ',d);<br />

end;<br />

end;<br />

CloseFile(Re<strong>de</strong>);<br />

CloseFile(Re<strong>de</strong>Orig);<br />

End;<br />

procedure Tform2.Button1Click(Sen<strong>de</strong>r: TObject);<br />

Var NomeAbr:String;<br />

TempoInicio,TempoFinal:TDateTime;<br />

begin<br />

Inf:=99999;<br />

MenosInf:=-StrToInt(Form1.Edit8.Text);<br />

Penalida<strong>de</strong>:=StrToInt(Form1.Edit10.Text);<br />

Form1.StatusBar1.SimpleText := 'Escolhe o Grafo a ser lido';<br />

Form1.ListBox1.Enabled :=true;<br />

Form1.ListBox1.Items.Clear;<br />

//OpenDialog1.InitialDir := 'C:\Arquivos <strong>de</strong> programas\Borland\Delphi4\Projects\DadosMcpp\';<br />

OpenDialog1.InitialDir := 'C:\Meus documentos\Doutorado\MCPPgls Demo\';<br />

If OpenDialog1.Execute<br />

Then ArqNome := OpenDialog1.FileName<br />

Else Exit;<br />

Form1.StatusBar1.SimpleText := 'Transformando o grafo';<br />

DefineInicioEFimDoRoteiro(Form1.Edit11,Form1.Edit12);<br />

LerArq;<br />

Form1.GroupBox2.Enabled:=true;<br />

NomeAbr:=ArqNome;<br />

If Length(ArqNome)>20<br />

Then NomeAbr := Copy(ArqNome,Length(ArqNome)-19, 16);<br />

Form1.GroupBox2.Caption := 'Grafo ativo : ...'+NomeAbr;<br />

Form1.Label9.Caption := 'Nós: '+IntToStr(N);<br />

Form1.Label10.Caption := '<strong>Arcos</strong>: '+IntToStr(MA);<br />

Form1.Label11.Caption := 'Arestas: '+IntToStr(ME);<br />

Form1.GroupBox2.Update;<br />

TempoInicio:=Time;<br />

ArqErrado:=false;<br />

Transform;<br />

If ArqErrado Then exit;<br />

Form1.StatusBar1.SimpleText := 'O Grafo já foi transformado. Calculando agora a matriz <strong>de</strong> distâncias';<br />

Floyd;<br />

AjusteGTSP;<br />

TempoFinal:= Time;<br />

Form1.Label15.Caption:='Tempo CPU: '+TimeToStr(TempoFinal-TempoInicio);<br />

Form1.StatusBar1.SimpleText := 'Salve o grafo transformado com um nome diferente';<br />

If Rural then ReduzirRuralPostman;<br />

GravaArq(SaveDialog1,OpenDialog1,Form1.ListBox1);<br />

NomeAbr := ArqNomeTxt;<br />

If Length(NomeAbr) > 20<br />

Then Delete(NomeAbr,1,Length(NomeAbr)-20);<br />

158

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

Saved successfully!

Ooh no, something went wrong!