Constructor
new Node(constants)
MCTSのノードを生成します。
Parameters:
Name | Type | Description |
---|---|---|
constants |
BoardConstants |
Members
edgeLength
着手候補数です。(名前のedgeはグラフ理論の枝のことです。)
evaluated
moves要素に対応する局面のニューラルネットワークを計算したか否かを保持します。
hashes
moves要素に対応するハッシュです。
moves
ポリシー確率の高い順並んだ着手候補です。
nodeIds
moves要素に対応するノードIDです。
probabilities
moves要素に対応するポリシー確率です。
totalActionValues
moves要素に対応する総アクションバリューです。ただしノードの手番から見ての値です。
values
moves要素に対応するバリューです。ただしノードの手番から見ての値です。
visitCounts
moves要素に対応する訪問回数です。
Methods
clear()
未使用状態にします。
getSortedIndices()
visitCountsの多い順のインデックスの配列を返します。
incrementVisitCount(index)
visitCountsを1増やし、sortedIndicesをクリアします。
Parameters:
Name | Type | Description |
---|---|---|
index |
Integer |
initialize(hash, moveNumber, candidates, prob)
初期化します。
Parameters:
Name | Type | Description |
---|---|---|
hash |
Integer | 現局面のハッシュです。 |
moveNumber |
Integer | 現局面の手数です。 |
candidates |
Array.<UInt16> | Boardが生成する候補手情報です。 |
prob |
Float32Array | 着手確率(ニューラルネットワークのポリシー出力)です。 |
selectByUCB(c_puct) → {Array}
UCB評価で最善の着手情報を返します。
Parameters:
Name | Type | Description |
---|---|---|
c_puct |
number |
Returns:
[UCB選択インデックス, 最善ブランチの子ノードID, 着手]
- Type
- Array
winrate(index) → {number}
indexのエッジの勝率を返します。
Parameters:
Name | Type | Description |
---|---|---|
index |
Integer |
Returns:
- Type
- number