文章目录
- 一、部分题目
- 二、部分论文
- 三、部分源代码
- 问题1
- 问题3
- 四、完整word版论文和源代码
一、部分题目
2015高教社杯全国大学生数学建模竞赛题目
B题 “互联网+”时代的出租车资源配置
出租车是市民出行的重要交通工具之一,“打车难”是人们关注的一个社会热点问题。随着“互联网+”时代的到来,有多家公司依托移动互联网建立了打车软件服务平台,实现了乘客与出租车司机之间的信息互通,同时推出了多种出租车的补贴方案。
请你们搜集相关数据,建立数学模型研究如下问题:
问题1 试建立合理的指标,并分析不同时空出租车资源的“供求匹配”程度。
问题2 分析各公司的出租车补贴方案是否对“缓解打车难”有帮助?
问题3 如果要创建一个新的打车软件服务平台,你们将设计什么样的补贴方案,并论证其合理性。
二、部分论文
三、部分源代码
问题1
完整代码 https://github.com/yan-fanyu/CUMCM-Paper-And-SourceCode
sheng=shaperead('counties_china.shp', 'UseGeoCoords', true); chengdu=sheng(2333:2345);
boundall=[]; name=cell(13,1);
for i=1:length(chengdu) boundall=[boundall;chengdu(i).BoundingBox]; name{i}=chengdu(i).LAST_NAME9;
end
name{1}='成都';
name{2}='金堂';
name{3}='双流';
name{4}='温江';
name{6}='新都';
name{7}='大邑';
name{8}='浦江';
name{9}='新津';
name{10}='都江堰';
name{11}='彭州';
name{12}='邛崃';
name{13}=' 崇 州 '; minlon=min(boundall(:,1));%min(chengdu.Lon); maxlon=max(boundall(:,1));%max(chengdu.Lon); minlat=min(boundall(:,2));%min(chengdu.Lat); maxlat=max(boundall(:,2));%max(chengdu.Lat); dataall=[];
for i=1:24
data=dlmread(['cityID510100realDate20150909_',num2str(i),'_t.txt']);
end
tlen=length(data); nump=tlen/3; datat=zeros(nump,3); datat(:,1)=data(1:3:tlen);
datat(:,2)=data(2:3:tlen);
datat(:,3)=data(3:3:tlen);
cancel=datat(:,1)>maxlon | datat(:,1)<minlon | datat(:,2)>maxlat | datat(:,2)<minlat; datat(cancel,:)=[];
dataall(i).taxi=datat; data=dlmread(['cityID510100realDate20150909_',num2str(i),'_p.txt']); tlen=length(data);
nump=tlen/3; datap=zeros(nump,3); datap(:,1)=data(1:3:tlen);
datap(:,2)=data(2:3:tlen);
datap(:,3)=data(3:3:tlen);
cancel=datap(:,1)>maxlon | datap(:,1)<minlon | datap(:,2)>maxlat | datap(:,2)<minlat; datap(cancel,:)=[];
dataall(i).passenger=datap;
%plot fignum=[]; eachfignum=1; for i=1:24
datat=dataall(i).taxi; datap=dataall(i).passenger; if mod(i-1,eachfignum)==0
k=ceil(i/eachfignum); hfig=figure(k);
fignum=[fignum,hfig]; if eachfignum==1
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,10,8]);
end
else
end
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,21,29]);
if eachfignum>1
subplot(ceil(eachfignum/2),2,mod(i,eachfignum)*(mod(i,eachfignum)~=0)+eachfignum*(mo d(i,eachfignum)==0))
end geoshow(chengdu);
title([num2str(i),'点;黄-成都;绿-出租;红-乘客'])
hold on scatter(datat(:,1),datat(:,2),datat(:,3),'filled','o','g')
scatter(datap(:,1),datap(:,2),datap(:,3),'filled','s','r') title([num2str(i),'点;成都;绿-出租;红-乘客']) xlabel('经度')
ylabel('纬度')
for kk=1:length(chengdu)
text(mean(chengdu(kk).BoundingBox(:,1)),mean(chengdu(kk).BoundingBox(:,2)),name(kk)); end
hold off
if mod(i-1,eachfignum)==0 figname=strcat('chengdu_part',num2str(k),'.jpg');
end
end
saveas(hfig, figname, 'jpg');
savefig(fignum,'chengdu.fig') close all figs=openfig('chengdu.fig'); for k=1:length(fignum)
figname=strcat('chengdu_part',num2str(k),'.jpg'); saveas(figs(k), figname, 'jpg');
end close all
%mean plot meanall=[]; for i=1:24
meanall=[meanall;[mean(dataall(i).taxi(:,3)),mean(dataall(i).passenger(:,3))]];
end h=1:24;
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,16,10]); [hAx,hLine1,hLine2]=plotyy(h,meanall(:,1),h,meanall(:,2)); ylabel(hAx(1),'出租车均值')
ylabel(hAx(2),'乘客均值')
set(hLine1,'LineStyle','--','Marker','*','MarkerSize',6,'LineWidth',1.5)
set(hLine2,'LineStyle',':','Marker','o','MarkerSize',6,'LineWidth',1.5) xtlabel=num2cell(h);%cat(2,num2cell(h(1:4:end-2)),method); set(hAx,'XTick',h,'XTickLabel',xtlabel,'xlim',[1,24])
grid on xlabel('时间')
leglabel={'出租车均值','乘客需求均值'};
legend(leglabel,'Location','Best')
title('成都市 2015 年 9 月 9 日全天出租车分布和乘客需求均值图') figname=strcat('chengdu_mean','.jpg');
saveas(gcf, figname, 'jpg');
%matching C0=[0.1:0.1:0.9,1:50];
lc0=length(C0); match=[]; matchall=[]; matchpoint=[]; for i=1:24
p0=dataall(i).passenger; lp0=size(p0,1); t0=dataall(i).taxi; r=size(t0,1); disp=zeros(lp0,lc0);
for j=1:lp0
p00=ones(r,1)*p0(j,1:2); d=dis(p00(:,1),p00(:,2),t0(:,1),t0(:,2));
for k=1:lc0
ts=sum(t0(d<=C0(k),3)); if ts<p0(j,3)
disp(j,k)=1; elseif ts>p0(j,3)
disp(j,k)=-1;
end
end
else
end
disp(j,k)=0;
end
idx=ones(lp0,1)*(1:lc0); idx(disp>0)=inf; idxsel=min(idx,[],2); idxsel(isinf(idxsel))=C0(end); match(i).loc=p0(:,1:2); match(i).matchp=disp; match(i).matchpstats=idxsel;
matchall=[matchall;[i*ones(lp0,1),p0(:,1:2),disp,idxsel]]; matchpoint=[matchpoint,lp0];
mathpointcum=cumsum(matchpoint); newtime=zeros(size(matchall,1),1); newtime(ismember(matchall(:,1),[8,9]))=1;
newtime(ismember(matchall(:,1),[18,19]))=2;
newtime(ismember(matchall(:,1),[7,10:17]))=3; newtime(ismember(matchall(:,1),20:22))=4; newtime(ismember(matchall(:,1),[1:6,23:24]))=5;
%plot fignum=[]; eachfignum=1; for i=1:24
loc=match(i).loc; measure=match(i).matchpstats; if mod(i-1,eachfignum)==0
k=ceil(i/eachfignum); hfig=figure(k);%figure(i);%figure(ceil(i/6));% fignum=[fignum,hfig];
if eachfignum==1 set(gcf,'PaperType','A4', ...
'paperOrientation', 'portrait', ...
end
else
end
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,10,8]);
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,21,29]);
if eachfignum>1
subplot(ceil(eachfignum/2),2,mod(i,eachfignum)*(mod(i,eachfignum)~=0)+eachfignum*(mo d(i,eachfignum)==0))
end
geoshow(chengdu); % 此处用 mapshow 投影会不正确
hold on scatter(loc(:,1),loc(:,2),measure,'filled','s','b') title([num2str(i),'点;成都;蓝-打车难易程度;']) xlabel('经度')
ylabel('纬度')
for kk=1:length(chengdu)
text(mean(chengdu(kk).BoundingBox(:,1)),mean(chengdu(kk).BoundingBox(:,2)),name(kk)); end
hold off
if mod(i-1,eachfignum)==0 figname=strcat('chengdupipei_part',num2str(k),'.jpg'); saveas(hfig, figname, 'jpg');
end
end
savefig(fignum,'chengdupipei.fig') close all figs=openfig('chengdupipei.fig');
for k=1:length(fignum) figname=strcat('chengdupipei_part',num2str(k),'.jpg'); saveas(figs(k), figname, 'jpg');
end close all
%%%所有时点乘客打车难易度散点set(gcf,'PaperType','A4', ...
'paperOrientation', 'portrait', ... 'paperunits','CENTIMETERS','PaperPosition',[.00, .00,16,14]);
plot(matchall(:,end),'*') xlabel('乘客数据点') ylabel('邻域半径(km)')
title('所有时点乘客打车难易度')
set(gca,'YTick',1:5:lc0) xtlabel=cat(2,num2cell(C0(1:5:lc0))); set(gca,'YTickLabel',xtlabel)
axis tight grid on
figname=strcat('chengdupipei_scatter','.jpg'); saveas(gcf, figname, 'jpg');
%%%所有时点乘客打车难易度分布
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,16,14]); geoshow(chengdu);
hold on scatter(matchall(:,1),matchall(:,2),matchall(:,end),'filled','s','b') title('所有时点;成都;蓝-打车难易程度;')
xlabel('经度')
ylabel('纬度')
for kk=1:length(chengdu)
text(mean(chengdu(kk).BoundingBox(:,1)),mean(chengdu(kk).BoundingBox(:,2)),name(kk)); end
hold off figname=strcat('chengdupipei_all','.jpg'); saveas(gcf, figname, 'jpg');
问题3
完整代码 https://github.com/yan-fanyu/CUMCM-Paper-And-SourceCode
%问题(3)方案 1 time=8;
op=dataall(time).passenger;%选择 8 点的乘客数据
lp0=size(op,1); ebt=10;%每天补贴 1 元
lbt=30;%补贴 30 天
bt=ebt*ones(1,lbt); cbt=cumsum(bt);%累计补贴b0=1.645;
baifenbi=@(butie)exp(b0-11.532./butie);%S curve cper=baifenbi(cbt)/100;%预测订单数t0=dataall(time-1).taxi;
r=size(t0,1); matchn=[];
matchna=match(time).matchpstats;%8 点的难易度
for i=1:lbt
p0=op;
p0(:,3)=p0(:,3).*(1-cper(i));
disp=zeros(lp0,lc0); for j=1:lp0
p00=ones(r,1)*p0(j,1:2); d=dis(p00(:,1),p00(:,2),t0(:,1),t0(:,2));
for k=1:lc0
ts=sum(t0(d<=C0(k),3)); if ts<p0(j,3)
disp(j,k)=1; elseif ts>p0(j,3)
disp(j,k)=-1;
end
end
else
end
disp(j,k)=0;
end
idx=ones(lp0,1)*(1:lc0); idx(disp>0)=inf; idxsel=min(idx,[],2); idxsel(isinf(idxsel))=C0(end); matchn(i).loc=p0(:,1:2); matchn(i).matchp=disp; matchn(i).matchpstats=idxsel; matchna=[matchna,idxsel];
%问题(3)方案 2 time=8;
op=dataall(time).passenger;%选择 8 点的乘客数据[count,center]=hist(op(:,3)); count=count./sum(count);
set(gcf,'PaperType','A4', ... 'paperOrientation', 'portrait', ...
'paperunits','CENTIMETERS','PaperPosition',[.00, .00,10,8]); hist(op(:,3))
ylabel('频数')
xlabel('乘客需求')
title('成都市 8 点乘客需求条图') figname=strcat('chengdu8bar','.jpg'); saveas(gcf, figname, 'jpg');
%密集点datat=dataall(8).taxi; datap=dataall(8).passenger; set(gcf,'PaperType','A4', ...
'paperOrientation', 'portrait', ... 'paperunits','CENTIMETERS','PaperPosition',[.00, .00,10,8]);
geoshow(chengdu); % 此处用 mapshow 投影会不正确
title('8 点成都乘客打车需求最大区') hold on
scatter(datat(:,1),datat(:,2),datat(:,3),'filled','o','g') [~,idx]=max(datap(:,3)); scatter(datap(idx,1),datap(idx,2),datap(idx,3),'filled','s','r') legend('出租车','乘客','Location','Best')
xlabel('经度')
ylabel('纬度')
for kk=1:length(chengdu)
text(mean(chengdu(kk).BoundingBox(:,1)),mean(chengdu(kk).BoundingBox(:,2)),name(kk)); end
hold off figname=strcat('chengdu8miji','.jpg'); saveas(gcf, figname, 'jpg');
% 方 案 2 datat=dataall(8).taxi; datap=dataall(8).passenger; sumt=sum(datat(:,3)); datat(:,3)=datat(:,3)*0.99;
datat(end+1,1:2)=datap(idx,1:2); datat(end,3)=sumt-sum(datat(:,3)); p0=datap;
t0=datat; r=size(t0,1); disp=zeros(lp0,lc0); matchn=[];
matchna=match(time).matchpstats;%8 点的难易度
for j=1:lp0
p00=ones(r,1)*p0(j,1:2); d=dis(p00(:,1),p00(:,2),t0(:,1),t0(:,2));
for k=1:lc0
ts=sum(t0(d<=C0(k),3)); if ts<p0(j,3)
disp(j,k)=1; elseif ts>p0(j,3)
disp(j,k)=-1;
end
end
else
end
disp(j,k)=0;
idxs=ones(lp0,1)*(1:lc0); idxs(disp>0)=inf;
idxsel=min(idxs,[],2); idxsel(isinf(idxsel))=C0(end); matchn.loc=p0(:,1:2); matchn.matchp=disp; matchn.matchpstats=idxsel; matchna=[matchna,idxsel]; set(gcf,'PaperType','A4', ...
'paperOrientation', 'portrait', ... 'paperunits','CENTIMETERS','PaperPosition',[.00, .00,12,8]);
plot(1:40,matchna(1:40,1),'ro',1:40,matchna(1:40,2),'b+') title('方案 2 的应用前后对比')
xlabel('数据点')
ylabel('难易度') grid on
figname=strcat('chengdu8mijiduibi','.jpg'); saveas(