facebookresearch / darkforestGo

DarkForest, the Facebook Go engine.
Other
2.1k stars 324 forks source link

Does CNNPlayerMCTSV2.lua run player only with MCTS, not with DCNN? #13

Closed tornadomeet closed 8 years ago

tornadomeet commented 8 years ago

hello, as in the readme :https://github.com/facebookresearch/darkforestGo#code-overview, CNNPlayerMCTSV2.lua is Run player with DCNN + MCTS.
And i dive into the code https://github.com/facebookresearch/darkforestGo/blob/master/cnnPlayerV2/cnnPlayerMCTSV2.lua#L266, and into this funciton, it call https://github.com/facebookresearch/darkforestGo/blob/master/mctsv2/tree_search.c#L1291 to play, but it does't call cnn to calc, so does it mean only with mcts?
thanks~

yuandong-tian commented 8 years ago

No. Check https://github.com/facebookresearch/darkforestGo/blob/master/mctsv2/tree_search.c#L821 for code that accumulating win statistics. In this main thread function, when the thread expands a leaf (expand_leaf), it will call a callback function in https://github.com/facebookresearch/darkforestGo/blob/master/mctsv2/tree_search.c#L602, which is initialized using function dcnn_leaf_expansion (See https://github.com/facebookresearch/darkforestGo/blob/master/mctsv2/tree_search.c#L582).

In dcnn_leaf_expansion (https://github.com/facebookresearch/darkforestGo/blob/2978791f0066e0bda7ee6afdc2b35cd35ed564c0/mctsv2/playout_callbacks.c#L284), the function send_to_cnn is called, which sends the board information to the CNN server.

tornadomeet commented 8 years ago

@yuandong-tian thanks very much!

i was puzzled by how to combine DCNN and MCTS.

in your paper Better Computer Go Player with Neural Network and Long-term Prediction, the description of 3.4(page 7), the DCNN is used in the tree policy(selection), and in the figure 4(b) and the code here, the DCNN is used for expansion. so does it means DCNN has two role in MCTS Algo : selection and expansion , and NC is usde only in the simulation phase ?
the code here has the answer, but i should go through it, so would you explain it a little?