jaxrens.constraints.base

Composable configuration constraints for nested sampling.

A constraint is a hard predicate on a walker configuration — a function (positions, types, cell) -> bool that is jit/vmap/pmap safe and returns a scalar boolean (True == the configuration is allowed). Constraints restrict the support of the prior the chain explores; a proposal that would move a walker into a forbidden region is rejected exactly like one that violates the likelihood threshold.

Each constraint type is described by a ConstraintDescriptor, which carries:

  • depends_on — the set of state aspects the predicate reads ("positions", "cell", "types"). A move is gated by a constraint only when the move mutates an aspect the constraint depends on; this pairing is computed once, statically, when the sampler is assembled (see make_move_gate() and build_mwg). A move that cannot affect a constraint’s inputs provably preserves it, so the check is skipped entirely — not merely short-circuited at runtime.

  • reject_reason — the MoveInfo.reject_reason bucket to report when this constraint is the cause of a rejection (default 4 = configuration constraint; cell-geometry uses 2 to stay backward-compatible with the existing reject breakdown).

Constraints whose enforcement is claimed by a move kernel (e.g. cell geometry, which the cell-move kernels check internally so they can gate their own neighbor-bucket bookkeeping) are simply not registered as gate descriptors — that keeps them evaluated exactly once rather than twice.

Functions

make_move_gate

Build the constraint gate for a single move type.

Classes

ASPECTS

frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object

Constraint

A hard predicate on a single walker configuration.

ConstraintDescriptor

Declarative description of one constraint type for the sampler.