📄 delpross.pas
字号:
{$n+}
program pros;
{unit test;
interface
procedure readpro;
procedure writestandard;
procedure writeorigin;
Procedure tlBiaoZhunhua;
implementation}
uses delglobe,deltlqua;
var
tiaojian:ttiaojianp;
filename:string;
f:text;
bzh,typeoffx:string[3];
m,n,ntj:integer;
ntj0,n0,m0:integer;
i,j:integer;
c1,c:ccp;
xb1,b,b1:tcbp;
a1,a:aap;
sel_t:boolean;
Procedure tlBiaoZhunhua;
Var
varnum,leashnum:integer;
ok,j,i,k:integer;
Begin
For i:=1 to leashnum do {TO AVOID B<0};
if b^[i]<0.0 then
begin
for j:=1 to varnum Do a^[i,j]:=(-1)*a^[i,j];
b^[i]:=(-1)*b^[i];
if tiaojian2^[i]='>= ' then tiaojian2^[i]:='<= ';
if tiaojian2^[i]='<= ' then tiaojian2^[i]:='>= ';
end;
m0:=0;
for i:=1 to varnum do if c1^[i].att='<=>' then inc(m0);{add var x3->(x3'-x3''}
i:=m0+varnum;{this time 'i' is the total var num}
for k:=varnum downto 1 do
begin
if c^[k].att<>'<=>' then
begin
for j:=1 to leashnum do a^[j,i]:=a^[j,k];{jiang zhenglie ban zhou dao ling yi hang }
c^[i]:=c^[k];
end
else{c^[k].att='<=>'}
begin
for j:=1 to leashnum do
begin
a^[j,i]:=(-1)*a^[j,k];
a^[j,i-1]:=a^[j,k];
end;
c^[i].att:='>=0';c^[i].num:=c^[k].num*(-1);
dec(i);c^[i]:=c^[k]
end;
dec(i);
end;
for i:=m0+varnum downto 1 do
if c^[i].att='<= ' then
begin
for j:=1 to leashnum do a^[j,i]:=(-1)*a^[j,i];
c^[i].num:=c^[i].num*(-1);
end;
for i:=1 to leashnum do xb1^[i]:=0;
for i:=1 to leashnum do if tiaojian2^[i]<>'>= ' then inc(k);
for i:=1 to leashnum do {about artificial var}
if tiaojian2^[i]='>= ' then
begin
inc(m0);
c^[m0+varnum].att:='SYB';c^[m0+varnum].num:=0;
for j:=1 to leashnum do a^[j,m0+varnum]:=0;
a^[i,m0+varnum]:=-1;
end
else
if tiaojian2^[i]='<= ' then
begin
inc(m0);
c^[m0+varnum].att:='SCB';c^[m0+varnum].num:=0;
for j:=1 to leashnum do a^[j,m0+varnum]:=0;
a^[i,m0+varnum]:=1;
xb1^[i]:=m0+n;
end;
for i:=1 to leashnum do
if (tiaojian2^[i]='>= ') or (tiaojian2^[i]=' = ') then
begin
inc(m0);
for j:=1 to leashnum do a^[j,m0+n]:=0;
c^[m0+varnum].num:=0;c^[m0+varnum].att:='RGB';
a^[i,m0+varnum]:=1;xb1^[i]:=m0+varnum;
end;
sel_t:=false;
for i:=1 to m0+varnum do
if c^[i].att='RGB' then sel_t:=true;
if typeoffx='Min' then
for i:=1 to m0+varnum do c^[i].num:=(-1)*c^[i].num;
{m0+varnum is the total var num after the standarded}
End;
procedure readfromfile;
begin
filename:='t07.org';
assign(f,filename);
Reset(f);
Readln(f,BZH);
readln(f,typeofFx,n,ntj);
For i:=1 to n do read(f,C^[i].num);
readln(f);
For i:=1 to n do read(f,C^[i].att);
readln(f);
{----a[i,j]--}
For i:=1 to ntj do
begin
For j:=1 to N do read(f,A^[i,j]);
readln(f);
End;
{---------TiaoJian----------------}
For j:=1 to ntj Do Read(f,TiaoJian^[j]);
readln(f);
{-----b[i]--}
For i:=1 to ntj do read(f,B^[i]);
readln(f);
Close(f);
end;
procedure writestandard;
var
xb,cb:tcbp;
begin
filename:='t01csta.org';
Assign(f,filename);
rewrite(f);
{f2:=filename;}
{$I-}Writeln(f,'BZH');
Writeln(f,TypeofFx,N:10,Ntj:10,M:10);
for i:=1 to N+m do
if Abs(c^[i].num)>=MaxNumber then Write(f,' ',c^[i].Num:20:2)
Else Write(f,C^[i].Num:8:2);
Writeln(f);
for i:=1 to N+m do Write(f,C^[i].att:3);
Writeln(f);
for j:=1 to Ntj do
Begin
write(f,CB^[j]:8:2,XB^[j]:3);
for i:=1 to m+n do write(f,A^[j,i]:8:2);
writeln(f);
End;
For j:=1 to ntj Do write(f,TIAOJIAN^[j]:3);
Writeln(f);
For j:=1 to ntj Do Write(f,B^[j]:8:2);
writeln(f);{$I+}
end;
procedure writeorigin;
begin
assign(f,filename);
rewrite(f);
{ f1:=FILENAME;}
m:=0;
{$I-}Writeln(f,'ORG');
write(f,typeofFx:3,n:3,ntj:3);
writeln(f);
{----c[i]---}
For i:=1 to n do write(f,C^[i].num:8:2) ;
writeln(f);
For i:=1 to n do write(f,C^[i].att:3);
writeln(f);
{----a[i,j]--}
For i:=1 to ntj do
begin
For j:=1 to N do write(f,A^[i,j]:8:2);
writeln(f);
End;
{-------------TiaoJian-------------------}
for j:=1 to ntj do Write(f,TiaoJian^[j]:3);
Writeln(f);
{-----b[i]--}
For i:=1 to ntj do write(f,B^[i]:8:2);
writeln(f);{$I+}
end;
begin
readfromfile;
tlBiaoZhunhua;
writestandard;
writeorigin;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -