int_mdp.m

来自「approximate reinforcement learning」· M 代码 · 共 22 行

M
22
字号
function [xplus, rplus] = int_mdp(m, x, u)
% Implements the discrete-time dynamics of a simple integrator with
% bounded position, controlled in velocity.
%  [XPLUS, RPLUS] = DOUBLEINT_MDP(M, X, U)
%
% This function conforms to the specifications established by SAMPLE_MDP.

% 
% limit torque
u = max(-m.phys.maxu, min(m.phys.maxu, u));

% Compute and bound the next state
xplus = x + m.phys.K * u;
xplus = max(-m.phys.maxx, min(m.phys.maxx, xplus));

% Reward - QR
rplus = -x * m.goal.Q * x - u * m.goal.R * u + ...
    m.goal.zeroreward * (abs(x) <= m.goal.zeroband);


% END FUNCTION int_mpd() RETURNING xplus, rplus ==================================================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?