Class AgExec

java.lang.Object
jline.solvers.ag.AgExec
All Implemented Interfaces:
AutoCloseable

public final class AgExec extends Object implements AutoCloseable
Execution backend of the reversed-rate fixed point.

WHAT MAKES THIS SAFE IS THE DECOMPOSITION, NOT THE SCHEDULING. Agent k's generator is

Q_k(x) = L_k + sum_{c passive at k} x_c Pb_c
so an agent reads the rest of the model only through the scalar reversed rates x, and it writes only its own slot of the sweep's output. The sweep is Jacobi -- every x_a is read off the PREVIOUS sweep's stationary vectors and only then do the agents re-solve -- so the agent order is immaterial. A parallel or distributed sweep therefore produces the SAME iterates as the serial one.

How far that survives floating point depends on who runs the agent solve. threads is BIT-IDENTICAL to serial: same code, same process, only the evaluation order differs and the order is what does not matter. cluster is bit-identical only when the worker runs the same implementation as the coordinator -- the wire is exact, since JSON round-trips a double without loss, but the stationary vector comes back from the WORKER's solve, so a Python coordinator driving a Java ag-worker agrees to a few ulp (measured: 1.1e-16 on the M/M/1 tandem) rather than bit for bit. That is the ordinary cross-codebase difference, not a protocol defect, but it means a cluster run must not regenerate a seeded golden a same-language run will read.

The three backends differ only in who evaluates an agent:

  • serial: the caller's thread, in agent order (the reference).
  • threads: a fixed pool, one task per agent, barrier per sweep.
  • cluster: agents partitioned over ag-worker processes; the static half of each agent is shipped once, and only x crosses the wire per sweep.

A cluster worker that is missing, slow or broken is NOT fatal: its agents are solved on the coordinator through the same agent path, so the answer is the run's answer either way and only the wall clock changes.

  • Method Details

    • create

      public static AgExec create(AGOptions options)
      Resolve the backend named by the options. Returns null for serial, which is the caller's own loop and needs no object; that keeps the default path free of any scheduling machinery at all.
    • isParallel

      public static boolean isParallel(String mode)
      True for either accepted spelling of the local-thread-pool backend.
    • mode

      public String mode()
    • sweep

      public void sweep(Matrix x, Matrix[] Aa, Matrix[] Pb, Matrix[] L, int[] ACT, int[] PSV, int numProcesses, int numActions, int[] N, RCATModel rcat, Matrix[] Qs, Matrix[] pis)
      Evaluate every agent at the reversed rates x, writing agent k's generator into Qs[k] and its stationary vector into pis[k].
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable