|
P ɠ
:
@'
'
:
@'
'
: :
-406
.. ..
1995 .
Ŀ
- 1 -
:
@Š @
................................................... 2
1. ......................... 3
2. .
........................ 4
3. .
...................................... 5
4. ........................... 6 - 10
5. ... 11
6. . 12
7. - ..13 - 14
8. ........................... 15
9. .................................16 - 17
.......................................... 18
. ................................ 19
. ............................... 20
1...............................................21 - 26
2...............................................27 - 30
Ŀ
- 2 -
.
頠
-
.
.
-
.
-
,
. -
-
.
-
- .堠
.@-
@
.
.
. -
-
.
,
. ࠠ
-
,
-
,
.
,
@
@ .
,
,
-
.
.
-
젠
@-.
Ŀ
- 3 -
1. .
.
頠
11,0 堠
:
: 1,6 - 480 .
1,3 - 760 .
3,6 - 180 .
: 1) , 頠
.
2)
-
.
, ,
頠
.
-
.
Ŀ
- 4 -
2. .
.
:
m ( i=1,2,...,m ) - .
n ( j=1,2,...,n ) - .
Bi - "i"- .
bij - "i"- ,
"j"- .
Xj - () ,
"j"-
.
Cj - "j"- .
:
:
n
[1]
\
1) [1]/ bij
* Xj Bj i=(1,2,...,m)
j=1
2) Xj 0
:
n
[1]
\
3) F = [1]/ Cj
* Xj ^#& min
j=1
:
1.
Ŀ
Ⳡ
蠠 Ĵ
1
2 3 4 5 6
Ĵ
1,6 6 5 2 - 2 2 480
1,3
1 2 6 5 3 - 760
3,6 - - - 1 1 2 180
Ĵ
0,10,4 0 0,90,30,6
٠
.
Ŀ
- 5 -
3. .
.
@-, .. 䠠
-
.
,
.
,
. ꠠ
. -
. -
( ),
-
, ,
-
,
.
,
, -
,
,
-
.
-.
-
.
@
-.
Ŀ
- 6 -
4. .
Ŀ
- 7 -
Ŀ
- 8 -
Ŀ
- 9 -
Ŀ
- 10 -
- :
1: .
2,3,4,5:
.
6:
.
7: ,
.
8:
9: Y,
.
10: YV-
,
itr - .
11: YV=True (
), 䠠
( 31), .
12:
.
13: testY (
).
14: testY=True (
),
indY ( 15), indX.
15: indY.
頠
.
16: indX.
, .
17: test0.
.
18: test0=false (
堠
), ( 19),
( 30).
19:
.
20: MaxSt
.
21: Str
頠
.
22:
.
23:
(a) (H).
24:
.
25:
.
26: H.
27:
.
28: ,
.
29:
.
30:
. ( )
31:
.
32: .
Ŀ
- 11 -
5.
.
'' '', ..
. 1981. 'IBM
Corporation' 頠
IBM PC,
16- ࠠ
Intel-8088.
:
(), (),
,
頠
, ,
,
. -
IBM
, ..
-
(, , CD-ROM)
.
, 頠
( ,
, -
), -
.
頠
,
IBM PC -
: Intel-80286,
16 , -
1 , VGA,
14 .
-
,
.
- ,
.
, -
, ,
-
.
-
.
. -
: MS-DOS 3.0
-
' ',
.
Ŀ
- 12 -
6.
.
젠
, .. , .
, 50-
@ ,
, 젠
.
ASSEMBLER,
:
.
@
. 堠
, -
.
@Turbo PASCAL.
III .
80- Borland
Turbo PASCAL
,
. ꠠ
.
:
-
.
7.0 -
, ,
, -
.
,
.
- -
,
,
.
Ŀ
- 13 -
7. -
1 :
6X1 + 5X2 + 2X3
+ 2X5 + 2X6 480
< X1 + 2X2 + 6X3 + 5X4 + 3X5 760 Xj 0
Ġ X4
+ X5 + 2X6 180
, , :
Fmin = 0,1X1 + 0,4X2 + 0X3 + 0,9X4 + 0,3X6
:
6X1 + 5X2 + 2X3
+ 2X5 + 2X6 - X7
+ Y1 = 480
< X1 + 2X2 + 6X3 + 5X4 + 3X5 - X8 + Y2 = 760
Ġ X4
+ X5 + 2X6 - X9 + Y3 = 180
:
Fmin = 0,1X1 + 0,4X2 + 0X3 + 0,9X4 + 0,3X6 + 0X7
+ 0X8 + 0X9 +
+ MY1 + MY2 + MY3
-.
( 2).
5- , .. 頠
. 480 -
1,6 , 760 1,3 , 180 3,6 150 -
11 2 1,6 6 1,3 90 2
1,6 2 3,6 .
1,3 140 .
1.
2 * 150 = 300 (
1,6) 2 * 90 = 180 ( 1,6)
6 * 150 = 900 (
1,3) 2 * 90 = 180 ( 3,6)
, . .
W. - .
W. - .
.. - .
( , 2)
Ŀ
- 14 -
2.
Ŀ
0,1 0,4 0 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6) =
180
, . .
Ŀ
- 16 -
9. .
, -
.
MS-DOS, ( 堠
), 蠠
,
.
KURS.EXE .
, -
. . -
,
, .
, -
Enter ( ). , , -
, .
-
X Y, .
, Enter.
, -
, ,
. :
, , , -
" "
" (Y/N)?".
, 'Y' + ''.
-
,
: 'N' + ''. (
堠
'Ctrl' + 'Break').
, .
: ,
, "
Ŀ
- 17 -
!".
MS-DOS.
. -
.
.
,
-젠
.
Ŀ
- 18 -
:
..
.
; " " ; 1988.
..
堠
..
; " " ; 1980.
..
.. IBM PC
; " " ; 1994.
.. 6.0
; "- " ;
1992.
Ŀ
- 19 -
. .
"
"
-.
.
-
.
.
-
Turbo-Pascal -
.
-
,
.
Ŀ
- 20 -
.
-
-
:
@ .
,
-, 䠠
.
@ test0. -
. ,
-
'', ''.
@ testY.
. ,
'', ''.
@ indxY. ,
.
@ indxX. ,
.
@ maxSt. (-
)
.
@ Str. 蠠
.
PASCAL
-
,
, -
.
[1]D
"D
A*.FRM*.MACF
program
kurs;
uses
crt,dos;
type
mas= array [1..20,1..20] of real;
vek= array [1..20] of real;
vek1= array [1..20] of integer;
{*** Š ***}
var
h,h1 :vek; {.
}
{ ( H) }
f1
:vek; {
蠠 }
c,c1
:vek; {.
}
cc
:vek; { C~ }
b
:vek1; { }
o
:boolean;{ }
nn,n,n1,n2:integer;{ ߠ }
k,k1,dl
:integer;{
ɠ
}
otw
:char; {
}
kur
:integer;{ 堠 }
itr
:integer;{ 頠 }
id,id1
:integer;{ 堠 }
hh
:real; {
Fmin }
a,a1
:mas; {.
}
yv
:boolean;{ ࠠ }
procedure
muz(dl:integer);
{}
begin
sound(300);delay(dl);
sound(400);delay(dl);
sound(500);delay(dl);
nosound;
end;
function test0(c:vek):boolean;
{
}
var
l:integer;
begin
l:=0;
for k:=1 to n+n1 do
if c[k]>0 then l:=l+1;
if l>0 then test0:=false
else test0:=true;
end;
function testY(a:mas):boolean;
{
(Y) }
var
l:integer;
begin
l:=0;
for k:=1 to kur do
for k1:=(n+n1+1) to nn do
if A[k,k1]=1 then l:=l+1;
if l>0 then testy:=true
else testy:=false;
end;
procedure
indxY(aa:mas; var c1:vek);
{
, Y- }
var k2 : integer;
vr : mas;
l
: real;
begin
hh:=0;
for k:=1 to nn do
c1[k]:=0;
for k:=1 to kur do
for k1:=(n+n1+1) to nn do
if aa[k,k1]=1 then
begin
hh:=hh+h[k];
for k2:=1 to (n+n1) do
c1[k2]:=c1[k2]+aa[k,k2];
for k2:=(n+n1+1) to nn do
c1[k2]:=0;
end;
end;
procedure
indxX(aa:mas; var c1:vek);
{
}
begin
for k1:=1 to (n+n1) do
c1[k1]:=0;
for k:=1 to kur do
for k1:=1 to (n+n1) do
c1[k1]:=c1[k1]+cc[k]*aa[k,k1];
for k:=1 to (n+n1) do
c1[k]:=c1[k]-f1[k];
hh:=0;
for k:=1 to kur do
hh:=hh+cc[k]*h[k];
end;
procedure
maxSt (c1:vek; var id:integer);
{
}
var
maxi:real;
k :integer;
begin
id:=1;
maxi:=c1[1];
for k:=1 to n+n1 do
if (c1[k]>maxi) and (c1[k]>0) then
begin
id:=k;
maxi:=c1[k];
end;
end;
procedure
Str (id: integer;aa:mas; var id1:integer);
{
}
var
mini:real;
k
:integer;
begin
id1:=1;
mini:=aa[1,id];
for k:=2 to kur do
if (aa[k,id]>0) and ( (mini<=0) or
(h[k]/aa[k,id]<h[id1]/mini) ) then
begin
mini:=aa[k,id];
id1:=k;
end;
end;
{********************************************************************}
{* .
*}
{********************************************************************}
begin
textbackground(blue);
clrscr;
window(21,6,59,18);
textbackground(0);
clrscr;
window(20,5,57,17);
textbackground(7);
textcolor(4);
{*********
**********}
clrscr;
writeln('
Ŀ');
writeln(' ɠ
Ҡ ');
writeln(' :
');
writeln(' "
, ');
writeln('
,');
writeln(' - ." ');
writeln(' :
');
writeln(' " " ');
writeln(' :
');
writeln(' ..
.. ');
writeln(' () Ҡ
1995. ');
writeln(' ...
');
write
(' ');
repeat until keypressed;
window(1,1,80,24);
textbackground(blue);
clrscr;
for k:=1 to kur do
for k1:=1 to nn do
A[k,k1]:=0; { }
{ }
window(4,3,61,25);
textbackground(0);
clrscr;
window(3,2,59,24);
textbackground(3);
clrscr;
textcolor(0);
gotoxy(3,3);
write(' -
堠 :');
readln(kur);
gotoxy(3,5);
write(' -
蠠 :');
readln(n);
gotoxy(3,7);
write(' -
:');
readln(n1);
gotoxy(3,9);
write(' -
:');
readln(n2);
nn:=n+n1+n2;{nn- }
muz(50);
clrscr;
gotoxy(3,3);
writeln(' X , !');
for k:=1 to (n+n1) do
begin
write(' X',k,'= ');
readln(f1[k]);
end;
muz(50);
clrscr;
for k:=1 to kur do
begin
writeln(' ',k,' ');
readln(h[k]);
end;
for k:=1 to kur do
begin
muz(50);
clrscr;
writeln(' Y, N:',k);
for k1:=1 to nn do
begin
if k1<=n+n1 then write(' X',k1,'=')
else write(' Y',k1-(n+n1),'=');
readln(a[k,k1]);
end;
end;
{********************************************************************}
{* .
. *}
{********************************************************************}
yv
:=true;{ }
itr:=1; { }
o :=true;{ !}
repeat
{ }
begin
clrscr;
muz(100);
c1:=c;{ }
{ Y ?}
if testY(a) = true then indxY(a,c1)
{! . Y }
else indxX(a,c1);{!
. }
{ 堠 }
{ . ,
0 ?}
if test0(c1)=false then {!
}
begin
{****** ******}
writeln(' N:',itr);
writeln(' :');
writeln(' Fmin=',hh);
for k1:=1 to (n+n1) do
writeln(' X',k1,'=',c1[k1]);
writeln('
!!!');
write
(' (Y/N)?');
readln(otw);
{ ?}
if (otw='Y') or (otw='y') then {!
!}
begin
maxst(c1,id); { }
str(id,a,id1); { }
cc[id1]:=f1[id];{ C~
}
{ (X ) }
b[id1]:=id; { }
a1:=a;h1:=h;{
H}
{**** Ӡ ****}
{
}
for k:=1 to n+n1 do
a1[id1,k]:=a[id1,k]/a[id1,id];
{
}
for k:=1 to kur do
if k<>id1 then
for k1:=1 to n+n1 do
a1[k,k1]:=a[k,k1]-((a[id1,k1]*a[k,id])/a[id1,id]);
{ H}
for k:=1 to kur do
if k<>id1 then
h1[k]:=h[k]-((h[id1]*a[k,id])/a[id1,id]);
h1[id1]:=h[id1]/a[id1,id];
yv:=true;{ !}
a:=a1;h:=h1;c:=c1;{
}
itr:=itr+1;{ }
{ Y,
}
for k1:=(n+n1+1) to nn do
if a[id1,k1]=1 then a[id1,k1]:=0;
end
else
begin
yv:=false;{! !}
o :=false;
end;
end
else yv:=false;{! }
{
ࠠ }
end
until
(yv=false);{ . }
{
?}
if
o=true then {! !}
begin
{******
******}
muz(200);
textbackground(2);
textcolor(0);
clrscr;
writeln(' !!! !!!');
writeln(' ',itr,'-
!');
writeln(' :');
for k1:=1 to kur do
writeln(' X',b[k1],'=',h[k1]);
writeln('
Fmin=',hh);
writeln(' :');
for k1:=1 to (n+n1) do
writeln(' X',k1,'=',c1[k1]);
textcolor(16);
write('
!!!');
repeat until keypressed;
end;
end.
- 27 -
P 2
@
- 28 -
⥬:
"⨬ ᪨ ,
ਢ ,
- ⮤."
।:
"⥬
"
:
ࡠ⮢ .. ..
()
1995.
...
-
襩 ⥬
:3 -
६ ࠢ :6 -
६ ࠢ:3 -
६ ࠢ :3
樥 X ,騥 楫 㭪樨! X1= .1 X2= .4 X3= 0 X4= .9 X5= .3 X6= .6 X7= 0 X8= 0 X9= 0 童
1 ࠢ 480 童
2 ࠢ 760 童
3 ࠢ 180 樥
Y,騥 ࠢ N:1 X1=6 X2=5 X3=2 X4=0 X5=2 X6=2 X7=-1 X8=0 X9=0 Y1=1 Y2=0 Y3=0
- 29 - 樥
Y,騥 ࠢ N:2 X1=1 X2=2 X3=6 X4=5 X5=3 X6=0 X7=0 X8=-1 X9=0 Y1=0 Y2=1 Y3=0 樥
Y,騥 ࠢ N:3 X1=0 X2=0 X3=0 X4=1 X5=1 X6=2 X7=0 X8=0 X9=-1 Y1=0 Y2=0 Y3=1
N:1 祭 ᭮ ப: Fmin= 1.4200000000E+03 X1= 7.0000000000E+00 X2= 7.0000000000E+00 X3= 8.0000000000E+00 X4= 6.0000000000E+00 X5= 6.0000000000E+00 X6= 4.0000000000E+00 X7=-1.0000000000E+00 X8=-1.0000000000E+00 X9=-1.0000000000E+00 㭪 !!!
த (Y/N)?y
N:2 祭 ᭮ ப: Fmin= 4.0666666667E+02 X1= 5.6666666667E+00 X2= 4.3333333333E+00 X3= 0.0000000000E+00 X4=-6.6666666667E-01 X5= 2.0000000000E+00 X6= 4.0000000000E+00 X7=-1.0000000000E+00 X8= 3.3333333333E-01 X9=-1.0000000000E+00 㭪 !!!
த (Y/N)?
- 30 -
N:3 祭 ᭮ ப: Fmin= 1.8000000000E+02 X1= 0.0000000000E+00 X2= 0.0000000000E+00 X3= 0.0000000000E+00 X4= 1.0000000000E+00 X5= 1.0000000000E+00 X6= 2.0000000000E+00 X7= 0.0000000000E+00 X8= 0.0000000000E+00 X9=-1.0000000000E+00 㭪 !!!
த (Y/N)?y
N:4 祭 ᭮ ப: Fmin= 5.4823529412E+01 X1= 0.0000000000E+00 X2=-3.2352941177E-01 X3= 0.0000000000E+00 X4=-6.4705882353E-01 X5= 0.0000000000E+00 X6= 0.0000000000E+00 X7=-1.7647058824E-02 X8= 5.8823529412E-03 X9=-2.8235294118E-01 㭪 !!!
த (Y/N)?
!!! !!! 5- 樨 祭
⨬쭮 襭! 祭 : X8= 1.4000000000E+02 X3= 1.5000000000E+02 X6= 9.0000000000E+01 Fmin= 5.4000000000E+01 祭 ᭮ ப: X1=-1.0000000000E-01 X2=-4.0000000000E-01 X3= 0.0000000000E+00 X4=-6.0000000000E-01 X5= 0.0000000000E+00 X6= 0.0000000000E+00 X7= 0.0000000000E+00 X8= 0.0000000000E+00 X9=-3.0000000000E-01 !!!
FF[1]A*.FRM*.MAC
F[1]A*.FRM
. . . . . . . . . . . . . . .
|
|
|
|
| |