From 23baf72a4c95574d759a3fe6a5d1df2b0e92b223 Mon Sep 17 00:00:00 2001 From: Johannes Lenfers Date: Tue, 22 Oct 2024 17:51:30 +0200 Subject: [PATCH] catch empty rollout --- .../elevate/heuristic_search/heuristics/MCTS.scala | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/scala/elevate/heuristic_search/heuristics/MCTS.scala b/src/main/scala/elevate/heuristic_search/heuristics/MCTS.scala index 745448c1..93f04200 100644 --- a/src/main/scala/elevate/heuristic_search/heuristics/MCTS.scala +++ b/src/main/scala/elevate/heuristic_search/heuristics/MCTS.scala @@ -102,11 +102,16 @@ class MCTS[P] extends Heuristic[P] { // rollout performance should be the minimum that was seen during rollout rollout = choose_valid_solution_randomly(panel = panel, actions = actions, rollout._2) - rollout._1.solutionSteps.foreach(step => println(s"""[${step.strategy}, ${step.location}]""")) - - // check if we have a dead end for this rollout - if (rollout._1 == null) { + // check if rollout is empty + if (rollout == null) { isTerminal = true + } else { + rollout._1.solutionSteps.foreach(step => println(s"""[${step.strategy}, ${step.location}]""")) + + // check if we have a dead end for this rollout + if (rollout._1 == null) { + isTerminal = true + } } } else {