它是对一类有随机算法特性的归纳. 是一种使用随机方法的统计.html
相似于抽样调查, 虽没法保证最优解, 但也是近似解.python
<蒙特卡罗方法入门>, 这篇文章不错, 经过几个例子让你更加了解此方法的原理.git
全称 Monte Carlo Tree Searchgithub
使用蒙特卡罗方法对树进行搜索, 是一种人工智能问题中作出最优决策的方法.通常用于组合博弈中的行动规划.算法
全称 The Upper Confidence BoundAlgorithmapp
UCB1算法以下, ide
其中 v 是节点估计的值,n 是节点被访问的次数,而 N 则是其父节点已经被访问的总次数。C 是可调整参数。函数
更多细节可参考 <UCB算法> , 文章写得不错学习
全称 Upper Confidence Bounds for Trees测试
是经过UCB算法进行的树搜索
UCT 能够被描述为 MCTS 的一个特例, 即 UCT = MCTS + UCB, 后面介绍MCTS即指UCT算法.
在GitHub下载 mittmcts.
介绍一下, 使用方法,
首先定义Game类, 实现特定函数
class Game(object): @classmethod def initial_state(cls): return state # 返回初始状态 @classmethod # 参数: 传入此类名, 当前的状态, 下一步 # 返回值: 走了step这步后的状态 def apply_move(cls, state, step): return state @staticmethod # 参数: 传入状态信息 # 返回值: (是否不随机选择, 全部可能的下一步棋) def get_moves(state): return False, choices @staticmethod # 返回值: 此情况下的获胜者, 若是平局, 则返回mittmcts.Draw, 若是没有结局, 则返回None def get_winner(state): return state.winner @staticmethod # 返回值: 当前执行者 def current_player(state): return state.current_player
而后, 经过MCTS获得计算结果
from mittmcts import MCTS def main(): result = (MCTS(Game) .get_simulation_result(1000)) # 测试1000次, 获得结果 move = result.move # 下一步
转自: http://www.gcsjj.cn/articles/2019/04/20/1555740616718.html