最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

基于強化學習實現(xiàn)智能泊車附matlab代碼

2023-02-07 21:56 作者:Matlab工程師  | 我要投稿

?作者簡介:熱愛科研的Matlab仿真開發(fā)者,修心和技術(shù)同步精進,matlab項目合作可私信。

??個人主頁:Matlab科研工作室

??個人信條:格物致知。

更多Matlab仿真內(nèi)容點擊??

智能優(yōu)化算法??神經(jīng)網(wǎng)絡(luò)預測?雷達通信??無線傳感器

信號處理?圖像處理?路徑規(guī)劃?元胞自動機?無人機??電力系統(tǒng)

? 內(nèi)容介紹

基于強化學習的數(shù)字孿生智慧停車方法,為智慧城市信息物理融合物聯(lián)網(wǎng)構(gòu)建提供了一個智能,易用的系統(tǒng)模型.該智慧停車系統(tǒng)支持對實際場景下多車輛自動泊車過程進行實時控制,并能有效避免碰撞,降低人工停車時間成本,減少人為操作失誤安全事故的發(fā)生.

? 部分代碼

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');


? 運行結(jié)果

編輯

編輯

編輯

? 參考文獻

[1]肖蓬勃. 基于MATLAB中高檔轎車智能泊車系統(tǒng)開發(fā)及應(yīng)用研究[D]. 桂林電子科技大學.

[2]陳慧, 宋紹禹, 孫宏偉,等. 一種基于模型強化學習的智能泊車方法:.?

? Matlab代碼關(guān)注

??部分理論引用網(wǎng)絡(luò)文獻,若有侵權(quán)聯(lián)系博主刪除

?? 關(guān)注我領(lǐng)取海量matlab電子書和數(shù)學建模資料


基于強化學習實現(xiàn)智能泊車附matlab代碼的評論 (共 條)

分享到微博請遵守國家法律
扎囊县| 西安市| 理塘县| 昆山市| 通许县| 荔波县| 梁平县| 成都市| 东莞市| 高青县| 京山县| 临泉县| 大连市| 沙河市| 华宁县| 临颍县| 澄城县| 咸宁市| 图们市| 平陆县| 城固县| 建湖县| 沙坪坝区| 徐闻县| 长寿区| 永年县| 綦江县| 原阳县| 濮阳市| 宜都市| 奉贤区| 班戈县| 星座| 灵宝市| 左贡县| 贡嘎县| 铜鼓县| 光山县| 永兴县| 开化县| 攀枝花市|