-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add virtual nodes to the Monte Carlo Tree #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@jingyuanlm please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| self.node_value_sum: dict[int, float] = {} | ||
| self.node_prior: dict[int, float] = {} | ||
|
|
||
| self.root_id = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it the class attribute
| # visits = self.node_visit_count.get(node_id, 0) | ||
| # # Avoid div-by-zero; encourage exploration when visits are small | ||
| # return self.c_puct * prior * math.sqrt(max(1, self.global_visit_count)) / (1 + visits) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a new get_parents function
| u = self._get_u(leaf) | ||
| #u = self._get_u(leaf) | ||
| #u = self._get_u_uct(leaf,trace) | ||
| u = self._get_u_uct(leaf, trace) if leaf != self.root_id else self.c_uct * math.sqrt( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this if else should be placed into the _get_u_uct function.
| if best_leaf == self.root_id: | ||
| capacity = trace.sub_trace_count + self.uncommited_rec_status.get(trace.NEW_ROOT, 0) | ||
| if capacity >= self.max_trace_num: | ||
| # capacity full: pick next best real leaf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be simplified
Description
Motivation and Context
How Has This Been Tested?
Screenshots of Test Results (if appropriate):
Types of changes
📚 Documentation preview 📚: https://RDAgent--1300.org.readthedocs.build/en/1300/