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

Automatic time and step incrementing #2222

Closed
EwoutH opened this issue Aug 17, 2024 · 0 comments · Fixed by #2223
Closed

Automatic time and step incrementing #2222

EwoutH opened this issue Aug 17, 2024 · 0 comments · Fixed by #2223
Labels
breaking Release notes label
Milestone

Comments

@EwoutH
Copy link
Member

EwoutH commented Aug 17, 2024

This issue is a spin-off of the discussion in #1942 (comment)

Background

Currently, Mesa models require users to explicitly increase the time and step counters using _advance_time(). This approach can be unintuitive and prone to errors, especially for new users. It's also weird to have to use a private method to advance the time.

Motivation

We want to simplify the model creation process and reduce the potential for errors by automatically incrementing time and step counters. This change would make Mesa more user-friendly.

Simultaneously, the time-increase should be able to be overwritten if needed.

API proposal

I would propose the following user interface:

class Model:
    ...
    def step(self, time=1, step=1):
        ...

The default is time=1 and step=1. Users can change these numbers if they want, but they don't need to. If you want to turn both off, you can just say step(self, time=False, step=False), because in Python, the False is interpreted as 0.

Then we need to have one giant final battle if the time and step increases at the beginning of the step or the end of the step.

Curious what everybody thinks. If anyone has the golden bullet on an implementation idea, please share!

@EwoutH EwoutH added the breaking Release notes label label Aug 17, 2024
@EwoutH EwoutH added this to the v3.0 milestone Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Release notes label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant