solvers.AG
- ag_closed_chain_layout(sn)
AG_CLOSED_CHAIN_LAYOUT How every closed chain sits on the stations.
One entry per closed chain with a positive population: STATIONS it visits, KIND of each (‘single’ one chain class at a single server that is not PS or LCFS-PR; ‘shared’ a product-form single server; ‘inf’ an infinite server; ‘blocked’ a server the chain cannot be conditioned at), BLOCKED reasons the chain cannot be conditioned exactly at all (several chain classes at a single server that is not a product-form station) and APPROX reasons the conditioned answer is not the exact product form although population and flow balance still hold. Signals are judged on the RCAT model.
Shared by closed_chain_condition (solver_ag) and AG_INF_SUPPORTS, so the gate admits an infinite-server station exactly when the conditioning can serve it.
- lal_ag_message(err)
MSG = LAL_AG_MESSAGE(ERR) the text of an error without the ‘[file.m @ line N] ‘ location prefix that line_error adds
- lal_ag_supports(snapshot, method, options)
[OK, REASON] = LAL_AG_SUPPORTS(SNAPSHOT, METHOD, OPTIONS)
Support gate of SolverAG for a finite LAL composition (port of the Composition branch of SolverAG.supportsModelMethod). Every method needs finite agents; a composition with immediate, functional, embedded or multi-label actions (lal_model_features) takes only ‘default’ and ‘ctmc’, the exact CTMC path; inap/inaprc/rcat need the RCAT structural conditions, rcat also the certificate’s prerequisites; grouped needs a valid partition in OPTIONS.groups / OPTIONS.group_max_states.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_grouped_solve(comp, snapshot, groups, maxStates, tol, maxIter, truncated, damping)
RESULT = LAL_GROUPED_SOLVE(COMP, SNAPSHOT, GROUPS, MAXSTATES, TOL, MAXITER, TRUNCATED, DAMPING)
Grouped finite LAL decomposition: exact within groups, mean-field across them (port of line_solver.solvers.solver_ag.lal_grouped.solve_composition). Each group’s local state space is the existential projection of its agents’ moves reachable from the initial support (at most MAXSTATES states); an event shared by several groups fires at the expected minimum of their capacities under independent group marginals. A single group is the original finite CTMC (lal_ctmc_solve), exact unless TRUNCATED.
RESULT fields: stateTable, actionTable, iterations, converged, residual, diagnostics (groups, group_states, group_distributions, …), method (‘grouped’), exact.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_grouped_partition(snapshot, groups, maxStates)
PARTITION = LAL_GROUPED_PARTITION(SNAPSHOT, GROUPS, MAXSTATES)
Validate a user partition of the agents into groups and complete it with singletons, without enumerating any state (port of lal_grouped.group_partition). GROUPS is a nonempty cell of nonempty cellstr; PARTITION is a cell of cellstr, the declared groups in order then one singleton per remaining agent in declaration order.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_meanfield_solve(snapshot, tol, maxIter, damping)
RESULT = LAL_MEANFIELD_SOLVE(SNAPSHOT, TOL, MAXITER, DAMPING)
Finite LAL mean-field approximation for general atomic synchronizations (port of line_solver.solvers.solver_ag.lal_meanfield.solve_composition). Joint agent states are approximated by independent local marginals; event rates are averaged over the other participants, retaining local state dependence and the declared minimum rule. This is not an RCAT certificate.
RESULT fields: stateTable, actionTable, iterations, converged, residual, diagnostics, method (‘meanfield’), exact (false).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_expected_min(dists, cutoff)
TOTAL = LAL_EXPECTED_MIN(DISTS, CUTOFF)
Expectation of the minimum of independent discrete rates, computed from products of survival laws (port of lal_meanfield.expected_min). DISTS is a cell of {rates, pi} pairs (row vectors over local states); CUTOFF is [] or an upper cap included in the minimum.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_compare_ctmc(comp, snapshot, result, maxStates)
CMP = LAL_RCAT_COMPARE_CTMC(COMP, SNAPSHOT, RESULT, MAXSTATES)
Numerically compare the product of the agent marginals (or of the group distributions of a grouped result) with the exact finite CTMC (port of lal_rcat.compare_with_ctmc). The errors max_probability_error, total_variation and generator_residual compare the product CONDITIONED on the reachable states. Conditioning can hide product mass on states the CTMC never reaches, so that mass is reported as unreachable_product_mass, and unconditioned_total_variation compares the raw product, counting the unreachable mass as error. MAXSTATES is [] (no limit) or a positive integer.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_certify_result(original, result, tol)
[RESULT, OK, REASON] = LAL_RCAT_CERTIFY_RESULT(SNAPSHOT, RESULT, TOL)
Replace an approximate RCAT solution (lal_rcat_solve) with an exactly verified one when lal_certificate succeeds (port of lal_rcat.certify_result). On success RESULT carries the certified rates, marginals and throughputs, rcatResidual 0, exact true and method ‘rcat’. On failure RESULT is returned unchanged and REASON names the obstacle.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_full_reachability(snapshot, limit)
[OK, REASON] = LAL_FULL_REACHABILITY(SNAPSHOT, LIMIT)
Check whether the initial joint state reaches the entire Cartesian state space of the finite agents (port of lal_certificate.full_reachability).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_certificate(snapshot, estimatedRates, tol)
[PROOF, REASON] = LAL_CERTIFICATE(SNAPSHOT, ESTIMATEDRATES, TOL)
Bounded exact-arithmetic RCAT certificate for finite LAL agents (port of line_solver.solvers.solver_ag.lal_certificate.certify). All computations use the exact rational values of the supplied binary doubles (lal_rational over java.math.BigInteger). Global uniqueness is checked by autonomous irreducibility or, for small models, full Cartesian reachability; local balance equations are checked exactly. Failure is not a counterexample: PROOF is [] and REASON names the obstacle.
PROOF has fields rates (cell of lal_rational), marginals (cell of cells of lal_rational, one per agent) and irreducibility (‘autonomous’ or ‘full_reachability’).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_ctmc_pi(Q)
P = LAL_AG_CTMC_PI(Q) stationary row vector of an irreducible generator Q
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_solve(original, tol, maxIter, method)
RESULT = LAL_RCAT_SOLVE(SNAPSHOT, TOL, MAXITER, METHOD)
Finite-agent RCAT reversed-rate fixed point of a LAL model record (port of line_solver.solvers.solver_ag.lal_rcat.solve_composition). METHOD is ‘inap’ or ‘inaprc’. Every isolated agent carries its local transitions, its own synchronized active transitions, and each passive kernel it takes part in scaled by the action’s current reversed rate. The result is an approximation unless further product-form conditions are established (see lal_rcat_certify_result). Passive actions must be enabled in every state.
RESULT fields: stateTable, actionTable, reversedRates, rcatResidual, iterations, converged, method, exact (false), diagnostics.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_state_table(agents, marginals)
T = LAL_AG_STATE_TABLE(AGENTS, MARGINALS)
Agent/State/Probability table of independent local marginals, one row per local state in declaration order (MARGINALS{k} is a row over the states of AGENTS(k)).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_renames(transformations)
[FROM, TO] = LAL_AG_RENAMES(TRANSFORMATIONS)
Event-label renames of the dominated-minimum lowering: the trigger ‘Agent.action’ FROM{k} is reported under the first declared supplier’s label TO{k}, which is the label the event kernel assigns to the event.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_certificate_support(snapshot)
[OK, REASON] = LAL_RCAT_CERTIFICATE_SUPPORT(SNAPSHOT)
Conservative structural prerequisites of the exact RCAT certificate (port of lal_rcat.certificate_support): at most 12 synchronizations and 12 local states per agent, and, when the autonomous transitions of some agent are not irreducible, a Cartesian state space within the 10000-state full-reachability limit.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_graph(agent, keep)
G = LAL_AG_GRAPH(AGENT, KEEP) local transition graph of an agent record
G(i,j) = 1 when some transition i -> j (i ~= j) with a positive value satisfies the predicate KEEP(transition).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_lower_minimum(snapshot)
[LOWERED, TRANSFORMATIONS, REASON] = LAL_RCAT_LOWER_MINIMUM(SNAPSHOT)
Lower a provably dominated minimum synchronization to an ordinary one without changing its event law (port of lal_rcat._lower_minimum). For each minimum synchronization, the supplier whose largest local total rate is no larger than every other supplier’s smallest total is the bottleneck: it becomes the active endpoint, and the other suppliers become passive partners. LOWERED is [] and REASON names the refusal when no supplier is a bottleneck in every combination of local states, or a supplier is disabled in some state.
TRANSFORMATIONS is a cell of structs with fields type (‘dominated_minimum’), active ({agent, action} of the trigger), event_label ({agent, action} of the first declared supplier, which names the event) and other_suppliers (cellstr of ‘Agent.action’).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_rcat_structural_support(snapshot, method)
[OK, REASON] = LAL_RCAT_STRUCTURAL_SUPPORT(SNAPSHOT, METHOD)
Decomposition constraints of the finite LAL RCAT methods, checked without building a global state space (port of lal_rcat.structural_support): a dominated minimum must lower to an ordinary synchronization, every passive partner must be enabled in every local state, and every isolated agent must be structurally irreducible. A model the LAL validator rejects raises.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_active_labels(agent)
LABELS = LAL_AG_ACTIVE_LABELS(AGENT) distinct active action labels of an agent record, in order of first appearance (Python dict.fromkeys order).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_block(agent, action, role)
M = LAL_AG_BLOCK(AGENT, ACTION, ROLE) local matrix of one endpoint
Sum of the values of the transitions of the agent record AGENT with the given action label and role (‘active’ or ‘passive’), indexed by the agent’s local states.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_ag_endpoint(key)
[OWNER, ACTION] = LAL_AG_ENDPOINT(KEY) split an ‘Agent.action’ endpoint
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- lal_scc_count(G)
N = LAL_SCC_COUNT(G) number of strongly connected components of the directed graph with an edge i -> j wherever G(i,j) ~= 0 and i ~= j.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- solver_ag_autocat(R, AP, varargin)
SOLVER_AG_AUTOCAT Native MATLAB implementation of autocat
[X, PI, Q, STATS] = SOLVER_AG_AUTOCAT(R, AP, OPTIONS)
Searches for RCAT product-form solutions using various relaxation methods. Native MATLAB implementation without YALMIP dependency.
- Input:
R - Cell array of rate matrices AP - Action-Process mapping (A x 2) OPTIONS (name-value pairs):
- ‘relaxation’ - Relaxation method (default: ‘auto’)
‘lpr’ - LP relaxation with McCormick envelopes ‘tlpr0inf’ - Tightened LP with 0-level + infinity ‘tlpr1inf’ - Tightened LP with 1-level + infinity ‘tlprUinf’ - Tightened LP with U-level + infinity ‘ens’ - Exact nonlinear system (fmincon) ‘qcp’ - Quadratically constrained (fmincon) ‘ma’ - Mean Approximation (first moment matching) ‘va’ - Variance Approximation (slack variables) ‘minres’ - Minimum Residual (L1-norm of RC3) ‘inap’ - Iterative fixed-point approximation ‘tma1inf’ - Mean Approx + Tightened LP with 1-level + infinity ‘zpr’ - Zero potential relaxation with cutting planes ‘tzpr0inf’ - Tightened zero potential (0-level) ‘tzpr1inf’ - Tightened zero potential (1-level) ‘auto’ - Automatic selection
- ‘policy’ - Bound selection policy (default: ‘vol’)
‘vol’, ‘lu’, ‘l’, ‘u’
‘maxiter’ - Maximum iterations (default: 100) ‘tol’ - Convergence tolerance (default: 1e-4) ‘verbose’ - Verbosity level 0/1/2 (default: 1)
- Output:
x - Action rate parameters pi - Equilibrium distributions Q - Generator matrices stats - Statistics struct
Copyright (c) 2012-2025, Imperial College London All rights reserved.
- solver_ag_analyzer(sn, options)
[QN,UN,RN,TN,CN,XN,RUNTIME,METHOD,TOTITER,PERCRESULTS] = SOLVER_AG_ANALYZER(SN, OPTIONS)
Analyzer for the agent-based (RCAT) solver. Every (station, class) pair is an isolated component and the components are coupled only through the reversed rates of the synchronizing actions, so the whole analysis is the fixed point over that scalar vector; see solver_ag.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- solver_ag(sn, options)
SOLVER_AG RCAT agent-based methods for SolverAG
[QN, UN, RN, TN, CN, XN, ITER] = SOLVER_AG(SN, OPTIONS)
Uses RCAT (Reversed Compound Agent Theorem) to find product-form solutions for queueing networks.
Each (station, class) pair becomes an isolated component, and the components are coupled only through the reversed rates of the synchronizing actions. A component is a QBD whose LEVEL is the queue length and whose PHASE is the pair (arrival phase, service phase), laid out in the Kronecker order of qbd_mapmap1: an arrival moves the level up carrying kron(D1^a, I), a service completion moves it down carrying kron(I, D1^s), the busy levels evolve under krons(D0^a, D0^s) and level zero under kron(D0^a, I), because no server is running there. With exponential processes every block is 1x1 and the QBD collapses to the scalar birth-death chain this analyzer used before, entry for entry.
- 'inap' - Iterative Numerical Approximation Procedure (default, fast)
- 'inaprc' - Improved INAP with weighted rates (no normalization)
- 'inapinf' - INAP with matrix-geometric solution of the isolated open
components (no state-space truncation), per Marin, Rota Bulo, Balsamo, “A Numerical Algorithm for the Decomposition of Cooperating Structured Markov Processes”, MASCOTS 2012.
- 'exact' - Not available (see solver_ag_autocat, unreachable)
Copyright (c) 2012-2025, Imperial College London All rights reserved.
- ag_solve_component(Qk, mph, nlev, lvl)
AG_SOLVE_COMPONENT Stationary vector of one isolated component.
PI = AG_SOLVE_COMPONENT(QK, MPH, NLEV, LVL)
Shared by every execution backend and by the cluster fallback, so a remote agent and a local one are solved by the same code.
A component with a single phase per level is the birth-death chain the analyzer has always built, and the ratio recursion is both exact and stable there; a phase-expanded component is block tridiagonal instead, and the matrix analogue of that recursion (linear level reduction) keeps the same stability at the 100-level truncation, where a null-space solve is already ill-conditioned. Anything that reaches beyond the neighbouring level – a catastrophe, a batch removal – is neither, and falls back to ctmc_solve.
- class lal_rational
LAL_RATIONAL Exact rational number backed by java.math.BigInteger
Scalar value class used by the SolverAG LAL RCAT certificate in place of Python’s fractions.Fraction. The value num/den is kept normalized: gcd(num, den) = 1 and den > 0. Arithmetic accepts a lal_rational or a double on either side; a double is converted EXACTLY (fromDouble), as Fraction.from_float does.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- lal_rational(num, den)
R = LAL_RATIONAL(NUM, DEN) integers (double or BigInteger)
- Property Summary
- den
java.math.BigInteger, positive
- num
java.math.BigInteger
- Method Summary
- abs(a)
- static big(x)
B = BIG(X) java.math.BigInteger from a BigInteger or integral double
- bitLength(a)
N = BITLENGTH(A) the larger of the numerator and denominator bit lengths
- char(a)
S = CHAR(A) ‘n’ or ‘n/d’, as str(Fraction)
- cmp(a, b)
K = CMP(A, B) -1, 0 or 1
- double(a)
X = DOUBLE(A) nearest double (60 significant decimal digits first)
- eq(a, b)
- static floordiv(n, d)
Q = FLOORDIV(N, D) Python floor division of BigIntegers
- static fromDouble(x)
R = FROMDOUBLE(X) the exact value of the binary double X
- ge(a, b)
- gt(a, b)
- iszero(a)
- le(a, b)
- limitDenominator(maxDen)
R = LIMITDENOMINATOR(SELF, MAXDEN) closest rational with den <= MAXDEN
Port of fractions.Fraction.limit_denominator.
- lt(a, b)
- minus(a, b)
- mrdivide(a, b)
- mtimes(a, b)
- ne(a, b)
- static of(x)
R = OF(X) lal_rational from a lal_rational or a double
- plus(a, b)
- rdivide(a, b)
- sign(a)
- times(a, b)
- uminus(a)
- ag_is_tridiagonal(Q)
IS_TRIDIAGONAL Check if a matrix is tridiagonal
- ag_qbd_finite_solve(Q, m, nlev)
QBD_FINITE_SOLVE Stationary vector of a finite block-tridiagonal generator.
- Linear level reduction: censor the chain level by level from the top,
C(nlev-1) = B(nlev-1), C(n) = B(n) + F(n) * (-C(n+1))^-1 * D(n+1),
with B, F and D the diagonal, up and down blocks. C(0) is the generator of the chain censored on level 0, so pi_0 is its stationary vector and the rest follows from pi_(n+1) = pi_n F(n) (-C(n+1))^-1. This is the block form of BIRTH_DEATH_SOLVE and reduces to it entry for entry when m == 1.
- ag_inf_supports(sn)
[BOOL, REASON] = AG_INF_SUPPORTS(SN)
- @brief Can the RCAT decomposition serve the infinite-server stations of
this model?
EVERY RCAT COMPONENT IS A SINGLE-SERVER QBD: build_rcat (solver_ag) gives each (station, class) pair a level-INDEPENDENT completion block kron(I, D1^s) and never reads sn.sched or sn.nservers, so a Delay, or any station scheduled INF, is decomposed as an M/PH/1 queue. Left as it is, that is exact only when the component never holds more than one job, i.e. when the class is closed with a population of one: then the level is 0 or 1 and a single-server chain IS the infinite-server chain.
A CLOSED CHAIN IS CONDITIONED, AND THE CONDITIONING READS SN.SCHED. closed_chain_condition (solver_ag) replaces the chain’s marginals with the product form restricted to its population, giving an infinite server the level masses rho^n / n! (ag_closed_chain_layout kind ‘inf’), so a closed class of any population is served correctly at an INF station when its chain is conditioned. That needs (a) no station of the chain that the layout marks BLOCKED, and (b) no signal class in the model, since a negative or catastrophe action reaching the chain makes the conditioning step skip it (this gate sees only sn, so it refuses whenever a signal class exists; closed_chain_condition raises if it would still skip such a chain).
AN OPEN CLASS IS STILL REFUSED: nothing conditions it, so the component serves at mu where the station serves at n*mu, and the answer is that of a different model.
A self-looping class is exempt: it never leaves its reference station, and solver_ag reports it from sn.njobs directly (QN = N, UN = N at an INF station), which is exact.
ONE PREDICATE, TWO CALLERS: SolverAG.supportsModelMethod answers with it and solver_ag raises with it, so model.help cannot offer what the run refuses. The registry cannot state the rule because ‘Delay’ and ‘SchedStrategy_INF’ ARE declared; what decides is the population behind them.
@param sn NetworkStruct of the model @return bool true when every INF station may be decomposed (or conditioned) @return reason the refusal, or ‘’ when BOOL is true
- ag_exec_resolve(options)
EXEC = AG_EXEC_RESOLVE(OPTIONS)
Resolve the execution backend of the RCAT fixed point into a struct the sweep can act on without re-reading options.
THE BACKEND CHANGES WHO EVALUATES AN AGENT, NEVER WHAT IT EVALUATES TO. Agent k’s generator is Q_k(x) = L_k + sum_{c passive at k} x_c Pb_c, which depends on the other agents only through the scalar reversed rates x. The sweep is Jacobi – every x_a is read off the PREVIOUS sweep’s stationary vectors, then all 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 MATLAB 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, but a cluster run must not regenerate a golden that a same-language run will later read.
- Fields:
mode ‘serial’ | ‘parallel’ (alias ‘para’) | ‘cluster’ nworkers ‘parallel’: pool size, 0 = MATLAB’s default pool endpoints ‘cluster’: cell array of ‘host:port’ worker addresses timeout ‘cluster’: seconds to wait on a worker before solving its
agents locally instead
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- ag_cluster_sweep(x, Aa, Pb, L, ACT, PSV, numProcesses, A, N, meta)
[PI, Q] = AG_CLUSTER_SWEEP(X, AA, PB, L, ACT, PSV, NUMPROCESSES, A, N, META)
One sweep of the reversed-rate fixed point with the agents solved on remote ag-worker processes.
THE ONLY THING THAT CROSSES THE WIRE PER SWEEP IS X, one double per action, and back come the agents’ stationary vectors. The generator itself is rebuilt here rather than shipped, because assembling it is the cheap half (O(N^2)) and solving it is the expensive half (O(N^3)); see ag_agent_generator.
A worker that is missing, slow or broken is not fatal: its agents are solved locally through the same agent path, so the result is the run’s result either way and only the wall clock changes. That is a property of the decomposition, not a fallback bolted on – an agent depends on the rest of the model only through x, so anyone holding x can solve it.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- ag_cluster_session(exec, agents, reset)
SESSION = AG_CLUSTER_SESSION(EXEC, AGENTS, RESET)
Open (or reuse) the connections to the ag-worker processes and assign the agents to them once, up front.
WHY THE ASSIGNMENT IS SEPARATE FROM THE SWEEP. An agent’s static data – its local rate matrix and the passive/active matrices of the actions it takes part in – does not change across the fixed point; only the reversed rates x do, and those are one double per action. Shipping the matrices once and then exchanging x per sweep is what makes remote execution worth doing; shipping them every sweep would put an O(N^2) payload on the wire to save an O(N^3) solve and lose most of the benefit.
The partition is round-robin over the worker list in agent index order, so it is a pure function of (number of agents, number of workers): a rerun assigns the same agents to the same workers, which is what keeps a distributed run reproducible.
A worker that cannot be reached is NOT fatal. Its slot is left empty and ag_cluster_sweep solves those agents locally, because any agent can be solved anywhere given x. A cluster run therefore degrades to a slower run, never to a wrong one or a failed one.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- ag_cluster_agents(Aa, Pb, L, ACT, PSV, numProcesses, A, N, meta)
AGENTS = AG_CLUSTER_AGENTS(AA, PB, L, ACT, PSV, NUMPROCESSES, A, N, META)
The STATIC description of every agent, i.e. everything a worker needs that does not change across the fixed point. Only the reversed rates x change, so this is built once per solve and shipped once per worker.
Matrices travel as [row, col, value] triplets with 1-based indices, because the passive and active matrices of an action are nearly empty (an action touches one level transition) and a dense N-by-N payload would be mostly zeros. The receiving worker rebuilds the same matrices and therefore the same generator, which is what makes a remote agent’s answer identical to a local one rather than merely close.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- ag_is_block_tridiagonal(Q, lvl)
IS_BLOCK_TRIDIAGONAL True when every transition of Q stays within the neighbouring level, LVL being the level index of each state.
- ag_blk(n, m)
Row/column range of level N (0-based) in a component with M phases per level.
- ag_stat_vector(C)
Stationary vector of a generator C, allowing a reducible one.
Replaces the first balance equation by the normalization, which is the equation it is redundant with (the columns of a generator sum to zero), and solves the resulting square system. Unlike a null-space solve this stays well posed when the chain is reducible with ONE closed class, which the level-0 chain of a phase-expanded component routinely is: a phase-type restarts in the support of alpha, so every service phase outside that support is unreachable once the queue has emptied at least once.
- ag_agent_generator(k, x, Aa, Pb, L, ACT, PSV, A, N)
AG_AGENT_GENERATOR Agent k’s generator at the current reversed rates.
QK = AG_AGENT_GENERATOR(K, X, AA, PB, L, ACT, PSV, A, N)
SPLIT OUT FROM THE SOLVE BECAUSE THE TWO HALVES COST DIFFERENT ORDERS. Assembling the generator is O(N^2) and solving it is O(N^3), so the ‘cluster’ backend ships only the stationary vector back and rebuilds the generator on the coordinator: sending an N-by-N matrix per agent per sweep to save the cheaper half would spend more on the wire than it saves on the worker.
- ag_birth_death_solve(Q)
BIRTH_DEATH_SOLVE Solve equilibrium of a birth-death (tridiagonal) CTMC
For a birth-death chain with birth rate lambda_n = Q(n, n+1) and death rate mu_n = Q(n, n-1), the equilibrium is computed using the recursion pi(n) = pi(n-1) * lambda(n-1) / mu(n).
This is numerically stable and avoids the ill-conditioned linear system that plagues null-space methods for large state spaces.