基于DQN的游戏策略生成

 2022-05-12 09:05

论文总字数:31595字

摘 要

人工智能的研究目标就是创建一个可以与环境交互并基于观察所处状态做出动作的智能体,该智能体不仅应当具有“认识理解”的功能,还应具有“思考决策”的功能。2013年由DeepMind团队提出的深度强化学习为创建这样的智能体提供了可能性。深度强化学习最经典的算法是DQN,它将Q-learning算法与卷积神经网络相结合,用卷积神经网络来处理高纬度特征,并增加了经验回放以及双网络架构技术来打破数据相关性,避免了不平稳分布。

本文使用Tensorflow框架,基于OpenAI Gym平台,运用DQN算法在经典街机游戏Atari2600中的Breakout-v0游戏环境下实现自动策略生成。在实验中,首先对输入的游戏画面做预处理,得到一个84*84的图像,并将其输入进一个有三层卷积层、一层全连接层的卷积神经网络,获得所有可能动作所对应的Q值。接着使用-greedy算法选择动作,得到Q真实值。同时利用经验回放技术使用历史序列来更新网络。为了使真实Q值不断逼近目标Q值,定义了一个损失函数,并用优化器来不断减小它们之间的差值。

本文最后使用TensorBoard来可视化训练过程中各个参数的变化趋势,并通过对比不同优化器以及不同参数下损失函数值、Q值以及游戏最大得分的不同来分析实验结果,寻找最优策略。

关键词:深度强化学习,DQN,Atari,Tensorflow,游戏策略

Abstract

The research goal of Artificial Intelligence is to create an agent which can make interactions with the environment and make actions based on the observation. This agent should not only have the ability of “knowing and understanding”, but also the ability of “thinking and decision-making”. Deep reinforcement learning(DRL), which is proposed by the DeepMind team in 2013, offers the possibility to create such an agent. The most classic algorithm for DRL is the DQN algorithm, which combines the Q-learning algorithm with the convolutional neural network(CNN). The DQN algorithm uses CNN to handle high latitude features, while adds experience replay and target Q network to break the correlation of data and avoid the uneven distribution.

The experiment of this paper uses DQN algorithm, Tensorflow and OpenAI Gym to achieve an automatic strategy that can play the Breakout-v0 game in Atari2600. The experiment first preprocesses the input picture to get an 84*84 image. And then input the image sequence into a CNN which has three convolution layers and one fully-connected layer to get all the possible action-value functions. Then use the ε-greedy algorithm to select the action and get the true Q-value, while using the experience replay technique to update the network. Then the DQN algorithm defines a loss function and chooses an optimizer to reduce the difference between the true Q-value and the target Q-value.

At the end of this paper, TensorBoard is used to visualize the trend of each parameter during the training process. To find the best strategy that playing the Breakout-v0 game, the experiment analyzes the difference of the loss-value, Q-value and reward by changing the optimizers and parameters.

KEY WORDS: Deep reinforcement learning, DQN, Atari, Tensorflow, Game strategy.

目录

摘 要 I

Abstract II

第一章 绪论 1

1.1 研究背景与意义 1

1.2 研究发展与趋势 2

1.1.1 深度学习发展 2

1.1.2 强化学习发展 2

1.1.3 深度强化学习发展 2

1.3 主要研究目标与内容 3

1.4 论文的结构安排 3

第二章 相关知识介绍 5

2.1 深度学习 5

2.1.1 深度学习背景 5

2.1.2 人工神经网络 5

2.1.3 卷积神经网络 8

2.2 强化学习 9

2.2.1强化学习原理 9

2.2.2马尔科夫决策过程 10

2.2.3值迭代与策略迭代 11

2.2.4 Q-learning 11

2.3 DQN 12

2.4 实验工具和平台 14

2.4.1 OpenAI Gym平台 14

2.4.2 Tensorflow 15

2.5 本章小结 15

第三章 基于DQN的游戏策略生成 16

3.1 游戏介绍 16

3.2 环境预处理 16

3.3 网络结构设计 17

3.4 算法实现 17

3.5 参数设置 18

3.6 本章小结 19

第四章 训练效果评估 20

4.1 实验环境 20

4.2训练结果展示 20

4.3 训练过程图示分析 23

4.4实验结果分析 25

4.4 本章小结 31

第五章 总结与展望 32

5.1 工作总结 32

5.2 未来工作展望 32

参考文献 34

致 谢 36

绪论

1.1 研究背景与意义

机器学习是人工智能研究的核心问题之一。它被分成监督学习、无监督学习与强化学习(Reinforcement Learning,RL)三类。其中,强化学习是机器学习与心理学交叉的产物[1],是一种最接近人类学习方式的算法。它以“试错”的方式与周围环境进行交互,并获取来自周围环境的反馈,根据反馈信号的好坏来不断调整模型。传统的强化学习,如Q-learning算法就是利用一张Q值表存储每次迭代的状态。但在处理高维度数据,例如图像、语音时,这张Q值表就会变得非常巨大。于是科学家们将目光投向了在图像处理、计算机视觉、语音识别等领域具有卓越表现的深度学习(Deep Learning,DL),使用神经网络来代替Q值表能够很好地处理高维度特征。

深度学习具有高感知能力,强化学习则拥有高决策能力,将二者的优势结合起来,便形成了深度强化学习(Deep Reinforcement Learning,DRL)。DRL为复杂环境下的感知决策问题提供解决方案,对推动人工智能领域的发展具有极为深刻的意义。

剩余内容已隐藏,请支付后下载全文,论文总字数:31595字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;