1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Auto-generated by scripts/solve_sos_barrier.py
// Generated: 2026-03-05T23:36:24Z
// Polynomial degree: 4
// Variables: budget_remaining (x1), change_rate (x2)
//
// Barrier certificate B(x1, x2) = sum c[k] * x1^i * x2^j
// where k is the flat index over (i, j) with i+j <= degree,
// iterated as i=0..=degree, j=0..=(degree-i).
//
// Properties:
// B(x) > 0 in safe region (budget available, manageable load)
// B(x) <= 0 at/beyond unsafe boundary (budget exhausted, high load)
/// Polynomial degree of the barrier certificate.
pub const BARRIER_DEGREE: usize = 4;
/// Number of monomial terms: (degree+1)*(degree+2)/2.
pub const BARRIER_N_TERMS: usize = 15;
/// 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).
pub const BARRIER_COEFFS: [f64; 15] = [
0.0, // x1^0 * x2^0
0.0, // x1^0 * x2^1
-0.5, // x1^0 * x2^2
0.0, // x1^0 * x2^3
-0.1, // x1^0 * x2^4
1.0, // x1^1 * x2^0
0.0, // x1^1 * x2^1
-0.3, // x1^1 * x2^2
0.0, // x1^1 * x2^3
0.1, // x1^2 * x2^0
0.0, // x1^2 * x2^1
-0.15, // x1^2 * x2^2
0.05, // x1^3 * x2^0
0.0, // x1^3 * x2^1
0.02, // x1^4 * x2^0
];
/// Verification results from offline SDP solver.
/// Each entry: (x1, x2, B_value, passed).
pub const BARRIER_VERIFICATION_POINTS: usize = 8;