Fix Sugarscape example compatibility with Mesa 3.0#131
Fix Sugarscape example compatibility with Mesa 3.0#131suryanshgargbpgc wants to merge 16 commits intomesa:mainfrom
Conversation
t updates the Sugarscape example to work with Mesa 3.0 by addressing several compatibility issues: - Fixed model initialization to properly pass seed to Mesa base class - Updated agent creation and tracking to use Mesa 3.0's automatic ID assignment - Replaced deprecated scheduler methods with direct agent iteration for stability - Modified Sugar agent step method to correctly handle cell occupation checks - Removed manual agent list management that conflicted with Mesa's built-in tracking
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
=======================================
Coverage ? 91.78%
=======================================
Files ? 11
Lines ? 1680
Branches ? 0
=======================================
Hits ? 1542
Misses ? 138
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@adamamer20, please have a look if it works fine. |
There was a problem hiding this comment.
Put >= than the last version of mesa (3.1.4)
There was a problem hiding this comment.
@adamamer20, I think mesa does not use python 3.11, so instead of just changing mesa ~=3.0.0 to mesa >=3.1.4
i can implement a conditional dependency.
There was a problem hiding this comment.
It's great practice to test the changes but do not commit this result.
There was a problem hiding this comment.
You should use pytest for testing purposes.
|
@adamamer20 have a look if its fine now, as I mentioned earlier, I have implemented a conditional dependency instead of putting mesa >= 3.1.4. |
adamamer20
left a comment
There was a problem hiding this comment.
The new mesa model is not working correctly. You shouldn't save the agents in a custom list, but you should add them to the model
| sugar.step() | ||
|
|
||
| def run_model(self, step_count=200): | ||
| for i in range(step_count): |
There was a problem hiding this comment.
You're not actually adding any agents to the model so everytime you run_model from performance_comparison.py, the number of agents is always 0 and you don't actually do anything.
| "mesa>=3.1.4; python_version >= '3.11'", | ||
| "mesa~=3.0.0; python_version < '3.11'", |
There was a problem hiding this comment.
| "mesa>=3.1.4; python_version >= '3.11'", | |
| "mesa~=3.0.0; python_version < '3.11'", | |
| "mesa>=3.1.5", |
This wasn't a bad idea but let's just simplify and bump up the version to 3.11
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Solved by #170 |

updates the Sugarscape example to work with Mesa 3.0 by addressing several compatibility issues: