Skip to content

Commit

Permalink
Merge branch 'expo' into 'sela'
Browse files Browse the repository at this point in the history
open-source sela

See merge request agents/exp_optimizer!28
  • Loading branch information
garylin2099 committed Oct 18, 2024
2 parents 32d416b + 2ce186c commit f070455
Show file tree
Hide file tree
Showing 37 changed files with 3,341 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ share/python-wheels/
MANIFEST
metagpt/tools/schemas/
examples/data/search_kb/*.json
expo/AutogluonModels

# PyInstaller
# Usually these files are written by a python scripts from a template
Expand Down Expand Up @@ -188,3 +189,4 @@ cov.xml
*-structure.json
*.dot
.python-version
expo/results/*
19 changes: 19 additions & 0 deletions expo/Greedy.py
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)
Loading

0 comments on commit f070455

Please sign in to comment.