Skip to content

Commit

Permalink
catch empty rollout
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneslenfers committed Oct 22, 2024
1 parent a48e181 commit 23baf72
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/scala/elevate/heuristic_search/heuristics/MCTS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 23baf72

Please sign in to comment.