-
Notifications
You must be signed in to change notification settings - Fork 88
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
Dynamic stopping by setting FINAL_TIME #278
Comments
Hi @gingergenius , In order to make conditions like yours work some fixes will be needed. Probably we can adapt the Time object in functions.py to keep computing the value of the control variables during the integration and manage it. This would allow to include non-static The importance of using a class and not simply modify the integrator is that we need to keep working the models were I don't have time to solve this problem at the moment and I don't know when I will have time to do it. For the time being, if you can't solve the problem yourself, I recommend that you set an approximate end time that will ensure that the condition is met. |
I decided to just crop the dataframe manually like this:
Everything after the first occurence of |
@enekomartinmartinez unfortunately version 1.7.0 seems to break my currently functional workaround. FINAL TIME does not change when the dynamic stopping condition should fire. |
Hi @gingergenius , The variable final_time is not modified during integration, but at the end when the outputs are exported. Then, if you define
the STOP VARIABLE will save the values of FINAL TIME at each time step. Then, you only need to check STOP VARIABLE values. I will try to solve the thing that produced the bug, so you can continue using the FINAL TIME. But if needed, I recommend you to do as above. When I have time, maybe in September, I may work on big changes on PySD, such as how the cache is assigned, in order to improve efficiency and reduce needed resources. I will also check how to manage time, final time and time step, so the model can be automatically stoped with a condition as it is yours. |
Hi again @gingergenius , As soon as tests pass I will merge that PR and create a new release to make it available in pip and conda-forge. |
You are crazy quick with your corrections, thanks a ton! |
You welcome, |
You are crazy quick with your corrections, thanks a ton! |
I have a dynamic stopping condition that works in Vensim.
If a value reaches a certain threshold, the model stops. If it doesn't reach the threshold, the model runs until the maximum time.
I verified that
FINAL_TIME
is being set as expected and that the difference betweenTIME
andFINAL_TIME
becomes zero at some point. The model, however, just goes on running untilmax_final_time
.The text was updated successfully, but these errors were encountered: