-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add commons stats tracking and rewards for aligned objects #4598
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: daveey-hp
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2dfe6d3bbd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| explicit Commons(const CommonsConfig& cfg, | ||
| const std::vector<std::string>* resource_names = nullptr, | ||
| const std::unordered_map<std::string, ObservationType>* feature_ids = nullptr) | ||
| : HasInventory(cfg.inventory_config, resource_names, feature_ids), name(cfg.name) { | ||
| : HasInventory(cfg.inventory_config, resource_names, feature_ids), name(cfg.name), stats(resource_names) { |
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.
Require or guard null resource_names in Commons stats init
The new StatsTracker stats member is constructed with resource_names, but the constructor still defaults that parameter to nullptr. StatsTracker throws when resource_names is null, so any existing caller that relied on the default (e.g., the C++ Commons tests that do Commons commons(config) in packages/mettagrid/tests/test_commons.cpp) will now crash at construction. Either make the parameter required or provide a safe fallback when resource_names is null to avoid breaking existing usages.
Useful? React with 👍 / 👎.
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |

TL;DR
Added commons statistics tracking and rewards based on aligned objects.
What changed?
commons_statsthat allows agents to be rewarded based on commons statisticsHow to test?
test_align.pywhich verify:Why make this change?
This change enables more sophisticated reward mechanisms based on commons alignment patterns. It allows agents to be rewarded not just for the resources in commons, but for maintaining alignment with specific object types over time. This is particularly useful for scenarios where we want to incentivize agents to protect or maintain certain objects within their commons.