Skip to content

Fix: Collect finaFixes #2514 Ensures that BatchRunner collects the last data point after the model stops running.l step data in BatchRunner (Fixes #2514) #2749

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mesa/batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def _model_run_func(
model = model_cls(**kwargs)
while model.running and model.steps <= max_steps:
model.step()
# Fix for Issue #2514: collect final step's data


if self.collect_data and hasattr(model, "datacollector"):
model.datacollector.collect(model)

data = []

Expand Down
Loading