program optgen_gpa_modulo;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, SysUtils, CustApp, opt_gpa, testCase1, optimizador, dbPlanesPrueba,
  uplanprueba, opt_genetico
  { you can add units after this };

type

  { TOptGen_GPA }

  TOptGen_GPA = class(TCustomApplication)
  protected
    procedure DoRun; override;
  public
    constructor Create(TheOwner: TComponent); override;
    destructor Destroy; override;
    procedure WriteHelp; virtual;
  end;

{ TOptGen_GPA }

procedure TOptGen_GPA.DoRun;
var
  ErrorMsg: String;
begin
  // quick check parameters
  ErrorMsg:=CheckOptions('h','help');
  if ErrorMsg<>'' then begin
    ShowException(Exception.Create(ErrorMsg));
    Terminate;
    Exit;
  end;

  // parse parameters
  if HasOption('h','help') then begin
    WriteHelp;
    Terminate;
    Exit;
  end;

  { add your program here }
  writeln('Comenzando optimizacion. . .');

  randomize;

  optimizarPoblacion;

  writeln('Optimizacion finalizada. . .');

  // stop program loop
  Terminate;
end;

constructor TOptGen_GPA.Create(TheOwner: TComponent);
begin
  inherited Create(TheOwner);
  StopOnException:=True;
end;

destructor TOptGen_GPA.Destroy;
begin
  inherited Destroy;
end;

procedure TOptGen_GPA.WriteHelp;
begin
  { add your help code here }
  writeln('Usage: ',ExeName,' -h');
end;

var
  Application: TOptGen_GPA;

{$R *.res}

begin
  Application:=TOptGen_GPA.Create(nil);
  Application.Run;

  Application.Free;

end.

