1 简介
基于遗传算法的共享汽车定价规划模型的多目标优化方法,包括以下步骤:步骤一:首先获取路网各路径共享汽车车流的历史数据,路径行驶速度与驾驶时长;通过大数据方法对各路径各时间段共享电动汽车流量进行日前预测与地图映射,然后建立多目标模型;步骤二:构建约束条件,并通过遗传算法对多目标模型进行求解并找到非支配解解集,利用折衷解方法,在所有非支配解中寻找最优的方案;本发明为共享系统节约了运营成本,增加系统收益,同时提高了用户对于共享服务使用的满意度并且降低了共享电动汽车充电行为对于电网稳定性的负面影响.
2 部分代码
warning off;
clear all;
clc;
%% specify information for the objectives
kk=6;
nn=2*combntns(kk,2);
userObj.NOBJ = 1; %% the number of objective functions
userObj.popSize = 500; %% the number of popSize
userObj.dimension = 4*nn; %% the number of state variables
userObj.bounds = zeros(2, userObj.dimension); %% boundaries for individuals
for i=1:4*nn
userObj.bounds(1, i) = 0.28;
userObj.bounds(2, i) = 0.42;
end
%
% for i=49:287
% userObj.bounds(1, i) = 0;
% userObj.bounds(2, i) = 20;
% end
%
userObj.types = zeros(1, userObj.dimension) + 0; %% specify the data types of the problem; %% 0 for continous; 1 for binary; 2 for integers
userObj.MAXGEN =500; %% Maximum generation %% users can adjust this value according to your specific problem
userObj.MAXFUNEVALS = 2000*userObj.dimension*userObj.NOBJ; %% Function evaluations bound %% partly decide when is ready to break %% users can adjust the "2000" to other values according to your specific problem
userObj.CounterGEN = 0;
userObj.CounterFES = 0;
%% set the control parameters of NAA;
% parameters to balacne the sub-populations
controlParam.shelterNum =4;
avg = userObj.popSize/controlParam.shelterNum;
controlParam.shelterCap = floor(avg);
%parameters to control the local search behavior
controlParam.scale_local = 1;
controlParam.Cr_local =0.9;
%parameters to control the global search behavior
controlParam.alpha = 1.2;
controlParam.Cr_global = 0.1;
%% specify whether to use the 'bounce back' strategy: 0-not use; 1-use;
controlParam.bounceBack = 1;
%specify the file name of the fitness evaluation fuction;
fitnessFuncName = 'MO_fitness_test';
adjustIndFuncName = 'MO_adjustInd_test';
%% ------------------------------Run NAA-------------------------------------
OUT = MO_NAA(adjustIndFuncName, fitnessFuncName, userObj, controlParam);
%% output the X and Y of the last generation
bestInd = OUT.PSet
bestFitness = OUT.PFront
generation = OUT.CounterGEN
bestdemand=OUT.UserObj
PAL_1=bestdemand.P_kj./0.3;
PAL_2=bestdemand.P_kjt./0.3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2)
x = 1:nn;
y1 = bestdemand.D0_kj(1,:);
y1=reshape(y1,nn,1);
y2 = round(bestdemand.D_kj(1,:));
y2=reshape(y2,nn,1);
y3 = PAL_2(1,:);
y=[y1,y2];
[hAxes,hBar,hLine]=plotyy(x,y,x,y3,'bar','plot');
title('time vs demand chage at 5pm')
xlabel('Path number')
ylabel(hAxes(1),'number of shared cars')
ylabel(hAxes(2),'Price')
legend('D0_kj','D_kj','PAL_2');
%%%%%%%%%%%%%%%%%%%%%%
figure(3)
x = 1:nn;
y1 = bestdemand.D0_kj(2,:);
y1=reshape(y1,nn,1);
y2 = round(bestdemand.D_kj(2,:));
y2=reshape(y2,nn,1);
y3 = PAL_2(2,:);
y=[y1,y2];
[hAxes,hBar,hLine]=plotyy(x,y,x,y3,'bar','plot');
title('time vs demand chage at 6pm')
xlabel('Path number')
ylabel(hAxes(1),'number of shared cars')
ylabel(hAxes(2),'Price')
legend('D0_kj','D_kj','PAL_2');
%%%
figure(4)
x = 1:nn;
y1 = bestdemand.D0_kj(3,:);
y1=reshape(y1,nn,1);
y2 = round(bestdemand.D_kj(3,:));
y2=reshape(y2,nn,1);
y3 = PAL_2(3,:);
y=[y1,y2];
[hAxes,hBar,hLine]=plotyy(x,y,x,y3,'bar','plot');
title('time vs demand chage at 7pm')
xlabel('Path number')
ylabel(hAxes(1),'number of shared cars')
ylabel(hAxes(2),'Price')
legend('D0_kj','D_kj','PAL_2');
%%%%%%%%%%%%%%%
figure(5)
x = 1:nn;
y1 = bestdemand.D_kj(1,:);
y1=reshape(y1,nn,1);
y2 = round(bestdemand.D_kj(2,:));
y2=reshape(y2,nn,1);
y3 = round(bestdemand.D_kj(3,:));
y3=reshape(y3,nn,1);
y4 = PAL_1(1,:);
y=[y1,y2,y3];
[hAxes,hBar,hLine]=plotyy(x,y,x,y4,'bar','plot');
title('Time vs Demand after price varied')
xlabel('Path number')
ylabel(hAxes(1),'number of shared cars')
ylabel(hAxes(2),'Price')
legend('D_kj at 5pm','D_kj at 6pm','D_kj at 7pm','PAL_1');
set(hAxes,'Xlim',[1,nn])
%%%%%%%%%%%%%%%
figure(6)
P_0(1:nn)=1;
x = 1:nn;
y1 = bestdemand.D0_kj(1,:);
y1=reshape(y1,nn,1);
y2 = round(bestdemand.D0_kj(2,:));
y2=reshape(y2,nn,1);
y3 = round(bestdemand.D0_kj(3,:));
y3=reshape(y3,nn,1);
y4 = P_0(1,:);
y=[y1,y2,y3];
[hAxes,hBar,hLine]=plotyy(x,y,x,y4,'bar','plot');
title('Time vs Demand before price varied')
xlabel('Path number')
ylabel(hAxes(1),'number of shared cars')
ylabel(hAxes(2),'Price')
legend('D_kj at 5pm','D_kj at 6pm','D_kj at 7pm','PAL_1');
set(hAxes,'Xlim',[1,nn])
3 仿真结果
4 参考文献
[1]王澍. "基于遗传算法的共享汽车定价规划模型的多目标优化方法.", CN112507506A.
部分理论引用网络文献,若有侵权联系博主删除。