Курсовая работа: Минимизация транспортных расходов при перевозе груза со станций отправления грузовых поездов

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

Button4: TButton;

BitBtn1: TBitBtn;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label2: TLabel;

Button1: TButton;

procedure FormCreate(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

// Form1: TForm1;

Form2: TForm2;

implementation

uses Unit4, Unit3, Unit5;

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);

begin

StringGrid1.Cells[0,1]:='50';

StringGrid1.Cells[0,2]:='30';

StringGrid1.Cells[0,3]:='20';

StringGrid1.Cells[1,0]:='30';

StringGrid1.Cells[2,0]:='40';

StringGrid1.Cells[3,0]:='30';

StringGrid2.Cells[0,0]:='4';

StringGrid2.Cells[1,0]:='1';

StringGrid2.Cells[2,0]:='2';

StringGrid2.Cells[0,1]:='3';

StringGrid2.Cells[1,1]:='7';

StringGrid2.Cells[2,1]:='5';

StringGrid2.Cells[0,2]:='5';

StringGrid2.Cells[1,2]:='6';

StringGrid2.Cells[2,2]:='1';

StringGrid1.Cells[2,1]:='40';

StringGrid1.Cells[3,1]:='10';

StringGrid1.Cells[1,2]:='30';

StringGrid1.Cells[3,3]:='20';

StringGrid1.Cells[1,1]:='0';

StringGrid1.Cells[1,3]:='0';

StringGrid1.Cells[2,2]:='0';

StringGrid1.Cells[2,3]:='0';

StringGrid1.Cells[3,2]:='0';

end;

procedure TForm2.Button3Click(Sender: TObject);

begin

Form4.show;

end;

procedure TForm2.Button4Click(Sender: TObject);

begin

Form3.Show;

end;

procedure TForm2.Button2Click(Sender: TObject);

begin

Form5.show;

end;

procedure TForm2.Button1Click(Sender: TObject);

var x1,x2,x3,x4,x5,x6,x7,x8,x9:integer;

c1,c2,c3,c4,c5,c6,c7,c8,c9:integer;

begin

x2:=strtoint(StringGrid1.Cells[2,1]);

x1:=strtoint( StringGrid1.Cells[1,1]);

x3:=strtoint( StringGrid1.Cells[3,1]);

x4:=strtoint( StringGrid1.Cells[1,2]);

x5:=strtoint( StringGrid1.Cells[2,2]);

x6:=strtoint( StringGrid1.Cells[2,2]);

x7:=strtoint( StringGrid1.Cells[1,3]);

x8:=strtoint( StringGrid1.Cells[2,3]);

x9:=strtoint( StringGrid1.Cells[3,3]);

c1:=strtoint(StringGrid2.Cells[0,0]);

c2:=strtoint(StringGrid2.Cells[1,0]);

c3:=strtoint(StringGrid2.Cells[2,0]);

c4:=strtoint(StringGrid2.Cells[0,1]);

c5:=strtoint(StringGrid2.Cells[1,1]);

c6:=strtoint(StringGrid2.Cells[2,1]);

c7:=strtoint(StringGrid2.Cells[0,2]);

c8:=strtoint(StringGrid2.Cells[1,2]);

c9:=strtoint(StringGrid2.Cells[2,2]);

f:=c1*x1+c2*x2+c3*x3+c4*x4+c5*x5+c6*x6+c7*x7+c8*x8+c9*x9;

Label2.Font.Size:=14;

Label2.Caption:='Ieieiaeuiua cao?aou = '+IntTostr(f);

end;

end.

unit Unit3;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, OleCtnrs, StdCtrls, Buttons, Grids;

type

TForm3 = class(TForm)

Button2: TButton;

Label2: TLabel;

Button1: TButton;

BitBtn1: TBitBtn;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

f,x11,x12,x13,x21,x22,x23,x31,x32,x33:integer;

c11,c12,c13,c21,c22,c23,c31,c32,c33:integer;

Kos13,Kos12,Kos31,Kos32,kos22,kos11,kos23,kos21:integer;

a1,a2,a3,b1,b2,b3:integer;

u1,u2,u3,v1,v2,v3:integer;

implementation

uses Unit6;

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);

begin

c11:=4; c12:=1; c13:=2;

c21:=3; c22:=7; c23:=5;

c31:=5; c32:=6; c33:=1;

a1:=50; a2:=30;a3:=20;

b1:=30; b2:=40; b3:=30;

x11:=b1; a1:=a1-b1;

x12:=a1; a2:=b2-a1;

x22:=a2; a2:=a2-b2;

x23:=a2; b3:=b3-a2;

x33:=a3; //x12:=0;

x13:=0; x31:=0; x32:=0; x21:=0;

f:=c11*x11+c12*x12+c13*x13+c21*x21+c22*x22+c23*x23+c31*x31+c32*x32+c33*x33;

u1:=0;

v1:=C11-u1;

v2:=C21-v1;

u2:=C22-v2;

v3:=c23-u2;

u3:=c33-v3;

Kos13:=u2+v2;

Kos12:=u2+v3;

Kos31:=u3+v1;

Kos32:=u3+v2;

x21:=0+20;

x11:=30-20;

x12:=20+20;

x22:=20-20;

x13:=0; x31:=0; x32:=0; x33:=20;x23:=10;

if (Kos13<0) or (Kos12<0) or (Kos31<0) or (Kos32<0) then

f:=c11*x11+c12*x12+c13*x13+c21*x21+c22*x22+c23*x23+c31*x31+c32*x32+c33*x33

else

u1:=0;

v1:=c11-u1;

v3:=c13-u1;

u2:=c21-v1;

u3:=c33-v3;

v2:=c12-u1;

Kos11:=u1+v1;

Kos13:=u1+v3;

Kos23:=u2+v3;

Kos21:=u2+v1;

x13:=0+10;

x11:=10-10;

x21:=20+10;

x23:=10-10;

x12:=40; x22:=0; x31:=0; x32:=0; x33:=20;

f:=c11*x11+c12*x12+c13*x13+c21*x21+c22*x22+c23*x23+c31*x31+c32*x32+c33*x33;

Kos22:=u2+v2;

Kos23:=u2+v3;

Kos31:=u3+v1;

Kos32:=u3+v2;

if (Kos22<0) or (Kos23<0) or (Kos31<0) or (Kos32<0) then

f:=c11*x11+c12*x12+c13*x13+c21*x21+c22*x22+c23*x23+c31*x31+c32*x32+c33*x33;

Label2.Font.Size:=14;

Label2.Caption:='Ieieiaeuiua cao?aou = '+IntTostr(f)

end;

procedure TForm3.Button2Click(Sender: TObject);

begin

Form6.Show;

end;

end.

unit Unit4;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, OleCtnrs, StdCtrls, Buttons;

type

TForm4 = class(TForm)

BitBtn1: TBitBtn;

OleContainer2: TOleContainer;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

{$R *.dfm}

end.

unit Unit5;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, OleCtnrs;

type

TForm5 = class(TForm)

OleContainer1: TOleContainer;

BitBtn1: TBitBtn;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

{$R *.dfm}

end.

unit Unit6;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, OleCtnrs, StdCtrls, Buttons;

type

TForm6 = class(TForm)

BitBtn1: TBitBtn;

OleContainer1: TOleContainer;

OleContainer2: TOleContainer;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

implementation

{$R *.dfm}

end.