⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 delphi编译的运筹学单纯形法 操作方便
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    RadioGroup1: TRadioGroup;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel2: TPanel;
    Memo1: TMemo;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);


  private
    { Private declarations }
  public
    { Public declarations }
  end;
    const long=250;
    type array1=array[1..long]of array[0..long] of real;
   type  array2=array[0..long]of array[0..long]of tedit;
var
  Form1: TForm1;
  m,n:integer;
    a:array1;
    b:array[1..long]of real;
implementation
 uses Unit2;
 var shuru:array2;
{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  i,j:integer;
begin
    if(edit1.Text<>'')and(edit2.Text<>'') then
       begin
         try
         for i:=1to m+1 do
           for j:=1 to n+2 do
                shuru[i,j].Free;
          finally
            m:=0;n:=0;
            m:=strtoint(edit1.Text);
            n:=strtoint(edit2.Text);
            for i:=1 to m+1 do
              for j:=1 to n+2 do
                begin
                  shuru[i,j]:=tedit.Create(self);
                  shuru[i,j].Parent:=panel2;
                  shuru[i,j].Width:=40;
                  shuru[i,j].Left:=30+(j-1)*shuru[i,j].Width;
                  shuru[i,j].Top:=30+(i-1)*shuru[i,j].Height;
                 end;
       end;
  shuru[1,1].SetFocus;
  bitbtn2.Enabled:=true;

end
else showmessage('条件不够,请重新输入!');
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
var i,j:integer;
    opt:array[1..long]of integer;
begin
for i:=1to long do
  for j:=0 to long do a[i,j]:=0;
for i:=1 to long do b[i]:=0;
for i:=1 to long do opt[i]:=0;
for i:=1 to m+1 do
 begin
   if shuru[i,n+2].Text<>'' then a[i,0]:=strtofloat(shuru[i,n+2].text);
   if shuru[i,n+1].Text<>'' then opt[i]:=strtoint(shuru[i,n+1].text);
   for j:=1 to n do
      if shuru[i,j].Text<>'' then
         a[i,j]:=strtofloat(shuru[i,j].Text);
 end;
 if radiogroup1.Items[radiogroup1.ItemIndex]='max' then
    for j:=1 to n do
      a[m+1,j]:=-a[m+1,j];
  leixing:=radiogroup1.Items[radiogroup1.itemindex];    
  for i:=1 to m do
    a[i,n+i]:=1;
  for j:=1 to n do
    b[j]:=a[m+1,j];
form2.Show;
form2.BitBtn4.Enabled:=true;
end;






end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -