solvers.ENV
- solver_env_statevec_analyzer(self, phase, it, e)
SOLVER_ENV_STATEVEC_ANALYZER Full state-vector coupling for SolverENV.
Alternative to the mean-field analyzer (solver_env_meanfield_analyzer). Instead of collapsing each stage to marginal mean queue lengths and re-seeding the next stage with initFromMarginal, this analyzer carries the entire state probability vector across environment switches and propagates it with the CTMC transient (matrix-exponential action) on the per-stage generator.
For each stage e with infinitesimal generator Q_e (supplied by a SolverCTMC inner solver) and entry distribution pi_enter{e}, one iteration solves the sojourn in closed form on the joint chain of the stage state and the phase of the holding-time MMAP holdTime{e} (resolvent for an exponential sojourn, Kronecker solve for a PH/Erlang one, ctmc_timeaverage for a deterministic one), giving:
the exit distribution toward each destination h, pi_exit{e}{h}: the law at the switch epoch, conditioned on the switch going to h;
the sojourn time-average distribution pi_timeavg{e}, used in the environment-averaged blend.
No inner-solver timespan is read. Entry distributions are chained as
pi_enter{e} = sum_h probOrig(h,e) * resetStateFun{h,e}(pi_exit{h}{e}),
renormalised, and iterated to an L1 fixed point. The blend reuses the discipline-aware CTMC marginal mapping (solver_ctmc_avg_from_pi).
With a Markovian environment this coupling is exact: it is the stationary equation of the joint (stage, sojourn phase, state) chain. It is what options.method=’default’ resolves to when every stage is a flat Network solved by SolverCTMC (SolverENV.init, see _kb/06-solver-catalog.md), because the mean-field coupling has to round each entry marginal to an integer state for such a stage and loses mass between stages.
Backend: a SolverCTMC inner solver (explicit enumerated generator and state space), or SolverMAM (level-dependent QBD blocks flattened to a generator).
- Phase dispatch (called by the SolverENV EnsembleSolver hooks):
‘pre’ pre_(self,it) -> [] ‘analyze’ analyze_(self,it,e) -> [results_e, runtime] ‘post’ post_(self,it) -> [] ‘finish’ finish_(self) -> [] ‘converged’ converged_(self,it) -> bool
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- solver_env_meanfield_analyzer(self, phase, it, e)
SOLVER_ENV_MEANFIELD_ANALYZER Mean-field (marginal mean queue-length) coupling for SolverENV.
This analyzer implements the default (and historical) SolverENV coupling: every stage is solved transiently and reduced to its marginal mean queue lengths, which are carried across environment switches via initFromMarginal. This mean-field collapse discards the joint state distribution at the handoff; see solver_env_statevec_analyzer for the full state-vector alternative. It is the default analyzer (options.method other than ‘statevec’).
METHOD ‘meancov’ RUNS HERE TOO, and carries a COVARIANCE beside the mean. The propagation is the mean-field one – same sojourn average, same probOrig mixture, same fixed point – so it lives here rather than in an analyzer of its own, which would fork the whole exit/mixture/reseed path to change only the object being carried. What is added at each step:
- exit Cov[Q(T)] = E_T[Cov(Q(t)|t)] + Cov_T[E(Q(t)|t)], the law of total
variance over the random sojourn T. The first term is the WITHIN-STAGE covariance, taken from the stage solver when it integrates one (getTranAvgVar, i.e. SolverFLD ‘kp’ or ‘dae’) and zero otherwise; the second is the TIMING variance, which the sojourn law contributes whatever the stage solver is. A deterministic sojourn has no timing variance and the exit covariance is C(d).
- mixture over the origins h of a switch into e, again by the law of total
variance: sum_h p_h (C_h + m_h m_h’) - m m’. A convex combination of the C_h ALONE is wrong and silently so: it drops the spread of the per-origin means, which is most of the variance when the stages differ, and the answer still looks like a covariance.
- reseed options.config.init_qlen / init_qcov on the stage solver, beside the
usual initFromMarginal. Both are in the (station,class) index space ir = (r-1)*M+i, so this analyzer never builds a phase-layout object: the lift into phases belongs to the stage solver that owns the layout (solver_fluid_kp).
A stage solver that reports no covariance and reads no seed still runs, and then ‘meancov’ returns the ‘meanfield’ means with the environment-induced second moment reported beside them (SolverENV.getAvgQLenCov).
- Phase dispatch (called by the SolverENV EnsembleSolver hooks):
‘pre’ pre_(self,it) -> [] ‘analyze’ analyze_(self,it,e) -> [results_e, runtime] ‘post’ post_(self,it) -> [] ‘finish’ finish_(self) -> [] ‘converged’ converged_(self,it) -> bool
Copyright (c) 2012-2026, Imperial College London All rights reserved.