2 Опыт решения транспортной проблемы


Download 1.3 Mb.
bet17/18
Sana26.01.2023
Hajmi1.3 Mb.
#1124581
TuriРеферат
1   ...   10   11   12   13   14   15   16   17   18
Bog'liq
Матрицца

Приложение 3


Код программы алгоритма нахождения матрицы корреспонденций гравитационным методом.
source(’dat1’);
V=e.ˆ (-0.065*vrem_zat); [m,n]=size(V);
s=(Q*V’)’;
for i=1:m T1(i,:)=D(i).*Q.*V(i,:)/s(i);
endfor while 1
S=sum(T1);
if max(abs(S-Q))<1e-10 save otvet_gr T1 break;
endif
for j=1:n
if S(j)>Q(j) T2(:,j)=T1(:,j)*Q(j)/S(j);
elseif S(j)<=Q(j) T2(:,j)=T1(:,j);
endif endfor
Q1=D - sum(T1’)’;
R1=Q - sum(T1);
s=(R1*V’)’;
for i=1:m T3(i,:)=T2(i,:)+Q1(i).*R1.*V(i,:)/s(i);
endfor T1=T3; p+=1;
endwile
Код программы алгоритма нахождения матрицы корреспонденций энтропийным методом.
source (’dat’);
T = e.ˆ (-vrem_zat); [m,n]=size(T)
s=0;
while 1
k12 = ones(1,n); for i=1:m
if D(i)!=0 k1(i,1)=sum(T(i,:))/D(i);
T1(i,:) = T(i,:)/k1(i);
elseif D(i) == 0 T1(i,:)=0;
endif endfor
T=T1;
if max(max(abs(sum(T)-Q)))<1e-11 save otvet_entr T
break; endif
for j=1:n if Q(j)!=0
k2(1,j)=sum(T(:,j))/Q(j);
T2(:,j) = T(:,j)/k2(j);
elseif Q(j) == 0 T2(:,j) = 0;
endif endfor
T=T2; s+=1;
endwile

43


Приложение 4


Таблица 4: Матрица корреспонденций в сегмент (8,8)




1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

2

1

4

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

3

0

7

41

19

20

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

4

0

0

11

17

21

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

5

0

0

1

0

39

54

46

2

0

0

0

0

0

0

0

0

0

0

0

0

0

0

6

0

8

13

65

0

19

127

9

42

0

0

0

0

0

0

0

0

0

0

0

0

0

7

0

35

26

84

8

31

63

16

101

1

0

0

0

0

0

0

0

0

0

0

0

0

8

0

23

58

75

1

26

48

64

39

55

39

13

34

116

0

0

0

0

0

0

0

0

9

0

31

111

80

1

47

80

17

4

73

61

90

46

128

140

56

0

0

0

0

0

0

10

0

3

28

79

6

133

75

24

12

0

47

64

76

68

18

1

5

2

0

0

0

0

11

2

0

43

96

65

141

52

38

1

0

16

52

26

37

1

1

0

0

1

0

0

0

12

0

6

114

56

44

100

41

48

7

0

0

0

0

6

8

0

0

3

8

0

0

0

13

0

7

96

19

79

122

29

6

1

0

0

0

0

0

0

0

0

0

4

23

0

0

14

0

45

94

0

2

0

0

0

4

8

4

0

0

0

0

0

0

0

2

2

0

0

15

0

6

101

0

0

0

0

0

7

0

4

0

0

0

0

0

0

0

1

0

0

0

16

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

17

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

8

0

18

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

2

19

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

1

3

20

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

0

8

24

3

21

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

3

3

4

22

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

23

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

24

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

25

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

26

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

27

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

3

6

0

0

0

28

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

3

0

0

0

0

0

0

29

0

0

0

0

0

0

0

0

0

0

0

0

0

0

2

3

0

0

0

0

0

0


44



Download 1.3 Mb.

Do'stlaringiz bilan baham:
1   ...   10   11   12   13   14   15   16   17   18




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling