感谢阅读本文。我开发了像 AlphaGo Lee 或 AlphaGo Zero 这样的国际象棋 AI。我用过 Python 和 tensorflow。国际象棋AI由Montecarlo-Tree-Search、策略网络和价值网络组成。
我为蒙特卡罗树搜索学习了政策和价值网络。没有问题。但是,蒙特卡罗树搜索中的每个模拟都太慢了。所以我想提高每个模拟速度。
我知道由于 GIL,python 不共享对象。我真的需要为此提供帮助。如果你们有在 python 多处理中共享对象的经验,请分享你的经验。
我在此页面下方发布摘要代码。
ps:我英文不好。因此,如果您在阅读此页面时感到不舒服,那是我的错。请理解。
class monte
#I want to share Tree in multiprocessing
tree = Tree()
def doMontecarloTreeSearch:
while numberOfsimulation:
#I want to boost speed each simulation
# but each search() computing neural network to make new node
# so they spend much time.
search()
def search:
#node is created in each selection and is added in tree
while is_gameover():
selection()
evaluation()
backpropagation()
def selection
#add best value node in Tree
def evaluation
#each node is evaluated for expasion
def backpropagation
# after gameove, leaf node backpropagate gameresult
# and patent nodes are updated util parent node is root node