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

Discrete control with discrete callback #1393

Merged
merged 39 commits into from
Apr 17, 2024

Conversation

SouthEndMusic
Copy link
Collaborator

@SouthEndMusic SouthEndMusic commented Apr 16, 2024

Fixes #455, fixes #495. The latter is made redundant by this PR since U/D truth values are removed.

Upgrade instructions

This changes DiscreteControl, to only check the conditions on each timestep. Before it used root finding to determine the exact moment a threshold is crossed. This method is simpler and will likely scale better. If it is important that threshold crossings are recognized without too much delay, it is important to set the dtmax or dt appropriately. With this change the U and D conditions for upcrossing and downcrossing are no longer supported.

@SouthEndMusic SouthEndMusic marked this pull request as draft April 16, 2024 13:09
@SouthEndMusic SouthEndMusic marked this pull request as ready for review April 17, 2024 06:59
@SouthEndMusic SouthEndMusic requested review from visr and evetion April 17, 2024 06:59
Copy link
Member

@evetion evetion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a great reduction in complexity, kudos! And ~200 lines less. ❤️

python/ribasim/ribasim/model.py Outdated Show resolved Hide resolved
docs/python/examples.ipynb Outdated Show resolved Hide resolved
@SouthEndMusic SouthEndMusic requested a review from evetion April 17, 2024 09:57
@SouthEndMusic SouthEndMusic merged commit 169466e into main Apr 17, 2024
24 checks passed
@SouthEndMusic SouthEndMusic deleted the discrete_control_with_discrete_callback branch April 17, 2024 10:21
@SouthEndMusic SouthEndMusic added the breaking A change that breaks existing models label Apr 17, 2024
visr pushed a commit that referenced this pull request Apr 18, 2024
As discussed with @gijsber, this model is not worth maintaining and it
broke with #1393.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A change that breaks existing models
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor "U", "D" truth values Implement DiscreteControl with DiscreteCallback
2 participants