Closed
Conversation
|
Performance benchmarks:
|
Contributor
Author
|
I am not fully sure about the placement of runspec.py . Should it stay in mesa.experimental or in mesa.experimental.scenarios? |
Collaborator
|
Thanks for the PR but I think this is a bit premature, we haven't had yet reached a consensus on the separation of concerns. Also your extract function doesn't seem good, |
Contributor
Author
I agree, i kept it as a placeholder. I'll try a few more things out locally before updating this PR. |
Member
|
I am in favour of first hashing this out in more detail in the appropriate discussion rather than spreading it out over PRs and the discussion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR adds a RunSpec class to define how a single Scenario is executed. It has been discussed in #3483 .
Motive
After the Scenario refactor, experiment setup is now handled cleanly, but there is no clear way to define how a Scenario should actually be run. This makes execution logic implicit and inconsistent across use cases. RunSpec introduces a simple and explicit way to define how a model is built, executed, and how results are extracted for a single run.
Implementation
RunSpec acts as a small execution pipeline. By default, it builds a model from a Scenario, runs it using
run_for, and returns the model’sdata_registry. The class is designed to be subclassed, with clear override points for model construction, execution logic, result extraction, and output formatting.Tests are added to cover the default behavior and each extension point, including custom execution, extraction, and output formatting.
Usage Examples
Basic usage:
Custom behavior: