-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from kobanium/develop
Support MCTS player
- Loading branch information
Showing
15 changed files
with
628 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""ニューラルネットワーク計算用のキュー。 | ||
""" | ||
from typing import List, Tuple | ||
import numpy as np | ||
|
||
|
||
class BatchQueue: | ||
"""ミニバッチデータを保持するキュー。 | ||
""" | ||
def __init__(self): | ||
"""BatchQueueクラスのコンストラクタ。 | ||
""" | ||
self.input_plane = [] | ||
self.path = [] | ||
self.node_index = [] | ||
|
||
def push(self, input_plane: np.array, path: List[Tuple[int, int]], node_index: int): | ||
"""キューにデータをプッシュする。 | ||
Args: | ||
input_plane (np.array): ニューラルネットワークへの入力データ。 | ||
path (List[Tuple[int, int]]): ルートから評価ノードへまでの経路。 | ||
node_index (int): ニューラルネットワークが評価する局面に対応するノードのインデックス。 | ||
""" | ||
self.input_plane.append(input_plane) | ||
self.path.append(path) | ||
self.node_index.append(node_index) | ||
|
||
def clear(self): | ||
"""キューのデータを全て削除する。 | ||
""" | ||
self.input_plane = [] | ||
self.path = [] | ||
self.node_index = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""探索用のパラメータ設定 | ||
""" | ||
|
||
# 未展開の子ノードのインデックス | ||
NOT_EXPANDED = -1 | ||
|
||
# PUCBの第2項の重みパラメータ | ||
PUCB_SECOND_TERM_WEIGHT = 1.0 | ||
|
||
# 1手ごとの探索回数 | ||
PLAYOUTS = 100 | ||
|
||
# 探索時のミニバッチサイズ | ||
NN_BATCH_SIZE = 1 |
Oops, something went wrong.