Skip to content

debug: do not increment mhe.Nk if updatestate! was not called and direct=true - #417

Closed
franckgaga wants to merge 2 commits into
mainfrom
mhe-window-length-debug
Closed

debug: do not increment mhe.Nk if updatestate! was not called and direct=true#417
franckgaga wants to merge 2 commits into
mainfrom
mhe-window-length-debug

Conversation

@franckgaga

Copy link
Copy Markdown
Member

This is a minor debug to ensure that the length of the data windows are not incremented if the user did not called updatestate! on a MovingHorizonEstimator with direct=true. This should not happen on normal usage of the package. This is however useful for benchmarking. Now we can call preparestate! multiple time (e.g. with @btime) and the data windows will be identical at each call.

This is a minor debug to ensure that the length of the data windows are not incremented if the user did not called `updatestate!` on a `MovingHorizonEstimator` with `direct=true`. This should not happen on normal usage of the package. This is however useful for benchmarking. We can call `preparestate!` multiple time (e.g. with `@btime`) and the data windows will be identical at each call.
@franckgaga franckgaga changed the title debug: do not increment mhe.Nk if updatestate! was not called and mhe.direct == true debug: do not increment mhe.Nk if updatestate! was not called and direct=true Aug 3, 2026
@franckgaga

franckgaga commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Come to think of it, it would create an inconsistency between direct=true and direct=false for the MHE. Calling updatestate! multiple times with direct=false would always increment Nk, but not calling preparestate! multiple times with direct=true. This is not intuitive at all. Let's close this PR. Anyway, this is only useful for benchmarking.

edit: and the other option of not incrementing Nk with multiple updatestate! calls and direct=false is very bad since updatestate! is meant to be called without preparestate! when direct=false (since preparestate! does nothing in this case)

@franckgaga franckgaga closed this Aug 3, 2026
@franckgaga
franckgaga deleted the mhe-window-length-debug branch August 3, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant