Skip to content
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

Fix batch_run data collection on final step #2588

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
7 changes: 5 additions & 2 deletions mesa/batchrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ def _model_run_func(

data = []

# steps for data collection
steps = list(range(0, model.steps, data_collection_period))
if not steps or steps[-1] != model.steps - 1:
steps.append(model.steps - 1)

# final step for data collection
if steps and steps[-1] != model.steps:
steps.append(model.steps)

for step in steps:
model_data, all_agents_data = _collect_data(model, step)
Expand Down
Loading