mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
implement solved
This commit is contained in:
@@ -107,8 +107,7 @@ public abstract class MCTSAI extends AbstractAI {
|
||||
}
|
||||
|
||||
protected Node selection(Node root) {
|
||||
// while (Float.isNaN(root.solved) && root.isFullyExpanded() && !root.state.isTerminal()) {
|
||||
while (root.isFullyExpanded() && !root.state.isTerminal()) {
|
||||
while (Float.isNaN(root.solved) && root.isFullyExpanded() && !root.state.isTerminal()) {
|
||||
root = root.bestUCTChild();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ public class MCTSAI1 extends MCTSAI {
|
||||
|
||||
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
|
||||
|
||||
// while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
|
||||
while (System.nanoTime() < endTime) {
|
||||
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
|
||||
Node leaf = selection(root);
|
||||
leaf = expansion(leaf);
|
||||
final float value = simulation(leaf);
|
||||
|
||||
@@ -29,8 +29,7 @@ public class MCTSAI2 extends MCTSAI {
|
||||
|
||||
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
|
||||
|
||||
// while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
|
||||
while (System.nanoTime() < endTime) {
|
||||
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
|
||||
Node leaf = selection(root);
|
||||
leaf = expansion(leaf);
|
||||
final float value = simulation(leaf);
|
||||
|
||||
@@ -41,8 +41,7 @@ public class MCTSAI3 extends MCTSAI {
|
||||
tasks.add(() -> {
|
||||
final Node localRoot = new Node(game.deepCopy());
|
||||
|
||||
// while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
|
||||
while (System.nanoTime() < endTime) {
|
||||
while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
|
||||
Node leaf = selection(localRoot);
|
||||
leaf = expansion(leaf);
|
||||
final float value = simulation(leaf);
|
||||
|
||||
@@ -50,8 +50,7 @@ public class MCTSAI4 extends MCTSAI {
|
||||
tasks.add(() -> {
|
||||
final Node localRoot = threadRoots[threadIndex];
|
||||
|
||||
// while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
|
||||
while (System.nanoTime() < endTime) {
|
||||
while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
|
||||
Node leaf = selection(localRoot);
|
||||
leaf = expansion(leaf);
|
||||
final float value = simulation(leaf);
|
||||
|
||||
Reference in New Issue
Block a user