-
大小: 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
评论
共有 条评论