-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Bug in model.run_until #3327
Copy link
Copy link
Closed
Labels
bugRelease notes labelRelease notes label
Description
Describe the bug
There is a bug with model.run_until and model.run_for. Specifically, if you first run_for(10) and then do run_until(5.0), model.time after the second call should be 10, but is set to 5.0.
Expected behavior
Model.time should not go backward.
To Reproduce
Just add an extra check to test_schedule_run.test_already_past, asserting model.time==10
fix
The problem is that in model._advance_time, after the while loop, time is updated to until. But if until is smaller than the current value of time, we go backwards. The simplest solution is to check before the while loop if until is smaller than time and just return if true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugRelease notes labelRelease notes label