pub struct MinFill;Expand description
Approximate Minimum Fill metric (HAMF4) — Amestoy 1999 thesis.
AMF selects the next pivot to minimise the fill introduced by
the elimination, rather than the candidate’s degree. On bipartite-
KKT graphs with a few “hub” rows AMF can be 47× better than AMD on
final nnz_L (see dev/research/amf-clean-room.md Section 1).
Score is a quantized RMF = DEG*(DEG-1+2*DEGME) - WF(i) value
stored in i32. Buckets up to and including NORIG = n are one
bucket per integer score; above NORIG the buckets quantize with
stride PAS = max(n / 8, 1) and the head must be linear-scanned
to pick the minimum-RMF entry. Supervariable absorption merges
the per-supervariable WF with max.
Inner loop: MinFill::run_elimination dispatches to
run_elimination_amf (Phase B.2 of dev/plans/amf-clean-room.md).
The lazy WF(e) cache, three-accumulator Pass-2, supervariable
max-merge of wf, saturated/regular RMF branch, and coarse-bucket
linear scan all live in algo.rs.
Trait Implementations§
Source§impl Metric for MinFill
impl Metric for MinFill
Source§fn n_buckets(n: usize) -> usize
fn n_buckets(n: usize) -> usize
AMF needs 2 * n + 2 slots: 0..=NORIG for one-per-score
fine buckets, NORIG+1..=NBBUCK (NBBUCK = 2 * n) for
coarse-stride buckets, and one halo slot at NBBUCK + 1
reserved for V1 boundary variables (inert in our use case;
see Section 11 of dev/research/amf-clean-room.md).
Source§fn init_score(len: i32) -> i32
fn init_score(len: i32) -> i32
Seed the per-supervariable score with the row’s adjacency
length len(i). Same seeding as AMD; the AMF metric only
diverges once the elimination loop starts producing elements.
Source§fn bucket(score: i32, n: usize) -> usize
fn bucket(score: i32, n: usize) -> usize
Quantize score into a bucket index.
0..=n are fine buckets (one per integer score). Above n
the buckets are coarse with stride PAS = max(n / 8, 1),
capped at NBBUCK = 2 * n. Negative scores (which should not
occur in a well-formed AMF run, but we defend against
truncation underflow on RMF / (NVI + 1)) clamp to bucket 0.
Reference: ana_orderings.F:4954-5017 and
dev/research/amf-clean-room.md Section 4.
Source§fn coarse_bucket(idx: usize, n: usize) -> bool
fn coarse_bucket(idx: usize, n: usize) -> bool
Coarse buckets are those above NORIG = n. select_pivot
must walk the bucket chain and pick the entry with the
smallest exact score (ana_orderings.F:4392-4418).
Source§fn merge_supervariable(parent: &mut i32, child: i32)
fn merge_supervariable(parent: &mut i32, child: i32)
On supervariable merge j → i, update the surviving anchor’s
score with max(WF(i), WF(j)) (ana_orderings.F:4920).
Source§type Score = i32
type Score = i32
i32
(the running degree); AMF will also use i32 (quantized RMF).Source§fn run_elimination(
ws: &mut Workspace,
aggressive: bool,
) -> Result<StepFlops, OrderingError>
fn run_elimination( ws: &mut Workspace, aggressive: bool, ) -> Result<StepFlops, OrderingError>
Workspace. Returns the accumulated flop counters. Read more