-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
open-source sela See merge request agents/exp_optimizer!28
- Loading branch information
Showing
37 changed files
with
3,341 additions
and
21 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import random | ||
|
||
from expo.MCTS import MCTS | ||
|
||
|
||
class Greedy(MCTS): | ||
def best_child(self): | ||
if len(self.children) == 0: | ||
return self.root_node | ||
all_children = [child for children in self.children.values() for child in children] | ||
return max(all_children, key=lambda x: x.normalized_reward.get("dev_score", 0)) | ||
|
||
|
||
class Random(MCTS): | ||
def best_child(self): | ||
if len(self.children) == 0: | ||
return self.root_node | ||
all_children = [child for children in self.children.values() for child in children] | ||
return random.choice(all_children) |
Oops, something went wrong.