Skip to content

Improve robustness and documentation of CDHR uniform random walk assumptions #392

@Akash504-ai

Description

@Akash504-ai

Is your feature request related to a problem? Please describe.
The uniform Coordinate Direction Hit-and-Run (CDHR) implementation relies on several implicit assumptions (such as valid polytope dimension, internal state dependence, and reuse of internal buffers) that are not explicitly guarded or documented. While this does not usually cause failures in typical full-dimensional use cases, it may lead to undefined or unintuitive behavior in edge cases (e.g. low-dimensional or degenerate polytopes, or restarting chains with small walk lengths).

Describe the solution you'd like
I would like to improve the robustness and clarity of the CDHR implementation by:

  • Adding explicit guards or assertions for unsupported or degenerate configurations.
  • Documenting the assumptions and state dependencies of the CDHR walk (e.g. dependence on previous direction/state).
  • Making the reuse expectations of internal buffers (such as _lamdas) explicit, or ensuring they are safely handled.

These changes would help prevent fragile behavior and make the implementation easier to reason about and maintain.

Describe alternatives you've considered
An alternative would be to leave the implementation unchanged and rely on higher-level code or user discipline to avoid unsupported configurations. However, this keeps the assumptions implicit and may increase the risk of subtle issues as the code evolves.

Additional context
Similar assumption-related and low-dimensional edge cases have appeared in other parts of the codebase. Addressing these points in the CDHR walk would improve consistency, robustness, and long-term maintainability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions