最新数学建模b题交巡警服务平台的设置与调度程序Word格式文档下载.docx
- 文档编号:20690188
- 上传时间:2023-01-25
- 格式:DOCX
- 页数:27
- 大小:25.14KB
最新数学建模b题交巡警服务平台的设置与调度程序Word格式文档下载.docx
《最新数学建模b题交巡警服务平台的设置与调度程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《最新数学建模b题交巡警服务平台的设置与调度程序Word格式文档下载.docx(27页珍藏版)》请在冰豆网上搜索。
index_adj=index_adj+1;
%根据邻接矩阵数据创建图论的稀疏矩阵
a1=Adjoin_matrix(:
1)'
;
a2=Adjoin_matrix(:
2)'
a3=Adjoin_matrix(:
3)'
DG=sparse(a1,a2,a3);
%建立稀疏矩阵,图论求解
fori=1:
forj=1:
ifDG(i,j)==0
DG(i,j)=inf;
ifi==j
DG(i,j)=0;
fork=1:
fori=1:
ifDG(i,k)+DG(k,j)<
DG(i,j)
DG(i,j)=DG(i,k)+DG(k,j);
Patrol_range=cell(20,1);
20
if(DG(i,j)<
=3000)
Patrol_range{i}=[Patrol_range{i},j];
Patrol_distribution=Patrol_range;
%复制原始数据
Patrol_cover=cell(92,1);
%定义交集
Cover=[];
Isolated=[];
%定义孤立点
c=[];
m=length(Patrol_range{j});
forl=1:
m
if(Patrol_range{j}(l)==i)
c=[c,j];
%保存i节点所对应的所有可能的交通巡警点
m=length(c);
if(m>
1)%如果大于1,说明有交集,先去除,不分配
Cover=[Cover,i];
Patrol_cover{i}=c;
%保存交集
fork=1:
find(Patrol_distribution{c(k)}~=i);
Patrol_distribution{c(k)}=Patrol_distribution{c(k)}(find(Patrol_distribution{c(k)}~=i));
%预分配只属于自己的交通节点
if(m==0)
Isolated=[Isolated,i];
Patrol_xin=Patrol_distribution;
%进行B类节点的的分配
m=length(Patrol_cover{i});
Distance_linshi=[];
=1)
Distance_linshi(j)=DG(i,Patrol_cover{i}(j));
m0=min(Distance_linshi);
ifDG(i,k)==m0
f=k;
end
Patrol_xin{f}=[Patrol_xin{f},i];
m=length(Isolated);
%对孤立点进行分配
dist(j)=DG(Isolated(i),j);
[m0,m1]=min(dist);
Patrol_xin{m1}=[Patrol_xin{m1},Isolated(i)];
savePatrol_xin.mat;
问题一
(2):
求解围堵13条要道的方案
程序1:
!
求围堵的方案与最快时间
sets:
AA/1..20/;
cross/1..13/;
links(AA,cross):
dis,x;
Endsets
!
数据的定义部分;
data:
dis=
22236.15
16028.47
9286.812
19293.44
21096.21
22501.75
22893.2
19001.16
19515.81
12083.44
5880.935
11850.11
4885.217
20463.92
14129.72
7388.063
17394.69
19197.47
20603
21120.97
17228.93
17743.58
10311.21
3982.186
10309.54
6035.068
18352.27
12767.23
6025.566
16032.19
17834.97
19240.51
19009.32
15117.28
15631.92
8199.56
6093.84
8197.884
4393.385
21997.38
15008.51
8266.853
18273.48
20076.26
21481.79
22654.43
16226.91
15535.34
8102.976
4860.976
7395.869
350
17628.19
12969.63
6227.967
16234.59
17749.52
19155.06
18285.24
11306.87
10615.29
3182.933
9421.119
2475.826
5255.075
17658.78
13000.21
6258.552
16265.18
17780.11
19185.65
18315.83
11337.45
10645.88
3213.518
9451.704
2506.411
5337.332
14914.94
10901.22
4159.559
14166.19
15036.27
16441.81
15571.99
8570.218
8015.457
583.0952
7352.711
1290.202
7991.722
14092.51
9433.943
2692.282
12698.91
14213.84
15619.38
14749.56
10228.03
10493.18
3060.82
5885.434
3099.467
8677.283
13010.71
8274.202
1532.54
11539.17
13132.05
14537.59
13667.76
9775.722
10724.41
3492.304
4725.692
4199.41
9336.668
7586.585
12775.66
6956.67
9510.693
7707.918
9113.456
8243.635
14194.86
15143.55
7911.446
10149.82
8618.553
14760.8
3791.353
8337.298
11395.03
5072.332
3269.557
4675.095
3805.274
18633.23
19581.91
12349.81
14588.18
13056.91
19199.16
11950.28
14543.26
8685.316
6882.541
6477.002
3591.63
21781.45
22730.13
15498.03
17736.41
16205.14
22347.38
5977.002
5973.28
12714.94
2708.314
905.5385
500
2385.372
22808.32
23757
16524.9
16120.82
17232.01
21331.79
6741.662
3264.966
5067.741
6473.28
8358.652
18049.92
18916.68
11484.32
10147.54
12191.42
15358.51
17029.61
13298.08
6556.421
16563.05
17150.94
18556.48
17686.66
4751.842
5700.525
4401.472
9749.573
5108.579
11810.1
10006.63
11809.4
13214.94
15100.31
11308.26
12175.02
4742.655
3405.877
5449.761
8616.853
21892.11
14903.24
8161.58
18168.21
19970.98
21376.52
22549.16
18657.12
19523.87
12091.51
4755.703
12798.62
7820.525
24247.18
18514.48
11772.82
21779.45
23582.23
24987.76
24904.23
21012.19
21526.83
14094.47
8366.946
13699.26
6734.362
22546.53
16961.48
10219.82
20226.45
22029.23
23434.76
23203.58
19311.53
19826.18
12393.82
7639.281
11998.61
5033.709
26945.8
21213.11
14471.45
24478.08
26280.85
27686.39
27602.86
23010.82
22319.25
14886.89
11065.57
14179.78
6448.88
enddata
目标函数;
min=@max(links(i,j):
x(i,j)*dis(i,j));
需求约束;
@for(cross(j):
@sum(AA(i):
x(i,j))=1);
@for(AA(i):
@sum(cross(j):
x(i,j))<
=1);
整数约束;
@for(links(i,j):
@bin(x(i,j)));
程序2:
fuctionzudj1.2
A=zeros(20,13);
A(i,1)=DG(i,12);
A(i,2)=DG(i,14);
A(i,3)=DG(i,16);
A(i,4)=DG(i,21);
A(i,5)=DG(i,22);
A(i,6)=DG(i,23);
A(i,7)=DG(i,24);
A(i,8)=DG(i,28);
A(i,9)=DG(i,29);
A(i,10)=DG(i,30);
A(i,11)=DG(i,38);
A(i,12)=DG(i,48);
A(i,13)=DG(i,62);
问题一(3):
管辖区域的确定:
求解集合覆盖模型并使工作量最均衡
functionjunheng1.2
c=[];
forx=1:
72
c(x)=fenpei(x);
c
functionc=fenpei(x)
loadB.mat;
Patrol_range=cell(24,1);
D_24=B(x,:
%B为可能的分配情况,共有48中,每次从中选取1中可能,本次选取的事第13中可能
24
dist(j)=DG(D_24(i),j);
if(dist(j)<
savePatrol_range;
%求解交集和预分配问题
loadPatrol_range.mat;
%载入数据
c2=[];
c2=[c2,D_24(j)];
Patrol_cover{i}=c2;
savePatrol_distribution.mat;
%完成预分配,对于交集和孤立交点另外考虑
savePatrol_cover.mat;
%保存交集所对应的可能交通巡警点
loadPatrol_cover.mat;
loadPatrol_distribution.mat;
%初始化预分配中每个交通巡警点的发案次数
Occurrence=xlsread('
e2:
e93'
%A区每个交通节点的发案次数
Standard_occurrence=sum(Occurrence)/24
Patrol_occurrence=zeros(24,1);
m=length(Patrol_distribution{i});
a=0;
a=a+Occurrence(Patrol_distribution{i}(j));
Patrol_occurrence(i)=a;
%进行交集分配
A=Sort_vector(Distance_linshi);
%记录最小值的相对位置
h=length(Distance_linshi);
h
linshi_canshu=find(D_24==Patrol_cover{i}(A(j,2)));
Patrol_occurrence(linshi_canshu);
Patrol_cover{i}(A(j,2));
if(Patrol_occurrence(linshi_canshu)<
=(Standard_occurrence+0.62))
Patrol_xin{linshi_canshu}=[Patrol_xin{linshi_canshu},i];
Patrol_occurrence(linshi_canshu)=Patrol_occurrence(linshi_canshu)+Occurrence(i);
break;
if(j==h)
i
Patrol_occurrence
c=var(Patrol_occurrence);
程序3:
functionchuli
a=[1234567891011121314151617181920];
I=[2829];
J=[3839,40];
K=[48,61];
L=[878889909192];
m=0;
2
3
6
m=m+1;
B(m,:
)=[a,[I(i)J(j)K(k)L(l)]];
DD(m,:
)=[I(i)J(j)K(k)L(l)];
saveB;
程序4:
functionA=Sort_vector(X)%创建子函数供调用
a=length(X);
a
[m0,weizhi]=min(X);
A(i,1)=m0;
A(i,2)=weizhi;
X(weizhi)=inf;
End
问题二
(1)计算现有节点工作量,不均衡度和C类节点个数,以判断合理性:
functionMcm2.1
c583'
\数学建模第二期培训\第一题\B\2.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 数学 建模 巡警 服务 平台 设置 调度 程序