Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-05, 12:44   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 强化学习

我想使用此q学习(增强学习)代码。似乎代码是正确的,但是我遇到了错误,而且不知道为什么:

function q=ReinforcementLearning clc; format short; format compact; int state=0; 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.8; q=zero(size(R)); q1=one(size(R))*inf; count=0; for episode = 0:20000; y=randperm(size(R,1)); state=y(1); x=find(R(state,:)>=0); if size(x,1)>0, x1=RandomPermutation(x); x1=x1(1); end qMax=max(q,[],2); q(state,x1)=R(state,x1)+ gamma* qMax(x1); int state=x1; if sum(sum(abs(q1-q)))0)) if count > 1000; break else count=count+1; end else q1=q; count=0; end end 但是我收到以下警告和错误:

enter code here Warning: The method char/int will be removed in a future relase. Use sym/int instead. For example int(sym('x^2')). > In char.int at 10 In ReinforcementLearning at 6 Error using mupadmex Error in MuPAD command: Invalid integrand. [int] Error in sym/int (line 107) rSym = mupadmex('symobj::intindef',fs,xs,options); Error in char/int (line 12) y = int(sym(f),varargin{:}); Error in ReinforcementLearning (line 6) int state=0; 可以在以下链接中找到此代码: http : //people.revoledu.com/kardi/tutorial/ReinforcementLearning/Q-Learning-Matlab.htm



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 23:51


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.