Add explicit failure status reporting to uniform billiard walk#446
Add explicit failure status reporting to uniform billiard walk#446adilraza99 wants to merge 1 commit intoGeomScale:developfrom
Conversation
Akash504-ai
left a comment
There was a problem hiding this comment.
Thank you for working on this. Adding WalkStatus is the right idea but the current changes modify too much of the file and introduce duplicated code and structural issues. Please keep the original structure and make only the minimal changes to add status reporting.
Return bool from apply() to indicate walk success or failure, following the existing pattern in exponential_hamiltonian_monte_carlo_exact_walk. Returns false when iteration limit (50*dimension) is reached. Returns true on successful walk completion. Resolves GeomScale#433
e92df28 to
b0cdeed
Compare
|
Thanks for the review and for suggesting a minimal approach. I’ve revised the implementation to follow the existing walker pattern while keeping the changes strictly surgical: • Verification: Please let me know if you’d like any further adjustments. |
There was a problem hiding this comment.
Thank you for the change, this change is clean and correctly handles the iteration limit case. But the issue also mentions numerical stagnation and degenerate intersections which are not handled yet. Should we extend this to cover those cases as well or clarify the exact scope of this fix? Since this is an architectural level issue in my opinion it may be better to wait for mentor's suggestion and have a proper discussion before finalizing the approach.
Fixes #433
Summary
This PR adds explicit failure status reporting to the uniform billiard walk implementation to address the silent failure scenarios discussed in #433.
Previously, the walk could fail internally without informing the caller. This made it difficult for users to detect issues or implement proper error handling in higher-level code.
Problem
The billiard walk could silently fail in several situations, including:
In all of these cases, the caller had no way to distinguish a successful walk from a failed one.
Solution
This change introduces a small
WalkStatusenum and updates the core walk function to return an explicit status value.The enum covers the main failure modes:
SUCCESS– walk completed normallyITERATION_LIMIT– maximum reflections exceededNUMERICAL_STAGNATION– insufficient movement detectedINVALID_STATE– degenerate intersection or numerical issueThis allows callers to detect and handle failures explicitly:
Scope and Compatibility
The change is intentionally minimal and localized to
uniform_billiard_walk.hpp.Successful walks preserve their previous behavior, and the sampling
trajectory is unchanged. The update simply exposes failure information
that was previously hidden.
Verification
This PR focuses only on exposing failure status and does not introduce
architectural changes.