Skip to main content

Module sos_barrier

Module sos_barrier 

Source
Expand description

SOS barrier certificate evaluator for frame-budget admissibility.

Evaluates a pre-computed polynomial barrier certificate B(x1, x2) to determine whether the current frame-budget state is admissible (safe) or has crossed into the degradation region.

The barrier certificate is computed offline by scripts/solve_sos_barrier.py using SOS/SDP relaxation. The Rust code here is ONLY the evaluator — no SDP solving happens at runtime.

§State Space

  • x1 = budget_remaining: fraction of frame budget remaining, [0, 1]
  • x2 = change_rate: normalized rate of cell changes per frame, [0, 1]

§Barrier Properties

  • B(x) > 0 → safe region (budget available, manageable load)
  • B(x) <= 0 → at or beyond unsafe boundary (trigger degradation)

Structs§

BarrierResult
Result of evaluating the barrier certificate.

Constants§

BARRIER_COEFFS
Flattened polynomial coefficients. Layout: row-major over (i, j) with i+j <= degree. Index k corresponds to monomial x1^i * x2^j where (i, j) are enumerated as i=0..=degree, j=0..=(degree-i).
BARRIER_DEGREE
Polynomial degree of the barrier certificate.
BARRIER_N_TERMS
Number of monomial terms: (degree+1)*(degree+2)/2.
BARRIER_VERIFICATION_POINTS
Verification results from offline SDP solver. Each entry: (x1, x2, B_value, passed).

Functions§

evaluate
Evaluate the barrier certificate at (budget_remaining, change_rate).
is_admissible
Quick check: is the current state safe?
safety_margin
Margin of safety: how far inside the safe region the current state is.