Created
July 13, 2023 09:29
-
-
Save joaofig/1f57faf87c286f1cf884c7410b72007c to your computer and use it in GitHub Desktop.
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
def expand_path(path: PredictedPath, | |
max_branch: int = 3) -> list[PredictedPath]: | |
successors = get_successors(path.array[path.step-2], path.array[path.step-1]) | |
best_expansions = [] | |
total = successors.total() | |
for p in successors.most_common(max_branch): | |
new_probability = p[1] / total | |
new_path = evolve_path(path, p[0], new_probability) | |
best_expansions.append(new_path) | |
return best_expansions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment