-
大小: 3KB文件類型: .rar金幣: 1下載: 0 次發布日期: 2021-01-02
- 語言: Python
- 標簽: 強化學習??Q-learning??
資源簡介
python實現強化學習Q-learning走迷宮例子,包含3個文件.詳細描述可見:https://blog.csdn.net/Eric_Fisher/article/details/90664819
代碼片段和文件信息
“““
Reinforcement?learning?maze?example.
Red?rectangle:??????????explorer.
Black?rectangles:???????hells???????[reward?=?-1].
Yellow?bin?circle:??????paradise????[reward?=?+1].
All?other?states:???????ground??????[reward?=?0].
This?script?is?the?environment?part?of?this?example.?The?RL?is?in?RL_brain.py.
View?more?on?my?tutorial?page:?https://morvanzhou.github.io/tutorials/
“““
import?numpy?as?np
import?time
import?sys
if?sys.version_info.major?==?2:
????import?Tkinter?as?tk
else:
????import?tkinter?as?tk
UNIT?=?40???#?pixels
MAZE_H?=?4??#?grid?height
MAZE_W?=?4??#?grid?width
class?Maze(tk.Tk?object):
????def?__init__(self):
????????super(Maze?self).__init__()
????????self.action_space?=?[‘u‘?‘d‘?‘l‘?‘r‘]
????????self.n_actions?=?len(self.action_space)
????????self.title(‘maz
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4307??2019-05-23?19:04??maze_env.py
?????文件???????1859??2019-05-23?19:07??RL_brain.py
?????文件???????1453??2019-05-23?20:10??run_this.py
-----------?---------??----------?-----??----
?????????????????7619????????????????????3
評論
共有 條評論