Fix batch_run data collection on final step #2588
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This is a bug where the function of batch_run, in the Mesa framework, is not collecting data on the last step of the simulation. Such an issue is affecting users because they need accurate data collection at the end of the simulation step.
Bug / Issue
The issue is tracked under#2514. Within the batch_run function, DataCollector wasn't collecting information on final step because of incorrect step range logic. The missing data had an appearance in simulations that were more than one step.
Implementation
To resolve this issue, the logic for generating the list of steps for data collection was modified. Specifically:
The line generating steps was changed from: file path: (..mesa\batchrunner.py)
to:
Testing
Everything looks good, and the results are consistent now!
Additional Notes
While working on this issue, I consistently encountered a warning related to the following line:
Despite my efforts, I wasn’t able to identify a solution for this warning. If anyone has insights or suggestions on resolving this, I would greatly appreciate your guidance.