MATLAB的强化学习工具箱(Reinforcement Learning Toolbox)使用细节注意

普遍问题

step function和reset function执行顺序

  • ResetFunc (-1 Episode)
  • StepFunc (0 step)
  • ResetFunc (0 Episode)
  • ResetFunc (1 Episode)
  • StepFunc (1 step)

Discrete Action Space

当actions组合较少时,可以不用预分配cell空间,可以动态添加cell的数量或cell里的元素;
当actions的组合较多时,以递增方式动态增加cell的数量或元胞中元素的数量会导致 Out of Memory,需要预分配空间;
当actions的组合非常多时,预分配cell空间也会导致Out of Memory。
相关问题1: link.
相关问题2: link.
关于离散action设置: link.

关于并行训练(Parallel training with several workers)和RNN(LSTM)

两者不可以同时使用,因为RNN有状态。
下图是A3C使用LSTM的错误提示。
在这里插入图片描述

不同agent各自的问题

SAC

1.actor不可以useGPU

Caused by:
Error using rl.representation.rlAbstractRepresentation/gradient (line 183)
Unable to compute gradient from representation.
Error using nnet.internal.cnn.layer.util.CustomLayerVerifier>iThrow (line 686)
Incorrect type of ‘dLdX’ for ‘backward’ in Layer ‘rl.layer.ScalingLayer’. Expected to be
‘gpuArray’, but instead was ‘single’.

PPO

  1. Continuous Action Space:

UpperLimit和LowerLimit无法限制action范围(不同于DDPG)(可能会很大导致NaN)。将标准差standard deviation path的最后三层网络设置成如下,可以极大限制action范围。

tanhLayer(‘Name’,‘svp_tanh1’)
fullyConnectedLayer(numActions,‘Name’,‘svp_fc2’)
softplusLayer(‘Name’, ‘svp_out’)

  1. 关于继续训练之前训练的agent
    因为rlPPOAgentOptions没有’ExperienceBufferLength’和’SaveExperienceBufferWithAgent’这两个选项,所以不用考虑这两项。参考代码:

agentOpts.ResetExperienceBufferBeforeTraining =true;
load(PRE_TRAINED_MODEL_FILE,‘saved_agent’);
agent = saved_agent;
trainingStats = train(agent,env,trainOpts);

  1. NormalizedAdvantageMethode参数选择moving
    报错,错误提示如下图:
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

Discrete Action Space

AC(A2C/A3C)

For continuous action spaces, the rlACAgent object does not enforce the constraints set by the action specification, so you must enforce action space constraints within the environment.
AC的action space也需要在环境中限制。
(to be continued)

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值