概述
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
????个人主页:Matlab科研工作室
????个人信条:格物致知。
更多Matlab仿真内容点击????
智能优化算法 神经网络预测 雷达通信 无线传感器
信号处理 图像处理 路径规划 元胞自动机 无人机 电力系统
⛄ 内容介绍
基于强化学习的数字孪生智慧停车方法,为智慧城市信息物理融合物联网构建提供了一个智能,易用的系统模型.该智慧停车系统支持对实际场景下多车辆自动泊车过程进行实时控制,并能有效避免碰撞,降低人工停车时间成本,减少人为操作失误安全事故的发生.
⛄ 部分代码
clear all; close all;
freeSpotIdx = 26;
map = ParkingLot(freeSpotIdx);
egoInitialPose = [20, 15, 0];
egoTargetPose = createTargetPose(map,freeSpotIdx)
autoParkingValetParams
mdl = 'rlAutoParkingValet';
open_system(mdl)
createMPCForParking
numObservations = 16;
observationInfo = rlNumericSpec([numObservations 1]);
observationInfo.Name = 'observations';
steerMax = pi/4;
discreteSteerAngles = -steerMax : deg2rad(1) : steerMax;
actionInfo = rlFiniteSetSpec(num2cell(discreteSteerAngles));
actionInfo.Name = 'actions';
numActions = numel(actionInfo.Elements);
blk = [mdl '/RL Controller/RL Agent'];
env = rlSimulinkEnv(mdl,blk,observationInfo,actionInfo);
env.ResetFcn = @autoParkingValetResetFcn;
rng(0)
criticNetwork = [
featureInputLayer(numObservations,'Normalization','none','Name','observations')
fullyConnectedLayer(128,'Name','fc1')
reluLayer('Name','relu1')
fullyConnectedLayer(128,'Name','fc2')
reluLayer('Name','relu2')
fullyConnectedLayer(128,'Name','fc3')
reluLayer('Name','relu3')
fullyConnectedLayer(1,'Name','fc4')];
criticOptions = rlRepresentationOptions('LearnRate',1e-3,'GradientThreshold',1);
critic = rlValueRepresentation(criticNetwork,observationInfo,...
'Observation',{'observations'},criticOptions);
actorNetwork = [
featureInputLayer(numObservations,'Normalization','none','Name','observations')
fullyConnectedLayer(128,'Name','fc1')
reluLayer('Name','relu1')
fullyConnectedLayer(128,'Name','fc2')
reluLayer('Name','relu2')
fullyConnectedLayer(numActions, 'Name', 'out')
softmaxLayer('Name','actionProb')];
actorOptions = rlRepresentationOptions('LearnRate',2e-4,'GradientThreshold',1);
actor = rlStochasticActorRepresentation(actorNetwork,observationInfo,actionInfo,...
'Observation',{'observations'},actorOptions);
agentOpts = rlPPOAgentOptions(...
'SampleTime',Ts,...
'ExperienceHorizon',512,...
'ClipFactor',0.2,...
'EntropyLossWeight',0.01,...
'MiniBatchSize',64,...
'NumEpoch',3,...
'AdvantageEstimateMethod',"gae",...
'GAEFactor',0.95,...
'DiscountFactor',0.99);
% 'DiscountFactor',0.998);
agent = rlPPOAgent(actor,critic,agentOpts);
trainOpts = rlTrainingOptions(...
'MaxEpisodes',10000,...
'MaxStepsPerEpisode',200,...
'ScoreAveragingWindowLength',200,...
'Plots','training-progress',...
'StopTrainingCriteria','AverageReward',...
'StopTrainingValue',80,...
'UseParallel',true);
doTraining =0;
if doTraining
tic
trainingStats = train(agent,env,trainOpts);
toc
save('7_Self_rlAutoParkingValetAgent.mat');
else
load('6_Self_rlAutoParkingValetAgent.mat','agent');
end
set(gcf,'position',[500 600 1500 1000])
pause(1)
freeSpotIdx = 26; % free spot location
sim(mdl);
% save('Self_rlAutoParkingValetAgent.mat');
% load('Self_rlAutoParkingValetAgent.mat');
⛄ 运行结果
⛄ 参考文献
[1]肖蓬勃. 基于MATLAB中高档轿车智能泊车系统开发及应用研究[D]. 桂林电子科技大学.
[2]陈慧, 宋绍禹, 孙宏伟,等. 一种基于模型强化学习的智能泊车方法:.
⛄ Matlab代码关注
❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料
最后
以上就是柔弱鞋子为你收集整理的【泊车】基于强化学习实现智能泊车附matlab代码的全部内容,希望文章能够帮你解决【泊车】基于强化学习实现智能泊车附matlab代码所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复