资源简介
Q 学习方面的MATLAB程序,对于研究强化学习和自适应动态规划的朋友很有参考价值
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Q learning of single agent move in N rooms
% Matlab Code companion of
% Q Learning by Example
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function q=ReinforcementLearning
clc;
format short
format compact
% Two input: R and gamma
% immediate reward matrix;
% row and column = states; -Inf = no door between room
R=[-inf-inf-inf-inf 0 -inf;
-inf-inf-inf 0-inf 100;
-inf-inf-inf 0-inf -inf;
-inf 0 0-inf 0 -inf;
0-inf-inf 0-inf 100;
-inf 0-inf-inf 0 100];
gamma=0.80; % learning parameter
q=zeros(size(R)); % initialize Q as zeroq的行数和列数等于矩阵R的。
q1=ones(size(R))*inf; % initialize previo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3150 2014-03-24 18:47 Q-Learning.m
评论
共有 条评论