Telekommunikatsiya texnologiyalar davlat


Ўйинларнинг тўлов матрицасини minmax ва maxminни


Download 1.08 Mb.
bet7/11
Sana18.06.2023
Hajmi1.08 Mb.
#1564198
1   2   3   4   5   6   7   8   9   10   11
Bog'liq
Kitob 7693 uzsmart.uz

2.4 Ўйинларнинг тўлов матрицасини minmax ва maxminни
аниқловчи ва даминантлик усули дастурий таьминоти

Дастур матни
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, Grids, Menus, XPMan;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
Fayl1: TMenuItem;
Chiqish1: TMenuItem;
tekshirish1: TMenuItem;
dominatlik1: TMenuItem;
minmax1: TMenuItem;
XPManifest1: TXPManifest;
StringGrid1: TStringGrid;
BitBtn1: TBitBtn;
Edit2: TEdit;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
BitBtn2: TBitBtn;
Label3: TLabel;
Label4: TLabel;
BitBtn3: TBitBtn;
procedure Chiqish1Click(Sender: TObject);
procedure dominatlik1Click(Sender: TObject); procedure minmax1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a:array[1..100,1..100] of integer; i,j,n,m:integer;
f:boolean;

27

implementation
uses Unit2, Unit3;
{$R *.dfm}

procedure TForm1.Chiqish1Click(Sender: TObject); begin


Form1.Close;
end;
procedure TForm1.dominatlik1Click(Sender: TObject); begin
Form2.ShowModal;
end;
procedure TForm1.minmax1Click(Sender: TObject); begin
Form3.ShowModal;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
n := StrToInt(Edit1.Text);
m := StrToInt(Edit2.Text);
StringGrid1.RowCount := StrToInt(Edit1.Text);
StringGrid1.colCount := StrToInt(Edit2.Text);
StringGrid1.Visible := true;
BitBtn2.Visible := true;
BitBtn3.Visible := true;
form1.Height := 400;
if (n = 2) then
f := true
else
if (m = 2) then
f := false
else
begin
StringGrid1.Visible := false;
BitBtn2.Visible := false;
BitBtn3.Visible := false;
form1.Height := 100;
ShowMessage('2XM lik yoki nX2 matritsa kiriting!'); end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);

28

var
p0,maxw,p,w:real;
begin
for i := 0 to n-1 do
for j := 0 to m-1 do
if f then a[i+1,j+1] :=StrToInt(StringGrid1.Cells[j,i]) else
a[j+1,i+1] :=StrToInt(StringGrid1.Cells[j,i]) ;
maxw := 0;
i:= 1;
while (i+1 <= n+m-2) do
begin
j :=i+1;
p := (a[2,j]-a[2,i])/(a[1,i]-a[2,i]-a[1,j]+a[2,j]);
w := p*(a[1,i]-a[2,i])+a[2,i];
if (maxw < w) then
begin
maxw := w;
p0 := p;
end;
i := i+1;
end;

label3.Caption := 'P0 nuqtalar ['+FloatToStr(p0)+','+FloatToStr(1-p0)+']'; Label4.Caption := 'keltrilgan foyda :'+ FloatToStr(maxw)+' mln so`m';


end;
end.

29

Дастурни ишлатишга йўриқнома

Дастурнинг асосий интерфейси





Дастурга маьлумот киритиш ойнаси





30

Ўйин матрицасини минмах ва махмин аниқлаш дастурини ойнаси



Дастурнинг натижаси





31




Download 1.08 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   11




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling