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

📄 lpdchxing.pas

📁 线性规划CAI应用程序及原代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
         begin
         write(fofown,czgrid1.cells[i-1,1]:8);
         write(fofown,',');
         end;
         writeln(fofown);
         writeln(fofown,'系数X对应的c-z的值');
         writeln(fofown);
     writeln(fofown,'*****************以上为表czgrid2的值****************');
     writeln(fofown);
     for i:=1 to afterleashnum do{保存bda???空值}
     begin
         write(fofown,bdagrid1.cells[0,i]:8);
         write(fofown,',');
     end;
     writeln(fofown);
     writeln(fofown,'*****************以上为表bdagrid2的值****************');
       finally
     system.close(fofown);
     end;{end of try}
end;{end of write}

procedure Tdchxingform.readfromfileofown;{从文件中读取自动保存的信息}
var i,j:integer;{在用到“上一步”时从系统自动保存的文件中读去取数据  存储第一张表}
    str1:string;
    ext1:string;
    bp_afteraddvarnum:integer;
begin
     bp_afteraddvarnum:=afteraddvarnum;
     afteraddvarnum:=m0+varnum;
     if not fileexists(nameoffileofown) then
          showmessage('对不起,现在不能进行上一步操作!')
     else
     begin
          assignfile(fofown,nameoffileofown);
     	  reset(fofown);
          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);{ext1}
               xigrid1.cells[i-1,1]:=str1;
               read(fofown);
               end;
          readln(fofown);
          For j:=1 to {agrid1.rowcount}afterleashnum do
               begin
               For i:=1 to {agrid1.colcount}afteraddvarnum do
                    begin
                    read(fofown,ext1);{A^[j,i]}
                    agrid1.cells[i-1,j-1]:=ext1;
                    read(fofown);
                    end;
               readln(fofown);
               End;
          readln(fofown);
{          For i:=1 to afterleashnum do{注意一下}
 {              begin
               read(fofown,ext1);{B^[i]}
{               cxbgrid1.cells[0,i]:=ext1;
               read(fofown);
               end;
          readln(fofown);
}          for i:=1 to afterleashnum do
               begin
               read(fofown,str1);
               cxbgrid1.cells[0,i]:=str1;
               read(fofown);
               read(fofown,str1);
               cxbgrid1.cells[1,i]:=str1;
               read(fofown);
               read(fofown,str1);
               cxbgrid1.cells[2,i]:=str1;
               read(fofown);
               readln(fofown);
               end;
          readln(fofown);

          read(fofown,str1);
          objedit1.text:=str1;
          readln(fofown);

          readln(fofown);

          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);
               czgrid1.cells[i-1,0]:=str1;
               read(fofown);
               end;
          readln(fofown);
          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);
               czgrid1.cells[i-1,1]:=str1;
               read(fofown);
               end;
          readln(fofown);

          for i:=1 to afterleashnum do
              begin
              read(fofown,str1);
              bdagrid1.cells[0,i]:=str1;
              read(fofown);
              end;
          readln(fofown);
          readln(fofown);
     end;
     system.close(fofown);
     afteraddvarnum:=bp_afteraddvarnum;
end;
procedure Tdchxingform.readfromfileofowngrid2;
var i,j:integer;{将GRID2从文件中读取数据,也就是在已经达到最优解的情况下
              用“下一步”到达的最后一张表}
    str1:string;
    ext1:string;
    bp_afteraddvarnum:integer;

begin
     bp_afteraddvarnum:=afteraddvarnum;
     afteraddvarnum:=m0+varnum;
     if not fileexists(nameoffileofown) then
          showmessage('对不起,现在不能进行上一步操作!')
     else
     begin
     assignfile(fofown,nameoffileofown);
     reset(fofown);
          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);{ext1}
               xigrid1.cells[i-1,1]:=str1;
               read(fofown);
               end;
          readln(fofown);
          For j:=1 to {agrid1.rowcount}afterleashnum do
               begin
               For i:=1 to {agrid1.colcount}afteraddvarnum do
                    begin
                    read(fofown,ext1);{A^[j,i]}
                    agrid1.cells[i-1,j-1]:=ext1;
                    read(fofown);
                    end;
               readln(fofown);
               End;
          readln(fofown);
{          For i:=1 to afterleashnum do{注意一下}
 {              begin
               read(fofown,ext1);{B^[i]}
{               cxbgrid1.cells[0,i]:=ext1;
               read(fofown);
               end;
          readln(fofown);
}          for i:=1 to afterleashnum do
               begin
               read(fofown,str1);
               cxbgrid1.cells[0,i]:=str1;
               read(fofown);
               read(fofown,str1);
               cxbgrid1.cells[1,i]:=str1;
               read(fofown);
               read(fofown,str1);
               cxbgrid1.cells[2,i]:=str1;
               read(fofown);
               readln(fofown);
               end;
          readln(fofown);

          read(fofown,str1);
          objedit1.text:=str1;
          readln(fofown);

          readln(fofown);

          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);
               czgrid1.cells[i-1,0]:=str1;
               read(fofown);
               end;
          readln(fofown);
          for i:=1 to afteraddvarnum do
               begin
               read(fofown,str1);
               czgrid1.cells[i-1,1]:=str1;
               read(fofown);
               end;
          readln(fofown);

          for i:=1 to afterleashnum do
              begin
              read(fofown,str1);
              bdagrid1.cells[0,i]:=str1;
              read(fofown);
              end;
          readln(fofown);
          readln(fofown);
     end;
     system.close(fofown);
     afteraddvarnum:=bp_afteraddvarnum;
end;{end of readfromfileofowngrid2;}

procedure Tdchxingform.RadioButton2Click(Sender: TObject);
begin{用一判断当前是单步还是分步执行}
     if radiobutton2.checked then
          statusbar1.panels[1].text:='分块执行';
      danbu:=false;
      fenkuai:=true;
end;

procedure Tdchxingform.RadioButton1Click(Sender: TObject);
begin{同上}
      if radiobutton1.checked then
      statusbar1.panels[1].text:='单步执行';         

      danbu:=true;
      fenkuai:=false;
end;

procedure Tdchxingform.Button4Click(Sender: TObject);
{退出时的一些设置}
var i:integer;
begin
//	  for i:=1 to 100 do
//			c01^[i]:=nil;
     for i:=1 to afterleashnum do
			cxbgrid2.cells[0,i]:='';
     button6.enabled:=false;
     biaonum:=1;
     backbiaonum:=1;
     currentbiaonum:=1;
     totalcontrol:=1;
     totalcontrol2:=1;
     step:=1;
     usef6:=false;
     getresult:=false;
     jisuan_over:=false;
     radiobutton1.Checked :=true;
     radiobutton2.Checked :=false;
     dchxingform.close;
     main.show;
end;

procedure Tdchxingform.Button3Click(Sender: TObject);
begin        {用此来得到结果}
      danbu:=false;
      fenkuai:=false;
      usef8:=true;
      usef7:=true;
      bestanswer:=false;
      zhuhangchoose:=true;
      repeat
            Button5Click(Sender)
      until (bestanswer=true) or (zhuhangchoose=false);
      if (mainchoose=20)and (not jieduan2) then
      button3.enabled:=false;
end;

    {刚开始只需输入A,B,C,Xi,Cxi,在运算中加入其他数据}
procedure Tdchxingform.FormActivate(Sender: TObject);
var i:integer;

begin
     if jisuan_over=false then
     for i:=1 to 50 do
         basevar[i]:=0;
     unbound:=false;
     zhuhangchoose:=true;
     prestep:=false;
     if jisuan_over=false then
     begin
     button1.enabled:=false;{add here}
     button2.enabled:=false
     end
     else
     begin
     button2.enabled:=true;
     if (filenum>1)and(not (mainchoose=20)) then
     button1.Enabled :=true;
     end;
     xigrid1.width:=(xigrid1.ColWidths[0]+1)*afteraddvarnum+5;
     xigrid1.Height :=xigrid1.RowHeights[0]*2+2;
     xigrid1.defaultcolwidth:=defaultwidth;
     xigrid1.rowcount:=2;
     xigrid1.colcount:=afteraddvarnum;
     xigrid1.left:=label1.left+cxbgrid1.Width+30;
     xigrid1.top:=label1.top-5;//+label1.Height +10;

     agrid1.width:=(agrid1.ColWidths[0]+1)*afteraddvarnum+5;
     agrid1.DefaultColWidth :=defaultwidth;
     agrid1.rowcount:=afterleashnum;
     agrid1.colcount:=afteraddvarnum;
     agrid1.left:=xigrid1.left;
     agrid1.top:=xigrid1.top+xigrid1.Height;
     agrid1.Height :=agrid1.RowHeights[0]*(afterleashnum)+7;

     cxbgrid1.Height :=(cxbgrid1.RowHeights[0]+1)*(afterleashnum+1)+5;
     cxbgrid1.Width :=(cxbgrid1.ColWidths[0]+1)*3+4;
     cxbgrid1.rowcount:=afterleashnum+1;
     cxbgrid1.ColCount :=3;
     cxbgrid1.left:=agrid1.left-cxbgrid1.Width ;
     cxbgrid1.top:=agrid1.top-cxbgrid1.RowHeights[0]-1 ;

     czgrid1.width:=(czgrid1.ColWidths[0]+1)*afteraddvarnum+5;
     czgrid1.Height :=(czgrid1.RowHeights[0]+1)*2+4;
     czgrid1.DefaultColWidth :=defaultwidth;
     czgrid1.colcount:=afteraddvarnum;
     czgrid1.rowcount:=2;
     czgrid1.left:=agrid1.left;
     czgrid1.top:=agrid1.Top+agrid1.height+2;

     bdagrid1.left:=agrid1.left+agrid1.Width;
     bdagrid1.rowcount:=afterleashnum+1;
     bdagrid1.ColCount :=1;
     bdagrid1.top:=cxbgrid1.Top;
     bdagrid1.Height :=(bdagrid1.RowHeights[0]+1)*(afterleashnum+1)+5;
     bdagrid1.width:=bdagrid1.ColWidths[0]+1+4;

     objedit1.left:=cxbgrid1.left+82;
     objedit1.top:=czgrid1.Top+5;

     {The secound table}
     cxbgrid2.left:=cxbgrid1.left;
     cxbgrid2.top:=objedit1.top+75;
     cxbgrid2.Height :=(cxbgrid2.RowHeights[0]+1)*afterleashnum+4;
     cxbgrid2.width:=(cxbgrid2.ColWidths[0]+1)*3+4;
     cxbgrid2.rowcount:=afterleashnum;
     cxbgrid2.ColCount :=3;

     agrid2.width:=(agrid2.ColWidths[0]+1)*afteraddvarnum+4;
     agrid2.rowcount:=afterleashnum;
     agrid2.DefaultColWidth :=defaultwidth;
     agrid2.colcount:=afteraddvarnum;
     agrid2.left:=cxbgrid2.left+cxbgrid2.Width;
     agrid2.top:=cxbgrid2.top;
     agrid2.Height :=(agrid2.RowHeights[0]+1)*afterleashnum+4;

     czgrid2.width:=agrid2.Width ;
     czgrid2.Height:=(czgrid2.RowHeights[0]+1)*2+4;
     czgrid2.DefaultColWidth :=defaultwidth;
     czgrid2.colcount:=afteraddvarnum;
     czgrid2.RowCount :=2;
     czgrid2.left:=agrid2.left;
     czgrid2.top:=agrid2.Top+agrid2.height;

     bdagrid2.left:=agrid2.left+agrid2.Width;
     bdagrid2.top:=agrid2.Top;
     bdagrid2.rowcount:=afterleashnum;
     bdagrid2.ColCount :=1;
     bdagrid2.Width:=(bdagrid2.ColWidths[0]+1)*1+4;
     bdagrid2.Height :=(bdagrid2.rowheights[0]+1)*afterleashnum+4;

     objedit2.left:=cxbgrid2.left+82;
     objedit2.top:=czgrid2.Top+3;
     {控件操作}
     button1.Left :=bdagrid1.left+75;
     button1.top:=bevel1.top+bevel1.Height +10;
     button5.Left :=bdagrid1.left+75;
     button5.top:=button1.top+40;
     button3.Left :=bdagrid1.left+75;
     button3.top:=button5.top+40;
     button2.Left :=bdagrid1.left+75;
     button2.top:=button3.top+40;

⌨️ 快捷键说明

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