|
Табличный симплекс-метод
????????????? ?????????? ????????-?????? ??? ??????? ????? ????????? ???????????????? ??? ??????????? ?????????????
????? ????????????????- ??????? ?????? ????????? ??????????????
????? ? ?????, ??? ??? ??? ???? ?????????????, ??? ? ???? - ????????????????? ???? ??? ????????
???. ???????????????? ????? ???? ??????? ????????????? ????. ???????????????????? ??????? ?????????:
???????? ???????????? ????? f ( x n * ³ ????????????? - ??
??? ????????????????, ????????????? ??? ???? ??????? ???????? ?????? ?????????????, ??????? ???????
?????????. + a ; n . . . . . .
. . . . . . . . . . . . . . . . . . . . . . n 0, x 0 ? ??????????? ????????????? ??????????????? ??? max
c ??? - ?????????????? ( m (n n
????? min f(x) ???????max [ - f(x) ]
, ? ??? ????????????? ??? ?????? ???????? ??? ??????. 4) ???????? ???? - ??? ?? ??????? ?????, ???????????????? ?? ???? ?? ???? ?????? ????b -
??????.
???????? ????????????????? ?????????????? ?? ???? ? ???????????? ??????? ?????? ????? ??????? ?????????. ????? ???? ?????? ???, ???? ???? ????, ?????? ???. ???? ???????? ? ??? ????-???????????? ???
????. ??????????? ?????? ???????????????? ????? ???? ?? ???? ???? ?? ??????????
?????? ????? ???. ???? ?????????? ?????????????????? ? ???, ?????? ?? ????, ?? ?? ?????? ? ??? ???????? ?????????? ?????
???? ????? ??????? ???????? . ??? ????? ???? ????? ??? - ??? ??????????????, ?? ?????? ?????????????? ???. ????
??????????? 1.4 ????????????? - ???P>? ??? ??? ???????????-??? ???? ?????????????
????, ????????????? ???? ??? ???? ???? ?????????? ???????????????????? ???? ? ???? ??? ?????????? ????? ????????????????
???? ???????????????? ??? ? ????? ????????? ??? ???????????? ????? ????? ????? ???????? ?????????????? ????????????? ???????.
??? ?? ????, ??????????? n ????????????????????m. ? ??? ??????? ?????? ?????? ????????? ????????????????, ?????? ???
?????? ???????, ????????-????? ???? ??????????? ?????????????????? ???????????-???? 2. ?????????????? ?????????? ?????? 1
???????? ???????? ? ??????? ???: ???????1-? ?? - b ???????? ?? ??????????? , ?????? 3-? ?? ? ??? ???
t ???, ????? ? - ????? ?? ?????? ????? ??, ?????????????? ????? ? ?????. ??????? ????????-???? ?????????? ?????? ???, ????? ?? ???
? ?????? ????????-??????? = 3
b 3 3.1 ????????????? ??? ??? ?????-? ???? ?, ???/TD> ????????????? ??? ??????? ?????? : 1
?? ???????????? ????????????? ?? ????, ? ??????? ? ????? ????? 2x ( ??? ). ????? ?????????F, ????? ????? ??????? ?????? ????????: ????? ?????
???? ????? x ?? ??????????????? ???????? ?? ??? ?????? ?
???, ??????????? ?????? ??? ?????? ? ?????? ?? ???? ?? ???? ????????????????: + 2x 10 . ³ ??? ???? ??????? ??? ??? ?????? ??? : ????? ?? x ????????????: 2 10 . 3.2 ???? ??? ???? +
5x £ 1
2. ?????????????????: + x ³ A = = -
????????-????? ??j = 1..6 . C 4 4 5 . ?? ??? ? max ? ?????? ?????????????????-?????.
? ??? ??? ?? ??? ? min ? ??? ??? ??????
? a =
a ¹ C 4 4 5 3 A 1 A 0 d 0 ?? ????????-???? ??????, ?
??????????????: ??????????? ???????? ???? ????????????, ???? ????? ??? ????? ??????????? ??? ????? ????????? ) ???????P> y + 2y ³ 0. ? ?????? ?????????? ??? ????? ????????????? ? ?????????-???? ? ????? ???? ???????????????? ???
: ?????? ???? ??????????????? ??? ??????????????????????????, ???? ??? ?????. ???? ????? ??????, ?? ???????? ????????? ??? ??????? ??????????????????, ??????? ? ?????? ???????? ??
?????? ????????????? ???????? ????????? ??????????-???????? ? ???? ??????? ?????. ??????? ???? ??????? ????? ?????? ????
??????????????? ???? ?? ? ?????????, ???????? ??????? ????? ?????? ?????? ???? ?????, ??????? ?????? ????????? ?? ?????? ??????? ??????? - ??????? (
?SUB>3 ?????????????????? ?????????? ?????? ???? ????????F, ??????? ? ???????? ???????? ?????????? ??? ???????? ?
???? ?????? ????? ????????????????? ???. = ( 0, 1/4, 5/8, 0, 0 ). ???
???? ? ?? ?????? ???? ?????? ?????? ??????? ????? ?????? ???????? ? ????????? ?????????????? ???? ? ????
???????? ????? ????????????? ?????? ????( ?? ??? ??? ??????)
??????? ???????? ???? ????. ???? ???????? ???? ???????????????????? ??????????? ????? ?????. ?????????????, ?????????? ??
?????? ???? ????? ?????????????? ?????. ????? ???? ????? ????????????? ? ?????????. ?????? ????-???????
?????: C 4 A 0 0 ??????????????????????????????
??????????? , ?????? ??? ???12 +
0.75 - D 0 , / 2 ???? ??? ??-3.66 3 , ?? 8.34 ??? ??????????? ???? ??? ? ?????? ?????? ????? ???? ? 15
????????? ? 8.34 ?? ??????? ??????????. ??????????????? ???????? ??? ??????? ????? ???? ????? ? ???????. D i
.???????? ??????? ????
? ?????????? ????? ???? ?????? ??? ????? ?????? ??? ???? ???????????????????????? ? ????? ???????. × . ???? ?????????? ????????? ????? ??????? ? ?????? ??????. ?? ??? ????? ??? ??? ???? ? 0 ???????h = 0.5 ?
3 ??? ?????????????????????1. F, ?? F, ?? C??????, ?????????????? ? ??????
?????? ? 2 ?? ??????? ????????? ???????? 28 ???. ?????? ??????? ??? ?? ?? ????????? ? ?????? ?????????. ???, ??????????????, ????? ? ?????
???????? ????- ????????? ????? 2 10 . 1). x = 2 2
= 4, x 1 4). ????????? ????: 6. ?????? ? ???????????? ?? ????????????? ????????????? ???????? ??? ????????????? ????????
?????????, ????????? ???????? ????? ??????????. ????????????? - ????( ?????? ????), ????? ?????? ?
????????? ????? ????? ????? ?????????? ? ??????? ?????? ????????? ?????????????.
????????????? - ?????????? ??????? ??. ???????????? ??????????? ??? ?????????? ????????????
??????? - ????? ??????? ?? ? ????? ????. ????????????? - ?????? ?????? ??? ????, ??????? ????.
???????? ????? ????? ????? ?????? ???? ??????? ????( ???? ). ??????? - ?????????????? ??????? ( ????) ????, ?? ????????
?????????????? ?????????? ( ????? ? ??? ). ????????????? - ??????? ????????? ????. ? ???? ??????? ? ???????? ????? ????, ? ????
???????????? ????, ??????? ???? ??? ????????? ?? ???? ???? ??? ???. 1. ?????????? ????????? ???, ??????????? ????????? ?
?????????????????????? ????? ??????? ??????. ????????????????? ?????? ????MS DOS ??? 5.0, ?????? ??? NORTON COMMANDER,
??????????? Borland Pascal 7.0 . ??? ?? ???? ??? ?????????????? KURSOVIK: IBM PC
??IBM PC - ????????????????? 3.25?????? 1.2 ?? ???? ????? ??? ????? ????KURS97.DAT ?KURS97.RES ???????. ???? ??? ??????? ??????? ????
???????? ??????? ??? ????-???. ????????? ???????????????????????? ???????? ??????????????? ????- ????????????????
????. ????????????KURS97.PAS ??????????????:
VectorA : array [1..m, 0..m+n] of real; DigitOfBasisVector : array
[1..m] of real; MinimumBuffer : real; DateFile : text; for i:=1 to n do Readln(DateFile,
TargetVector[i]); for j:=0 to n do VectorA[i, j]:=1; for i:=1 to m do
BasisVector[i]:=n+i; ReadDatesVectorA; i,j : integer;
SimplexVector[0]:=SimplexVector[0] + DigitOfBasisVector[i]*VectorA[i, 0]; for i:=1 to m do Summa:=Summa
+ DigitOfBasisVector[i]*VectorA[i, j]; end; GetEnterVector:=1; GetEnterVector:=i; i :
integer; if VectorA[1,
IndexOfEnterVector] > 0 then MinimumBuffer:=VectorA[1, 0] / VectorA[1,
IndexOfEnterVector]; if MinimumBuffer >=
Temp then procedure ReCountOutputString; { ???? ??????? ????????
}
DigitOfBasisVector[IndexOfOutputString]:=TargetVector[IndexOfEnterVector]; end;
Buffer:=VectorA[IndexOfOutputString, IndexOfEnterVector]; end; for i:=1 to m do then VectorA[i, j]:=VectorA[i, j] - VectorA[i
,IndexOfEnterVector]*VectorA[IndexOfOutputString,j]; end; if
SimplexVector[i] < 0 then AllIsPositiv:=False; ToStr:=' ' + S
+ ' '; writeln(' +-------------
----------------------------------------+'); procedure WriteMatrixA; writeln('
+-----------------+--------+--------+--------+------
--+--------+--------?'); writeln(' +--------+--------+--------+---
-----+--------+--------+--------+--------?'); for j:=0 to m+n do write(ToStr(VectorA[i,
j]),'?'); writeln;
else writeln(' +--------+--------+--------+--------+------
--+--------+--------+--------?'); for i:=0 to m+n do write(ToStr(SimplexVector[i]),'?'); writeln;
WriteTargetMatrix; procedure
WriteTargetMatrix; write (FileOfOutput, ' ? Target ?');
procedure WriteMatrixA; writeln(FileOfOutput, '
+-----------------+--------+--------+--------+------
--+--------+--------?'); writeln(FileOfOutput, ' +--------+-----
---+--------+--------+--------+--------+--------+---
-----?'); for j:=0 to m+n do
write(FileOfOutput, ToStr(VectorA[i, j]),'?'); writeln(FileOfOutput); if i = m then
writeln(FileOfOutput, ' +--------+--------+--------+--------+-
-------+--------+--------+--------?') end; for i:=0 to m+n do write(FileOfOutput,
ToStr(SimplexVector[i]),'?'); writeln(FileOfOutput); clrscr; ReadDates; while not
AllIsPositiv do
ReCountVectorA;
Close(FileOfOutput); 1. ????? ReadDates - ???????? ? ??? 3. ????? ReadDatesVector - ????? ? ???? ???????? ?????? ??????
???? 6. ????? GetOutputString - ????????? ??? ???. 9. ?????
WriteMatrixA, WriteTargetMatrix, WriteMatrixSimplex - ??? ??????????? ? ???
????.
| |