home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue53 / Alfresco / Unit1.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1999-11-27  |  1.2 KB  |  68 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Label1: TLabel;
  13.     Label2: TLabel;
  14.     Label3: TLabel;
  15.     Button2: TButton;
  16.     Label4: TLabel;
  17.     procedure Button1Click(Sender: TObject);
  18.     procedure Button2Click(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. uses
  33.   AASimAnn;
  34.  
  35. procedure TForm1.Button1Click(Sender: TObject);
  36. var
  37.   TextLog : TFileStream;
  38. begin
  39.   TextLog := nil;
  40.   try
  41.     Label1.Caption := 'Running...';
  42.     Label1.Update;
  43.     TextLog := TFileStream.Create('c:\TrvSales.LOG', fmCreate);
  44.     TravelingSalesman(100, TextLog);
  45.   finally
  46.     TextLog.Free;
  47.     Label1.Caption := 'Done!';
  48.   end;
  49. end;
  50.  
  51. procedure TForm1.Button2Click(Sender: TObject);
  52. var
  53.   TextLog : TFileStream;
  54. begin
  55.   TextLog := nil;
  56.   try
  57.     Label4.Caption := 'Running...';
  58.     Label4.Update;
  59.     TextLog := TFileStream.Create('c:\Knapsack.LOG', fmCreate);
  60.     SolveKnapsackProblem(100, TextLog);
  61.   finally
  62.     TextLog.Free;
  63.     Label4.Caption := 'Done!';
  64.   end;
  65. end;
  66.  
  67. end.
  68.