2 Commits

Author SHA1 Message Date
Dane Sabo
1eab154847 SOS + polytopic barrier exploration — first degree-4 barrier found
Polytopic (Nagumo face-by-face LP check) and SOS polynomial
(Prajna-Jadbabaie w/ CSDP) barrier attempts on operation mode.

**Polytopic (barrier_polytopic.jl):** the naive check on
inv2_holds ∩ precursor_tube_bounds fails — 16 of 18 faces can be
crossed under A_cl. This is EXPECTED: safety halfspaces alone form
a set too big for LQR to contract from everywhere.  The correct
approach is Blanchini's pre-image iteration (max robustly controllable
invariant set). Sketched in the script; 2-3 days to implement properly.

**SOS (barrier_sos_2d.jl):** a working proof of concept.

CSDP returns OPTIMAL on a 2-state projection of the operation mode
(dn, dT_c) with:
  X_entry  = |dn| ≤ 0.01, |dT_c| ≤ 0.1
  X_unsafe = dn ≥ 0.15 (high-flux-trip direction)
  Dynamics = reduced 2×2 A_cl after LQR.
  No disturbance (B_w projects to 0 in this subset).
  Global decrease condition (-(∇B·f) SOS) instead of Putinar ∂{B=0}.

Result: a degree-4 polynomial B(x) satisfying all three barrier
conditions.  Coefficients printed.  First non-quadratic barrier
artifact for this plant.

Caveats:
  - 2D projection loses precursor coupling.
  - Disturbance ignored in this projection.
  - Global-decrease is stronger than the Putinar ∂{B=0} condition;
    the latter requires bilinear σ_b·B formulation (BMI) and
    iterative solvers. Deferred.
  - Scaling to 10-state degree-4 gives SDP ~ 1000×1000; CSDP may
    choke. Mosek or MOSEK-free SDP (SCS) might handle.

JuMP, HiGHS, SumOfSquares, DynamicPolynomials, CSDP all added to
Project.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 17:19:47 -04:00
Dane Sabo
fbbaebff9f julia migration: port MATLAB to Julia, delete MATLAB, rename julia-port -> code
Full toolchain port. Numerical equivalence verified against MATLAB:
- main_mode_sweep.jl: every mode's final state matches MATLAB to 3-4 dp
- reach_operation.jl: per-halfspace margins match MATLAB exactly
- barrier_lyapunov.jl: per-halfspace bounds match (best Qbar from sweep
  yields max|dT_c| = 33.228 K either side)
- barrier_compare_OL_CL.jl: OL gamma 1.038e13, CL gamma 1.848e4
  matching the MATLAB result; LQR helps by ~20,000x on every halfspace.

Phase summary:
  Phase 1: pke_solver.jl, plot_pke_results.jl (Plots.jl), main_mode_sweep.jl
  Phase 2: reach_linear.jl, reach_operation.jl, barrier_lyapunov.jl,
           barrier_compare_OL_CL.jl, load_predicates.jl
  Phase 3 (this commit): delete plant-model/ entirely, delete reach
           code from reachability/ keeping predicates.json + docs,
           git mv julia-port/ -> code/, update root README + CLAUDE,
           write code/CLAUDE.md and code/README.md, update reach
           README + WALKTHROUGH file paths, journal preamble note
           that pre-port entries reference MATLAB paths.

Why now: prompt-neutron stiffness in nonlinear reach made it clear we
need TMJets, which is Julia. Already had the Julia plant model
working and matching MATLAB. Two languages = two sources of truth =
two places to drift. One language, one truth.

Manifest.toml gitignored. .mat results gitignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 21:44:59 -04:00