01 • DATA ENCODING
Bitmask Encoding & Variability Sorting
Each character state is encoded as an 8-bit bitmask supporting standard morphological states (0–3), nucleotides (A, C, G, T/U), gaps as a 5th state (-), missing data (?, N, X), full IUPAC ambiguity codes (R, Y, M, K, S, W, B, D, H, V), and bracketed polymorphic states (e.g., [01], [AC]).
- Zero-Loss Compression: Invariant sites (0 steps) and parsimony-uninformative singletons are stripped upfront; singleton steps are accumulated into an exact constant
base_cost.
- Early-Exit Ordering: Informative sites are sorted by decreasing state diversity so mutations cluster in the leading 32-byte SIMD blocks.
02 • GOLOBOFF + AVX2 ENGINE
Two-Pass PhyloTree & Store-Free SIMD Kernels
Internal and leaf sequences are stored in 32-byte aligned buffers (S_down, S_up, S_edge) implementing Pablo Goloboff's two-pass parsimony framework.
- Selective Top-Down Pass: When pruning subtree p, HYDRA flags eligible target edges (
need_edge, need_up) and computes top-down states only where needed on the residual tree TR.
- O(1) Branch Reinsertion: Evaluates 32 sites per CPU cycle in registers via 256-bit
AVX2 bitwise masks and hardware POPCNT, aborting immediately whenever accumulated steps exceed max_delta.
03 • SIMULATED ANNEALING
Compound SPR Neighborhood & Metropolis Pruning
At temperature T, for a candidate pruned subtree p (drawn without immediate repetition in shuffled epochs), HYDRA scans all valid regrafting branches v ≠ s on TR to select the best compound neighbor.
- Exact Metropolis Bound: Drawing u ∈ (0, 1), a cost change Δf satisfies e−Δf/T > u iff Δf < −T ln(u), yielding an exact integer ceiling
max_degrad = ⌈-T ln(u)⌉ - 1 passed directly to the AVX2 kernel.
- Dynamic Reheating & Intensification: Stagnation over 18 plateaus triggers elite reheating (T ← max(1.4T, 0.35Ti·0.85r-1)), ending with strict SPR local-search descent (
max_degrad = -1).