Elamur GroupantsโŒ•
โ˜ฐ

algorithm-hungarian

The groupant beside algorithms/src/hungarian/mod.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

Facts

Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

Components

componentlabelwhere
approximantpartialapproximant
astpartialsyntax.json
descriptantpresentdescriptant
invariantpartialapproximant
testsfinite checkstests

Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

idtypelabelwhere
behavior_complementbehavior_complementpartial relational specificationbehavior_complement
reverse_reconstructionreverse_reconstructionpartial relational specificationreverse_reconstruction
dual_certificatedual_certificatepartial relational specificationdual_certificate
augmenting_stateaugmenting_statepartial relational specificationaugmenting_state
tie_selectiontie_selectionpartial relational specificationtie_selection
row_translationrow_translationpartial relational specificationrow_translation
resource_partitionresource_partitionpartial relational specificationresource_partition
wide_arithmeticwide_arithmeticpartial relational specificationwide_arithmetic

Model text

Migration: consolidated into model.md, 2026-11-04, operator decision; fresh hash-bound references to the former files were rebound to the sections below.

descriptant

hungarian: mod.rs

Epoch 2026-10-30: original exact implementation and fixtures. Deterministic ties, witness identity, explicit admission and wide objective arithmetic define the API. The implementation exports its mathematical certificate/witness directly; finite exhaustive checks inspect those identities independently.

This is a new implementation epoch, not a measured optimization. No speedup or numerical surrogate is proposed: exact objectives remain exact. Partial source syntax has opaque macro bodies; semantic analysis and unrestricted correctness remain outside the structural model. Four compiled objective/oracle controls are retained as falsification evidence.

approximant

Forward, invariant and cost

Forward: minimize sum_i C[i,p_i] over injections p from r rows into c columns. Return the deterministic primal witness and dual potentials. Invariant at return: distinct columns, u_i+v_j<=C_ij, equality on chosen pairs, v_j<=0 and v_j=0 for unused columns. Tight alternating-tree augmentations preserve optimality of the processed-row matching. Cost O(r^2c) time and O(r+c) auxiliary/output storage, excluding input. Admission bounds r<=512, c<=4096 and rr*c<=20000000. Work product is checked; all signed edge/potential arithmetic is widened to i128 under finite path bounds. The 1955 Kuhn paper supplies classical attribution; this source and fixtures are original.

models

Typed models: hungarian mod.rs

Subject: adjacent source SHA-256 in manifest; epoch 2026-10-30. Observation is the pure call result or finite test outcome. All entries are partial relational specifications supported by source inspection and the named finite checks; formulas are not automatically verified. Allocation behavior is conditional on successful reservation. No general inverse, semantic AST or approximation-error guarantee is claimed.

behavior_complement

Universe: admitted rectangular signed matrices paired with candidate assignments and potentials. Excluded relation: repeated columns, wrong dimensions, objective unequal to selected edge sum, any u_i+v_j>c_ij, positive column potential, or nonzero potential on an unused column. This is a necessary-condition inner description of absent successful outputs, not an exhaustive operational complement. Evidence: exhaustive_small_assignments and boundaries_ties_and_extremes.

reverse_reconstruction

Fix a returned assignment (p,z,u,v). Compatible antecedents include every admitted i64 matrix C with C[i,p_i]=u_i+v[p_i], C[i,j]>=u_i+v_j, sum_i C[i,p_i]=z and the same deterministic augmentation result. The inequalities alone form an outer relaxation because tie behavior is not inverted. Nonselected entries can vary, so recovery is ambiguous. Evidence checks forward inclusion, not complete enumeration of this fiber.

dual_certificate

For all admitted C, let u_i+v_j<=C_ij, v_j<=0, equality on selected columns, and v_j=0 on unused columns. Then any injective q has sum C[i,q_i]>=sum u_i+sum v_j, attained by p. Observation is primal/dual objective equality plus all reduced costs. Test check independently validates every inequality and edge identity.

augmenting_state

During one row insertion, visited columns form an alternating tree; owner maps occupied columns to distinct rows. Slack[j] is the minimum reduced edge from a reached row to unvisited j, with previous[j] retaining its first strict minimizer. Potential updates make at least one new column tight. First update can be negative for a previously unprocessed row; global dual feasibility is asserted at completion, not before that row is introduced. Exhaustive finite optima constrain the recurrence.

tie_selection

With fixed matrix, ascending row and column scans, strict slack comparisons and predecessor retention select a repeatable witness. This specifies the procedural selector, not lexicographic optimization. Zero 2x3 selects [0,1]. Observation includes returned potentials as well as columns. Repeat equality in check is a finite stability oracle.

row_translation

For mathematical row offsets d_i that keep entries in i64 and admission unchanged, adding d_i to every entry of row i preserves the set of optimal injections and shifts optimum by sum d_i. This is an objective/set counterfactual, not a promise that every internal dual coordinate is invariant. Exhaustive signed matrices exercise some instances; a universal Rust metamorphic experiment is not executed.

resource_partition

Input partition ordered by rows>512, first row width>4096, any unequal row width, rows>columns, checked rowsrowscolumns>20000000, allocation failure, then success. Later-row width alone triggers raggedness, not first-row cap. Product checking occurs before scratch allocation. Named precedence/work fixtures execute finite representatives; allocator failure is not injected.

wide_arithmetic

At most 512 i64 edges sum into i128. Potentials and finite reduced costs are bounded by alternating paths of at most 512 rows and i64 cost differences, far below i128 magnitude. i128::MAX is a slack sentinel only until every unvisited column receives a finite first relaxation; no sentinel remains in subtraction. Extremal signed fixtures test objective and certificate identity. No arbitrary-dimension arithmetic claim is made.

tests

Checks

Run cargo test -p mova-algorithms hungarian::tests. Three tests cover independent enumerations, objective/witness identities and shape/resource boundaries. Debug and release each repeat twice with identical sorted test outcomes. Strict all-targets Clippy and narrow rustfmt pass. Raw logs stay under external run key octopus-wave11-optimization-2026-10-30; see validation.md for hashes. No cross-algorithm integration is executed in this leaf task; the root owns composition tests.

application-transfers

Application transfers

Declared consumers of this algorithm's modeled mechanism:

Root transfer catalog. These are scoped mechanism transfers; original algorithm ownership and numerical contracts remain unchanged. Evidence status is recorded in the catalog.

validation

Validation epoch 2026-10-30

Six owned tests pass twice in debug and twice in release. Three per module have identical normalized test identities across all four runs. Four compiled implementation/test-oracle objective controls fail named equality assertions; exact source bytes restore and positive focused checks pass. Strict all-targets algorithm Clippy passes. Partial syntax projections repeat byte-identically. No timing or general proof claim.

External run key: octopus-wave11-optimization-2026-10-30. SHA-256 evidence:

This page in Markdown โ†’ https://md.groupants.elamur.ai/free/en/mova/algorithms/src/hungarian/mod.rs.groupant/