代码调试记录
论文名称:《Combining Reinforcement Learning with Model Predictive Control for On-Ramp Merging》
代码链接: https://github.com/jlubars/RL-MPC-LaneMerging
1 traci连接不上
解决方法:
改traci连接的port号,在sumo.py的line 52,将traci.start(sumo_cmd) 改为 traci.start(sumo_cmd,port=8813),
因为在Sumo\tools\traci\main.py中,
def init(port=8813, numRetries=tc.DEFAULT_NUM_RETRIES, host="localhost", label="default", proc=None, doSwitch=True):
定义了port为8813.
2 系统找不到指定的路径:‘runs/ddpg_default1_extended’
当运行
(RL-MPC-LaneMerging) H:\RL-MPC-LaneMerging>python main.py configs/combined_default_1.json
报错
FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'runs/ddpg_default1_extended'
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).
目前这个问题还没有解决,在GitHub的issue上也有人遇到了同样的问题,目前作者尚未回复。
解决办法:
运行别的.json,我这里运行的是train_default_1.json,可以正常训练。
3 OSError: [WinError 123] 文件名、目录名或卷标语法不正确。: ‘runs\_ddpg 7ee8b83 2021-10-26 15:47:46 109368’
解决方法:
因为我是使用的win10 ,作者应该是macos或者linux,这个是win下面比较常见的问题了,在writer.py里面,把命名方式里面的冒号:和小横杠-改成别的就可以了
current_time = datetime.now().strftime('%Y_%m_%d %H_%M_%S %f')
然后就可以训练了,具体的训练效果和后面的问题还没出现,出现了再来补充。