![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Execution backends of the reversed-rate fixed point. More...
#include <algorithm>#include <cstddef>#include <string>#include <thread>#include <vector>#include "line/num/number.h"#include "line/solvers/ag/ag_types.h"#include "line/solvers/ag/ag_worker_client.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::ag |
Functions | |
| template<class T, class Gen, class Sol> | |
| void | line::ag::ag_sweep_serial (std::size_t n, Gen gen, Sol sol, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| Evaluate every agent of one sweep. | |
| template<class T, class Gen, class Sol> | |
| void | line::ag::ag_sweep_parallel (std::size_t n, unsigned nworkers, Gen gen, Sol sol, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| The same sweep over a thread pool. | |
| template<class T, class Gen, class Sol, class Payload> | |
| void | line::ag::ag_sweep_cluster (std::size_t n, AgWorkerPool &workers, const std::vector< T > &x, Gen gen, Sol sol, Payload payload, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| The same sweep with the agents partitioned over remote ag-worker processes. | |
Execution backends 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, and a parallel or distributed sweep produces the SAME iterates as the serial one.
HOW FAR THAT SURVIVES FLOATING POINT DEPENDS ON WHO RUNS THE AGENT SOLVE. parallel is BIT-IDENTICAL to serial: the same code in the same process, differing only in an order that 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 C++ coordinator driving a Java ag-worker agrees to a few ulp rather than bit for bit. That is the ordinary cross-codebase difference, not a protocol defect.
ARITHMETIC. parallel carries any arithmetic the agent solve carries, because it moves no numbers between representations. cluster is DOUBLE ONLY and refuses by name otherwise: the wire is JSON, so an exact rational or a 200-digit float would have to be rounded to send, and silently answering a high-precision request at double precision is worse than refusing it.
Definition in file ag_exec.h.