Documentation

CslibFrontier.Algorithms.WordRAM.Arborescence.Internal.CoreProg

Core Chu–Liu/Edmonds phase programs and Realizes certificates (internal) #

Defines bestEntryProg, bestExitProg, contractTablesProg, expandLevelProg, and edmondsCoreProg over Memory.Prog, together with their Realizes .exact certificates.

Parameters for scanning arcs entering a cycle from non-cycle vertex u.

  • n : ℕ

    Matrix dimension (number of vertices).

  • u : ℕ

    Source non-cycle vertex index u.

  • adjBase : ℕ

    Base address of the working n × n adjacency table.

  • costBase : ℕ

    Base address of the working n × n cost table.

  • maskBase : ℕ

    Base address of the n-word 0/1 cycle-membership mask.

  • predOut : ℕ

    Output base address for candidate feasibility indicators (n words).

  • costOut : ℕ

    Output base address for candidate signed costs (n words).

Writes candidate feasibility (inY = 1 ∧ auy = 1) and cost for target y from env.u.

@[reducible, inline]

Address-fit safety precondition for one step of bestEntryRowStep.

Fills candidate entry feasibility and cost arrays for source vertex a.u.

Parameters referencing contraction stack frame k within workspace ws.

  • n : ℕ

    Matrix dimension (number of vertices).

  • ws : ℕ

    Workspace base address.

  • k : ℕ

    Contraction stack frame index.

Computes and stores the best cycle-entry vertex bEntry[u] into frame env.k.

@[reducible, inline]

Safety precondition for one source vertex in bestEntryOuterStep.

Parameters for scanning arcs exiting a cycle toward column col with reduced costs.

  • n : ℕ

    Matrix dimension (number of vertices).

  • col : ℕ

    Target column index col.

  • adjBase : ℕ

    Base address of the working n × n adjacency table.

  • costBase : ℕ

    Base address of the working n × n cost table.

  • maskBase : ℕ

    Base address of the n-word 0/1 cycle-membership mask.

  • parentBase : ℕ

    Base address of the n-word selected cycle-parent array.

  • predOut : ℕ

    Output base address for candidate feasibility indicators (n words).

  • costOut : ℕ

    Output base address for candidate signed reduced costs (n words).

Writes candidate exit feasibility and reduced cost c[x][col] - c[x][f[x]] at row x.

@[reducible, inline]

Address- and arithmetic-fit safety precondition for one step of bestExitRowStep.

Fills candidate exit feasibility and reduced cost arrays for target column a.col.

Computes and stores the best cycle-exit vertex bExit[col] into frame env.k.

@[reducible, inline]

Safety precondition for one target column in bestExitOuterStep.

Parameters for contracting row u of the adjacency and reduced-cost matrices at frame k.

  • n : ℕ

    Current matrix dimension (number of vertices).

  • r : ℕ

    Designated root vertex index.

  • x0 : ℕ

    Representative vertex of the contracted cycle.

  • u : ℕ

    Row index being contracted.

  • ws : ℕ

    Workspace base address.

  • k : ℕ

    Contraction stack frame index.

Writes contracted signed cost (u, col) into nextCostBase using reduced exit costs.

@[reducible, inline]

Address- and arithmetic-fit safety precondition for one contracted cell (u, col).

Contracts row a.u across all columns into nextAdjBase/nextCostBase.

Parameters for contracting the active graph around cycle representative x0 at frame k.

  • n : ℕ

    Matrix dimension (number of vertices).

  • r : ℕ

    Designated root vertex index.

  • x0 : ℕ

    Representative vertex of the contracted cycle.

  • ws : ℕ

    Workspace base address.

  • k : ℕ

    Contraction stack frame index.

Contracts row u across all columns into nextAdjBase/nextCostBase.

@[reducible, inline]

Safety precondition for contracting row u in contractOuterStep.

Builds contracted adjacency and reduced-cost tables in nextAdjBase/nextCostBase.

Builds contracted tables and copies them back into curAdjBase/curCostBase.

Parameters for expanding frame k's cycle parent map using contracted parent qx0 and exit bx.

  • n : ℕ

    Matrix dimension (number of vertices).

  • x0 : ℕ

    Representative vertex of the contracted cycle at frame k.

  • qx0 : ℕ

    Selected parent curParent[x0] of the contracted cycle node.

  • bx : ℕ

    Best cycle-exit vertex frameBExit[qx0].

  • ws : ℕ

    Workspace base address.

  • k : ℕ

    Contraction stack frame index being expanded.

Computes the expanded parent for vertex v and writes it to nextParentBase.

@[reducible, inline]

Address-fit safety precondition for expanding vertex v in expandRowStep.

Expands all a.n parent entries at level a.k into nextParentBase.

Uncontracts stack frame a.k, updating curParentBase with the expanded parent array.

@[reducible, inline]

Safety precondition for uncontracting stack frame a.k in expandLevelProg.

Top-level parameters for the in-workspace Chu–Liu/Edmonds solver core.

  • n : ℕ

    Number of vertices.

  • r : ℕ

    Designated root vertex index.

  • ws : ℕ

    Workspace base address.

Word encoding of CoreArgs into 3 consecutive registers.

@[reducible, inline]

The tuple word encoding of the fields of encCoreArgs.

Forward contraction loop state (status: 0 active, 1 acyclic feasible, 2 infeasible).

  • k : ℕ

    Current contraction depth k.

  • status : ℕ

    Solver status (0 running, 1 feasible acyclic tree found, 2 infeasible).

  • depth : ℕ

    Number of contracted frames pushed before terminating.

Performs one full contraction round at frame a.k around cycle vertex a.x0.

@[reducible, inline]

Safety precondition for one full contraction round contractRoundBodyProg.

Executes one step of the forward contraction pass (noop once st.status ≠ 0).

@[reducible, inline]

Safety precondition for one forward contraction iteration in forwardStep.

Runs up to a.n forward contraction rounds from an initialized workspace.

Parameters for the backward cycle-expansion pass over depth contracted frames.

  • n : ℕ

    Number of vertices.

  • ws : ℕ

    Workspace base address.

  • depth : ℕ

    Total number of contracted stack frames to unwind.

@[reducible, inline]

Safety precondition for one backward expansion iteration in backwardStep.

Full in-workspace Chu–Liu/Edmonds solver: forward contraction followed by backward cycle expansion, returning 1 iff feasible.